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

Re: [colorforth] Strange ColorForth results


Hi John,

# Ok, I think I get it.  By the way, how did you
# get the Pentium diassembly?

1)
I use my build of ColorForth for Windows,
run it under Visual Studio (open color.exe as workspace)

2)
In some block (though it's a good idea to put it in a some autoload block)
I define a word
macro : debug 0cch 1, ;
which compiles INT3 opcode (debugger interrupt)

3) Then I insert it where I want to set a breakpoint.

4) When INT3 is executed, Visual Studio debugger points exactly to the place
I want to see.

I use VS because a) our BD.COM is 16-bit real-mode and supports 286 only
(though there was a 286 PM version), and development was stopped in 1994 b)
other debuggers I tried to use (gobug and govest) had troubles either with
debug info or with Win NT. (I'm not M$ advocate, but some of their products
are not pure junk. Though their business model is very unfriendly). I'll
appreciate if If someone can suggest a better Windows debugger. (I love(d)
Turbo Debugger, but Borland has degraded to what it is now, it has very big
user base it xUSSR (mostly unlicensed at that time, but there was market,
anyway))

Btw, raw metal ColorForth does not run under VMWare -- it says some internal
error and coredumps.

# > Now, my preferred one:
# >
# > : 0? [ 0 ] + drop if 0 ; then 1 ;
# > where [ 0 ] is a yellow zero
# Yep.  That works.  I'm still not sure when to
# use yellow versus green.  For instance
# : 0? 0 + drop if 0 ; then 1 ;
# also works.  I'm guessing using the yellow
# 0 is more efficient?  Then why not the following?
#
# : 0? [ 0 ] + drop if [ 0 ] then [ 1 ] ;
#

Yellow-to-green transition is a funny thing when you learn how to use it.
Read once again what Chuck writes about it here
http://www.colorforth.com/parsed.html
==
Yellow words within a definition will be executed, as expected. However,
they should leave a (single) number on the stack. The transition from yellow
to green words causes this number to be compiled. Thus numbers can be
calculated inside definitions, which helps understand where they came from.
==

As far as I grok it, y2g transition is appropriate when your macro consumes
one parameter off stack,
or when it "uncompiles" a literal using cyan ?lit.

I use it in my code for ascii and Windows (tm:) DLL support, blocks 234-236.

BR,
Roman


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