Re: [cc65] rebuilding libraries - generated program crashes

Date view Thread view Subject view

From: jimsymolon (jsymolon01_at_attbi.com)
Date: 2003-06-08 02:10:19


Ullrich von Bassewitz wrote:

>Hi!
>
>Thanks for the detailed description. I'm sorry that I didn't note this
>earlier, but the linker acts exactly as it should. Have a look at the
>linker configuration for the Apple (this file is part of the source
>package and comes in the doc/ directory of the apple2 binary package):
>
>    MEMORY {
>        ZP: start = $00, size = $1A, type = rw, define = yes;
>        HEADER: start = $0000, size = $4, file = %O;
>        RAM: start = $800, size = $8E00, file = %O;
>    }
>    SEGMENTS {
>        EXEHDR: load = HEADER, type = ro;
>        STARTUP: load = RAM, type = ro, define = yes;
>        LOWCODE: load = RAM, type = ro, optional = yes;
>        CODE: load = RAM, type = ro;
>        RODATA: load = RAM, type = ro;
>        DATA: load = RAM, type = rw;
>        BSS: load = RAM, type = bss, define = yes;
>        ZEROPAGE: load = ZP, type = zp;
>    }
>
>What you can see is that the AppleDOS 3.3 header which comes in the EXEHDR
>segment is written into the HEADER memory area, which goes to the output
>file ("%O" is the output file named on the command line).
>
>The STARTUP segment, which contains the code from crt0.s is the first
>segment that is written to the RAM memory area, which is relocated to $800
>and which goes into the same file as the header.
>
>This means that the output file contains 4 bytes of header, followed by
>code that must be loaded to $800. So either the loader has to strip the
>first 4 bytes and load the remainder to $800, or you have to load the
>whole file to $7FC so that the STARTUP segment begins at $800.
>
>As you can see, there is no error, anything works as it should. I'm not
>sure why you insist on loading the whole file to $800. If this is based on
>some information in the docs, the docs are wrong. In this case please tell
>me where you found the information so I can fix it.
>
>Older versions of cc65 produced apple2 binaries without the header. It has
>been added later by request of the AppleWin author (Oliver Schmidt). His
>statement was that both, AppleDOS 3.3 and ProDOS are both able to use this
>header.
>
>If you don't want the header, just modify line 3 of the linker config so
>that it reads:
>
>        HEADER: start = $0000, size = $4, file = "";
>
>This will dump the header by assigning an empty output file. Then apply
>the changed linker config by using
>
>        ld65 -C apple2.cfg ...
>
>instead of
>
>        ld65 -t apple2 ...
>
>The latter command uses the builtin version of the apple2 linker
>configuration as shown above.
>
>Regards
>
>
>        Uz
>
>
>  
>
I've a copy of  "Beneath Apple DOS", in which it describes the binary 
file as having the 4 byte header information, and I at a loss to figure 
out how I originally got it to work.  It might be the a2tools options 
are wrong.  I'll look into that.

CC65 is a great product and I hope to add to your work with the DOS drivers.

Thank you for your help
Jim




----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-06-08 02:23:36 CEST