RE: [cc65] How smart is the linker?

From: Rick Cortese <brewboy1frys.com>
Date: 2009-12-16 19:36:28
>From: owner-cc65@musoftware.de [mailto:owner-cc65@musoftware.de] On Behalf
Of Jakub

>I have to define a lot of aligned segments because of 8bit Atari
limitations 
>(aligned segment for sprites, fonts, screen data in display list etc.)

I don't know how gracefully cc65 handles return of control to DOS. Assuming
it works right, the way to handle this is with the LOAD/INIT/RUN feature of
DOS and the OS. I have mostly done this in assembler so it wasn't necessary
for me to use the DUP.SYS for this except on one or two programs from other
people that I only had the binaries for.

Been a while and I don't have an Atari set up to check the exact procedure
but it goes something like:

Depending on technique, use a disk with a MEM SAV.

Let's say you decide to put your character set, DL, and P/M graphic data in
high memory. You start with a short program that just lowers RAMTOP so you
have enough room, fills the space with your data, terminates, and returns to
DOS.

If you need to you may have to edit the last couple of bytes to switch a
CC65 compiled program from using the RUN vector to INIT vector, only 4
bytes.

Do your main program with everything pointing to the RAM locations you used
in the first program.

From DOS use the COPY with the append option(/A) to copy the main program
onto the end of the first.

It should be load and go now. The two programs can actually use the same
load address. Once the first program runs to set up data area and fills it.

Something similar could even be done *NOT* even using code for the first
part in the final program. Just run the first program and return to DOS
menu. USE the BINARY SAVE option and just give it the address of your data.
Let's say you have your character set and P/M graphics starting at $B400.
You just use something like
$B400, $B900,,
For the address. The load vectors will automatically be put into the file
and the ',,' just leaves the LOAD and INIT vectors out.

For you final file you would have one program that just lowers RAMTOP,
another with RAW character set and graphic data, and the third with your
actual program. After appending the three files, when run:  DOS runs the
first file, sees more bytes in the file and loads the next.  Not seeing a
RUN or INIT at the end of the second file but seeing more bytes DOS proceeds
to load and go with the third.

The reason you may want a MEM save is if DOS steps on your code. For
instance if you overwrite the area you are trying to save with DUP.SYS.

Rick

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed, 16 Dec 2009 10:36:28 -0800

This archive was generated by hypermail 2.1.8 : 2009-12-16 19:36:55 CET