home .. forth .. colorforth mail list archive ..

Re: [colorforth] If? and A.


On Thu, 31 Oct 2002, Peter Appelman wrote:

> Not being familiar with c18, I turn to the group for these questions.
>
> First:
>
> Should 'if' (and -if) be defined as:
> if c023 2, 74 2, here ;
> which is: and eax,eax; jz nn
>
> I do not know when the flags are set in the c18.

I belive c18 operates on the TOS (top of stack), it doesn't have flags
like the pentium. The way it is defined on the pentium, you can use the
side effects of operations to conditionally branch. The virtual machine is
more complex, but I suppose there is may be improved efficiency.

> Second:
>
> Why use edx as A register? Edx is used for mult/div and more. If
> ebp was used, would that not more acurately reflect what happens on the
> c18. Once an address is stored it would remain unchanged?

I don't know the details of the c18, but from what I've seen of the
pentium colorForth the A register is mostly used in the implementation of
macros. The contents will change in using many of these primitives, such
as '!' or 'swap'. I don't think it was intended to be used to store
variables for long periods of execution, someone please correct me if I'm
wrong.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx