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

[colorforth] Another complement! and some new stuff ;p


I also forgot to underline the fact that this is the page of
Mark Slicker and its all been discussed already on this list,
just search the (not up to date) archives at
http://www.strangegizmo.com/forth/ColorForth/index.html

And for the new stuff, I thought about a simpler IF construct,
that I use when im coding for AVRs: there's some asm
instructions on those chips that i.e. "skip the following instruction
if the Z flag is set". in asm its not that powerful because it skips
only a one memory cell instruction, like short jumps. but in forth,
if the if could skip only the following word if the flag is true it would
make the code much more clean and reusable. Example from a
aha like system i would like to implement coded from thin air but
embodies the general concepts of a 8 bit aha system:
Basic info about tokens to understand the code below:

1- Word Token
        0|1111111 min:0 max:127 Range:127
2- Function Token
        10|111111 min:128 max:191 Range:63
3- New Word Token
        1100|1111 min:192 max:207 Range:15
4- Comment Token
        1101|1111 min:208 max:223 Range:15
5- RLE Token 1110|1111
        min:224 max:239 Range:15
6- Binary Token 1111|1111
        min:240 max:255 Range:15

Compile: @+ dup
                127 <=if WordToken drop
                192 <=if FunctionToken drop
                207 <=if NewWordToken drop
                223 <=if CommentToken drop
                239 <=if RLEToken drop
                255 <=if BinaryToken drop

WordToken: Rdrop if getcountfromnextbyte ...blablabla
FunctionToken: Rdrop if getcountfromnextbyte ...blablabla

So here the Rdrop make those if statements behave like a jump table.
the Z flag is kept between the arithmetic operations and the if only
add the flag to the PC (-if add the last bit of a value to the PC).
The getcountfromnextbyte is basically an extension mechanism:
if the token is at its maximum value, then the count is in the
following byte.

A 32 bit VM that could run on every 32 bit gaming platform is my actual
project, ill try to implement those 8bits ahah concept to that VM.

Anyway thats a sketch, I hope to hear suggestions
from people on this list. Please dont sprut into thin air like the previous
thread about ascii, thanks.

CrowKiller
------------------------

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