Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!imagen!atari!apratt From: apratt@atari.UUCP (Allan Pratt) Newsgroups: comp.sys.atari.st.tech Subject: Re: How store extra data at the end of an executable? Message-ID: <2904@atari.UUCP> Date: 12 Apr 91 21:09:38 GMT References: <5796@mcrware.UUCP> Organization: Atari Corp., Sunnyvale CA Lines: 49 >erik@mcrware.UUCP (Erik Johnson) writes: >Here is what I would like to do. I would like to append a picture file to the >end of my executable file. In this case, the extra data is a picture file that >is the menu for my program. Once a program is loaded into memory, is it closed >and all file offset information lost, or is there a way I can start reading >data from the file where the program data left off. wolfram@ikki.informatik.rwth-aachen.de (Wolfram Roesler) writes [some stuff based on wierd and wrong guesses about how things work]. You can't just tack the picture data onto the program file after the program's data segment, because that would mess up the BSS segment. I reiterate: you should not try to "append a picture file to the end of [your] executable file" but rather "arrange for a picture file to be included in your program file." This you can do, in the worst case, by turning the picture file into an assembly (or C!) source file, assembling (or compiling) it, and linking with the resulting .o file. Example using my DB (it doesn't matter what compiler you ultimately use): :read picture.neo :transcript mypic.c :dw(+ `rwstart 4)[@32] ; dw(+ `rwstart 80)[@32000] :transcript off Now, in mypic.c, there's a top line you should delete ("dw..."), two lines' worth of palette data, and 2000 lines' worth of picture data, followed by another line you should delete ("transcript off"). You have to edit the file to remove the address and ASCII fields from the dump, and prefix each number by "0x", and put commas between them, and now you can wrap them in to C as array initializers, so the result looks like this: short paldata[] = { 0x0777,0x0007,0x0070,0x0700, ..., ... }; short picdata[] = { 0x ... }; and now you can compile this file, link with it, and use the symbols paldata and picdata in your program. ============================================ Opinions expressed above do not necessarily -- Allan Pratt, Atari Corp. reflect those of Atari Corp. or anyone else. ...ames!atari!apratt