Jump to content
IGNORED

Old World A78 Format (1.0 - 3.1) Primer


TailChao

Recommended Posts

Atari 7800 File (*.a78) Strategy Guide
for the Old World Format (1.0 - 3.1)

 

A78 Format Strategy Guide.doc

↑ Microsoft Word Document ↑

 

History

The *.a78 file is a ubiquitous format for describing Atari 7800 game cartridges originally designed by Dan Boris for his V7800 emulator, it then grew organically to encompass a broad range of aftermarket hardware.

 

This post and attached document are an attempt to make sense of the Old World Format (1.0 - 3.1) before its pivot to a more refined layout. Thus, it’s not a formal specification but rather a clarification of the format’s nuances - we’ll decode many of the header’s flags liberally to allow a healthy amount of mischief. We'll also be introducing new naming conventions for existing hardware.

 

Remember, what you're reading is a bunch of observations and suggestions written for where we are now - many of them could become completely irrelevant as we drift away from the post's timestamp.

 

 

File Format

A well behaved *.a78 file consists of a 128 byte header followed by one or more payloads - the header describes a cartridge’s form and function, while payloads contain a duplicate of its nonvolatile memory (usually a Mask ROM).

 

a78_layout.thumb.gif.876e42740d6d6416e024b540f99e6224.gif

 

Any strings are assumed to be ASCII, with valid characters from $20 (‘ ‘) - $7E (‘~’), reserved segments or undefined bitfields must be set to zero.

 

A Hint field indicates cosmetic preference - for example, a header tagged with a ProLine ($01) for the Controller Port 1 Device and VCS Keypad ($07) for the Controller Port 2 Device implies the software’s intended experience is with these devices but it may support other input methods. Similarly, a Support field implies the software is compatible with the peripheral or slot device, but may not require it to run (or at least start up).

 

 

Cartridge Types and Mappers

Two bytes at $35 - $36 are used to define the cartridge’s hardware, separated into individual bitfields which indicate Mappers , Features , and members of the Low Audio Block . The intent of each field is to represent a cartridge programmatically, and this also applies to the binary payloads following the header - these are expected to contain data as read sequentially through the card edge and not directly from the nonvolatile storage device.

 

Mappers are mutually exclusive bitfields used to select a cartridge hardware family, as of writing there are five varieties...
 

  • FLAT (16KB, 32KB, 48KB, 52KB)
    A scheme so simple, it’s selected by having no mapper bits set.

    The 16KB and 32KB sizes map their ROM at $8000 - $FFFF and Feature at $4000 - $7FFF (such as Ballblazer’s POKEY). 48KB cartridges map their data linearly from $4000 - $FFFF.

    The 52KB size is a special case - it’s mapped linearly from $3000 - $FFFF but this overlaps with the $3000 - $3FFF region used by the High Score Cartridge (and marked as reserved in GCC’s original documentation); this was introduced alongside BANKSET.
     
  • SUPER
    Used prolifically during and after the 7800’s commercial life; the $4000 - $FFFF region is divided into three sections with a Feature at $4000 - $7FFF, Paged ROM segment at $8000 - $BFFF, and Fixed ROM segment at $C000 - $FFFF.

    The Paged ROM segment is selected by writing its bank number anywhere from $8000 - $BFFF, giving a theoretical upper limit of 256x16KB pages and...
    • 4,096KB ROM for SUPER
    • 4,112KB ROM for SUPER + EXROM
    • 8,192KB ROM for SUPER + BANKSET
       
  • ACTIVISION
    Supports up to 128KB of ROM arranged an 8KB Paged ROM segment from $A000 - $DFFF and four 8KB Fixed ROM segments in $4000 - $9FFF and $E000 - $FFFF. Used in software such as Double Dragon and Rampage.
     
  • ABSOLUTE
    Supports 64KB of ROM arranged as a 16KB Paged ROM segment from $4000 - $7FFF and 32KB Fixed ROM segment from $8000 - $FFFF. Used only in F-18 Hornet.
     
  • SOUPER
    Supports up to 512KB of ROM, 32KB of RAM, Maria Fetch Trapping, and BupChip Expansion Audio. First saw use in Rikki & Vikki; see tailchao.com for details and source.
     

More information on the FLAT, SUPER, ACTIVISION (78AC), and ABSOLUTE (78AB) schemes is available in Eckhard Stolberg’s guide on 7800.8bitdev.org.

 

 

Cartridge Features or Options

