{
 "schema": 1,
 "platform": "c64",
 "game": "gunship",
 "part": "debrief",
 "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,
    2048,
    "Side two helpers"
   ],
   [
    6194,
    65535,
    "Side two helpers"
   ]
  ],
  "extra": [],
  "edges": [
   0,
   256,
   512,
   1024,
   2048,
   4096,
   16384,
   32768,
   40960,
   49152,
   53248,
   57344
  ],
  "elsewhere": [
   [
    0,
    2048,
    "Side two helpers"
   ],
   [
    6194,
    65535,
    "Side two helpers"
   ]
  ]
 },
 "blocks": [
  {
   "start": 2049,
   "end": 6193,
   "type": "BASIC"
  }
 ],
 "symbols": [
  {
   "address": 2049,
   "name": "basic_b_setup",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 2140,
   "name": "line_4_flight_var",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 2196,
   "name": "line_6_copies",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 2305,
   "name": "line_11_two_digits",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 2344,
   "name": "line_13_how_it_ended",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 2412,
   "name": "line_16_summary_head",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 2743,
   "name": "line_24_nearest_place",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 2883,
   "name": "line_28_landing",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 3110,
   "name": "line_33_position",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 3297,
   "name": "line_38_craft",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 3623,
   "name": "line_48_missions",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 3795,
   "name": "line_52_wounds",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 4025,
   "name": "line_59_results_back",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 4126,
   "name": "line_63_put_back",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 4401,
   "name": "line_72_load_e",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 4494,
   "name": "line_75_store_var",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 4587,
   "name": "line_78_var_lists",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 4657,
   "name": "line_80_side_one",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 5017,
   "name": "line_89_load",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 5115,
   "name": "line_92_try_again",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 5427,
   "name": "line_100_choice",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 5485,
   "name": "line_101_fly_again",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 5897,
   "name": "line_113_constants",
   "type": "UserDefined",
   "kind": "user"
  },
  {
   "address": 6057,
   "name": "line_116_setnam",
   "type": "UserDefined",
   "kind": "user"
  }
 ],
 "comments": [
  {
   "address": 2049,
   "type": "line",
   "text": "Lines 1-3: switches off the CIA's interrupts and RESTORE, lowers BASIC's top to $1A00, sets the constants (113) and the four tables it reads: CB = 828 ($033C, the mission block the front end wrote and the flight filled in), EN = $5100 (the units: an x at EN+I, a y at EN+I+128 and three bytes of state at +256, +384 and +512), SV = $3F00 (the flight's variables) and OD = $53D8."
  },
  {
   "address": 2140,
   "type": "line",
   "text": "Lines 4-5: reads flight variable V into ZV: the byte at $3F00+V, or for V of 256 and more a word, low byte first, at $3F00+V-256."
  },
  {
   "address": 2196,
   "type": "line",
   "text": "Lines 6-10: the copies, with F, T and L in pages: 6 moves through all of RAM (M6), 7 fills (SB), 8 copies with the ROMs in (MV); 9-10 put F, T and L into $A5-$AA for them."
  },
  {
   "address": 2305,
   "type": "line",
   "text": "Lines 11-12: T$ is Z as two digits, with a leading zero."
  },
  {
   "address": 2344,
   "type": "line",
   "text": "Lines 13-15: white screen, lower-case letters. Flight variable 130 says how the flight ended: 128 is an abort (RUN/STOP with RESTORE), which goes to 80 and asks for side 1; 1 is a crash, noted in XX."
  },
  {
   "address": 2412,
   "type": "line",
   "text": "Lines 16-23: MISSION RESULT SUMMARY, the pilot's rank (the byte at $0376, one of eight from SGT to COL in line 19) and name ($0362-$0375), and the elapsed time from flight word 106, counted in thirds of a second, as minutes and seconds."
  },
  {
   "address": 2743,
   "type": "line",
   "text": "Lines 24-27: finds the unit or place on the map nearest the helicopter (flight words 94 and 96, its x and y), among the 116 entries from EN+6 whose third state byte is not zero, by the sum of the distances in x and in y."
  },
  {
   "address": 2883,
   "type": "line",
   "text": "Lines 28-32: DG counts the set bits of damage word 116, and the landing is told from flight variable 130: CRASHED!, landed perfectly, landed hard or landed very hard, \"into a hill.\" when the byte at $3F05 is set."
  },
  {
   "address": 3110,
   "type": "line",
   "text": "Lines 33-37: where the helicopter came down: behind enemy lines, behind friendly lines (bit 5 of the nearest place's state), or at a friendly base (type 54 within 1280 units)."
  },
  {
   "address": 3297,
   "type": "line",
   "text": "Lines 38-47: the craft's state from flight words 112 and 114 (both zero makes it unflyable), damage byte 77 and damage word 116: undamaged, lightly damaged, badly damaged, unflyable, or a total wreck after a crash."
  },
  {
   "address": 3623,
   "type": "line",
   "text": "Lines 48-51: which missions are complete, from the two low bits of $7043: neither, primary, secondary or both."
  },
  {
   "address": 3795,
   "type": "line",
   "text": "Lines 52-58: the pilot's wounds: healthy, slightly wounded, seriously wounded or dead. A pilot who is dead or whose craft is a total wreck, and whose rank is SGT or WO1, is offered the same mission again (92)."
  },
  {
   "address": 4025,
   "type": "line",
   "text": "Lines 59-62: copies the flight's results into the cassette buffer for the base program: OD's six bytes to every other byte of $0350-$035A, nine flight variables (DATA 78) as words to $033E-$034F and seven more (DATA 79) to $03A4-$03B1; $7043's mission bits to $03B4."
  },
  {
   "address": 4126,
   "type": "line",
   "text": "Lines 63-71: puts back what the flight moved away: eight pages from $C800 to $D000, and pages from $E300, $1A86, $5100 and $E200 back to $9100-$9400. Unless the craft crashed, it then loads 1 and 2, the base's two pictures, and keeps each bitmap and its colours in the RAM under BASIC's ROM, at $B000-$BFFF and $A000-$AFFF, saving the screen's colours at $1A00 meanwhile."
  },
  {
   "address": 4401,
   "type": "line",
   "text": "Lines 72-74: prints LOAD \"e\",8,1, puts a RETURN in the keyboard buffer and ends with NEW: BASIC loads the base program."
  },
  {
   "address": 4494,
   "type": "line",
   "text": "Lines 75-77: stores flight variable V, as a word, in the cassette buffer at 828+2I."
  },
  {
   "address": 4587,
   "type": "line",
   "text": "Lines 78-79: the flight variables kept for the base program, numbers as line 4 reads them (256 and up are words)."
  },
  {
   "address": 4657,
   "type": "line",
   "text": "Lines 80-88: after an abort: asks for the disk the other way up, reads track 18 sector 0 and checks that byte 163, the second character of the disk's ID, is \"1\", then prints LOAD\":*\",8,1 and puts a RETURN in the keyboard buffer: the game starts again from side 1."
  },
  {
   "address": 5017,
   "type": "line",
   "text": "Lines 89-91: loads the file F$ through the helper call (SETLFS at 116), with the RUN/STOP key back on while it loads, and tries again until the status says it worked."
  },
  {
   "address": 5115,
   "type": "line",
   "text": "Lines 92-99: \"Would you like to TRY the same mission AGAIN?\", No and Yes chosen with the joystick, up for No and down for Yes, the choice shown by colouring the arrow and the word, and taken with fire."
  },
  {
   "address": 5427,
   "type": "line",
   "text": "Line 100: No goes back to line 59 and on to the base. Yes goes on to 101."
  },
  {
   "address": 5485,
   "type": "line",
   "text": "Lines 101-112: Yes: makes the mission's units ready for another attempt (low bits of each state byte cleared, each unit's square on the 16 by 16 map recomputed and its bit set in the map's page at $4400, copied out from $E200 and back), clears the four bytes from $03A8, and loads G2 again, so the same mission is flown without the front end."
  },
  {
   "address": 5897,
   "type": "line",
   "text": "Lines 113-115: FNLB(X) gives the low byte of X; FNRG(X) reads a word above 32767 as the negative number BASIC's AND needs; the helpers' addresses SB, MV, KE and M6; A0-A6 = $A5-$AB; KP = 256."
  },
  {
   "address": 6057,
   "type": "line",
   "text": "Lines 116-118: puts the file name at 1006 ($03EE) and calls the KERNAL's SETLFS (device 8, secondary address RR) and SETNAM through the helper call."
  }
 ]
}