diff --git a/cfg/atari7800.cfg b/cfg/atari7800.cfg index 8029ca674..d7b166809 100644 --- a/cfg/atari7800.cfg +++ b/cfg/atari7800.cfg @@ -1,7 +1,12 @@ # Atari VCS 7800 linker configuration file for cc65 +# This cfg file adds the a78 header in front of the image +# If you want just the ROM you can mark the __EXEHDR__ as weak instead of import +# But for the most common use we add the a78 automatically as it +# contains info about what kind of cart the build supports SYMBOLS { - __STACKSIZE__: type = weak, value = $0010; # 16 bytes stack + __STACKSIZE__: type = weak, value = $0600; # C stack + __CARTSIZE__: type = weak, value = $c000; __EXEHDR__: type = import; __VEC_BOTTOM__: value = $fffa, type = export; __VEC_SIZE__: value = $6, type = export; @@ -21,7 +26,7 @@ MEMORY { RAM2: file = "", define = yes, start = $2100, size = $0040, type = rw; RAM3: file = "", define = yes, start = $2200, size = $0600, type = rw; # For emulators you also need a header file - HEADER: file = %O, start = $0000, size = 128; + HEADER: file = %O, start = $0000, size = 128; # "Normal" cartridge rom. Multiple banks arent supported # by this script. You may change the rom size, but keep # two things in mind: @@ -37,7 +42,7 @@ MEMORY { SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro, define = yes; + EXEHDR: load = HEADER, type = ro; STARTUP: load = ROMS, type = ro, define = yes; ONCE: load = ROMS, type = ro, define = yes; CODE: load = ROM, type = ro, define = yes; diff --git a/doc/atari7800.sgml b/doc/atari7800.sgml index 85f6e4f9f..b6551614c 100644 --- a/doc/atari7800.sgml +++ b/doc/atari7800.sgml @@ -24,7 +24,29 @@ comes with the cc65 C compiler. It describes the memory layout, Atari Binary format

The default binary output format generated by the linker for the Atari -7800 target is a 32K cartridge image. +7800 target is a 48K cartridge image. + +A78 header

+ +There is lots of different cart hardware available for the atari7800. +Some carts have ROM, RAM, sound hardware, non-volatile high score chips. +In order to know what kind of hardware the cart build requires there is +a header file of 128 bytes in front of the binary. + +The default build creates a cart file for a 48K rom cart without any +extra features like the pokey audio chip or extra RAM. + +In order to make cc65 more user friendly the build will add the a78 +header automatically. This allows you to run the binary on emulators +and flash carts on the real console. + +Encryption

+ +In order to boot the game in a mode that supports atari7800 functions +the cart must be encrypted after the linking phase. +There is a program called sign7800 that can be used to sign the cart. +The encryption is not required for running the cart on emulators. +You can also run atari2600 games without encryption. Memory layout

@@ -104,12 +126,6 @@ There are no drivers for the Atari 7800. TBD -Encryption

- -In order to boot the game in a mode that supports atari7800 functions -the cart must be encrypted after the linking phase. -There is a program called sign7800 that can be used to sign the cart. - Other hints

One may write a custom linker configuration file to tune the memory diff --git a/libsrc/atari7800/exehdr.s b/libsrc/atari7800/exehdr.s index 6f3023040..618164cd4 100644 --- a/libsrc/atari7800/exehdr.s +++ b/libsrc/atari7800/exehdr.s @@ -4,7 +4,7 @@ ; This header contains data for emulators ; .export __EXEHDR__: absolute = 1 - + .import __CARTSIZE__ ; ------------------------------------------------------------------------ ; EXE header .segment "EXEHDR" @@ -12,7 +12,7 @@ .byte 'A','T','A','R','I','7','8','0','0',' ',' ',' ',' ',' ',' ',' ' .byte 'G','a','m','e',' ','n','a','m','e',0,0,0,0,0,0,0 .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .byte 0,0,$80,0 ; Size + .byte 0,0,>__CARTSIZE__,0 ; Set the cart size in the cfg file ; bit 0 - pokey at 4000 ; bit 1 - supergame bank switched ; bit 2 - supergame ram at $4000