MAKSRL 04/22/85 RDL The MAKSRL package allows you to create a self-relocating program, that is, a program which automatically relocates itself to high memory upon beginning execution. There's been a scad of ways used at one time or another to produce COM files which, when executed, will determine where high memory is, then relocate the bulk of the code into the highest possible memory location for execution. The most difficult example I've come across is in BYE, which has a whole section devoted to examining its own code to determine which bytes must be modified. MAKSRL automatically produces a COM file which does the whole thing with practically no fuss at all. The whole process comes down to creating an M80 source file which expects to execute in high memory, then typing either SUBMIT MAKSRL , or (in Tdos) DO MAKSRL . For example, to create FOOBAR.COM from FOOBAR.MAC, type SUBMIT MAKSRL FOOBAR. Whichever batch file you use on your system, it will assemble your source with M80, then invoke L80 twice to create the two object files which MAKSRL.COM uses as input. Finally, the batch procedure will invoke MAKSRL.COM and delete all intermediate files. MAKSRL.COM is invoked with a file-name header which identifies the two input files and the destination file. If both input files are found, MAKSRL creates .COM which contains the code from .REL and a loader which relocates the code to high memory. As an example, the command MAKSRL FOOBAR will create FOOBAR.COM from the input files created earlier by the batch file. Writing your program is very straightforward. Just make sure the program counter is set to CSEG, then jump right in with your code. From the first line, what you're writing will eventually execute in high memory. If you're writing a module which is to remain memory resident, you can put any initializations, including the code which sets up the BIOS and BDOS pointers, just before a BDOS jump-around vector, so that the inits do not stay memory resident. (See example below.) MAKSRL is loosely based on and heavily modified from the MAKELUX program in LUX40.LBR which creates LUX.COM. SAMPLE CODE FOR A MODULE WHICH WILL BE CORE RESIDENT: ; ; INITS ; CSEG ; LHLD 6 ;GET ACTUAL BDOS ENTRY SHLD JBDOS+1 ;SAVE IN JUMP-AROUND VECTOR LXI H,JBDOS ;SET TOP MEM PTR TO PROTECT CODE SHLD 6 ; LHLD 1 ;SET UP TO TRAP WARM STARTS INX H ;SAVE ACTUAL WARM START VECTOR MOV E,M INX H MOV D,M XCHG SHLD WRMSAV LXI H,FAKEWM ;SET LOCAL WARM START VECTOR XCHG MOV M,D DCX H MOV M,E ; JMP START ;GO TO PROGRAM BEGINNING ; JBDOS: JMP $-$ ;BEGINNING OF RESIDENT CODE ; Here, in the body of your program, include code at FAKEWM to do whatever you want to do when a warm start occurs. ; ; CODE TO REMOVE THE MODULE WHEN NO LONGER NEEDED ; QUIT: LHLD JBDOS+1 ;RESTORE ACTUAL BDOS POINTER SHLD 6 ; LHLD WRMSAV ;RESTORE BIOS WARM START XCHG LHLD 1 INX H MOV M,E INX H MOV M,D ; JMP 0 ;GO WARM START ; WRMSAV: DW 0 ;STORAGE FOR WARM START VECTOR ; END