Sun Jul 27 11:53:19 CEST 2008

A simple example

Staapl is now installed on PLT Planet, which is the central repository
for PLT Scheme user contributions, so it's very easy to install.  Get
the latest PLT Scheme at http://pre.plt-scheme.org You only need the
command line version (MzScheme)

To try it out in batch mode, create a file test.ss with the following

 #lang scheme/base
 (require (planet zwizwa/staapl/prj/pic18))
 (forth-compile ": inc 1 + ;")
 (save-ihex "test.hex")

Then execute it like this:

> mzscheme test.ss

This will locally cache the Staapl distribution, and create a file
test.hex containing the compiled Forth code ": inc 1 + ;". Check it
with gpdasm:

> gpdasm -p 18f1220 test.hex
000000:  0f01  addlw	0x1
000002:  0012  return	0

This only uses the barebones compiler. To compile a Forth application
together with the boot monitor, replace the 'require line in the build
script with:

 (require (planet zwizwa/staapl/prj/pic18f1220-serial))

And compile again. The top file of the monitor code can be found here:


These files are cached locally in this directory:

> mzscheme -p zwizwa/staapl/prj/pic18 -e pic18-lib