[net.lang.forth] starting programs in figFORTH 8080

carr@utah-cs.UUCP (Harold Carr) (11/10/84)

I am writing an application using figFORTH's 8080 system on CP/M.
I know how to load the application screens then save the system
so they are already loaded when FORTH starts up.

My question is:  How do I modify it so that it comes up in the
application program rather than the FORTH interpreter?

Thanks for your help,
Harold Carr  

ARPA: CARR@UTAH-20
uucp: harpo!utah-cs!carr

keithd@cadovax.UUCP (Keith Doyle) (11/12/84)

>I am writing an application using figFORTH's 8080 system on CP/M.  
>I know how to load the application screens then save the system 
>so they are already loaded when FORTH starts up.  

>My question is:  How do I modify it so that it comes up in the 
>application program rather than the FORTH interpreter?
>Thanks for your help,
>Harold Carr  


There are several possible methods.  I'd suggest either patching
COLD or QUIT to execute your application.  The ABORT at the end
of COLD is a good place, or perhaps the CR in QUIT.  Also ABORT
itself could be patched to execute your application.  If QUIT
is used and if an error occurs during the application, it will
restart.  However, you'll probably have to patch QUIT and do your
SAVE command in the same input line, as once QUIT is patched you
might jump right into your application at the end of the present 
input line, and have no way to save it out to disk from there.
I've created a word called 'BOOT' which you use as BOOT ****, where
**** is the name of the application startup word.  BOOT patches
the CR word in QUIT to be the address of the new applications word.
I can then within the application, use the construct BOOT CR to return
QUIT to its original state if I want to do a real QUIT.  Also I have to
do a BOOT **** BYE  all in the same line to patch quit and exit to CP/M
so I can do the SAVE.  Unfortunately my version of BOOT is version-
dependent, but to get an idea, here's my definition:


: BPATCH   CFA 4341 ! ;   ( patch the CR in QUIT, 4341 is for my system )

: BOOT     [COMPILE] '       ( get address of input word )
           STATE @           ( test if compiling )
	   IF LITERAL        ( if so, compile applications address as literal )
	   COMPILE BPATCH    ( and compile the patch word )
	   ELSE BPATCH       ( otherwise, just execute bpatch )
	   THEN ; IMMEDIATE  ( immediate allows use in definition )

Keith Doyle
{ucbvax,decvax}!trwrb!cadovax!keithd