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

Re: [colorforth] Strage ColorForth results


Since in CF IF and -IF are implemented as jz and jnc opcodes
that check values of Z and C flags respectively.

Try inserting '?' after the literal -- it compiles into test eax, eax,
which should set Z flag (C flag is zeroed, but plz check with Inter's
manual)

Good Luck. I did not test this, though

Roman

----- Original Message ----- 
From: John Drake
To: colorforth@xxxxxxxxxxxxxxxxxx
Sent: Tuesday, February 24, 2004 4:21 AM
Subject: [colorforth] Strage ColorForth results


Hello all,

In an effort to better understand branching in
colorforth, I implemented the simplest branch
word I could think of, 0=.  As most of you know
0= takes the top number on the stack and if it's
0 replaces it with a 1, otherwise it replaces it
with a 0.  I implemented this two different ways:

: 0? ? drop if 0 ; then 1 ;

and

: 0? ? if drop 0 ; then drop 1 ;

Now here is the strange part.  Both
implementations work, but only HALF of the time!
What I mean is, if I load the screen with either
definition once it may work, but the next time
I load it (without even making any changes) it
doesn't.  Then it works again.  (When it doesn't
work it always replaces TOS with 1).  Thinking
this was a bug in ColorForth for Windows (what
I normally use) I tested it with standalone
ColorForth, and I got the same results.  What's
going on here?

Regards,

John M. Drake

__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com


---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com