My development and test sequence for gForth on the Rabbit 2000

The assembler test sequence:
define a word (opcode) then interactively test it checking for correct
bytes compiled to memory and for no stack change.

Once you have enough of the assembler working to do the CPU initialization,
write the init code in assembly in a template prim.fs file.  Start by taking an
existing prim.fs and delete the assembly implementation inside all of the macro
and Code/End-Code wrappers.

You'll also need to modify an existing mach.fs and makegfcpu.fs

Run cross.fs on this by invoking:
gforth -m 1000000 makegfcpu.fs
This will produce a binary image.
The binary image can be viewed with this utility: http://home.mho.net/jswaby/fb.html 
or use the hex edit feature of Xemacs: http://www.xemacs.org 
Check that the initialization part of the image is correct.

The init code should set up your serial port.
Append a boot message to the init code.
Try running this.  This tests the load mechanism for the CPU (burning EPROM/Flash, etc)
and tests your serial output. I code a halt routine to control how much code actually
runs.  When things go wrong it is very useful to know where to look. Divide and conquer.

code next, lit (emit)

define a word called myboot and change mach.fs to invoke this instead of boot.

test1: ...next, lit and (emit)

test2: ...IF-ELSE-THEN, which is need by other core words
It is useful to check the binary image to make sure that the code generated is correct.

test3: ... colon defines docol and ;s
This is your first high level word!

test4: .... character input

test6: ...  >r r> begin until (?branch)

test8: ... if-else-endif

test9: ... (key?) and alternate path in (key)

test10: ... 2/ dup +

test12: ... 0=

test13: ... variable (dovar) constant (docon) 

test14: ... dup drop or and xor - (uses .w from dotx.fs)

test15: ... depth r@

test16: ... sp@ sp!

Collected test words. Don't just load this file! It is the result of the testing I did
to get gForth running on the Rabbit 2000.  Notice that there is a sequence from the
minimum needed to increasing complexity.  depth failed when I first tried it. So
I looked at the definition of depth and specifically tested the words used to define it.


| © 2005 Ken Staton