A78 Header Specification

From 8BitDev.org - Atari 7800 Development Wiki
Revision as of 16:47, 29 March 2022 by MSaarna (talk | contribs)
Jump to: navigation, search

History and Purpose

The A78 header was originally created by Dan Boris, in tandem with his A7800 emulator. The header, which is added to the beginning of ROM images, serves to tell the emulator which hardware should be present for the game to run correctly.

The format has since been expanded to incorporate new hardware, and is now being used by multiple emulators and the Concerto 7800 flash cart.

A78 Header Fields

A78 Header Fields
0000 03 41 54 41 52 49 37 38 30 30 00 00 00 00 00 00 .ATARI7800......
0010 00 43 6f 6d 6d 61 6e 64 6f 00 00 00 00 00 00 00 .Commando.......
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0030 00 00 02 00 00 00 03 01 01 00 00 00 00 00 00 00 ................
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0060 00 00 00 00 41 43 54 55 41 4c 20 43 41 52 54 20 ....ACTUAL CART
0070 44 41 54 41 20 53 54 41 52 54 53 20 48 45 52 45 DATA STARTS HERE
color purpose size offset
  header version 1 byte 0 / 0x00
  ATARI7800 magic-text 16 bytes 1 / 0x01
  cart title 32 bytes 17 / 0x11
  rom size without header 4 bytes 49 / 0x31
  cart type 2 bytes 53 / 0x35
  controller 1 type 1 byte 55 / 0x37
  controller 2 type 1 byte 56 / 0x38
  TV type 1 byte 57 / 0x39
  save device 1 byte 58 / 0x3A
  reserved    
  expansion module 1 byte 63 / 0x3F
  header end magic-text 28 bytes 100 / 0x64

cart type word details::

  bit 0     = pokey at $4000
  bit 1     = supergame bank switched
  bit 2     = supergame ram at $4000
  bit 3     = rom at $4000
  bit 4     = bank 6 at $4000
  bit 5     = banked ram
  bit 6     = pokey at $450
  bit 7     = mirror ram at $4000
  bit 8     = activision banking
  bit 9     = absolute banking
  bit 10    = pokey at $440
  bit 11    = ym2151 at $460/$461
  bit 12    = souper
  bit 13    = banksets
  bit 14 = halt banked ram
  bit 15 = pokey@800

controller type byte details:

  0 = none
  1 = 7800 joystick
  2 = lightgun
  3 = paddle
  4 = trakball
  5 = 2600 joystick
  6 = 2600 driving
  7 = 2600 keypad
  8 = ST mouse
  9 = Amiga mouse

TV type details:

  bit 0 = 0:NTSC, 1:PAL
  bit 1 = 0:component, 1:composite

save device details:

  bit 0    = HSC
  bit 1    = SaveKey/AtariVox


expansion module:

  bit 0    = XM


v3 A78 Header Version Notes

The current header version stands at 3. There were fields in previous versions that were ambiguously defined, but are now spelled out. To be v3 compliant, a header must:

  • Have a zero-terminated Cart Title field. Any post-title padding should be zeros, rather than spaces.
  • All reserved bytes must contain zero.

Previous versions of the header were ambiguous as to the TV Type byte being an index or bitfield. V3 headers define TV type as a bitfield, and have included a bit to indicate whether composite display artifacts are appropriate for the game.


Adding Or Modifying an A78 Header on an Existing ROM

You can add or update an A78 header with the interactive command-line utility 7800header, which is distributed with 7800basic and the 7800AsmDevKit.

The utility displays the current header (or default header if the file is headerless) and you can set/unset hardware features with the displayed commands.

7800 A78 Header Info

    embedded game name : commando
    rom size           : 131072
    cart format        : Pokey@4000 SuperGame 
    controller 1       : Joystick 
    controller 2       : None 
    save peripheral    : None 
    xm/xboard          : not enabled 
    tv format          : NTSC

Commands: "save"           Save the A78 file and exit.
          "set [option]"   Set one of the options.
          "unset [option]" Unset one of the options.
          "name game name" Set the game name in the header.
          "exit"           Exit the utility. Unsaved changes will be lost.

Options:  rom@4000 bank6@4000 pokey@450 pokey@4000 supergame supergameram
          supergamebankram absolute activision tvpal tvntsc savekey hsc xm
          joystick1 joystick2 lightgun1 lightgun2 

> exit


Adding an A78 Header to Source Code

To add an A78 header to your DASM source code, you can add or include the header at the start of your source, and adjust the fields to encode the hardware your game requires.

For the current a78 assembly-language header, see the a78 header github