A Feature or Option is an extension to Atari’s FLAT or SUPER cartridges. Certain features can be stacked and others are mutually exclusive, see Compatibility Matrix for details.
 

  • POKEY @ $4000 - $7FFF
    POKEY mapped to $4000 - $7FFF, repeating every $10; used by software such as Ballblazer and Commando for enhanced audio.
     
  • EXRAM
    16KB of SRAM mapped to $4000 - $7FFF; used by software such as Tower Toppler.

    It should be noted that while this feature definition specifies 16KB of SRAM mapped within the $4000 - $7FFF region, no cartridges were actually manufactured with an SRAM of that size. Most used a 6264 (8KB) mirrored twice or a 62256 (32KB) with only half of its capacity available.
     
  • EXROM
    16KB of ROM mapped to $4000 - $7FFF; used by software such as Alien Brigade.

    This is intended for pairing with SUPER cartridges which require a small amount of additional data, but not enough to justify doubling the Primary ROM’s size - so a 16KB Secondary ROM is added instead

    The Secondary ROM’s data comes FIRST in the payload, followed by the Primary ROM - so a 144KB SUPER + EXROM game’s payload would contain the 16KB Secondary ROM from $00000 - $03FFF and the 128KB Primary ROM from $04000 - $23FFF.
     
  • EXFIX
    Extended Fixed ROM Segment for SUPER cartridges, where the LAST BANK - 1 is mapped to $4000 - $7FFF. For example, a 512KB SUPER + EXFIX cartridge would have bank $1E assigned to the $4000 - $7FFF region. Saw use in software such as Xenophobe and was a prolific feature for SUPER cartridges.

    Historically, this field hasn’t been tagged consistently and thus requires special handling; see Quirks for details.
     
  • EXRAM/X2
    32KB of SRAM organized as 2x16KB segments mapped to $4000 - $7FFF, the current segment is chosen using Bit 5 of SUPER’s paging register. This limits its use to SUPER cartridges with a ROM size of 512KB or less.

    First introduced in the VersaBoard and MegaCart+, as of writing this feature has yet to see documented adoption in any software.
     
  • EXRAM/A8
    8KB of SRAM mapped to $4000 - $7FFF with a unique wiring scheme; A7 - A0 are connected between the SRAM and cartridge slot directly, but A8 on the cartridge slot is “skipped” and all subsequent address lines are shifted down by one when routed to the SRAM (i.e. SLOT A9 → SRAM A8 … SLOT A13 → SRAM A12).

    This has the effect of doubling up raster lines when Maria fetches graphics and saw use in the Rescue on Fractalus prototype, where it was implemented with a 2KB SRAM mirrored four times in the $4000 - $7FFF segment.
     
  • BANKSET
    A “ROM Doubler” which can be applied to both FLAT and SUPER cartridges, this feature uses the current bus master to select between halves of ROM. All of Sally’s accesses are routed to the lower half of ROM while Maria’s go to the upper half.

    For example, a 2x128KB SUPER + BANKSET cartridge’s header would carry a 256KB payload with Sally’s accesses routed to $00000 - $1FFFF and Maria’s to $20000 - $3FFFF. Padding isn’t required for FLAT cartridges of non 2n sizes, such that a 2x48KB BANKSET’s payload would be 96KB with Sally’s accesses routed to $00000 - $0BFFF and Maria’s to $0C000 - $18000.

    First saw use in Attack of the PETSCII Robots; see 7800.8bitdev.org for details.
     
  • EXRAM/M2
    32KB of SRAM organized as 2x16KB segments whose paging is dictated by the current bus master and access region. This was introduced alongside the BANKSET feature.

    If Sally has the bus, the lower 16KB page is mapped to $4000 - $7FFF (R/W) and the upper 16KB page is mapped to $C000 - $FFFF (W/O). If Maria has the bus, the upper 16KB page is mapped to $4000 - $7FFF.
     

 

Low Audio Block

The Low Audio Block (or LAB) is a blanket term for audio enhancements mapped below $4000 and typically between $0400 - $047F and $0500 - $0FFF. This practice originated in Pontus Oldberg’s XBoard which contained a POKEY at $0450 - $045F.

 

Any member of the LAB is assumed to be directly (linearly) mapped to its address region, and can be paired with any cartridge type. Note the LAB refers specifically to audio enhancements in the cartridge and not in upgrades such as the XBoard or XM.

 

  • POKEY @ $0450 - $045F
    First introduced in the XBoard and then implemented in numerous aftermarket cartridges, as of writing this is the LAB’s most prolific member.
     
  • POKEY @ $0440 - $044F
    Introduced in the DragonFly Cartridge.
     
  • YM2151 @ $0461 - $0462
    Introduced in the DragonFly Cartridge.
     
  • POKEY @ $0800 - $080F
    Introduced alongside BANKSET.
     

 

