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

[ColorForth] Hello World!


At 10:58 AM 5/4/02 -0700, you wrote:
If you were to substitute
   (   for  \C
   :   for  \r
   nothing for  \g
   nothing for  \w
your listing would look more like Forth, with still a clear transcription
into colorForth.

Chuck,

I started it that way, but then thought, "what the heck, I'll use this \x technique, see what folks think." And actually, I don't know how to use normal plain-ascii forth to do the following (silly) variation on the hello world program. (This is from memory, and a note I happen to have sitting on my desk; sorry if there's a typo or extra "nul" or something):

        \C hello world in block 60 \m x \m y
        \r w \g @ fffffff0 and
        \r ww \g unpack if emit ww ; then space drop drop ;
        \r hw \g 60 block dup w 1 + w ;
\r hello \g show black screen text \w x \g @ \w y \g @ at hw keyboard ;
        \r l \g -5 x +! ;
        \r u \g -5 y +! ;
        \r d \g 5 y +! ;
        \r r \g 5 x +! ;
        \r nul ;
        \r world \g pad nul nul accept nul
        nul nul nul nul l u d r nul nul nul nul
        nul nul nul nul nul nul nul nul nul nul nul nul
        \w 2500 , 0 , 110160c , 0 , 0 , 0 , 0 , hello world

(Note: the 2500 is hex)

What I don't get is how to notate that last line; here's my best guess:

        ( hello world in block 60 )
        variable x  variable y
        : w @ fffffff0 and
        : ww unpack if emit ww ; then space drop drop ;
        : hw 60 block dup w 1 + w ;
        : hello show black screen text x @ y @ at hw keyboard ;
        : l -5 x +! ;
        : u -5 y +! ;
        : d 5 y +! ;
        : r 5 x +! ;
        : nul ;
        : world pad nul nul accept nul
                nul nul nul nul l u d r nul nul nul nul
                nul nul nul nul nul nul nul nul nul nul nul nul
                [ 2500 , 0 , 110160c , 0 , 0 , 0 , 0 , hello world

That seems reasonable, I guess, using "[". Is that what you'd do? Overall, it's certainly easier to read than the \x convention.

Thanks!

... for colorForth and Forth and sharing your insightful genius with us and... well, I could go on, but this list is supposed to be about colorForth. :-) ------------------------

To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems   -   List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site   -   http://www.colorforth.com