These are the load blocks for running EMACS or some other editoras a child from FORTH. Note that the sequence is set up to get the editor at a ram disk which is in the auto folder at bootup. This can be changed to any path on any drive. From a ram disk, the load is near instant, from a floppy it takes about 5 sec. tohave Emacs load, but from a hard disk I cannot advise since I'm too cheap to buy one. I've used this method to load gem prgs. as well. They come up just fine, except 1st Word had trouble with the default filename. With GEM editors and programs you must start from the desktop (ie. with GEM initialized). I will start a simple block file converter definition(s) next that will simply stick an EOL (CR/LF) for each line to the end of the file. This will enable real editing on the old blocks. ( This block is to load the editor to a RAM DRIVE. ) : LOAD-EMACS " D:\EMACS001.TOS " MAKE IS DEFAULT FLUSH " A:\PROGRAMS\EMACS001.TOS" OPEN IS INPUT " D:\EMACS001.TOS " OPEN IS OUTPUT ORG PROGSIZE @ + DUP 100000 GETDATA IF PUTDATA ELSE CLS " COULD NOT LOAD EMACS TO RAM DISK " TYPE THEN ; ( set up some system variables & buffers ) VARIABLE MODE 0 MODE ! ( the mode for running EXEC ) VARIABLE VECTOR ( pointer to base page of child ) CREATE DUMMY 62 ALLOT ( path buffer for FORTH interface ) 32 DUMMY C! ( space at first location ) DUMMY 1+ 61 0 FILL ( clear the rest of the buffer ) CREATE FILENAME 62 ALLOT ( path buffer for the GEMDOS call ) 32 FILENAME C! ( space at first location ) FILENAME 1+ 61 0 FILL ( clear the rest of the buffer ) : SWITCH ( -- ) DUMMY FILENAME 62 CMOVE ( swaps the path buffers ) ; ( a user interface to grab the filename to be edited ) : DEFAULT CLS " EDITING FILE? --->" TYPE ( Clear screen, type prompt ) FILENAME 62 TYPE ( Show the current filename ) DUMMY 1+ 61 0 FILL ( Clear the dummy buffer ) BEGIN KEY? UNTIL ( Wait for a key press ) 19 0 AT 27 EMIT 75 EMIT ( Clear old filename ) DUMMY 1+ 61 EXPECT ( Get new filename ) 18 0 AT FILENAME 62 DUMMY 62 ( Old and new on the stack ) COMPARE 0 = ( Check dummy to see if new ) DUMMY 1+ C@ 0 > OR ( filename is desired. Use ) FILENAME C@ 0 = OR ( what is typed if different ) IF SWITCH ( from existing path ) THEN FILENAME 62 TYPE ( Prompt user while loading ) ; ( This is the block to do the EXEC call. Adjust as necessary ) ( for your individual needs. ) : EDIT ( addr,addr,addr -- ) DEFAULT ( get default edit file to C$ ) " " $>C$ ( addr of enviornment C$ ) FILENAME ( addr of default edit file C$ ) " D:\EMACS001.TOS " $>C$ ( addr of editor program C$ ) MODE @ ( mode to run EXEC in ) L>W 75 L>W 8 -1 GDOS ( do the GEMDOS call ) VECTOR ! ( save the base page addr ) CLS ( clear the screen ) ; ORG PROGSIZE @ + CONSTANT LOADER ( put base addr above FORTH ) 0 CONSTANT LENGTH : ELOAD LOADER 100000 0 FILL ( Clear load buffer ) FILENAME 1+ 61 OPEN IS INPUT ( Open the file ) LOADER 100000 GETDATA ( Load it to ram ) IF DUP IS LENGTH 13 SWAP C! ( Save length, put CR at end ) ELSE " ERROR ON LOAD" TYPE ABORT ( Flag any problems to user ) THEN LENGTH 0 ( Start a loop to replace ) DO LOADER I + C@ ( all CR/LF's with an ASCII ) DUP 13 = SWAP 10 = OR ( 32 value. ) IF 32 LOADER I + C! THEN LOOP FLUSH ( Close the file ) LOADER TIBPNT ! ( Pass the base addr LOADER ) ; ( to the text buffer pointer )