{
 "schema": 1,
 "platform": "c64",
 "game": "gunship",
 "part": "helpers",
 "build": "original disk, Rapidlok V6, PAL, C64 Preservation Project gunship_s1/s2[microprose_1985](rl6)(pal)",
 "source": "regenerator2000 live",
 "regions": {
  "exclude": [
   [
    256,
    511,
    "stack"
   ],
   [
    53248,
    57343,
    "I/O and colour RAM"
   ],
   [
    1024,
    2047,
    "screen RAM"
   ],
   [
    0,
    32767,
    "3 parts: Debriefing, Flight, Side two loader"
   ],
   [
    32995,
    65535,
    "2 parts: Debriefing, Flight"
   ]
  ],
  "extra": [],
  "edges": [
   0,
   256,
   512,
   1024,
   2048,
   4096,
   16384,
   32768,
   40960,
   49152,
   53248,
   57344
  ],
  "elsewhere": [
   [
    0,
    32767,
    "3 parts: Debriefing, Flight, Side two loader"
   ],
   [
    32995,
    65535,
    "2 parts: Debriefing, Flight"
   ]
  ]
 },
 "blocks": [
  {
   "start": 32768,
   "end": 32771,
   "type": "Address"
  },
  {
   "start": 32772,
   "end": 32776,
   "type": "PETSCII Text"
  },
  {
   "start": 32777,
   "end": 32994,
   "type": "Code"
  }
 ],
 "symbols": [
  {
   "address": 32768,
   "name": "cbm80_vectors",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32772,
   "name": "cbm80_text",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32777,
   "name": "rom_out",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32788,
   "name": "move_ram",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32797,
   "name": "fill_ram",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32803,
   "name": "rom_back",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32804,
   "name": "saved_port",
   "type": "AbsoluteAddress",
   "kind": "user"
  },
  {
   "address": 32809,
   "name": "fill",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32817,
   "name": "b_8031",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32827,
   "name": "b_803B",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32831,
   "name": "b_803F",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32837,
   "name": "r_8045",
   "type": "Return",
   "kind": "auto"
  },
  {
   "address": 32838,
   "name": "copy_up",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32844,
   "name": "b_804C",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32858,
   "name": "b_805A",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32862,
   "name": "b_805E",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32870,
   "name": "r_8066",
   "type": "Return",
   "kind": "auto"
  },
  {
   "address": 32871,
   "name": "copy_down",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32877,
   "name": "b_806D",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32887,
   "name": "b_8077",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32895,
   "name": "b_807F",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32900,
   "name": "b_8084",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32909,
   "name": "r_808D",
   "type": "Return",
   "kind": "auto"
  },
  {
   "address": 32910,
   "name": "call",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32921,
   "name": "window_colours",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32961,
   "name": "window_rows",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 32963,
   "name": "b_80C3",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32965,
   "name": "b_80C5",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32982,
   "name": "b_80D6",
   "type": "Branch",
   "kind": "auto"
  },
  {
   "address": 32987,
   "name": "reset_halt",
   "type": "AbsoluteAddress",
   "kind": "user"
  }
 ],
 "comments": [
  {
   "address": 32768,
   "type": "line",
   "text": "The cartridge signature the KERNAL looks for on a reset: two vectors and the letters CBM80. A reset (and an NMI that reaches the KERNAL's handler) jumps through $8000 or $8002, here both $80DB, which blanks the screen and stops."
  },
  {
   "address": 32772,
   "type": "line",
   "text": "The letters CBM80 in PETSCII, with bit 7 set on the first three as the KERNAL's test expects."
  },
  {
   "address": 32777,
   "type": "line",
   "text": "Switches the ROMs and I/O out for a copy through any of memory: interrupts off, the processor port's setting saved into the operand at $8024 for rom_back to restore, then $01 = $04, all RAM."
  },
  {
   "address": 32788,
   "type": "line",
   "text": "SYS M6 (32788): rom_out, copy_up, rom_back. The copy reaches the RAM under the ROMs and the I/O."
  },
  {
   "address": 32797,
   "type": "line",
   "text": "SYS S6 (32797): rom_out, fill, rom_back. The fill reaches the RAM under the ROMs and the I/O."
  },
  {
   "address": 32803,
   "type": "line",
   "text": "Puts the processor port back as rom_out found it (its LDA operand is rewritten by rom_out) and turns interrupts on."
  },
  {
   "address": 32804,
   "type": "line",
   "text": "The operand of rom_back's LDA #: rom_out writes the processor port's setting here, so rom_back puts back whatever was there before the copy."
  },
  {
   "address": 32809,
   "type": "line",
   "text": "SYS SB (32809): stores the byte in $A5 into $AA whole pages and then $A9 more bytes, from the address in $A7-$A8. The BASIC sets $A5-$AA by POKE A0..A5."
  },
  {
   "address": 32838,
   "type": "line",
   "text": "SYS MV (32838): copies $AA pages and then $A9 bytes from the address in $A5-$A6 to the one in $A7-$A8, upwards."
  },
  {
   "address": 32871,
   "type": "line",
   "text": "SYS BM (32871): the same copy run backwards, from the last byte down, for a block that moves up over itself. $A5-$A6 and $A7-$A8 hold the last addresses; $A9 counts the bytes of the first pass and $AA the pages after it."
  },
  {
   "address": 32910,
   "type": "line",
   "text": "SYS KE (32910): calls a machine-code routine with registers set from BASIC. A from $A5, X from $A6, Y from $A7, the carry from bit 0 of $A8, and the routine's address in $A9-$AA. The loaders use it for the KERNAL's SETLFS, SETNAM and LOAD."
  },
  {
   "address": 32921,
   "type": "line",
   "text": "SYS 32921: colours the cockpit's window for the theatre, or for night. $A7 goes into five bytes ($3FC4, $420C-$420D, $422A-$422B), then $A5 fills 12 rows of 32 bytes from $402C and $A6 the same rows from $7C2C, 40 bytes to a row, the layout of a screen's colour cells. G2 calls it with four DATA values for each theatre."
  },
  {
   "address": 32961,
   "type": "line",
   "text": "Fills 12 rows of 32 cells with A, from the address in $A7-$A8, stepping 40 bytes a row."
  },
  {
   "address": 32987,
   "type": "line",
   "text": "Where a reset lands while the side two programs are in memory: the screen is blanked and the machine loops here for ever."
  }
 ]
}