Re: [cc65] Bank Switching

Date view Thread view Subject view

From: Christian Groessler (cpg_at_aladdin.de)
Date: 2002-09-21 01:22:18


Hi,

On 09/21/2002 12:44:32 AM ZE2 Ullrich von Bassewitz wrote:
>
>As far as I remember, the Atari is able to have separate chunks in an
>executable file, where each chunk has it's own header, and is loaded to a
>different address. The last one of these headers has a special marker. If so,
>the solution would be to slightly modify the standard startup script. Just
>include both headers (place the second header into a segment named HEADER2 or
>similar). Then change the linker config so that each one of the RAM1 and RAM2
>memory areas has its own header.
>
>Maybe one of the Atari guys can comment on this in more detail (or correct me
>if I got this wrong).

You're mostly correct. Mostly, because the last chunk is not in any
way special (as viewed from the EXE file format). The format of an
executable file on the atari is

0xffff      magic number (16bit)
start1      load address of first byte of chunk 1 (16bit)
end1        load address of last byte of chunk 1 (16bit)
block1      contents of chunk, size determined by start1 and end1

            the following is optional and can repeat:

start2      load address of first byte of chunk 2 (16bit)
end2        load address of last byte of chunk 2 (16bit)
block2      contents of chunk, size determined by start2 and end2


In the current atari.cfg linker file, EXEHDR is the first 6 bytes of
the executable (0xffff and the addresses for chunk 1) and AUTOSTRT is
in fact only a 2nd chunk which "loads" the start address of the
program into the relevant system variable.

So with some linker and segments fiddling, one should be able to make
RAM2 a separate chunk in the file. The AUTOSTRT chunk should be last
(unless you know what you do), because I think it's address will be
called immediately after being loaded, before the remaining chunks get
loaded. 

Shawn, if you have problems setting this up, don't hesitate to contact
me, I'm happy to help. (I've never really used this multi-chunk
feature and I'm curious...)

regards,
chris

----------------------------------------------------------------------
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 : 2002-09-21 01:24:28 CEST