\ FED overlay for various Forth's 21:48 22Jul87 GmK Author Guy M. Kelly (c) 1987 The following screen are the common documentation for the various versions of the editor overlay loader. The words on screens 1 through 4 are generic. They can be used for loading any overlay. The words on screen 5 are specific to the editor overlay. Setting the variable FIRST-EDIT to true will cause the words >FED or EDIT to load a new copy of the editor. See the editor documentation for further information on the various editor modes. \ EXEC Overlays 20:09 20Jul87 GmK VARIABLE FIRST-EDIT True if overlay has not yet been loaded. VARIABLE CURRENT-SP A plact to save the current SP for EXEC. VARIABLE OVERLAY-SIZE Size of the overlay, in 16 byte paragraphs. CREATE OVERLAY-LOC Contains the starting offset and segment of the overlay. CREATE PARAM-BLOCK Starting segment and relocation factor for loading the overlay. CREATE FILE-SPEC Contains the overlay file-spec. \ EXEC Overlays 20:09 20Jul87 GmK ALLOCATE-MEM ( #paragraphs -- start-seg T | #available F ) Given the number of 16 byte paragraphs, returns the starting segment-address of an available chunk of memory of the requested size and a true flag, or the maximum amount of memory available and a flase flag. RELEASE-MEM ( seg-of-block-to-release -- flag ) Given the segment-address of the previously allocated chunk of memory, returns it to the free memory pool and returns a true flag or returns a flase flag if unsucessful. \ EXEC Overlays 20:09 20Jul87 GmK EXEC ( param-blk-addr file-spec-addr mode -- flag ) Given the address of a valid parameter block, a valid file specification address and a mode of 3, loads the overlay named at the file specification address into the memory location specified at the parameter block address and returns a true flag. A flase flag is returned if the function fails. >OVL ( p1 p2 p3 cmd -- ) A command and three general parameters are passed to the overlay addressed by the variable OVERLAY-LOC. Register usage: AX=cmd, BX=p1, CX=p2, and DX=p3. \ EXEC Overlays 21:52 22Jul87 GmKSome of the Forth packages which come with the Forth object codein a .COM file do not return any memory to DOS when loaded. GRAB-MEMORY assumes this to be the case. GET-MEMORY ( -- ) Attempts to obtain the memory needed for loading the overlay. If sucessful, updates the various pointers needed for the EXEC function. If some memory is available (but not enough) does ABORT" and if none is available, assumes .COM, does GRAB-MEMORY. GET-OVERLAY ( -- ) Attempts to load the overlay. Issues an error message and abortson faliure. \ EXEC Overlays 20:09 20Jul87 GmK FED-CHK ( -- ) Aborts with an error message if the editor is not loaded. (FED) ( -- ) The basic editor loader: 1. Sets OVERLAY-SIZE to the number of paragraphs needed, 2. Clears the file specification buffer, 3. Puts the name of the editor overlay into the spec. buffer, 4. Obtains the necessary memory for the overlay, 5. Attempts to load the overlay, if sucessful clears FIRST-EDIT >FED ( -- ) Allows access to the editors Forth system. Loads the overlay if i not yet loaded, calls overlay, exit=BYE. EDIT ( -- ) Allows access only to the editor EDIT mode. Loads the overlay if it has not been loaded, calls the overlay. DISP ( scr# -- ) Allows access only to the DISP mode. Aborts if the editor has not been loaded. L ( -- ) Re-enters the last editor mode.