Close

fig-FORTH 1.0

A project log for Chameleon

FPGA shield board with XC3S50A/XC3S200A FPGA, 2 232/485 ports, 32Mb Flash, 4kb FRAM, 128kB SRAM, 12 Arduino UNO connections.

michael-a-morrisMichael A. Morris 12/17/2014 at 12:570 Comments

fig-FORTH 1.0 now running on the Chameleon. The source for this interpreter was provided by user enso of 6502.org.

All that is required to get fig-FORTH 1.0 to run is to edit the configuration data at the beginning. In particular, only two variables need to be modified to adapt fig-FORTH to a target such as the Chameleon: ORIG and MEM. The remainder of the variables that define the fig-FORTH environment are offsets from ORIG and MEM, or have default settings compatible with most 6502/65C02 implementations.

In addition to modifying ORIG and MEM, it is necessary to provide three serial I/O routines for use by fig-FORTH: cin (getch), cout (putch), and crout (putcrlf). fig-FORTH assumes that 7-bit ASCII is the terminal default. Since fig-FORTH sets the msb of the last character in a FORTH word's name field, I modified the fig-FORTH routine that uses cout to mask off the msb of the output character. This allows the use of the VLIST word to see the dictionary without extended ASCII characters at the end of every name.

The following is a small capture of a fig-FORTH 1.0 session on the Chameleon:

0020 - 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
>0400G

 PC=3A1D  A=2A  X=B4  Y=FF  S=FF  P=73 (NVRBDIZC)=01110011

>D000G

fig-FORTH 1.0a
 OK
 OK
: star 42 emit ; OK
: stars 0 do star loop ; OK
: margin cr 30 spaces ; OK
: blip margin star ; OK
: bar margin 5 stars ; OK
: f bar blip bar blip blip cr ; OK
f
                              *****
                              *
                              *****
                              *
                              *
OK
First, Klaus Dormann's 6502 functional test program is run, i.e. >400G. It completes successfully, and then fig-FORTH is booted, i.e. >D000G. After a couple of simple null line entries, a simple FORTH program (from Leo Brodie's "Starting FORTH") is entered and executed.

With fig-FORTH in place and working, it can be further modified in two ways for the Chameleon: (1) disk support using the serial Flash can be added, and (2) the primitives can be improved using 65C02 instructions and M65C02A FORTH instructions. The first task will be to incorporate support for the fig-FORTH file system. The second task will be to incorporate the 5 planned FORTH-specific instructions into the M65C02A and update the fig-FORTH core to use those instructions.

Discussions