Documentation for RLCLDR (ReLoCating LoadDeR) Part 1: Loading RLC format files As the number of machine language programs for the 100/200 increases, it becomes increasingly desirable to use more than one m/l program at one time. The problem is that they all seem to want to occupy the same area of memory. A program stored in RLC format (uses modified hex coding) can be loaded into any memory address. This program will produce machine language at any desired memory address from an RLC file or produce an RLC file from an existing m/l program. CHANGE FOR TANDY 200 For the Tandy 200, substitute the following for line 4: 4 CLS:PRINT:FORY=-3403TO-2908STEP11:IF(PEEK(Y)AND192)=192THENFORZ=3TO8:PRINTCHR$(PEEK(Y+Z));:NEXT:PRINT" "; LOADING RLC FORMAT FILES Before loading a file, you must decide where to put it. The first number on the first line of an RLC file is one less than the length of the machine language. Let's say the number is 833. If you have no other m/l loaded, go into Basic and type ?MAXRAM-833-1. The answer may be, for example, 62126. Write this number down. You then need to type CLEAR256,62126 and then run RLCLDR. If you have existing m/l which is to stay loaded when the new m/l program is being used, you would load the new program at Top-833-1 (where top is the lowest address of the existing one) and clear memory accordingly. When you run RLCLDR you get three choices; Load, Save, or Menu. Pressing 1 or L will start the Load. (Pressing 3, M or F8 will take you out of RLCLDR). After pressing L or 1, you see a list of .DO files in the memory. Type the name of one of these to load it or just press enter to re-start RLCLDR. The next prompt is "Start address." Enter the address you just figured out. If everything goes okay, after awhile the computer will beep and print "Done". Go to the menu and you will see the program saved as a .CO file. If you plan to leave the new program loaded in high memory, you can kill the .CO file. One of two error messages may appear with two beeps when attempting a load: "Memory not clear" indicates that you are attempting to load below HIMEM. You need to do a CLEAR256,xxxx where xxxx is the address where the program will start. "Checksum error. File is bad." indicates that there is some error in the RLC file you are trying to load. Try loading the .DO file again before re-running RLCLDR. Part 2: Saving programs in RLC format To produce an RLC file from your m/l program, RLCLDR requires two copies of your program. First assemble or compile the program just below MAXRAM, then do it again below the first copy. NOTE: The number of bytes between the starts of the two copies must not be evenly divisible by 256 or RLCLDR will not work. Run RLCLDR and press 2 or S for save, then type a filename for the RLC file to be created or just press enter to re-start RLCLDR. Next, the program needs four numbers. For the first m/l program (the one with higher addresses), you need the Top (lowest address), End (highest address), and Exe (execution address). If you just press for Exe, the Top address will be used. For the second copy of your program, only the Top address is needed. If all goes well, the computer will create the file, beep, and return to the main menu. An ".RLC" extension is suggested for filenames. The computer compares the two copies of the program as it saves it. If they don't compare properly, it beeps twice and prints "Data at xxx & xxx are not the same program." Check the start addresses and be sure you have entered them correctly. Press to re-start RLCLDR; the .DO file being saved into is automatically killed. If the addresses are correct, try re-loading the m/l copies before running RLCLDR again. NOTE: It is possible to use a relocatable buffer in a program without saving the blank buffer in the RLC file, BUT . . . Such a buffer must be located AFTER the program because RLCLDR is unable to decode relocatable addresses before the file start. If you do this, be sure to give users sufficient warning that such a buffer space is required. See SAVLCD.RLC in DL6 for an example. SPECIAL CONSIDERATIONS FOR TCOMP USE To properly recognize two compiled programs as the same one, you need to clear the memory to be used before compiling. This can be done by adding the following line to TCOMP.121 (NOT to RLCLDR): 7065 FOREX=HIMEMTOZ:POKEEX,0:NEXT There is also a problem with programs containing arrays. The following can be merged into RLCLDR to patch the compiled program as it saves it. (Put line 14 in one piece and line 74 in one piece): 0 'Merge File for RLCLDR with TCOMP arrays 0 'RLCLDR with routine for TCOMP (PD) 14 FORX=TTOE:B=PEEK(X):B2=PEEK(X-OF):GOSUB70:IFB=B2THENPRINT#1,CHR$(48+BCHR$(48+(BMOD16));:L=L+2:C=C+B:GOTO18 70 IFB<>6THENRETURN 72 IFB2<>6ORPEEK(X+2)<>14ORPEEK(X-OF+2)<>14THENRETURN 74 IFPEEK(X+1)*256+PEEK(X+3)=PEEK(X-OF+1)*256+PEEK(X-OF+3)+OFTHENPOKEX,0:POKEX-OF,0:POKEX+2,PEEK(X+3):POKEX-OF+2,PEEK(X-OF+3):POKEX+3,PEEK(X+1):POKEX-OF+3,PEEK(X-OF+1):POKEX+1,1:POKEX-OF+1,1:B=0:B2=0:RETURN 76 GOTO17 This will slow down the operation of RLCLDR, so I would suggest that you save this only for TCOMPed programs with arrays. Leave me a message if you have any problems or comments. Neil Wick [71056,613]