I have created a new library which allows you to incorporate Forth subroutines in a BASIC program:
http://groups.yahoo.com/group/bb4w/files/Libraries/FORTHLIB.BBC
Forth is much faster than BASIC, but is easier to learn (and more portable) than assembly language.
FORTHLIB contains three callable procedures:
Code:PROC_forth_init(dictionary_size%)
Initialise the Forth subsystem with a dictionary of the specified size (bytes).
Code:PROC_forth_compile(forthfile$)
Compile a Forth file. Usually, the first file you compile should be bb4wforth.f or an adaptation of it (perhaps with the 'welcome' message deleted).
Code:PROC_forth_run(word$, par%)
Run a compiled Forth subroutine, with a single integer parameter. You can pass multiple parameters by CALLing _forth_run instead:
Code:CALL _forth_run, word$, par1%, par2%, ....
Note: If any errors occur (for example the dictionary isn't big enough, or you attempt to divide-by-zero) you won't get any friendly messages, BB4W will just crash catastrophically! Forth code is best tested in BB4Wforth first.
Here's a sample program using the library:
Code:INSTALL @lib$+"forthlib"
PROC_forth_init(100000)
PROC_forth_compile(@dir$+"bb4wforth.f")
PROC_forth_compile(@dir$+"hanoix.f")
PROC_forth_run("TOWERS",12)
Richard.