Merge Copyright © 1990 by Kevin Kelm SHAREWARE $5 GENERAL Merge is a utility for all you programmers out there that want to integrate data files with your executables. Merge even lets you chose to put the data into chip memory. If you find this program useful, please consider dropping $5 in the mail at the address below. FORMAT The command-line form at of Merge is: 1> Merge <$LONG_ID> [CHIP] where... is the filename of your program executable. is the filename of the data you want to include. This file will be included, VERBATIM. is the output, executable filename. <$LONG_ID> is any HEXADECIMAL longword identifier ... this is the long word that you will search the hunk table for... more on this later. I typically use a value that I *know* will not be found at the beginning of any other hunk... 4B454C4D = "KELM". This value ***MUST*** be unique! [CHIP] is an optional word that you may include to specify that you want the data to end up in CHIP memory. IMPLEMENTATION DETAILS Ok, now the fun. Anybody out there using Benchmark Modula-2 is all set... all you need to do is call FindImageTable from the Images library module FindImages, and the ImageDescriptionTablePtr returned will be a pointer to your data hunk, rather than a pointer to an image description table. More on this later (see step 4). For programmers using other systems, I can only make the following recomendations on how to find your data when the program is running. 1) Get the address of the segment list for your process. This CAN be more complex than it might seem. 2) Scan through this list, looking for the first memory block that has as its first longword the <$LONG_ID> you are searching for. 3) Once you find this value, you've found your data. The longword immediately following the <$LONG_ID> will be a 1. Ignore this; your data officially begins at beginning_of_hunk+8; 4) The structure of your data is as follows: The first longword represents the size, in bytes, of the data block. The very next longword is the first longword of your data. SUMMARY Personally, I am somewhat wary of putting too much executable data in CHIP memory... past experience tells me that memory can get badly fragmented. But this CAN be a useful feature; my first commercial video game contained all imagery for game play within the executable using just this technique. Well, enjoy! I hope you get good use out of merge. If for any bizarre reason you need to contact me, I can be reached as: Kevin Kelm 7080 Roaring Springs Avenue Fountain, CO 80817 (719)392-1023 -or- CIS: 71071,2726 -or- USENET: Try and catch me on comp.sys.amiga or comp.sys.amiga.tech ! Some of my other releases: T.A.C.L. The Adventure Construction Language COMMERCIAL T.A.C.L. Game demos Fred Fish 300 Boing! The Game COMMERCIAL Boing! The Game demo Fred Fish 337(?) Super Echo 1.0 Fred Fish 300 TitleGen 1.6 Fred Fish 300 NeuralLab 1.0 ???? XenoZap virus killer ???? Visionary Aegis, Nov. 1990