Camel Forth v1.3 for the TRS-80 Model 4

last updated 29 FEB 2000

TRS-80 CamelForth v1.03 -- now enhanced for TRSDOS/LS-DOS host

This allows vectors to be changed to use LS-DOS console I/O. (in fact, I've done this for you, and created an executable version of CamelForth for the TRS-80 Model 4.)

I'll show you, step-by-step, how this was done, so you can do the same for a Model 3, Model 1, or any system running LS-DOS.

Creating a /CMD executable of CamelForth for TRSDOS/LS-DOS:

You need to use SBOOT4/CMD on a TRS-80 Model 4 or 4P.. even though the 4P has a built-in loader, you need to run SBOOT4/CMD. Also, SBOOT3/CMD should allow the same things mentioned here on a Model 3.

Making CamelForth into a standalone /CMD program is fairly simple:

  1. make a note of the highest used memory address,
  2. define BYE for CamelForth
  3. say SAVEU to CamelForth
  4. say BYE to CamelForth
  5. use the DUMP command from TRSDOS to create a /CMD file.

To save a new system, use { HEX HERE . }, without the braces, to display the next available free memory location. Subtract 1 from this and remember it. This value needs to be given for the END= parameter when we use the LS-DOS DUMP command in a moment.

..then do { SAVEU } to update the initialization area.

{ 0 0 0 22 SVC } will invoke the @EXIT Supervisor Call, exit CamelForth and return control to TRSDOS/LS-DOS. You should probably define this as { : BYE 0 0 0 22 SVC ; } before you use SAVEU, and then just use { BYE } instead (thereby always having the proper BYE for TRSDOS available).

DUMP CAMEL/CMD:0 (START=X'6600',END=X'????',TRA=X'6600)

..where ???? is the address found by HERE, minus 1.

Now you have Camel Forth for the TRS-80, running on a TRS-80. A more elegant way of doing this, would be with a high-level forth word, e.g. { SAVE-FORTH } which would save a new /CMD file, and perhaps over-writing the existing file. This is left as an exercise to the TRS-80 CamelForth programmer.

Download CAMEL413.ZIP (45K) which also includes the /CMD program in a .DSK image for David Keil's emulator for the Model 4 -- Cross development and remote boot require the Serial Bootloader, sBoot4T, but the standalone /CMD version is functional enough to develop into a full ANS Forth system.

Standalone executable /CMD for TRSDOS/LS-DOS v6

The problem remains of console input/output -- the system you just saved still uses the serial port for its I/O. To create the /CMD executable of CamelForth, I used SBOOT4T v1.1a, which allows redirected input from a file.


..for example, will enter terminal mode, and allow you to use CamelForth with RS-232 console I/O. But if you press F9, it will read input from INP.FS until there is no more to read, then return control to the terminal interface. In this way, you can load definitions from a DOS file, immediately compiling them into CamelForth. Then, with the facility described above, save a new CamelForth to TRSDOS/LS-DOS.

    SBOOT4T CAMEL80.HEX <REVEC.FS the command I used to create a standalone /CMD edition of CamelForth v1.3 for the TRS-80 Model 4. REVEC.FS is a seqential Forth source file, which changes KEY KEY? and EMIT to use LS-DOS keyboard and video, through Supervisor Calls.

Note that the words (KEY) (KEY?) and (EMIT) still use the serial channel, but these assume the TRS-80 serial port is already initialized. Serial port initialization routines for the standalone /CMD executable are left as another exercise for the TRS-80 CamelForth programmer.


29 FEB 2000
Douglas Beattie Jr.

For reference, here also is the original file, before v1.3.
Camel Forth v1.2 for the TRS-80 -- CAML4P12.ZIP (37K) -- requires Serial Bootloader, sBoot4T