Cartridge Compatibility Matrix

 

a78_matrix.gif.fe8bc943e21dc423bd8dde73d6479695.gif

 

a78_matrix_k.gif.6fdc5223146c57f7d7d3b25c5a074a67.gif

 

  1. POKEYs mapped to $4000 - $7FFF may coexist with other devices in this region such as EXRAM or ROM; this causes the POKEY to become write only.

    An EXRAM, EXRAM/A8, EXRAM/X2, or EXRAM/M2 pairing requires special handling, as the POKEY should only respond to writes from $4000 - $400F instead being mirrored throughout the entire segment. See Quirks for details on this behavior.
     
  2. SUPER cartridges with EXRAM/X2 use the VersaBoard / MegaCart’s 2x16KB paging scheme which limits the ROM size to 512KB or less. This is considered an exclusive feature within the $4000 - $7FFF range.
     
  3. BANKSET may not be paired with EXROM.
     


Slot IRQs

The POKEY @ $4000 - $7FFF and members of the LAB output active-low interrupts - these can be routed to the cartridge slot’s /IRQ line by setting their pertinent bits in this field. Setting multiple bits will logically AND the interrupt signals together.

 

 

Realistic Expectations

Because you don’t always need to implement everything.

 

  • The following configurations cover the entire commercial library...
    • FLAT
      • 16KB or 32KB
        • POKEY @ $4000 - $7FFF
      • 48KB
    • SUPER
      • POKEY @ $4000 - $7FFF
      • EXRAM
      • EXROM
      • EXFIX
    • ABSOLUTE
    • ACTIVISION
       
  • ...anything else is a prototype or aftermarket cartridge, and none of the original releases exceed 144KB (128KB SUPER + 16KB EXROM) in size. Support for up to 512KB of ROM is likely a safe overhead; with the 512KB SUPER + EXRAM + POKEY @ $0450 - $045F configuration as a popular target.
     
  • To date, EXRAM/A8 has only been used by the Rescue on Fractalus prototype - the game’s wirewrap board contained a 2KB SRAM to implement this feature.
     
  • SUPER + EXROM + POKEY @ $4000 was used by Bentley Bear’s Crystal Quest, but the game also supports using a POKEY @ $0450 in the LAB or XBoard. Releases are available in both configurations.
     
  • As of writing, SOUPER has only been used by Rikki & Vikki and no provisions are available for declaring its BupChip audio resources in the header - this is enough to run the game without its soundtrack.
     
  • Similarly, Slot IRQs for POKEY @ $4000 and the LAB members have only been used for a handful of music demonstrations targeting the DragonFly Cartridge.
     

 

Quirks

It wouldn’t be a file format without them.

 

  • EXRAM + POKEY @ $4000 is a configuration inherited from ProSystem 1.3 which allowed a POKEY to be dropped at this location along with any other device, the POKEY would respond to writes from $4000 - $4008 which excludes SKCTL. This arrangement is fairly obscure, if opting to support it I recommend expanding the POKEY’s allocation to $4000 - $400F so all its registers can be accessed.
     
  • Certain emulators had no padding requirements for FLAT (52KB or less) cartridges and loaded their binaries downward from the top of the address space. For example, a cartridge with no features and a 21,778 byte payload would manifest as a 32KB cartridge with garbage data from $8000 - $AAED and the payload in $AAEE - $FFFF. Dependence upon this behavior is limited to a handful of homebrew software, so it’s likely safe to restrict FLAT cartridge payloads to 16KB, 32KB, 48KB, and 52KB.
     
  • EXFIX has a history of not being tagged in SUPER cartridges which require it; which was further complicated by emulators assuming any SUPER cartridge had EXFIX unless it used EXRAM or EXROM. I recommend assuming a SUPER cartridge has EXFIX if no features are enabled which occupy the $4000 - $7FFF region and the header’s version is less than $02.
     
  • An improperly tagged version of Commando lacking the POKEY @ $4000 - $7FFF bit has been floating around since the dawn of 7800 emulation. If you load this up and can’t hear any music - check the header. This has since become a recurrent nuisance akin to digital canada geese - we know the header was always tagged incorrectly and someone will inevitably bump into it.
     
  • There are a few rare occasions where the header’s requirement for zeroing any reserved or unused segments was not followed - usually substituting $FF instead. This affects the Slot IRQ field, and some prudence in only checking this byte if the header version is $03 and only enabling IRQs for audio enhancements which actually exist is advised.
     
  • Spaces ($20 / ‘ ‘) are frequently used as padding in $0A - $10, a vestige from earlier header iterations. As of writing this is fairly benign.

 

  • Like 8
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...