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

Re: [colorforth] If? and A.



Mark Slicker wrote:

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.


Exactly my point. With 'Pentium' colorForth I can do: (contrived)
...  x @ 1024 less drop if .... then ...
which might not work on the c18, because the 'flags' are changed by drop.
So, the question is really, if colorForth on the pentium should be
restricted to the hardware model, or should it take advantage of any
pentium instructions/features?
If it should be restricted, then the second question I asked
really needs to be answered too.  And Robert Patten's question also.
Doing @+ and !+ comes in handy and would reduce stack clutter.

BTW Mark, I pulled your Vesa-chuck image from your page, thanks. But
the parameters for the int 10 should be 4117. You have them as 0117.
No big deal, but changing them in debug before W 100 0 0 7e made it work.

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


Peter



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