S L E D G E H A M M E R + 4 By James Hehl SLEDGE HAMMER +4 will attach or link up to 24 binary files into a single program, and pack them, eliminating the need for LOADing file after file. SLEDGE HAMMER +4 creates a executable file. When you execute it, all the modules are copied to their proper locations in memory. This takes a second or so usually. On 1541s and other floppies with slow seek time, finding five or six files may take more than ten seconds, which is too much time to add to a slow drive. So placing them all in one file speeds booting even though the file may be longer. With the files all together in an executable program, you can PACK them smaller with one of the program packers we have out there, for the Plus/4. Although SLEDGE HAMMER +4 was originally intended to start a program with an SYS address, you may easily use it to RUN a BASIC main program. This is accomplished by linking one of the MLRUN modules, provided as support programs on this disk. As you may have guessed, this is not a tool for beginners, although you don't have to be a programmer to use it. You have to do three things before you even boot SLEDGE HAMMER +4. You have to: (1) Determine which support files are to be linked to the BASIC program and copy them ALL to the same disk. (2) REM out the lines that LOAD them (in the BASIC program). (3) Determine the end address of the BASIC program and the beginning address of the last module. LIST the BASIC program (if you are using one) and find lines that LOAD the files. They will probably be near the beginning of the program. Insert a REM in front of them. You don't want the program to load any files (except high scores, Help files and the like). The SLEDGE HAMMERed file will contain the ML or data files. Then scratch and save the BASIC program. NOTE: You should always retain the original files used to create your linked program. Now you are ready to link the BASIC program and its files into one file. LOAD "SLEDGE HAMMER +4",8 and RUN it. The main menu looks like this: SLEDGE HAMMER! -Equal character packer -Compacts 24 files -Packs memory $07e8-$fcff -Sequence packing Press: F1-Start packing F3-Disk directory Select file with cursor keys Press Return to choose Press 'C' to continue To start, press the F1 key. The files in the directory will be listed. Select the files you want to link/pack with the cursor keys and the Return key. When you are finished, press the C key. The program will access the disk drive and list the programs that you chose... in the order of their addresses. You will then be given the option to change any LOAD addresses, that you wish. Cursor to the programs that you want to change the address and press RETURN. Enter the new address in Hex ($). You can continue the process until done. When you are finished, press the C key. You will be asked for a name, for the new program. Enter one. Then you are asked for the address that will execute the program. If you are linking only binary files, then enter the address that executes the program, in Hex ($). If you are going to RUN a BASIC main file and are linking with one of the MLRUN boots, then enter $0FE8. The linking process will begin. While the object file is written to disk, the border flashes. When all is done, you see be asked to insert the destination disk. This is an "Open Ended Linker", in that the pointers at decimal 45 and 46 are set to the end of the last file loaded in. If you run into a problem with an "OUT OF MEMORY ERROR", upon running the program, then you must manually set the End of Program pointers... within the program itself. This is done by using the START/END FINDER utility, included with this package. This program will provide you with the Starting and Ending addresses in both Decimal and Hex format. The final lines in this program will give you the values (in Low/High format), that you will need to plug into the first line of your BASIC program with: POKE45,xx:POKE46xx:CLR This must be in Low/High address format. You may also have to combine them first by saving a chunk of memory from your ML monitor. NOTES: You can't have a module unpack to the zero page area or up to $07E7. SLEDGE HAMMER resides there. You can't link BASIC programs that RUN at other than $1001, unless you use the appropriate MLRUN module. If your BASIC program is to RUN at, say $1001, then the program must not only RUN from $1001... but it MUST BE SAVED from $1001. So if you've created your program in the Graphics mode, you must LOAD and SAVE it again in the normal mode mode. This is because the beginning of BASIC, in Graphic mode, starts at $4001 and the load address will reflect THAT! If you find that you just HAVE to start a BASIC program, somewhere besides $1001, then you need to use one of the xxxx/RUN ML modules. These will properly set the Beginning of BASIC pointers, for you. The BASIC program, itself, MUST be SAVEd from that location. So, if you wish the program to run from BASIC at $2001, then the program must be LOADed into $2001 and then SAVEd, from there. This can be done with the RELOAD PROGRAM boot, also provided with this package. This boot will ask you the name of the program that you want to relocate. It then asks you for the new Start of BASIC address in HEX. Such as 1001, 1c01, 2001, 3001 and etc. It will then display some info and LOAD your program into the proper area of memory. The program will then call a CLEAR (to set certain pointers) and stop. You can then do a normal SAVE"filename",8 or DSAVE"filename to make a copy of ypour program... SAVEd from the new area of memory, as mentioned above. You could RUN your program, at this point, to check it out. SLEDGE HAMMER's buffer will handle about 248 blocks worth of BASIC program and data. If you need to handle more than that, you will have to look into linking, packing, then additional linking. This takes careful planning. There are some programs that SLEDGE HAMMER +4 just won't work with. God knows why. They just won't. You might try setting the end of the BASIC program, in the first line of the BASIC program, itself. Also you will need to set the Top of BASIC pointers, if you have ML modules, way up in memory. Your SLEDGE HAMMERed file will be around the same size as all of the modules added together, or smaller. It can be reduced in size, even more, if you use another cruncher/packer on the finished file... it's up to you! EXAMPLE: You want to link/pack a program that is in two parts, the main BASIC program and an ML module. You also want it to start with RUN. First, you use the START/END FINDER utility to determine the addresses of the modules. Let's say that they are the following: BASIC program $1001 - $3412 ML module $6000 - $6FFF Be sure to copy down the values that are shown, at the bottom, that are to be POKEd into pointer locations 45 & 46: POKE 45 46 BASIC pgm 18 52 ML module 0 96 Since the BASIC program is to RUN at $1001 (4097), then you'd use the MLRUN module: 1001/RUN(0FE8) Next, LOAD and LIST the BASIC program. Locate and REM out the line that Loads the ML module. Create a new first line in your program, using the values that were given for the BASIC portion. Also, since we want to protect the ML module, we want to set the End of BASIC pointers: 1 POKE45,18:POKE46,52:POKE55,0:POKE56,96: CLR We could have rounded off the POKEs to 45 and 46, just to be sure: 1 POKE45,0:POKE46,53:POKE55,0:POKE56,96: CLR What we've done is to set the pointers for the End of Program (45 & 46), just above the end of the BASIC program. We then set the Top of BASIC pointers (55 & 56) to just below the start of the ML module. This will give the area from about $3500 to $6000, for strings, arrays and variables. If you don't feel that there is enough room for these, then you could have set the End of Program pointers past the end of the ML module. That would give the area from $7000 to $FCFF for all those variables. In order to do that, you'd have used: 1 POKE45,0:POKE46,112:CLR Next, SAVE the modified BASIC program under a new name like: PROGRAM.MOD Now, make sure that all three files (MLRUN, PROGRAM.MOD and ML module) are on the same disk. Boot SLEDGE HAMMER +4 and select F1 to begin linking/packing. Select, with the cursor keys and the Return key, all three files. Then press the C key, to Continue. At the prompt, for address changes, answer No. At the next prompt, enter the name for the file that you want to create. Then enter 0FE8 at the JMP prompt. The files will be combined and packed. When you LOAD and RUN the finished file, it will unpack the modules into their proper locations, in memory. Then the program will jump to the ML at $0FE8, which will RUN the BASIC main program. You may use another cruncher on the SLEDGE HAMMERed file. If you decide to, the starting address for a SLEDGE HAMMERed file is $1010 (4112).