; vars
;
;8000-83ff Video RAM
;8400-87ff Color RAM
;8b80-8bff sprite code/color
;9380-93ff sprite position
;9b80-9bff sprite control
;8800-9fff RAM
;
; there is some const data at $1249, some $20 bytes that are copied to $9000 at startup (see sub _1230)
;
;6800-6807 dip switches (only bits 0 and 1 are used - bit 0 is DSW1, bit 1 is DSW2)
;          dsw1:
;            bit 6-7 lives
;            bit 3-5 bonus
;            bit 0-2 coins per play
;          dsw2: (bootleg version, the original version is slightly different)
;            bit 7 cocktail/upright (1 = upright)
;            bit 6 ?
;            bit 5 RACK TEST
;            bit 4 pause (0 = paused, 1 = not paused)
;            bit 3 ?
;            bit 2 ?
;            bit 0-1 difficulty
;
;($6804) rd
;($6807) rd
;($6820) wr
;($6822) wr
;($6823) wr
;($6830) wr
;($7100) rd
;($7100) wr
;($8208) wr
;($8210) wr
;($82EA) wr
;
; $8B00-$8B7F  sprite code/color buffer
;
; some $20 bytes are used $9000-$901F (see sub _1230)
;($9000) wr
;($9002) wr
;($9012) wr
;($901E) wr
;
;($9020) wr
;($9100) rd
;($9101) rd
;($9201) rd/wr  ; game_state:  2-coin(s)_up_press_start, 3-in_game, 0-game_over, 1-attract
;($9203) rd/wr
;($9205) rd/wr
;($920B) rd
;($9215) rd/rw
;($9270) rd/rw  ; see 'call  _39F2' (sound check)
;($9280) rd/wr  ; 8-bytes are copied to $9280-$9287 from _3AC4, see _384B
;($9281-$9284)  ; 4-bytes are copied from COINS/CREDIT parameter blocks at _3A6C based on current coins-to-play dsw setting, see _386F
;($9285-$9287)
;($9288) rd
;($92A0) rd/wr
;($92A2) rd
;($92A6) rd/wr
;($92A7) rd
;($92A8) wr
;($92AA) rd
; $92AC, $04 bytes, see _02D7 
;($92AE) rd/wr
;($92AF) rd/wr
;($92C4) wr
;($92C5) wr
;($92C6) wr
;($92C8) wr
;$92CA, fill with $FF, see _02ED
;($92D6) wr  CPU-0 is busy, CPU-1 must wait
;($92D7) rd  CPU-1 is busy, CPU-0 must wait
;
; $9300-$937F  sprite position buffer
;
; some $20 bytes are used $98E0-$98FF, see sub _1230
;
;($9980-$9981)   ; bonus settings from dsw
;($9982) rd/wr   ; number of lives from dsw setting
;($9983) wr      ; A==0 for UPRIGHT   A==1 for "TABLE" (see _37FB)
;($9984) wr      ; difficulty from dsw setting
;($99B3)         ; 0 is 1-Player game, 1 is 2-Player game
;($99B5) rd      ; count of credits avilable from coin-box
;($99B8) rd/wr   ; "local" count of credits
;($99B9) wr
;($99BE) rd/wr
;($99C0) rd
;($99C1) rd
;($99C2) rd
;($99C3) rd
;($99C4) wr
;($99C5) rd
;
; at boot, clear (to 0) the 16 bytes from 99E0 to 99F0
;
; $9AA0-$9ADF ($40 bytes) are used... see 'call  _3A3C', $20 bytes used... see _02DD 
;
;($9A79)        ; how many credits were put in (per 1 coin)... coin-up sound will play this many times
;($9AB9) rd
;
; $9B00-$9B7F  sprite control buffer
;
;($A007) wr     ; 1 to flip screen upside-down
;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
       org $0000
_0000  ld   a,$10      ; reset vector
_0002  ld   ($7100),a  ; custom IO chip status ($10 = command executed)
_0005  jp   _02C4      ; reset handler
;
_0008  add  a,a        ; begin 'rst $08' ... HL:+=2A
_0009  jr   nc,_0010   ; if result of A+=A carries, then ...
_000B  inc  h          ; ...inc H on a carry 
_000C  jp   _0010      ; finish by adding A to HL
       defb $FF
_0010  add  a,l        ; begin 'rst $10' ... adds HL:+=A
_0011  ld   l,a
_0012  ret  nc         ; if !Cy, we're done 
_0013  inc  h          ; H gets the carry
_0014  ret             ; end 'rst  $10'
       defb $FF,$FF,$FF
_0018  ld   (hl),a     ; begin 'rst $18' ... memset((HL), A, B) ... (HL) is src, A is character to fill with, B is count
_0019  inc  hl
_001A  djnz _0018      ; while (B--)
_001C  ret             ; end 'rst $18'
       defb $FF,$FF,$FF
_0020  ld   a,e        ; begin 'rst  $20' ... DE-=$20, s.a. _0A6F
_0021  sub  $20        ; sub 32d
_0023  ld   e,a        ; result in E
_0024  ret  nc
_0025  dec  d          ; D gets the carry
_0026  ret             ; end 'rst  $20'
       defb $FF
_0028  ld   hl,$9100   ; begin 'rst $28' ... memset($9100, 0, $F0)
_002B  ld   b,$F0
_002D  xor  a          ; A==00
_002E  rst  $18        ; call memset
_002F  ret             ; end 'rst $28'
;
; entry point to display string function at _139A
_0030  scf             ; begin 'rst  $30' ... set Cy flag, it tells _139A that we're displaying string with dest address encoded directly within
_0031  ex   af,af'
_0032  jp   _139A      ; end 'rst $30', 
       defb $FF,$FF,$FF
_0038  jp   _0237
_003B  jp   (hl)       ; tasks are _0828, $17B2, $1984, $0857, $23DD, $1EA4, $0935, $1DD2, $0977 
_003C  ld   hl,$9300   ; begin 'call  $003C' ... initialize $80 bytes from $9300, $9B00, $8800
_003F  ld   b,$80
_0041  xor  a          ; let A=$00
_0042  rst  $18        ; memset($9300, 0, $80)
_0043  ld   hl,$9B00   
_0046  ld   b,$80
_0048  rst  $18        ; memset($9300, 0, $80)
_0049  ld   hl,$8800   ; start of RAM
_004C  ld   a,$80
_004E  ld   b,$80
_0050  rst  $18        ; memset($9300, $80, $80)
_0051  ret             ; end 'call _003C'
;
; $FF to _0066
       org $0060
;       defb $11,$22,$33,$44,$55,$66 ; ID for me
;
       org $0066
_0066  exx             ; begin NMI, get our regs from the aux regs
_0067  ldi             ; each nmi will move one byte (one ldi), so BC--, DE++, HL++
_0069  jp   pe,_008F   ;  P/V==1 when BC!=0  ('P' appears in debugger when parity odd)
_006C  push af         ; save AF, it's not part of the exx exchange
_006D  ld   hl,$7100
_0070  ld   (hl),$10   ; writing the "command executed" status indicator to the status variable
_0072  ld   a,($9AB9)  ; ($9AB9)==$02 when you get hit!
_0075  and  a          ; A!=0 when you don't get hit
_0076  jr   z,_008E    ; if A==0, jr $008E
_0078  xor  a          ; 0078 when you get hit!
_0079  ld   ($9AB9),a
_007C  ld   hl,$0092
_007F  ld   de,$7000
_0082  ld   bc,$0004
_0085  exx
_0086  ld   a,$A8
_0088  ld   ($7100),a
_008B  pop  af
_008C  retn            ; retn when you get hit
_008E  pop  af
_008F  exx             ; restore regs for the main "thread", saves our regs into aux regs
_0090  retn            ; end 'NMI'
;
       defb $10,$10,$20,$20  ; data, s.a. _007C
; start of 'jump-table' addresses
       defb $27,$08,$28,$08,$B2,$17,$00,$17,$80,$1A
_00A0  defb $57,$08,$27,$08,$27,$08,$16,$29,$E6,$1D,$90,$2A,$B3,$1D,$DD,$23
_00B0  defb $A4,$1E,$32,$1D,$35,$09,$65,$1B,$B2,$19,$76,$1D,$27,$08,$85,$1F
_00C0  defb $04,$1F,$27,$08,$D2,$1D,$22,$22,$CB,$21,$27,$08,$27,$08,$F2,$20
_00D0  defb $00,$20,$27,$08,$77,$09
;
;
_00D6  ld   de,$83ED   ; begin 'call _00D6' ... display score text top of screen (1 time only after boot)
_00D9  ld   hl,$02B9   ; source of string "20000" (stored backwards)
_00DC  ld   bc,$0005
_00DF  ldir
_00E1  ld   e,$CB
_00E3  ld   hl,$00EB   ; source of string "1UP    HIGH SCORE"  (stored backwards)
_00E6  ld   c,$11
_00E8  ldir
_00EA  ret             ; end  'call _00D6'
;
_00EB  ; src of string "1UP    HIGH SCORE"  (stored backwards)
       defb $0E,$1B,$18,$0C,$1C,$24,$11,$10,$12,$11,$24,$24,$24,$24,$19,$1E,$01 
;
_00FC  defb $FF,$FF,$FF,$FF
;
_0100  ; TODO: apparently some data that is loaded from here pseudo-randomly, s.a. _100B
       defb $14,$06,$14,$0C,$14,$08,$14,$0A,$1C,$00,$1C,$12,$1E,$00,$1E,$12
       defb $1C,$02,$1C,$10,$1E,$02,$1E,$10,$1C,$04,$1C,$0E,$1E,$04,$1E,$0E
       defb $1C,$06,$1C,$0C,$1E,$06,$1E,$0C,$1C,$08,$1C,$0A,$1E,$08,$1E,$0A
       defb $16,$06,$16,$0C,$16,$08,$16,$0A,$18,$00,$18,$12,$1A,$00,$1A,$12
       defb $18,$02,$18,$10,$1A,$02,$1A,$10,$18,$04,$18,$0E,$1A,$04,$1A,$0E
       defb $18,$06,$18,$0C,$1A,$06,$1A,$0C,$18,$08,$18,$0A,$1A,$08,$1A,$0A
;
;
;       org $0160
_0160  ld   hl,$8040   ; begin 'call _0160' ... clears the screen before Train, Demo, Heroes
_0163  ld   de,$8041
_0166  ld   bc,$037F
_0169  ld   (hl),$24   ; clear Tile RAM with $24 (space)
_016B  ldir
_016D  ld   hl,$8440   ; clear Color RAM with $00
_0170  ld   de,$8441
_0173  ld   bc,$037F
_0176  ld   (hl),$00
_0178  ldir
_017A  ld   a,$04
_017C  ld   b,$20
_017E  rst  $18        ; HL==$87BF ... clearing more color RAM with value $04
_017F  ld   a,$4E
_0181  ld   b,$20
_0183  rst  $18        ; HL==$87DF ... clearing more color RAM with value $4E
_0184  ret             ; end 'call _160'
;
;
_0185  ld   hl,$9821   ; begin 'call _0185', s.a. _060F... something to do with player start/init... (on two-player game, runs at the first turn of each player) s.a. _0234
_0188  inc  (hl)
_0189  ld   a,(hl)
_018A  inc  a
_018B  and  $03
_018D  ld   ($9825),a
_0190  jr   z,_01A2    ; change into challenge stage?
_0192  ld   c,$06
_0194  rst  $30
_0195  ex   de,hl
_0196  ld   a,($9821)
_0199  ld   l,a
_019A  ld   h,$00
_019C  call _0A53
_019F  xor  a
_01A0  jr   _01AC
;
_01A2  ld   c,$07        ; change into challenge stage
_01A4  rst  $30
_01A5  ld   a,$01
_01A7  ld   ($9AAD),a
_01AA  ld   a,$08
;
_01AC  ld   ($92A8),a    ; this may be the setting up of new game, or the demo-mode
_01AF  ld   a,$03
_01B1  ld   ($92AE),a
_01B4  ld   ($920B),a
_01B7  ld   a,($9825)
_01BA  and  a
_01BB  ex   af,af'
_01BC  call _117F        ; this point occurs sometime into opening theme music
_01BF  ld   a,($92AE)
_01C2  and  a
_01C3  jr   nz,_01BF
_01C5  ld   a,$78        ; begin 'call  _01C5' (s.a. _186C)
_01C7  ld   ($92AE),a
_01CA  call _2896        ; here is a point reached at start of demo
_01CD  call _25A2
_01D0  ld   a,$02
_01D2  ld   ($92AC),a
_01D5  xor  a
_01D6  call _12C3
_01D9  xor  a
_01DA  ld   b,$30
_01DC  ld   hl,$9200
_01DF  ld   (hl),a
_01E0  inc  l
_01E1  inc  l
_01E2  djnz _01DF
_01E4  ld   ($9009),a
_01E7  ld   ($9010),a
_01EA  ld   ($9004),a
_01ED  ld   ($9288),a
_01F0  ld   ($982C),a
_01F3  ld   ($9841),a
_01F6  ld   ($9842),a
_01F9  ld   ($9826),a
_01FC  ld   ($99B0),a
_01FF  ld   ($9824),a
_0202  inc  a
_0203  ld   ($982D),a
_0206  ld   ($986D),a
_0209  ld   ($9828),a
_020C  ld   ($900B),a
_020F  ld   ($9008),a
_0212  ld   ($900A),a
_0215  call _2C00
_0218  ld   hl,$9830
_021B  ld   de,$01B5
_021E  ld   b,$04
_0220  ld   (hl),d
_0221  inc  l
_0222  ld   (hl),e
_0223  inc  l
_0224  djnz _0220
_0226  ld   a,($6805)
_0229  bit  1,a
_022B  ret  nz         ; end 'call  _01C5' (ret to _186F)
_022C  ld   c,$0B      ; I think it's the offset to the string table to show a bunch of space characters, but the code never seems to go here?
_022E  ld   hl,$83B0
_0231  call _1398      ; display string
_0234  jp   _0185
;
;
_0237  push af         ; begin handler for rst $38
_0238  ex   af,af'
_0239  push af
_023A  push bc
_023B  push de
_023C  push hl
_023D  push ix
_023F  push iy
_0241  ld   a,($6804)  ; bonus-dsw1 or pause-dsw2?
_0244  ld   d,a
_0245  ld   a,($92A0)
_0248  and  $1C
_024A  ld   c,a
_024B  rrca
_024C  xor  c
_024D  and  $18
_024F  ld   c,a
_0250  ld   a,($99BE)
_0253  bit  1,d
_0255  jr   nz,_0259
_0257  ld   a,$07      ; when is jr not taken?
_0259  and  $07
_025B  or   c
_025C  ld   b,$05
_025E  ld   hl,$A000   ; $0000-$a001 starfield scroll speed (only bit 0 is significant)
_0261  ld   (hl),a
_0262  inc  l
_0263  rrca
_0264  djnz _0261
_0266  ld   ($6830),a  ; Watchdog
_0269  xor  a          ; A==0
_026A  ld   ($6820),a  ; cpu #1 irq acknowledge/enable
_026D  bit  1,d
_026F  jp   z,_02A8
_0272  ld   c,a
_0273  ld   hl,$9000   ; begin task loop
_0276  ld   a,c        ; add ...
_0277  add  a,l        ; ... C ...
_0278  ld   l,a        ; ... to L
_0279  ld   a,(hl)     ; if (HL) ...
_027A  and  a          ; ... !0
_027B  jr   nz,_0280   ; ... then jp _0280
_027D  inc  c          ; ... else c++
_027E  jr   _0273      ; ... in otherwords, 'while (0==c) jp _0273'
_0280  ld   b,a
_0281  ld   hl,$0096
_0284  ld   a,c        ; ... A:=C ...
_0285  sla  a          ; ... and essentially, A*=2 ...
_0287  add  a,l        ; ...therefore ...
_0288  ld   l,a        ; ...L+=C*2
_0289  ld   e,(hl)     ; lo-byte of the jp address
_028A  inc  hl
_028B  ld   d,(hl)     ; hi-byte of the jp address
_028C  ex   de,hl
_028D  push bc
_028E  call _003B      ; run the current task
_0291  pop  bc
_0292  ld   a,b        ; add ...
_0293  add  a,c        ; ... B ...
_0294  ld   c,a        ; ... to C
_0295  and  $E0        ; in other words, while ( C+=B != $E0 )
_0297  jr   z,_0273
_0299  ld   hl,$7000   ; custom IO chip return values
_029C  ld   de,$99B5   ; count of credits avilable from coin-box
_029F  ld   bc,$0003
_02A2  exx
_02A3  ld   a,$71
_02A5  ld   ($7100),a  ; send command to IO chip
_02A8  ld   a,$01
_02AA  ld   ($6820),a  ; cpu #1 irq acknowledge/enable
_02AD  pop  iy
_02AF  pop  ix
_02B1  pop  hl
_02B2  pop  de
_02B3  pop  bc
_02B4  pop  af
_02B5  ex   af,af'
_02B6  pop  af
_02B7  ei
_02B8  ret             ; end 'rst  $0038' handler
;
_02B9 ; src of "SCORE 20000
      defb $00,$00,$00,$00,$02,$24,$17,$0A,$16,$0C,$18
;
;
_02C4  im   1          ; here is the handler for the reset vector
_02C6  xor  a          ; let A=$00
_02C7  ld   hl,$99E0
_02CA  ld   b,$10
_02CC  ld   (hl),a     ; clear (to 0) the 16 bytes from 99E0 to 99F0
_02CD  inc  hl
_02CE  djnz _02CC
_02D0  jp   _336C      ; then we do somemore reset shit, then start the POST
;
;
_02D3  ld   sp,$90A0   ; this is the prequel to attract mode, s.a. _3763
_02D6  xor  a
_02D7  ld   hl,$92AC
_02DA  ld   b,$04
_02DC  rst  $18        ; duplucates 'B' bytes in memory from A starting at (HL)
_02DD  ld   hl,$9AA0
_02E0  ld   b,$20
_02E2  rst  $18
_02E3  ld   ($A007),a  ; flip screen
_02E6  ld   ($9215),a
_02E9  ld   ($99B9),a
_02EC  dec  a          ; A:=$FF...
_02ED  ld   hl,$92CA   ; ...next buffer to fill
_02F0  ld   b,$10
_02F2  rst  $18        ; memset
_02F3  ld   a,$01
_02F5  ld   ($6820),a
_02F8  ld   hl,$83C0   ; clearing video ram (fill with spaces, top row of screen)
_02FB  ld   b,$40
_02FD  ld   a,$24
_02FF  rst  $18        ; memset
_0300  ld   h,$80
_0302  ld   b,$40
_0304  rst  $18        ; clearing video ram (fill with spaces, bottom row of screen)
_0305  ld   hl,$8400
_0308  ld   b,$40
_030A  ld   a,$03
_030C  rst  $18        ; clearing color ram 
_030D  call _0160      ; clearing the rest of the screen
_0310  ld   de,$8A20
_0313  ld   a,$05
_0315  ld   b,$00
_0317  ld   hl,$02B9   ; src of "SCORE 20000"
_031A  ld   c,$06
_031C  ldir
_031E  dec  a
_031F  jr   nz,_0317
_0321  ld   hl,$02BF
_0324  ld   a,$2A
_0326  ld   b,$05
_0328  ld   c,$FF
_032A  ldi
_032C  dec  hl
_032D  ld   (de),a
_032E  inc  e
_032F  ldi
_0331  djnz _032A
_0333  ld   a,$01
_0335  ld   ($9201),a
_0338  ld   hl,$A005
_033B  ld   (hl),$00
_033D  ld   (hl),a
_033E  call _003C      ; initializing more RAM
_0341  call _00D6      ; display score text top of screen (1 time only after boot)
_0344  call _1230      ; copy some stuff from ROM to RAM
_0347  rst  $28        ; clears out RAM at $9100 ($F0 bytes)
_0348  ld   a,$20
_034A  ld   ($901E),a
_034D  ld   a,($99B5)  ; count of credits avilable from coin-box
_0350  ld   ($99B8),a  ; "local" count of credits
_0353  xor  a
_0354  ld   ($901E),a
_0357  ld   ($9020),a
_035A  xor  a          ; jp here, s.a. _0722
_035B  ld   ($A007),a  ; flip screen
_035E  ld   ($9215),a
_0361  ld   ($9012),a
_0364  ld   b,$80      ; clear out RAM at $9200 ($80 bytes)
_0366  ld   hl,$9200
_0369  rst  $18        ; duplucates 'B' bytes in memory from A starting at (HL)
_036A  ld   a,$06
_036C  ld   ($99BE),a
_036F  rst  $28        ; clears out RAM at $9100 ($F0 bytes)
_0370  call _003C      ; initializing more RAM
_0373  call _1230      ; copy some stuff from ROM to RAM (again?)
_0376  ld   a,($99B8)
_0379  and  a
_037A  ld   a,$01
_037C  jr   z,_0380
_037E  ld   a,$02      ; when's it not take this jr?
_0380  ld   ($9201),a
_0383  jr   nz,_039D
_0385  xor  a
_0386  ld   ($9203),a
_0389  inc  a
_038A  ld   ($9002),a
_038D  ld   a,($9201)  ; some kind of register for coin-up event
_0390  dec  a
_0391  jr   z,_038D    ; stay here while ($9201)==$01, 1 indicates Attract mode state, 2 indicates Coinup has occured
;
_0393  call _1230      ; some aspect of (first?) coinup (to $03DF)
_0396  call _0160
_0399  rst  $28
_039A  call _003C
_039D  xor  a
_039E  ld   ($920B),a
_03A1  ld   c,$13
_03A3  rst  $30
_03A4  ld   c,$01
_03A6  rst  $30
_03A7  ld   hl,$0452   ; ld the data src address
_03AA  ld   ($9280),hl
_03AD  ld   a,($9980)  ; bonus setting from dsw
_03B0  cp   $FF
_03B2  jr   z,_03D8
_03B4  ld   e,a
_03B5  ld   c,$1B
_03B7  call _043D
_03BA  ld   a,($9981)
_03BD  cp   $FF
_03BF  jr   z,_03D8
_03C1  and  $7F
_03C3  ld   e,a
_03C4  ld   c,$1C
_03C6  call _043D
_03C9  ld   a,($9981)
_03CC  bit  7,a
_03CE  jr   nz,_03D8
_03D0  and  $7F
_03D2  ld   e,a
_03D3  ld   c,$1D
_03D5  call _043D
_03D8  ld   a,($9201)
_03DB  cp   $02
_03DD  jr   z,_03D8
_03DF  ld   ($9AB7),a
_03E2  call _0160
_03E5  call _003C
_03E8  ld   hl,$A005
_03EB  ld   (hl),$00
_03ED  ld   (hl),$01
_03EF  ld   hl,$9820
_03F2  xor  a
_03F3  ld   b,$A0
_03F5  rst  $18
_03F6  ld   ($9AB7),a
_03F9  ld   ($99B9),a
_03FC  inc  a
_03FD  ld   ($9AAB),a
_0400  ld   ($9012),a
_0403  ld   ($98F2),a
_0406  call _0466
_0409  call _1269
_040C  ld   c,$04
_040E  rst  $30
_040F  ld   hl,$92AF
_0412  ld   (hl),$08
_0414  ld   a,(hl)
_0415  and  a
_0416  jr   nz,_0414
_0418  ld   hl,$9290
_041B  ld   b,$10
_041D  rst  $18
_041E  ld   b,$30
_0420  ld   hl,$98B0
_0423  rst  $18
_0424  ld   hl,$83B0
_0427  ld   c,$0B
_0429  call _1398      ; near end of theme
_042C  ld   a,$01
_042E  ld   ($9880),a
_0431  ld   a,($9980)  ; bonus setting from dsw
_0434  ld   ($983E),a
_0437  ld   ($987E),a
_043A  jp   _060F
_043D  rst  $30        ; first coinup??  to $0451
_043E  ex   de,hl
_043F  ld   a,e
_0440  add  a,$40
_0442  ld   e,a
_0443  ld   h,$00
_0445  call _0A53
_0448  ex   de,hl
_0449  ld   c,$1E
_044B  call _1398
_044E  call _128C
_0451  ret
;
_0452  ; s.a. _03A7
       defb $00, $81, $19, $56, $02, $81, $19, $62, $04, $81, $19, $6E
;
_045E  call _0728      ; jp here, s.a. _064D...something with the start of a new ship?
_0461  call _080B
_0464  jr   _045E
_0466  ld   a,($9982)  ; loading up number of lives dsw setting at start of game (in theme?)
_0469  ld   ($9820),a
_046C  ld   ($9860),a
_046F  ld   de,$83F8
_0472  ld   hl,$0495
_0475  call _0486
_0478  ld   de,$83E3
_047B  ld   hl,$0495
_047E  ld   a,($99B3)
_0481  and  a
_0482  jr   nz,_0486
_0484  inc  hl
_0485  inc  hl
_0486  ld   c,$07
_0488  ldir
_048A  ld   hl,$0497
_048D  ld   de,$83C3
_0490  ld   c,$04
_0492  ldir
_0494  ret
;
_0495  ; s.a. _0472,_047B,_048A
       defb $00,$00
       defb $24,$24,$24,$24,$24,$24,$24
;
_049E  pop  hl         ; getting hit or captured? s.a. _0824
_049F  ld   hl,$92AF
_04A2  ld   (hl),$04
_04A4  ld   a,($901D)
_04A7  and  a
_04A8  jr   z,_04C1
;
_04AA  xor  a           ; when?
_04AB  ld   ($9213),a
_04AE  inc  a
_04AF  ld   ($9025),a
_04B2  ld   a,($92A7)
_04B5  and  a
_04B6  jp   nz,_045E
_04B9  ld   a,($901D)
_04BC  and  a
_04BD  jr   nz,_04B9
_04BF  jr   _04DC
;
_04C1  ld   a,(hl)
_04C2  and  a
_04C3  jr   nz,_04A4
_04C5  call _0728       ; something about starting a new ship
_04C8  ld   a,($92A7)
_04CB  ld   ($9843),a
_04CE  ld   c,a
_04CF  ld   a,($9213)
_04D2  or   c
_04D3  jr   nz,_04E2
_04D5  ld   a,($9825)
_04D8  and  a
_04D9  jp   z,_0650
_04DC  call _0185      ; jp here, s.a. _06DB, _04BF
_04DF  jp   _0632
;
;
_04E2  ld   hl,$9820   ; s.a. _04D3
_04E5  ld   a,(hl)
_04E6  dec  (hl)
_04E7  and  a
_04E8  jp   nz,_0579
;
_04EB  ld   a,($99B3)     ; end of game
_04EE  and  a
_04EF  jr   z,_04FD
_04F1  ld   hl,$824E      ; this is when it's two player game
_04F4  ld   a,($9840)
_04F7  add  a,$04
_04F9  ld   c,a
_04FA  call _1398         ; it displayed "PLAYER 1" (for "PLAYER 1 GAME OVER")
_04FD  ld   c,$02
_04FF  rst  $30
_0500  call _131F
_0503  call _131F
_0506  ld   hl,$9018
_0509  ld   a,(hl)
_050A  and  a
_050B  jr   nz,_0509
_050D  rst  $28
_050E  call _003C
_0511  call _0160
_0514  ld   c,$15
_0516  rst  $30
_0517  ld   c,$16
_0519  rst  $30
_051A  ld   de,$8132
_051D  ld   hl,($9846)
_0520  call _0A53
_0523  ld   c,$18
_0525  rst  $30
_0526  ld   de,$8135
_0529  ld   hl,($9844)
_052C  call _0A53
_052F  ld   c,$19
_0531  rst  $30
_0532  call _0A72
_0535  ex   de,hl
_0536  ld   c,$1A
_0538  call _1398
_053B  ld   hl,$92AE
_053E  ld   (hl),$0E
_0540  ld   a,(hl)
_0541  and  a
_0542  jr   nz,_0540
_0544  call _0160
_0547  call _3000       ; seems to call the gameover routine
_054A  xor  a
_054B  ld   ($9AB0),a
_054E  ld   hl,$9AAC
_0551  ld   de,$9AB6
_0554  ld   a,(de)
_0555  ld   b,(hl)
_0556  or   b
_0557  jr   z,_0562
_0559  inc  b
_055A  dec  b
_055B  jr   z,_055F
_055D  ld   (hl),$01
_055F  halt
_0560  jr   _0554
;
;
_0562  call _0160        ; s.a. _0557...screen is now cleared at end of game
_0565  ld   a,($99B3)
_0568  and  a
_0569  jp   z,_06DE
_056C  ld   a,($9860)
_056F  inc  a
_0570  jp   z,_06DE
_0573  ld   a,($9213)
_0576  dec  a
_0577  jr   nz,_058E
;
_0579  ld   a,($99B3)   ; this is when you die!
_057C  and  a
_057D  jp   z,_0604
;
_0580  ld   a,($9860)   ; when you die, but with two-player game?
_0583  inc  a
_0584  jp   z,_0612
_0587  ld   a,($9213)
_058A  dec  a
_058B  jp   nz,_0612
_058E  ld   a,($92A7)
_0591  and  a
_0592  jr   z,_059A
_0594  ld   a,($9287)
_0597  and  a
_0598  jr   nz,_0594
_059A  xor  a
_059B  ld   ($99B4),a
_059E  inc  a
_059F  ld   hl,$900E
_05A2  ld   (hl),a
_05A3  ld   a,(hl)
_05A4  and  a
_05A5  jr   nz,_05A3
_05A7  ld   a,($9AA0)
_05AA  ld   ($9848),a
_05AD  ld   a,($92AE)
_05B0  ld   ($983F),a
_05B3  call _110C
_05B6  call _2C00
_05B9  ld   a,($983F)
_05BC  ld   ($92AE),a
_05BF  ld   a,($9848)
_05C2  ld   ($9AA0),a
_05C5  call _136C
_05C8  ld   a,($9843)
_05CB  and  a
_05CC  jr   z,_05D1
_05CE  call _25A2       ; when not jr?
;
_05D1  ld   a,($9840)   ; s.a. _05CC
_05D4  ld   c,a
_05D5  ld   a,($9983)
_05D8  and  c
_05D9  ld   ($A007),a
_05DC  ld   ($9215),a
_05DF  ld   a,$3F
_05E1  call _12C3
_05E4  scf
_05E5  ex   af,af'
_05E6  call _117F
_05E9  ld   a,($9843)
_05EC  and  a
_05ED  jr   z,_060F
;
_05EF  ld   c,$03       ; this is like changin from plyr-2 to plyr-1 when fleet are leaving screen
_05F1  rst  $30
_05F2  ld   a,$80
_05F4  ld   ($99B4),a
_05F7  ld   hl,$900E
_05FA  ld   a,$01
_05FC  ld   (hl),a
_05FD  ld   a,(hl)
_05FE  and  a
_05FF  jr   nz,_05FD
_0601  jp   _0612      ; TODO: investigate...it run several frames and finally get here when plyr-1 bugs are entering screen
;
_0604  ld   a,($9843)  ; s.a. _057D
_0607  and  a
_0608  jr   nz,_061E
_060A  call _0185      ; when does it not take the jr?
_060D  jr   _061E
_060F  call _0185      ; jr here, s.a. _05ED,_043A... also, quite a lot of theme music play through this call
_0612  ld   a,($9840)  ; s.a. _0601, also...somethin in theme music?
_0615  add  a,$04
_0617  ld   c,a
_0618  ld   hl,$826E
_061B  call _1398
_061E  call _132B
_0621  ld   a,($92AE)  ; setting up the swarm when changing player or new ship? to $062F
_0624  add  a,$1E
_0626  cp   $78
_0628  jr   c,_062C
_062A  ld   a,$78      ; when jr not taken?
_062C  ld   ($92AE),a
_062F  call _131F
_0632  ld   a,$01      ; starting the new ship for a player, and s.a. _04DF
_0634  ld   ($9015),a
_0637  ld   ($9025),a
_063A  ld   ($9842),a
_063D  ld   c,$0B
_063F  ld   hl,$83B0
_0642  call _1398
_0645  ld   c,$0B
_0647  ld   hl,$83AE
_064A  call _1398
_064D  jp   _045E
;
;
_0650  ld   a,($9288)   ; jp here, s.a. _04D9...when?
_0653  ld   e,a
_0654  ld   hl,$9AAE
_0657  cp   $28
_0659  jr   nz,_065E
_065B  ld   hl,$9AB4
_065E  ld   (hl),$01
_0660  call _131F
_0663  ld   c,$08
_0665  rst  $30
_0666  call _131F
_0669  ld   l,e
_066A  ld   h,$00
_066C  ld   de,$8110
_066F  call _0A53
_0672  call _131F
_0675  ld   a,($9288)
_0678  cp   $28
_067A  jr   z,_0699
_067C  ld   c,$09
_067E  rst  $30
_067F  call _131F
_0682  ex   de,hl
_0683  ld   a,($9288)
_0686  and  a
_0687  jr   z,_0693
_0689  ld   l,a
_068A  ld   h,$00
_068C  call _0A53
_068F  xor  a
_0690  ld   (de),a
_0691  rst  $20
_0692  xor  a
_0693  ld   (de),a
_0694  ld   a,($9288)
_0697  jr   _06BA
;
_0699  ld   b,$07        ; jr here, s.a. _067A
_069B  ld   a,($92A0)
_069E  and  $0F
_06A0  jr   nz,_069B
_06A2  ld   c,$0B
_06A4  bit  0,b
_06A6  jr   z,_06A9
_06A8  inc  c
_06A9  push bc
_06AA  rst  $30
_06AB  pop  bc
_06AC  ld   a,($92A0)
_06AF  and  $0F
_06B1  jr   z,_06AC
_06B3  djnz _069B
_06B5  ld   c,$0D
_06B7  rst  $30
_06B8  ld   a,$64
_06BA  ld   hl,$929F
_06BD  add  a,(hl)
_06BE  ld   (hl),a
_06BF  call _0728
_06C2  call _131F
_06C5  call _131F
_06C8  ld   hl,$83B0
_06CB  ld   c,$0B
_06CD  call _1398
_06D0  ld   hl,$83B3
_06D3  ld   c,$0B
_06D5  call _1398
_06D8  ld   c,$0B
_06DA  rst  $30
_06DB  jp   _04DC
;
;
_06DE  halt            ; s.a. _0569, ...screen is now cleared at end of game
_06DF  di
_06E0  ld   a,($7100)
_06E3  cp   $10
_06E5  jr   nz,_06E0
_06E7  ld   hl,$0725   ; ld data src
_06EA  ld   de,$7000
_06ED  ld   bc,$0003
_06F0  exx
_06F1  ld   a,$61
_06F3  ld   ($7100),a
_06F6  halt
_06F7  xor  a
_06F8  call _093C
_06FB  ei
_06FC  xor  a
_06FD  ld   b,$20
_06FF  ld   hl,$9AA0
_0702  rst  $18
_0703  ld   de,$83F9
_0706  call _0A27
_0709  ld   de,$83E4
_070C  call _0A27
_070F  ld   a,($99B3)
_0712  inc  a
_0713  ld   hl,$99E1
_0716  add  a,(hl)
_0717  daa
_0718  ld   (hl),a
_0719  jp   nc,_035A
_071C  dec  hl
_071D  ld   a,(hl)
_071E  add  a,$01
_0720  daa
_0721  ld   (hl),a
_0722  jp   _035A
;
_0725  defb $02,$02,$02 ; s.a. _06E7
;
;
_0728  ld   a,($9840)  ; begin 'call _0728' ... getting hit or captured?
_072B  and  a
_072C  ld   a,$F9
_072E  jr   z,_0732
_0730  ld   a,$E4      ; when not jr?
_0732  ld   ixl,a
_0734  ld   b,$10
_0736  ld   hl,$9290
_0739  ex   de,hl
_073A  ld   hl,$07FA   ; ld src address of data, always offset to at least _07FB
_073D  ld   a,b
_073E  rst  $10
_073F  ld   c,(hl)
_0740  ex   de,hl
_0741  ld   a,(hl)
_0742  and  a
_0743  jr   z,_0762
_0745  dec  (hl)
_0746  ex   de,hl
_0747  ld   h,$83
_0749  ld   a,ixl
_074B  ld   l,a
_074C  ld   a,c
_074D  and  $0F
_074F  call _07D8
_0752  ld   a,ixl      ; first wave docking up
_0754  inc  a
_0755  ld   l,a
_0756  ld   a,c
_0757  rlca
_0758  rlca
_0759  rlca
_075A  rlca
_075B  and  $0F
_075D  call _07D8
_0760  jr   _0740
;
;
_0762  inc  l        ; jr here, s.a. _0743
_0763  djnz _0739
_0765  ld   a,ixl
_0767  add  a,$04
_0769  ld   e,a
_076A  ld   hl,$83F2
_076D  ld   d,$83
_076F  ld   b,$06
_0771  ld   a,(de)
_0772  sub  (hl)
_0773  add  a,$09
_0775  cp   $E5
_0777  jr   nc,_0788
_0779  sub  $0A
_077B  cp   $09
_077D  jr   c,_0788
_077F  inc  a
_0780  jr   nz,_078E
_0782  dec  l
_0783  dec  e
_0784  djnz _0771
_0786  jr   _078E        ; end of challenge stage? or start of round?
_0788  ld   a,(de)       ; end of challenge stage? or free ship?
_0789  ld   (hl),a
_078A  dec  l
_078B  dec  e
_078C  djnz _0788
_078E  ld   a,ixl
_0790  add  a,$04
_0792  ld   l,a
_0793  ld   a,(hl)
_0794  cp   $24
_0796  jr   nz,_0799
_0798  xor  a
_0799  and  $3F
_079B  rlca
_079C  ld   c,a
_079D  rlca
_079E  rlca
_079F  add  a,c
_07A0  ld   c,a
_07A1  dec  l
_07A2  ld   a,(hl)
_07A3  cp   $24
_07A5  jr   nz,_07A8
_07A7  xor  a
_07A8  add  a,c
_07A9  ld   hl,$983E
_07AC  cp   (hl)
_07AD  ret  nz
_07AE  ld   a,($9981)   ; when not ret?
_07B1  ld   b,a
_07B2  and  $7F
_07B4  ld   c,a
_07B5  ld   a,(hl)
_07B6  cp   c
_07B7  jr   nc,_07BC
_07B9  ld   a,c
_07BA  jr   _07BD
;
_07BC  add  a,b
_07BD  ld   (hl),a
_07BE  ld   ($9AAA),a
_07C1  ld   hl,$9820
_07C4  inc  (hl)
_07C5  call _136C
_07C8  ld   hl,$99EB
_07CB  ld   a,(hl)
_07CC  add  a,$01
_07CE  daa
_07CF  ld   (hl),a
_07D0  ret  nc
_07D1  dec  l
_07D2  ld   a,(hl)
_07D3  add  a,$01
_07D5  daa
_07D6  ld   (hl),a
_07D7  ret
;
;
_07D8  and  a          ; begin 'call _07D8', blow shit up... s.a. _074F
_07D9  ret  z
_07DA  add  a,(hl)
_07DB  cp   $24
_07DD  jr   c,_07E1
_07DF  sub  $24        ; when is jr not taken?
_07E1  cp   $0A
_07E3  jr   nc,_07E7
_07E5  ld   (hl),a
_07E6  ret
_07E7  sub  $0A        ; first wave was docking up
_07E9  ld   (hl),a
_07EA  inc  l
_07EB  ld   a,(hl)
_07EC  cp   $24
_07EE  jr   nz,_07F1
_07F0  xor  a
_07F1  cp   $09
_07F3  jr   z,_07F8
_07F5  inc  a
_07F6  ld   (hl),a
_07F7  ret
_07F8  xor  a          ; was firin at some shit on first stage
_07F9  jr   _07E9
;
_07FB  ; data, s.a. _073A
       defb $10,$00,$00,$00,$00,$00,$00,$00,$50,$08,$08,$08,$05,$08,$15,$00
;
;
_080B  ld   a,($9008)   ; begin 'call _080B', s.a. _0461
_080E  ld   b,a
_080F  ld   a,($92A7)
_0812  or   b
_0813  jr   nz,_081B
_0815  ld   ($9AA0),a  ; when does it go here?
_0818  jp   $049E
;
_081B  ld   a,($9213)
_081E  and  a
_081F  ret  z
_0820  xor  a
_0821  ld   ($9842),a
_0824  jp   _049E
;
_0827  ret             ; in the POST phase, this is just an empty task, no other tasks are "scheduled" 
;
;
; the $0828 task, copies from sprite "buffer" to sprite RAM
; works in conjunction with task _05BF of CPU1 to update sprite RAM
_0828  ld   a,$01      
_082A  ld   ($92D6),a  ; set this CPU status to 1
_082D  ld   hl,$8B40
_0830  ld   de,$8BC0   ; 8b80-8bff sprite code/color
_0833  ld   bc,$0040   ; cp $40 bytes from $8B40 to top-half ($8BC0 thru $8BFF)
_0836  ldir
_0838  ld   hl,$9340   ; 9380-93ff sprite position
_083B  ld   de,$93C0
_083E  ld   c,$40
_0840  ldir            ; this loop causes sprite to actually appear
_0842  ld   hl,$9B40   ; 9b80-9bff sprite control
_0845  ld   de,$9BC0
_0848  ld   c,$40
_084A  ldir
_084C  xor  a
_084D  ld   ($92D6),a  ; set this CPU status to 0
_0850  ld   a,($92D7)  ; check status of other CPU, while ($92D7) == $01 ...
_0853  dec  a
_0854  jr   z,_0850    ; ...spin!
_0856  ret             ; end task $0828
;
;
_0857  ld   a,($92AE)  ; the _0857 task, the data tables below have do with sprite coordinates for demo or such
_085A  ld   b,a
_085B  cp   $3C
_085D  jr   nc,_0865
_085F  ld   a,($99C5)
_0862  ld   ($99C4),a
_0865  ld   a,($92A7)
_0868  ld   c,a
_0869  ld   a,($99C0)
_086C  ld   hl,$0909
_086F  call _08BE
_0872  ld   ($92C8),a
_0875  ld   a,($92AA)
_0878  and  a
_0879  jr   z,_0888
_087B  ld   hl,$92C4
_087E  ld   a,$02
_0880  ld   b,$03
_0882  rst  $18
_0883  xor  a
_0884  ld   ($9AA0),a
_0887  ret             ; end _0857 task
;
;
_0888  ld   a,($99C1)  ; end piece of _0857 task, s.a. _0879
_088B  ld   hl,$0929
_088E  call _08BE
_0891  ld   ($92C4),a
_0894  ld   a,($99C2)
_0897  ld   hl,$08CD
_089A  call _08AD
_089D  ld   ($92C5),a
_08A0  ld   a,($99C3)
_08A3  ld   hl,$08EB
_08A6  call _08AD
_08A9  ld   ($92C6),a
_08AC  ret             ; end _0857 task
;
;
_08AD  ld   e,a        ; begin 'call _08AD' ... called from $0857 task
_08AE  sla  a
_08B0  add  a,e
_08B1  rst  $10
_08B2  ld   a,b
_08B3  cp   $28
_08B5  jr   nc,_08B8
_08B7  inc  hl
_08B8  and  a
_08B9  jr   nz,_08BC
_08BB  inc  hl
_08BC  ld   a,(hl)
_08BD  ret             ; end 'call _08AD'
;
;
_08BE  sla  a          ; begin 'call _08BE' ... called from $0857 task
_08C0  rst  $08
_08C1  ex   de,hl
_08C2  ld   h,c
_08C3  ld   a,$0A
_08C5  call _1061
_08C8  ex   de,hl
_08C9  ld   a,d
_08CA  rst  $10
_08CB  ld   a,(hl)
_08CC  ret             ; end 'call _08BE'
;
_08CD ; data for call _08AD... s.a., _0897
       defb $09,$07,$05,$08,$06,$04,$07,$05,$04,$06,$04,$03,$05,$03
       defb $03,$04,$03,$03,$04,$02,$02,$03,$03,$02,$03,$02,$02,$02,$02,$02
;
_08EB ; data for call _08AD... s.a., _08A3
       defb $06,$05,$04,$05,$04,$03,$05,$03,$03,$04,$03,$02,$04,$02,$02,$03
       defb $03,$02,$03,$02,$01,$02,$02,$01,$02,$01,$01,$01,$01,$01,
;
_0909 ; data for call _08BE... s.a., _086C
       defb $03,$03,$01,$01,$03,$03,$03,$01,$07,$03,$03,$01,$07,$03,$03,$03
       defb $07,$07,$03,$03,$0F,$07,$03,$03,$0F,$07,$07,$03,$0F,$07,$07,$07
;
_0929 ; data for call _08BE... s.a., _088B
       defb $06,$0A,$0F,$0F,$04,$08,$0D,$0D,$04,$06,$0A,$0A
;
;
_0935  ld   a,($92A0)  ; the $0935 task
_0938  rlca
_0939  rlca
_093A  rlca
_093B  rlca
_093C  ld   c,a
_093D  ld   a,($9201)  ; if game_state==IN_GAME
_0940  cp   $03
_0942  ret  nz
_0943  ld   a,($9840)  ; code, Game Mode
_0946  ld   b,a
_0947  cpl
_0948  and  c
_0949  ld   hl,$096E
_094C  ld   de,$83D9
_094F  call _095F
_0952  ld   a,($99B3)
_0955  and  a
_0956  ret  z
_0957  ld   a,b       ; not sure when _0957-_095C occurs
_0958  and  c
_0959  ld   hl,$0971
_095C  ld   de,$83C4  
_095F  push bc
_0960  and  $01
_0962  jr   z,_0967
_0964  ld   hl,$0974   ; when is the jr not taken?
_0967  ld   bc,$0003
_096A  ldir
_096C  pop  bc
_096D  ret
;
_096E  defb $19,$1E,$01       ; data for call _95F...  s.a. _0949
_0971  defb $19,$1E,$02       ; s.a. _0959
_0974  defb $24,$24,$24       ; s.a. _0964
;
;
; the $0977 task, basically seems to handle coinage and changes in game-state thereof
_0977  ld   a,($99B5)  ; count of credits avilable from coin-box
_097A  cp   $BB
_097C  jp   z,_336C    ; does some reset shit, but when??
_097F  ld   a,($9201)
_0982  cp   $03        ; $03==GameMode
_0984  jr   nz,_099F   ; if ($9201!=$03), skip this next piece
;
_0986  ld   hl,$99E9   ; code, gameplay mode
_0989  ld   a,(hl)
_098A  add  a,$01
_098C  daa
_098D  cp   $60
_098F  jr   nz,_0992
_0991  xor  a
_0992  ld   b,$04
_0994  ccf
_0995  ld   (hl),a
_0996  dec  l
_0997  ld   a,(hl)
_0998  adc  a,$00
_099A  daa
_099B  djnz _0995
_099D  jr  _09E1       ;... skips us past display of "CREDIT" when we are in Game Mode
;
_099F  ld   a,($99B8)
_09A2  cp   $A0
_09A4  ld   de,$803C   ; dest of "C" of "CREDIT"
_09A7  jr   z,_09D9
_09A9  ld   a,($99B5)  ; load the credit_available count
_09AC  ld   hl,$09CF   ; string stored backwards between $09CA - $09CF
_09AF  ld   bc,$0006   ; length of string "CREDIT"
_09B2  lddr            ; repeat
_09B4  dec  e
_09B5  ld   c,a
_09B6  rlca
_09B7  rlca
_09B8  rlca
_09B9  rlca
_09BA  and  $0F
_09BC  jr   z,_09C0
_09BE  ld   (de),a     ; when is the jr not taken?
_09BF  dec  e
_09C0  ld   a,c
_09C1  and  $0F
_09C3  ld   (de),a     ; DE==$8035 (show "0" of "CREDIT 0")
_09C4  dec  e
_09C5  ld   a,$24      ; space character of "CREDIT 0"
_09C7  ld   (de),a     ; DE==$8034
_09C8  jr   _09E1
;
_09CA  defb $1D,$12,$0D,$0E,$1B,$0C  ; "CREDIT" spelled backward, s.a. _09AC
_09D0  defb $22,$0A,$15,$19,$24,$0E,$0E,$1B,$0F  ; "FREE PLAY" spelled backward, s.a. _09D9
;
_09D9  ld   hl,$09D8   ; load src (last byte) of string "FREE PLAY" 
_09DC  ld   bc,$0009
_09DF  lddr
;
_09E1  ld   a,($9201)  ; jr here, s.a. _099D
_09E4  and  a
_09E5  ret  z            ; if GameState==$00, return (0==GAME_ENDED)
_09E6  dec  a            ; A--, Z flag sets if A was == to 1
_09E7  jr   nz,_09FF     ; i.e. skip the next step if GameState==2 or GameState==3 PUSH_START and IN_GAME respectively)
_09E9  ld   a,($99B5)    ; since ($9201)==$01, we must be in ATTRACT_MODE...$99B5 is count of credit_available from custom IO chip...
_09EC  and  a            ; check if credit_available count is non-zero....
_09ED  jr   z,_09FF      ; jr to $09FF if credit_available count is zero because if the credit_count is non-zero we probly need to start the game
_09EF  ld   a,$02        ; credit_available is non-zero, make sure GameState is set to $02==PUSH_START
_09F1  ld   ($9201),a    ; $9201 will throw the 38d loop out of the Attract Mode, if it's not already in PUSH_START mode
_09F4  xor  a            ; A:=$00 for memset
_09F5  ld   hl,$9AA0     ; dest for memset
_09F8  ld   b,$08        ; len for memset
_09FA  rst  $18          ; memset...
_09FB  inc  l
_09FC  ld   b,$0F        ; when does this happen?
_09FE  rst  $18          ; memset at source $9AA0+$08 I suppose ???
_09FF  ld   a,($99B5)    ; get credits_available and determine if we need to change the game-state
_0A02  ld   c,a          ; note that credits_available is now loaded into C
_0A03  ld   a,($99B8)    ; this is our "local" copy of the credit_count...
_0A06  ld   b,a          ; ...which by now has been loaded into both A and B... 
_0A07  sub  c            ; ...then we subtract C (credits_available) from credit_count...
_0A08  ret  z            ; ...and if they are equal, then there is no change of game state   ; end of task $0977
;
_0A09  jr   c,_0A1A      ; the carry is generated when credits_available>credits_counted, if so, jp to _0A1A to count the credit-in
_0A0B  daa               ; else, credits_availble<credits_counted, meaning player-start has been pushed (credit is already deducted from credit_available)
_0A0C  dec  a            ; A contains "credits used" (from $0A07), which apparently indicates to start 1-player or 2-player
_0A0D  ld   ($99B3),a    ; anyway, after decrement, we'd have 0 for 1P, 1 for 2P
_0A10  ld   a,c          ; C==credits_available (from $0A02)... now has one or two credit deducted for the game about to start...
_0A11  ld   ($99B8),a    ; ...so update our credit_count accordingly
_0A14  ld   a,$03        ; $03==IN_GAME
_0A16  ld   ($9201),a    ; so change the GameState to IN_GAME
_0A19  ret               ; end of task $0977
;
;
_0A1A  ld   a,c          ; C==credits_available, let A=C...
_0A1B  ld   ($99B8),a    ; ...and store that into credits_counted
_0A1E  cp   $A0
_0A20  ret  z            ; enforces $A0 limit on credits_counted? apparently we don't sound the coin_in sound for any credit over $A0
_0A21  sub  b            ; B==old_credits_counted
_0A22  daa
_0A23  ld   ($9A79),a    ; ...so it means the "number of credits we just acquired", probably it's for sounding the coin-in sound x number of times
_0A26  ret               ; end of task $0977
;
;
_0A27  ld   hl,$9103     ; begin 'call _0A27', is something with endgame, s.a. _0706,_070C
_0A2A  ld   b,$05
_0A2C  ld   a,(de)
_0A2D  inc  e
_0A2E  cp   $24
_0A30  jr   nz,_0A33
_0A32  xor  a
_0A33  rrd
_0A35  bit  0,b
_0A37  jr   nz,_0A3A
_0A39  dec  l
_0A3A  djnz _0A2C
_0A3C  xor  a
_0A3D  rrd
_0A3F  dec  l
_0A40  ld   (hl),$00
_0A42  ld   l,$03
_0A44  ld   de,$99E5
_0A47  ld   b,$04
_0A49  and  a
_0A4A  ld   a,(de)
_0A4B  adc  a,(hl)
_0A4C  daa
_0A4D  ld   (de),a
_0A4E  dec  e
_0A4F  dec  l
_0A50  djnz _0A4A
_0A52  ret
;
;
_0A53  ld   b,$01       ; begin 'call _0A53', in theme or game start???
_0A55  dec  h
_0A56  inc  h 
_0A57  jr   nz,_0A5E
_0A59  ld   a,l
_0A5A  cp   $0A
_0A5C  jr   c,_0A68
_0A5E  ld   a,$0A       ; end game?
_0A60  call _1061
_0A63  push af
_0A64  inc  b
_0A65  jr   _0A55
;
_0A67  pop  af
_0A68  call _0A6E
_0A6B  djnz _0A67
_0A6D  ret
;
;
_0A6E  ld   (de),a      ; begin 'call _0A6E'
_0A6F  jp   _0020
;
;
_0A72  ld   hl,($9844)  ; begin 'call _0A72'...endgame? s.a. _0532
_0A75  ld   de,($9846)
_0A79  ld   a,d
_0A7A  or   e
_0A7B  jr   nz,_0A82
_0A7D  ld   de,$0000
_0A80  jr   _0AD3
;
;
_0A82  bit  7,d         ; here is something about "results" screen
_0A84  jr   nz,_0A90
_0A86  bit  7,h
_0A88  jr   nz,_0A90
_0A8A  add  hl,hl
_0A8B  ex   de,hl
_0A8C  add  hl,hl
_0A8D  ex   de,hl
_0A8E  jr   _0A82
;
;
_0A90  ld   a,d
_0A91  call _1061
_0A94  push hl
_0A95  ld   h,a
_0A96  ld   l,$00
_0A98  ld   a,d
_0A99  call _1061
_0A9C  ex   (sp),hl
_0A9D  ld   de,$99B0
_0AA0  ld   b,$04
_0AA2  ld   a,h
_0AA3  ld   h,$00
_0AA5  ex   de,hl
_0AA6  rld              ; rld (hl)
_0AA8  bit  0,b
_0AAA  jr   z,_0AAD
_0AAC  inc  l
_0AAD  ex   de,hl
_0AAE  call _0B06
_0AB1  ex   af,af'
_0AB2  ex   (sp),hl
_0AB3  call _0B06
_0AB6  ex   (sp),hl
_0AB7  rst  $10
_0AB8  ex   af,af'
_0AB9  add  a,h
_0ABA  ld   h,$00
_0ABC  djnz _0AA5
_0ABE  pop  de
_0ABF  cp   $05
_0AC1  jr   c,_0AD7
_0AC3  ld   de,($99B0)   ; when not jr?
_0AC7  ld   a,d
_0AC8  add  a,$01
_0ACA  daa
_0ACB  ld   d,a
_0ACC  jr   nc,_0AD3
_0ACE  ld   a,e
_0ACF  add  a,$01
_0AD1  daa
_0AD2  ld   e,a
;
_0AD3  ld   ($99B0),de   ; jr here, s.a. _0A80
_0AD7  ld   b,$04
_0AD9  ld   c,$00
_0ADB  ld   hl,$99B0
_0ADE  ld   de,$8138
_0AE1  dec  b
_0AE2  jr   nz,_0AE8
_0AE4  ld   a,$2A
_0AE6  ld   (de),a
_0AE7  rst  $20
_0AE8  inc  b
_0AE9  xor  a
_0AEA  rld              ; rld (hl)
_0AEC  bit  0,b
_0AEE  jr   z,_0AF1
_0AF0  inc  l
_0AF1  and  a
_0AF2  jr   nz,_0AF8
_0AF4  bit  0,c
_0AF6  jr   z,_0AFC
_0AF8  set  0,c
_0AFA  ld   (de),a
_0AFB  rst  $20
_0AFC  ld   a,b
_0AFD  cp   $03
_0AFF  jr   nz,_0B03
_0B01  set  0,c
_0B03  djnz _0AE1
_0B05  ret
;
;
_0B06  ld   a,$0A      ; begin 'call _0B06'
_0B08  call _104E
_0B0B  ld   a,h
_0B0C  ld   h,$00
_0B0E  ret
;
; $0B0F-$_0FFE  rst  $38
       org $0FFF
_0FFF  defb $93        ; sub  e  ($93) ... end of ROM0
;
_1000  push hl         ; begin 'call  _1000', s.a. _2612
_1001  ld   a,r
_1003  ld   h,a
_1004  ld   a,($92A0)
_1007  add  a,h
_1008  ld   l,a
_1009  ld   h,$01      ; apparently from data src at _0100... TODO
_100B  ld   a,(hl)
_100C  ld   h,a
_100D  ld   a,r
_100F  add  a,h
_1010  pop  hl
_1011  ret
;
;
; _1012   ; TODO: is it really code to _104D?
;
_1012  push bc
_1013  push de
_1014  ld   a,e
_1015  sub  l
_1016  ld   b,$00
_1018  jr   nc,_101E
_101A  set  0,b
_101C  neg
_101E  ld   c,a
_101F  ld   a,d
_1020  sub  h
_1021  jr   nc,_102D
_1023  ld   d,a
_1024  ld   a,b
_1025  xor  $01
_1027  or   $02
_1029  ld   b,a
_102A  ld   a,d
_102B  neg
_102D  cp   c
_102E  push af
_102F  rla
_1030  xor  b
_1031  rra
_1032  ccf
_1033  rl   b
_1035  pop  af
_1036  jr   nc,_103B
_1038  ld   d,c
_1039  ld   c,a
_103A  ld   a,d
_103B  ld   h,c
_103C  ld   l,$00
_103E  call _1061
_1041  ld   a,h
_1042  xor  b
_1043  and  $01
_1045  jr   z,_104A
_1047  ld   a,l
_1048  cpl
_1049  ld   l,a
_104A  ld   h,b
_104B  pop  de
_104C  pop  bc
_104D  ret

;
;       org $104E
;
                       ; begin 'call _104E', s.a. _0B08
_104E  push de         ; this is done starting demo, also something to do with results screen
_104F  ex   de,hl
_1050  ld   hl,$0000
_1053  srl  a
_1055  jr   nc,_1058
_1057  add  hl,de
_1058  sla  e
_105A  rl   d
_105C  and  a
_105D  jr   nz,_1053
_105F  pop  de
_1060  ret
;
;
_1061  push bc        ; begin 'call _1061' ... s.a. _08BE, which is called from $0857 task
_1062  ld   c,a
_1063  xor  a
_1064  ld   b,$11
_1066  adc  a,a
_1067  jr   c,_1074   ; when we hit the "Results" screen (showing hit-miss ratio?)
_1069  cp   c
_106A  jr   c,_106D
_106C  sub  c
_106D  ccf
_106E  adc  hl,hl
_1070  djnz _1066
_1072  pop  bc
_1073  ret            ; end 'call _1061'
;
;
_1074  sub  c         ; in "Results" mode
_1075  scf
_1076  jp   _106E
;
;
_1079  ld   a,l       ; tractor beam goin?
_107A  and  $80
_107C  inc  a
_107D  ex   af,af'
_107E  res  7,l
_1080  jp   _108A
;
;
_1083  ld   a,l       ; blew up a galaga in demo?
_1084  rrca
_1085  rrca
_1086  and  $80
_1088  inc  a
_1089  ex   af,af'
;
_108A  push de       ; jp here, s.a. _1080
_108B  ld   de,$0014
_108E  ld   b,$0C
_1090  ld   ix,$9100
_1094  bit  0,(ix+$13)
_1098  jr   z,_10A0
_109A  add  ix,de
_109C  djnz _1094
_109E  pop  de        ; when?
_109F  ret
;
;
_10A0  pop  de        ; jr here, s.a. _1098
_10A1  ld   (ix+$08),e
_10A4  ld   (ix+$09),d
_10A7  ld   (ix+$0d),$01
_10AB  ld   (ix+$04),$00
_10AF  ld   (ix+$05),$01
_10B3  ld   c,l
_10B4  ld   (ix+$10),c
_10B7  ex   af,af'
_10B8  ld   d,a
_10B9  ld   (hl),$09
_10BB  ld   a,ixl
_10BD  inc  l
_10BE  ld   (hl),a
_10BF  ld   a,($9215)
_10C2  ld   e,a
_10C3  ld   l,c
_10C4  ld   h,$93
_10C6  ld   c,(hl)
_10C7  inc  l
_10C8  ld   b,(hl)
_10C9  ld   h,$9B
_10CB  ld   a,(hl)
_10CC  rrca
_10CD  rr   b
_10CF  bit  0,e
_10D1  jr   nz,_10DC
_10D3  ex   af,af'
_10D4  ld   a,b
_10D5  add  a,$50
_10D7  neg
_10D9  ld   b,a
_10DA  ex   af,af'
_10DB  ccf
_10DC  ld   (ix+$01),b
_10DF  rra
_10E0  and  $80
_10E2  ld   (ix+$00),a
_10E5  ld   a,c
_10E6  bit  0,e
_10E8  jr   z,_10ED
_10EA  add  a,$0D       ; when?
_10EC  cpl
_10ED  srl  a
_10EF  ld   (ix+$03),a
_10F2  rra
_10F3  and  $80
_10F5  ld   (ix+$02),a
_10F8  ld   (ix+$13),d
_10FB  ld   (ix+$0e),$1E
_10FF  ld   a,($920B)
_1102  and  a
_1103  jr   z,_1108
_1105  ld   a,($92C8)
_1108  ld   (ix+$0f),a
_110B  ret
;
;
_110C  ld   a,$1F        ; begin 'call _110C', s.a. _05B3, changin players, fleet retreating
_110E  ld   ($9000),a
_1111  ld   ($98E0),a
_1114  ld   hl,$9820
_1117  ld   de,$9860
_111A  ld   b,$40
_111C  ld   c,(hl)
_111D  ld   a,(de)
_111E  ld   (hl),a
_111F  ld   a,c
_1120  ld   (de),a
_1121  inc  l
_1122  inc  e
_1123  djnz _111C
_1125  ld   hl,$8800
_1128  ld   de,$98B0
_112B  ld   b,$30
_112D  ld   a,(hl)
_112E  ld   c,a
_112F  ld   h,$8B
_1131  ld   a,(hl)
_1132  and  $7F
_1134  dec  c
_1135  jr   nz,_1142
_1137  and  $78
_1139  ld   c,a
_113A  inc  l
_113B  ld   a,(hl)
_113C  dec  l
_113D  and  $07
_113F  or   c
_1140  or   $80
_1142  ex   de,hl
_1143  ld   c,(hl)
_1144  ld   (hl),a
_1145  ex   de,hl
_1146  bit  7,c
_1148  jr   z,_115A
_114A  ld   a,c      ; when not jr?
_114B  and  $78
_114D  add  a,$06
_114F  ld   (hl),a
_1150  inc  l
_1151  ld   a,c
_1152  and  $07
_1154  ld   (hl),a
_1155  dec  l
_1156  ld   a,$01
_1158  jr   _1161
;
_115A  ld   (hl),c
_115B  ld   h,$93
_115D  ld   (hl),$00
_115F  ld   a,$80
_1161  ld   h,$88
_1163  ld   (hl),a
_1164  inc  de
_1165  inc  l
_1166  inc  l
_1167  djnz _112D
_1169  ld   hl,$9000
_116C  ld   de,$98E0
_116F  ld   b,$20
_1171  ld   c,(hl)
_1172  ld   a,(de)
_1173  ld   (hl),a
_1174  ld   a,c
_1175  ld   (de),a
_1176  inc  l
_1177  inc  e
_1178  djnz _1171
_117A  xor  a
_117B  ld   ($9000),a
_117E  ret
;
;
_117F  ld   hl,$8002   ; begin 'call _117F', s.a. _01BC,_05E6
_1182  ld   b,$12
_1184  ld   a,$24
_1186  rst  $18
_1187  ld   l,$22
_1189  ld   b,$12
_118B  rst  $18
_118C  ld   a,($9821)
_118F  ld   b,$00
_1191  ld   hl,$8001
_1194  cp   $32
_1196  jr   c,_119F
_1198  sub  $32        ; when not jr?
_119A  inc  b
_119B  inc  l
_119C  inc  l
_119D  jr   _1194
;
_119F  ex   de,hl
_11A0  ld   l,a
_11A1  ld   h,$00
_11A3  ld   a,$0A
_11A5  call _1061
_11A8  ld   h,a
_11A9  push hl
_11AA  ex   de,hl
_11AB  cp   $05
_11AD  jr   c,_11B1
_11AF  sub  $04         ; when not jr?
_11B1  ld   c,a
_11B2  ld   a,e
_11B3  bit  0,a
_11B5  jr   z,_11B9
_11B7  ld   a,$02       ; when not jr?
_11B9  add  a,c
_11BA  rst  $10
_11BB  inc  b
_11BC  djnz _11DC       ; this happens at each new stage, s.a. _11E1
_11BE  pop  bc
_11BF  ld   a,c
_11C0  call _11E3
_11C3  ld   a,b
_11C4  cp   $05
_11C6  jr   c,_11D0
_11C8  ld   d,$38       ; when not jr?
_11CA  call _1201
_11CD  ld   a,b
_11CE  sub  $05
;
_11D0  ld   b,a         ; jr here, s.a. _11C6
_11D1  inc  b
_11D2  djnz _11D5
_11D4  ret              ; start of Stage-1 "PLAYER 1"
;
;
_11D5  ld   d,$36
_11D7  call _1201
_11DA  jr   _11D2       ; "STAGE 1" showing
;
_11DC  ld   a,$04       ; s.a. _11BC, not sure when this happen
_11DE  call _11E9
_11E1  jr   _11BC
;
_11E3  and  a
_11E4  ret  z
_11E5  cp   $04        ; when
_11E7  jr   z,_11F0
_11E9  rlca            ;begin 'call _11E9'
_11EA  rlca
_11EB  add  a,$36
_11ED  ld   d,a
_11EE  jr   _11FA
;
;
_11F0  ld   d,$42      ; s.a. _11E7
_11F2  call _1201
_11F5  call _1216
_11F8  ld   d,$3A
_11FA  call _1201      ; s.a. _11EE
_11FD  call _1216
_1200  ret 
;
;
_1201  ex   af,af'     ; begin 'call _1201'
_1202  jr   c,_1215
_1204  ex   af,af'
_1205  ld   a,($92A0)
_1208  add  a,$08
_120A  ld   e,a
_120B  ld   a,($92A0)
_120E  sub  e
_120F  jr   nz,_120B
_1211  ex   af,af'
_1212  ld   ($9AB5),a
_1215  ex   af,af'      ; s.a. _1202
_1216  ld   (hl),d      ; begin 'call _1216'
_1217  inc  d
_1218  set  5,l
_121A  ld   (hl),d
_121B  inc  d
_121C  set  2,h
_121E  ld   a,d
_121F  and  $0C
_1221  cp   $08
_1223  ld   a,$01
_1225  jr   z,_1228
_1227  inc  a         ; when is the jr not taken?
_1228  ld   (hl),a
_1229  res  5,l
_122B  ld   (hl),a
_122C  res  2,h
_122E  dec  l
_122F  ret            ; some point at near end of theme music
;
;
_1230  ld   hl,$1249  ; begin 'call  $1230'
_1233  ld   de,$9000
_1236  ld   bc,$0020
_1239  push bc
_123A  push hl
_123B  ldir
_123D  pop  hl
_123E  pop  bc
_123F  ld   de,$98E0   ; copy same stuff again
_1242  ldir
_1244  xor  a
_1245  ld   ($9000),a
_1248  ret             ; end 'call _1230'
;
_1249 ; data, s.a. _1230, some $20 bytes copied to $9000
      defb $1F,$01,$00,$00,$00
      defb $01,
      defb $00,$00,$00,$00,$00,$00
      defb $01,$01,$00
      defb $01
      defb $00,$00,$00,$00,$00,$00,$00
      defb $01
      defb $00,$00,$00,$00,$00,$00,$00
      defb $0A         ; $1268 - code or not?
;
_1269  ld   hl,$8B64   ; begin 'call _1269', (during theme?) s.a. _0409, _1922
_126C  ld   de,$0930
_126F  ld   c,$00
_1271  ld   b,$0A
_1273  ld   (hl),e
_1274  ld   h,$93
_1276  ld   (hl),$00
_1278  ld   h,$9B
_127A  ld   (hl),c
_127B  ld   h,$8B
_127D  inc  l
_127E  ld   (hl),d
_127F  inc  l
_1280  ld   a,b
_1281  cp   $09
_1283  jr   nz,_1289
_1285  ld   c,$01
_1287  ld   d,$0B
_1289  djnz _1273
_128B  ret
;
;
; begin 'call $128C' writes values to sprite-buffer, _828 copies buffer to actual sprite-RAM
;
; 8b00-8b7f buffer  8b80-8bff sprite code/color
; 9300-937f buffer  9380-93ff sprite position
; 9b00-9b7f buffer  9b80-9bff sprite control      
;
; CTRL 1
; 0: flix  - flip "up/down"
; 1: flipy - flip from "left/right"
; 2: dblh-
; 3: dblw-
;
; CTRL 2
; 0: sx, bit-8    MAME calls it "sx", although it is effectively the "top/bottom" offset
; 1: enable-
;
_128C  ld   h,$8B       ; $8BXX, sprite code/color buffer
_128E  ld   de,($9280)  ; $9280 contains address of current sprite-table entry, s.a. _1948 ( "ld   hl,$195C" )
_1292  ld   a,(de)      ; is DE always some offset from $195C?  see _12BE
_1293  ld   l,a         ; ld the "index" of the sprite to use (first-byte of table-entry)
_1294  inc  de
_1295  ld   a,(de)      ; ld the 2nd byte from the table-entry (color/code)...
_1296  ld   c,a         ; ...also save a copy to C
_1297  and  $78         ; bits 3-6 get us the offset into the table of sprite-bitmaps
_1299  add  a,$06       ; 6th character in each set is the "upright" orientation, which is "un-contracted", like a bug with wing's spread
_129B  ld   (hl),a      ; ld to sprite-code buffer
_129C  inc  l
_129D  ld   a,c         ; reload the original color/code value
_129E  and  $07         ; bits 0-2 are the color
_12A0  bit  7,c
_12A2  jr   z,_12A6     ; if !bit-7, Z:=1, take the jr
_12A4  or   $08         ; when is jr not taken?      apparently when this bit-7 is on, it is intended to provide a value in the bit-3 position of the color value
_12A6  ld   (hl),a      ; ld to sprite-color buffer
_12A7  inc  de          ; point at 3rd byte of table-entry (L/R)
_12A8  dec  l
_12A9  ld   h,$88       ; HL:=$88XX,  sprite-?? ...keeps track of which sprites are "active"?
_12AB  ld   (hl),$01
_12AD  ld   h,$93       ; HL:=$93XX,  sprite-position buffer
_12AF  ld   a,(de)      ; 
_12B0  ld   (hl),a      ; ld to sprite-position-L/R 
_12B1  inc  de          ; point at 4th byte of table-entry (T/B)
_12B2  inc  l
_12B3  ld   a,(de)
_12B4  sla  a           ; effectively, A:+=$40, apparently the h/w always subtract $40 to give the effective address? therefore $0140 is right at very bottom of screen
_12B6  ld   (hl),a      ; ld to sprite-position-up/down, increasing moves down
_12B7  ld   a,$00       ; set the sprite with no additional control attributes
_12B9  rla
_12BA  ld   h,$9B       ; HL:=$9BXX,  sprite-control buffer
_12BC  ld   (hl),a
_12BD  inc  de          ; e.g., DE:=$1960
_12BE  ld   ($9280),de  ; store the address of the next sprite to draw
_12C2  ret              ; end 'call _128C'
;
;
;
_12C3  ld   ixl,a       ; code, end of theme music
_12C5  ld   a,($9215)
_12C8  ld   c,a
_12C9  ld   hl,$9900
_12CC  ld   de,$130F
_12CF  ld   b,$10
_12D1  ld   (hl),$00
_12D3  inc  l
_12D4  ld   a,(de)
_12D5  inc  de
_12D6  ld   (hl),a
_12D7  inc  l
_12D8  djnz _12D1
_12DA  ld   hl,$9800
_12DD  ld   de,$130F
_12E0  ld   b,$0A
_12E2  ld   a,(de)
_12E3  inc  de
_12E4  bit  0,c
_12E6  jr   z,_12EB
_12E8  add  a,$0D      ; when is jr not taken?
_12EA  cpl
_12EB  ld   (hl),a
_12EC  inc  l
_12ED  inc  l
_12EE  djnz _12E2
_12F0  ld   b,$06
_12F2  ld   a,(de)
_12F3  add  a,ixl
_12F5  inc  de
_12F6  bit  0,c
_12F8  jr   nz,_12FD
_12FA  add  a,$4F
_12FC  cpl
_12FD  sla  a
_12FF  ld   (hl),a
_1300  inc  l
_1301  ld   a,$00
_1303  rla
_1304  ld   (hl),a
_1305  inc  l
_1306  djnz _12F2
_1308  ld   a,($9215)
_130B  ld   ($920F),a
_130E  ret
;
_130F  ; data we're loading to $9900, s.a. _12CC
       defb $31,$41,$51,$61,$71,$81,$91,$A1,$B1,$C1,$92,$8A,$82,$7C,$76,$70
;
;
_131F  push hl          ; begin 'call _131F', s.a. _062F ... end of theme?
_1320  ld   hl,$92AF
_1323  ld   (hl),$03
_1325  ld   a,(hl)
_1326  and  a
_1327  jr   nz,_1325
_1329  pop  hl
_132A  ret              ; end 'call $131F'
;
;
_132B  ld   a,$01       ; begin 'call _132B', s.a. _061E ... player 1 stage 1 ?
_132D  ld   ($9014),a
_1330  ld   a,($8270)
_1333  cp   $24
_1335  jr   nz,_133A
_1337  ld   c,$03       ; when is the jr not taken?
_1339  rst  $30
_133A  ld   a,($9287)   ; begin 'call  _133A', s.a. _186F, _18E7, _1808
_133D  and  a
_133E  jr   nz,_133A
_1340  call _136C
_1343  ld   hl,$0906
_1346  ld   ($8B62),hl
_1349  ld   hl,$9362
_134C  ld   a,($9215)
_134F  and  $01
_1351  ld   a,$29
_1353  ld   c,$01
_1355  jr   z,_135A
_1357  add  a,$0E        ; when is the jr not taken?
_1359  dec  c
_135A  ld   (hl),$7A
_135C  inc  l
_135D  ld   (hl),a
_135E  ld   h,$9B
_1360  ld   (hl),c
_1361  dec  l
_1362  xor  a
_1363  ld   (hl),a
_1364  ld   ($9213),a
_1367  inc  a
_1368  ld   ($99B9),a
_136B  ret               ; end 'call  _133A', ret to _18EA
;
;
_136C  ld   a,($9820)    ; begin 'call  _136C', s.a. _1340
_136F  cpl
_1370  add  a,$06
_1372  ld   e,a
_1373  ld   d,$49
_1375  ld   hl,$801D
_1378  call _1386
_137B  dec  l
_137C  call _1386
_137F  set  5,l
_1381  inc  l
_1382  call _1386
_1385  dec  l
_1386  push hl           ; begin 'call  _1386', s.a. _1378
_1387  inc  d
_1388  ld   b,d
_1389  ld   a,$05
_138B  cp   e
_138C  jr   nz,_1390
_138E  ld   b,$24
_1390  ld   (hl),b
_1391  dec  l
_1392  dec  l
_1393  dec  a
_1394  jr   nz,_138B
_1396  pop  hl
_1397  ret
;
;
; begin 'call _1398'
; DE is some value e.g. $03, $01
;
; HL is the dest address ...HL==$83B1, 
; not sure about DE, it is pushed/popped ... DE==$B9,
; C is the offset into the String Table ... C==$0B
; A should be some non-zero at entry, like a flag that means that entry was _1398
; entry pt is _139A when dest address is encoded directly into the string
; the dest address is encoded at the two bytes prior to the src address encoded in the Table
_1398  and  a          ; if (0!=A), this clears Cy (s.a. rst $30, which is the entry point for dipslaying string that have dest address encoded directly within them )
_1399  ex   af,af'     ; apparently this is to save the flags....
                       ; this is the text routine that is jumped to from the rst $30
_139A  push de
_139B  ex   de,hl      ; save the dest address into DE
_139C  ld   a,c        ; C contains the offset into the String Table
_139D  ld   hl,$13D4   ; base-address of String Table
_13A0  rst  $08        ; HL:+=2A
_13A1  ld   a,(hl)     ; ld LSB of src-address of string...HL==$13F0  ; contains address of string to display
_13A2  inc  hl
_13A3  ld   h,(hl)     ; ld MSB of src-address of string...
_13A4  ld   l,a        ; ...and ld the LSB to L 
_13A5  ex   af,af'     ; ....get back the flags...
_13A6  jr   nc,_13AE   ; ...and if A was non-zero at entry, then there would be no Cy here...
                       ; ...which mean you entered at _1398....
_13A8  dec  hl         ; the destination address of the string...
_13A9  dec  hl         ; ...is actually two-bytes previous to the src address given in the Table
_13AA  ld   e,(hl)     ; ld the LSB of dest
_13AB  inc  hl
_13AC  ld   d,(hl)     ; ld the MSB of dest, now DE contains dest address
_13AD  inc  hl         ; now we're pointing at the "color" to use
;
_13AE  ld   c,(hl)     ; ....(HL) is the color byte ; $00 is "cyan"
_13AF  inc  hl         ; now point at the first byte of text
_13B0  ex   de,hl      ; get the dest address from DE into HL, and the src address from HL into DE
_13B1  ld   a,(de)     ; ld the character to display...
_13B2  cp   $2F        ; ...and check for the string terminator
_13B4  jr   z,_13D4    ; quit if it's the terminator
_13B6  sub  $30        ; convert from ASCII into machine text
_13B8  jr   nc,_13BE
_13BA  ld   a,$24
_13BC  jr   _13C4
;
_13BE  cp   $11
_13C0  jr   c,_13C4
_13C2  sub  $07        ; now the character is converted to machine set
_13C4  ld   (hl),a     ; display the character
_13C5  set  2,h        ; HL:+=$0400  ( H |= $04 )  point HL to appropriate offset in color RAM $8400-$87FF
_13C7  ld   (hl),c     ; C contains the color byte
_13C8  res  2,h        ; HL:-=$0400 ( H &= ~$04 )
_13CA  inc  de         ; inc the src address
_13CB  ld   a,l
_13CC  sub  $20
_13CE  ld   l,a        ; dest is effectively moved one position to the "right"
_13CF  jr   nc,_13B1
_13D1  dec  h          ; this probly jump one row "down"
_13D2  jr   _13B1
_13D4  pop  de
_13D5  ret             ; end call to display text subtask _139A
;
_13D6  ; here is the string address table...s.a. _139D
       defb $14,$14,$29,$14,$36,$14,$41,$14,$4B,$14,$57,$14,$61,$14,$76,$14
       defb $88,$14,$93,$14,$A7,$14,$C6,$14,$D3,$14,$EE,$14,$F8,$14,$07,$15
       defb $14,$15,$21,$15,$25,$15,$3A,$15,$45,$15,$52,$15,$69,$15,$77,$15
       defb $90,$15,$A7,$15,$AD,$15,$C1,$15,$D5,$15,$E7,$15
;
; here are the strings
;
       defb $EB,$82,$00  ; two-bytes dest. address, 1-byte "color"
       defb $50,$55,$53,$48,$20,$53,$54,$41,$52,$54,$20,$42,$55,$54,$54,$4F,$4E,$2F
       defb $70,$82,$00
       defb $47,$41,$4D,$45,$20,$4F,$56,$45,$52,$2F
       defb $70,$82,$00
       defb $52,$45,$41,$44,$59,$20,$21,$2F
       defb $50,$82,$00
       defb $50,$4C,$41,$59,$45,$52,$20,$31,$2F
_1441  defb $00
       defb $50,$4C,$41,$59,$45,$52,$20,$32,$2F
       defb $70,$82,$00
       defb $53,$54,$41,$47,$45,$20,$2F
       defb $10,$83,$00
       defb $43,$48,$41,$4C,$4C,$45,$4E,$47,$49,$4E,$47,$20,$53,$54,$41,$47,$45,$2F
       defb $10,$83,$00
       defb $4E,$55,$4D,$42,$45,$52,$20,$4F,$46,$20,$48,$49,$54,$53,$2F
       defb $B3,$82,$00
       defb $42,$4F,$4E,$55,$53,$20,$20,$2F
       defb $F1,$82,$04
       defb $46,$49,$47,$48,$54,$45,$52,$20,$43,$41,$50,$54,$55,$52,$45,$44,$2F
       defb $AD,$83,$00
       defb $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$2F
       defb $6D,$82,$04
       defb $50,$45,$52,$46,$45,$43,$54,$20,$63,$2F
       defb $73,$83,$05
       defb $53,$50,$45,$43,$49,$41,$4C,$20,$42,$4F,$4E,$55,$53,$20,$31,$30,$30,$30,$30,$20,$50,$54,$53,$2F
       defb $42,$82,$00
       defb $47,$41,$4C,$41,$47,$41,$2F
       defb $A5,$82,$00
       defb $5D,$5D,$20,$53,$43,$4F,$52,$45,$20,$5D,$5D,$2F
       defb $28,$82,$00
       defb $35,$30,$20,$20,$20,$20,$31,$30,$30,$2F
       defb $2A,$82,$00
       defb $38,$30,$20,$20,$20,$20,$31,$36,$30,$2F
       defb $2B,$82,$00
       defb $2F
       defb $FB,$82,$03
       defb $65,$20,$31,$39,$38,$31,$20,$4E,$41,$4D,$43,$4F,$20,$4C,$54,$44,$61,$2F
       defb $5E,$82,$04
       defb $66,$67,$68,$69,$6A,$6B,$6C,$2F
       defb $8F,$82,$04
       defb $5D,$52,$45,$53,$55,$4C,$54,$53,$5D,$2F
       defb $32,$83,$05
       defb $53,$48,$4F,$54,$53,$20,$46,$49,$52,$45,$44,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$2F
       defb $05
       defb $20,$20,$4D,$49,$53,$53,$49,$4C,$45,$53,$2F
       defb $35,$83,$05
       defb $4E,$55,$4D,$42,$45,$52,$20,$4F,$46,$20,$48,$49,$54,$53,$20,$20,$20,$20,$20,$20,$20,$2F
       defb $38,$83,$03
       defb $48,$49,$54,$5D,$4D,$49,$53,$53,$20,$52,$41,$54,$49,$4F,$20,$20,$20,$20,$20,$20,$20,$2F
       defb $03
       defb $24,$60,$2F
       defb $2F,$83,$05
       defb $31,$53,$54,$20,$42,$4F,$4E,$55,$53,$20,$46,$4F,$52,$20,$20,$20,$2F
       defb $32,$83,$05
       defb $32,$4E,$44,$20,$42,$4F,$4E,$55,$53,$20,$46,$4F,$52,$20,$20,$20,$2F
       defb $35,$83,$05
       defb $41,$4E,$44,$20,$46,$4F,$52,$20,$45,$56,$45,$52,$59,$20,$20,$20,$2F
       defb $05
       defb $30,$30,$30,$30,$20,$50,$54,$53,$2F
;
; $FF to _1700
;
       org  $1700
; _1700 task is first called prior to row of bosses appear in train-mode
_1700  ld   de,($9282)  ; get an entry from the table at _1928 or _1887, which provides an index into the list of sub-tasks at _1713 amd _1786
                        ; the subtasks obtained from table _1928 appear to "sequence" the game through the train-mode
                        ; the subtasks obtained from table _1887 appear to "sequence" the game through the demo-mode
_1704  ld   a,(de)
_1705  rlca
_1706  rlca
_1707  rlca
_1708  and  $07
_170A  ld   hl,$1713    ; ld the table address
_170D  rst  $08         ; HL:+=2A
_170E  ld   a,(hl)      ; HL== some offset from $1713
_170F  inc  hl
_1710  ld   h,(hl)
_1711  ld   l,a
_1712  jp   (hl)
;
; jp table for the first subtask of _1700...indexing into this table accomplished by getting the (first-byte?) of an entry from table _1928
       defb $66,$17,$66,$17,$1F,$17,$66,$17,$34,$17,$2D,$17
;
_171F  ld   a,($92A0)   ; subtask of _1700 ...stoped here at each changing frequency of the first portion of the sound when the far-right and far-left bosses got hit in train-mode
_1722  and  $0F
_1724  ret  nz
_1725  ld   hl,$9207    ; train-mode, far-right boss turned blue
_1728  dec  (hl)
_1729  ret  nz
_172A  jp   _1766       ; train-mode, far-right boss exploding
;
_172D  call _1F0F       ; subtask of _1700 ...appearance of first attack wave in GameOver Demo-Mode
_1730  ld   de,($9282)
;
_1734  ld   a,(de)      ; subtask of _1700 ...appearance of ship in TrainMode?
_1735  ld   hl,$9827
_1738  ld   e,(hl)
_1739  bit  0,a
_173B  jr   nz,_1741
_173D  and  $0A
_173F  jr   _1755
;
_1741  ld   a,($9209)   ; 5 bosses, 3 reds and the ship first appear in train-mode
_1744  ld   l,a
_1745  ld   h,$93
_1747  ld   a,($9362)
_174A  sub  (hl)
_174B  ld   a,$0A
_174D  jr   z,_1755
_174F  ld   a,$08
_1751  jr   c,_1755
_1753  ld   a,$02       ; when is jr not taken?
;
_1755  call _1F92       ; ship is first about to move in train-mode, s.a. _173F
_1758  ld   a,($92A0)
_175B  and  $03
_175D  ret  nz
_175E  ld   hl,$9207    ; train-mode, far-right boss exploding
_1761  dec  (hl)
_1762  ret  nz
_1763  call $1F0F       ; train-mode, ship about to shoot?
;
_1766  ld   de,($9282)  ; jp here, s.a. _172A
_176A  ld   a,(de)
_176B  and  $C0
_176D  cp   $80
_176F  jr   nz,_1772
_1771  inc  de          ; when is jr not taken?
_1772  inc  de          ; then next entry gets us into the table at $1786
_1773  ld   a,(de)
_1774  ld   ($9282),de  ; save the address of the next entry in the table of jp-table offsets
_1778  rlca
_1779  rlca
_177A  rlca
_177B  and  $07
_177D  ld   hl,$1786    ; ld the table address
_1780  rst  $08         ; HL:+=2A
_1781  ld   a,(hl)
_1782  inc  hl
_1783  ld   h,(hl)
_1784  ld   l,a
_1785  jp   (hl)        ; jp to second sub-task of _1700
;
_1786  ; jp table for the second subtask of _1700...indexing into this table accomplished by getting the (second-byte?) of an entry from table _1928
       defb $94,$17,$94,$17,$A1,$17,$A8,$17,$AE,$17,$AE,$17,$9C,$17
;
            ; sub-task of _1700, precursor to bosses and reds appearing
_1794  ld   a,(de)
_1795  rlca
_1796  and  $7E
_1798  ld   ($9209),a
_179B  ret
            ; sub-task of _1700, after shot-and-hit far-left boss in train-mode
_179C  xor  a
_179D  ld   ($9003),a
_17A0  ret
            ; sub-task of _1700, shoot-and-hit far-right and far-left boss in train-mode
_17A1  ld   a,(de)
_17A2  and  $1F
_17A4  ld   ($9207),a
_17A7  ret
            ; sub-task of _1700
_17A8  ld   a,(de)
_17A9  and  $1F
_17AB  ld   c,a
_17AC  rst  $30
_17AD  ret
            ; sub-task of _1700  ; player ship appears in train-mode
_17AE  inc  de
_17AF  ld   a,(de)
_17B0  jr   _17A4
;
;
                       ; begin $17B2 task
_17B2  ld   a,($9201)  ; once demo is running, this should be $01, ($9201) is initialized in the "SERVICE" mode segment
_17B5  dec  a
_17B6  ret  nz         ; if A!=$00,ret i.e. "if ( ($9201)==1)"
_17B7  ld   a,($9203)  ; let A=$02
_17BA  ld   hl,$17C3
_17BD  rst  $08        ; HL:+=2A, i.e. HL is the function-pointer to the current subtask
_17BE  ld   e,(hl)     ; let E=$84
_17BF  inc  hl         ; let HL=$17C8
_17C0  ld   d,(hl)     ; let D=$19
_17C1  ex   de,hl      ; let HL=$1984, let DE=$17C8
_17C2  jp   (hl)       ; usually HL==_1984, but $1940 occurs before "CREDIT 0" displayed in attract mode, and $1948 occurs before "GALAGA" displayed in attract mode
                       ; there is also a $17E1 subtask
;
_17C3   ; jump table for subtasks of $17B2
       defb $40,$19,$48,$19,$84,$19,$D9,$18,$D1,$18,$AC,$18,$40,$19,$F5,$17
       defb $52,$18,$D1,$18,$08,$18,$D1,$18,$40,$18,$40,$19,$E1,$17
;
;
_17E1  ld   a,($92AF)  ; subtask of _17B2, it happens during demo or HEROES screen ; something going on here with GALACTIC HERO screen
_17E4  and  a
_17E5  jr   z,_17EC
_17E7  dec  a          ; when does it not take the jr? when "GALACTIC HEROES" appear
_17E8  jp   z,_19A7
_17EB  ret
_17EC  call _3214
_17EF  ld   a,$0A
_17F1  ld   ($92AF),a
_17F4  ret
;
;
_17F5  ld   a,($92A0)  ; a _17B2 sub-task? we have just cleared the screen from train-mode
_17F8  and  $1F
_17FA  cp   $1F
_17FC  ret  nz
_17FD  ld   a,$01
_17FF  ld   ($9005),a
_1802  ld   c,$02
_1804  rst  $30
_1805  jp   _19A7
;
;
; _17B2 sub-task... boss with captured-ship has just rejoined fleet in demo
_1808  call _133A
_180B  ld   hl,$181F
_180E  ld   ($9282),hl
_1811  ld   a,$01
_1813  ld   ($9003),a
_1816  ld   ($9015),a
_1819  ld   ($9025),a
_181C  jp   _19A7
;
_181F ; data , s.a. _180B, not sure how it's used or exactly how much is data
       defb $08,$18,$8A,$08,$88,$06,$81,$28,$81,$05,$54,$1A,$88,$12,$81,$0F
       defb $A2,$16,$AA,$14,$88,$18,$88,$10,$43,$82,$10,$88,$06,$A2,$20,$56,$C0

; _17B2 sub-task... end of demo just before "HEROES" displayed
_1840  rst  $28
_1841  call _1230
_1844  xor  a
_1845  ld   ($9010),a
_1848  ld   ($920B),a
_184B  inc  a
_184C  ld   ($9002),a
_184F  jp   _19A7
;
;
; _17B2 sub-task (after _17F5) we have just cleared the screen from train-mode with "GAME OVER" showed
_1852  xor  a 
_1853  ld   ($982B),a
_1856  inc  a
_1857  ld   ($9AB7),a
_185A  ld   ($9821),a
_185D  ld   ($9003),a
_1860  ld   ($9015),a
_1863  ld   ($9825),a
_1866  ld   hl,$1887   ; ld the table address
_1869  ld   ($9282),hl
_186C  call _01C5
_186F  call _133A      ; apparently erases some stuff from screen?
_1872  ld   a,$01
_1874  ld   ($920B),a
_1877  ld   ($9842),a
_187A  ld   ($982C),a
_187D  inc  a
_187E  ld   ($99C4),a
_1881  ld   ($99C5),a
_1884  jp   _19A7
;
;
_1887 ; s.a. _1700, table contains offsets 
       defb $02,$8A,$04,$82,$07,$AA,$28,$88,$10,$AA,$38,$82,$12,$AA,$20,$88
       defb $14,$AA,$20,$82,$06,$A8,$0E,$A2,$17,$88,$12,$A2,$14,$18,$88,$1B
       defb $81,$2A,$5F,$4C,$C0
;
;
_18AC  ld   a,($92AE)  ; a _17B2 sub-task? after _179C, before _2535, start of explosion of far-left boss in train-mode
_18AF  and  a
_18B0  jr   z,_18BB
_18B2  dec  a          ; a little bit more of that explosion
_18B3  jp   z,$19A7
_18B6  cp   $05
_18B8  jr   z,_18C6
_18BA  ret
_18BB  ld   a,$34
_18BD  ld   ($9234),a
_18C0  ld   a,$09
_18C2  ld   ($92AE),a
_18C5  ret
_18C6  xor  a          ; now the little '150' marker has justed showed up on far-left boss place
_18C7  ld   ($9362),a
_18CA  ld   c,$13
_18CC  rst  $30
_18CD  ld   c,$14
_18CF  rst  $30
_18D0  ret
;
;
_18D1  ld   a,($9003)  ; _17B2 subtask, ship just appeared in train-mode
_18D4  and  a
_18D5  jp   z,_19A7
_18D8  ret
;
;
_18D9  ld   b,$07      ; a sub-task of _17B2, it puts on the row of bosses and reds in train-mode
_18DB  call _128C
_18DE  djnz _18DB
_18E0  xor  a
_18E1  ld   ($9820),a
_18E4  ld   ($9005),a
_18E7  call _133A      ; apparently erases some stuff from screen?
_18EA  ld   hl,$FF0D
_18ED  ld   ($92C5),hl
_18F0  ld   ($92C4),hl
_18F3  ld   ($92C1),hl
_18F6  ld   ($92C0),hl
_18F9  ld   hl,$1928   ; ld the table address
_18FC  ld   ($9282),hl
_18FF  xor  a
_1900  ld   b,$10
_1902  ld   hl,$92CA
_1905  rst  $18
_1906  ld   ($9827),a
_1909  ld   ($920B),a
_190C  inc  a
_190D  ld   ($982B),a
_1910  ld   ($9010),a
_1913  ld   ($900B),a
_1916  ld   ($9003),a
_1919  ld   a,($6803)
_191C  rrca
_191D  and  $01
_191F  ld   ($9AB7),a
_1922  call _1269
_1925  jp   _19A7
;
_1928  ; table of indexs to the subtasks of _1700
       defb $08,$1B,$81,$3D,$81,$0A,$42,$19,$81,$28,$81,$08
       defb $18,$81,$2E,$81,$03,$1A,$81,$11,$81,$05,$42,$C0
;
;
_1940  call _0160      ; this is like a subtask used during "CREDIT 0" from $17B2 task
_1943  call _003C
_1946  jr   _19A7      ; from  $19A7, do a couple of things then back to $0291 we go
;
; from $17B2 task, we jp here when "GALAGA" displayed in attract mode
_1948  ld   hl,$195C   ; ld the table address
_194B  ld   ($9280),hl
_194E  xor  a
_194F  ld   ($9205),a
_1952  ld   ($92A8),a
_1955  ld   a,$02
_1957  ld   ($92AE),a
_195A  jr   _19A7      ; from  $19A7, do a couple of things then back to $0291 we go
;
;
_195C ; data source for sprites used in attract mode
      ; 4-bytes each: index (sprite to use), color/code, L/R offset, T/D offset
       defb $08,$1B,$44,$3A,$0A,$12,$44,$42,$0C,$08,$7C,$50,$34,$08,$34,$5C
       defb $30,$08,$64,$5C,$32,$08,$94,$5C,$4A,$12,$A4,$64,$36,$08,$C4,$5C
       defb $58,$12,$B4,$64,$52,$12,$D4,$64
;
;
                       ; begin 'call _1984', subtask of $17B2 task
_1984  ld   a,($92AE)  
_1987  and  a
_1988  ret  nz
_1989  ld   a,$02      ; display an attract screen text
_198B  ld   ($92AE),a
_198E  ld   a,($9205)
_1991  cp   $05
_1993  jr   z,_19A7
_1995  inc  a
_1996  ld   ($9205),a
_1999  add  a,$0D
_199B  ld   c,a
_199C  rst  $30
_199D  ld   a,($9205)  ; apparently checks for a sprite to display with the text
_19A0  cp   $03
_19A2  ret  c
_19A3  call _128C
_19A6  ret             ; end subtask $1984
;
;
_19A7  ld   hl,$9203   ; end of subtasks _17F5, _1852, _18D9, _1940, _1948, _1984
_19AA  inc  (hl)
_19AB  ld   a,(hl)
_19AC  cp   $0F
_19AE  ret  nz         ; back to $0291
_19AF  ld   (hl),$00   ; HL==$9203 ... this is when "HEROES" screen is up
_19B1  ret
;
;
_19B2  ld   a,($928E)   ; main-task, Demo... boss just grabbed your ship
_19B5  and  a
_19B6  jr   nz,_19D2
_19B8  ld   hl,$92AD    ; again, your fighter has been captured
_19BB  or   (hl)
_19BC  jr   z,_1A01
_19BE  cp   $04
_19C0  jr   nz,_19C7
_19C2  dec  a           ; finally, "FIGHTER CAPTURED" was shown, boss getting ready to go home
_19C3  ld   (hl),a
_19C4  ld   ($9AA9),a
_19C7  ld   a,($9829)
_19CA  add  a,$0D
_19CC  ld   l,a
_19CD  ld   h,$91
_19CF  ld   (hl),$04
_19D1  ret
;
;
_19D2  ld   c,$0A     ; from _19B6, 
_19D4  rst  $30
_19D5  ld   a,$06
_19D7  ld   ($92AD),a
_19DA  ld   hl,$9362
_19DD  ld   a,($9828)
_19E0  and  $07
_19E2  ld   e,a
_19E3  ld   d,h
_19E4  ld   a,(hl)
_19E5  ld   (de),a
_19E6  ld   (hl),$00
_19E8  inc  l
_19E9  inc  e
_19EA  ld   a,(hl)
_19EB  ld   (de),a
_19EC  ld   h,$9B
_19EE  ld   d,h
_19EF  ld   a,(hl)
_19F0  ld   (de),a
_19F1  ld   h,$8B
_19F3  ld   l,e
_19F4  ld   (hl),$07
_19F6  dec  l
_19F7  ld   (hl),$07
_19F9  xor  a
_19FA  ld   ($928B),a
_19FD  ld   ($928E),a
_1A00  ret
;
;
_1A01  ld   a,($82D1)    ; from _19BC
_1A04  cp   $24
_1A06  jr   z,_1A10
_1A08  ld   c,$0B
_1A0A  ld   hl,$83B1
_1A0D  call _1398
_1A10  ld   a,($9828)
_1A13  ld   l,a
_1A14  and  $07
_1A16  ld   e,a
_1A17  ld   h,$88
_1A19  ld   a,($9215)
_1A1C  ld   c,a
_1A1D  ld   a,(hl)
_1A1E  cp   $09
_1A20  jr   nz,_1A3F
_1A22  ld   h,$93
_1A24  ld   d,h
_1A25  ld   a,(hl)
_1A26  ld   (de),a
_1A27  inc  l
_1A28  inc  e
_1A29  ld   a,$10
_1A2B  bit  0,c
_1A2D  jr   z,_1A31
_1A2F  neg               ; in demo, not taken?
_1A31  ld   b,a
_1A32  add  a,(hl)
_1A33  ld   (de),a
_1A34  rra
_1A35  xor  b
_1A36  rlca
_1A37  and  $01
_1A39  ld   h,$9B
_1A3B  ld   d,h
_1A3C  xor  (hl)
_1A3D  ld   (de),a
_1A3E  ret
;
;
_1A3F  ld   hl,$928B     ; from _1A20, boss docking home with your ship in demo
_1A42  ld   a,(hl)
_1A43  and  a
_1A44  jr   nz,_1A4B
_1A46  ld   d,$8B
_1A48  ld   a,$06
_1A4A  ld   (de),a
_1A4B  inc  (hl)
_1A4C  cp   $24
_1A4E  jr   z,_1A6A
_1A50  ld   b,$01
_1A52  bit  0,c
_1A54  jr   nz,_1A58
_1A56  dec  b
_1A57  dec  b
_1A58  ld   l,e
_1A59  inc  l
_1A5A  ld   h,$93
_1A5C  ld   a,b
_1A5D  add  a,(hl)
_1A5E  ld   (hl),a
_1A5F  rra
_1A60  xor  b
_1A61  rlca
_1A62  ret  nc
_1A63  ld   h,$9B      ; when is ret not taken?
_1A65  ld   a,(hl)
_1A66  xor  $01
_1A68  ld   (hl),a
_1A69  ret
;
;
_1A6A  xor  a           ; from _1A4E, boss done docking home with your ship
_1A6B  ld   ($9011),a
_1A6E  ld   ($9AA9),a
_1A71  ld   d,$88
_1A73  inc  a
_1A74  ld   (de),a
_1A75  ld   ($9828),a
_1A78  ld   ($99B9),a
_1A7B  inc  a
_1A7C  ld   ($9213),a
_1A7F  ret
;
;
_1A80  ld   a,($99CA)  ; main task, in the demo
_1A83  ld   c,a
_1A84  ld   a,($92A7)
_1A87  cp   c
_1A88  ret  nc
_1A89  ld   a,($9841)  ; this code is not seen in demo ... maybe when get hi-score? sometime in stage-4
_1A8C  and  a
_1A8D  jr   nz,_1AD5
_1A8F  ld   hl,$8807
_1A92  ld   bc,$14FF
_1A95  ld   a,$01
_1A97  inc  l
_1A98  cpi
_1A9A  jr   z,_1AAB
_1A9C  djnz _1A97
_1A9E  ld   hl,$883F
_1AA1  ld   b,$10
_1AA3  inc  l
_1AA4  cpi
_1AA6  jr   z,_1AAB
_1AA8  djnz _1AA3
_1AAA  ret
;
;
_1AAB  ld   a,$C0       ; s.a. _1A9A ... maybe when get hi-score? sometime in stage-4
_1AAD  ld   ($9841),a
_1AB0  dec  l
_1AB1  ld   e,l
_1AB2  ld   d,$8B
_1AB4  inc  e
_1AB5  ld   a,(de)
_1AB6  dec  e
_1AB7  ld   c,a
_1AB8  ld   a,($9821)
_1ABB  srl  a
_1ABD  srl  a
_1ABF  ld   l,a
_1AC0  ld   h,$00
_1AC2  ld   a,$03
_1AC4  call _1061
_1AC7  add  a,$04
_1AC9  ld   hl,$982D
_1ACC  ld   (hl),e
_1ACD  inc  l
_1ACE  ld   (hl),c
_1ACF  inc  l
_1AD0  ld   (hl),a
_1AD1  ld   ($9AB2),a
_1AD4  ret
;
;
_1AD5  inc  a          ; s.a. _1A8D ... again, maybe when get hi-score? 
_1AD6  jr   z,_1AF4
_1AD8  ld   ($9841),a
_1ADB  ex   af,af'
_1ADC  ld   hl,$982D
_1ADF  ld   e,(hl)
_1AE0  ld   d,$88
_1AE2  ld   a,(de)
_1AE3  dec  a
_1AE4  jp   nz,_1B54
_1AE7  ld   d,$8B
_1AE9  inc  l
_1AEA  ex   af,af'
_1AEB  bit  4,a
_1AED  jr   z,_1AF0
_1AEF  inc  l
_1AF0  ld   a,(hl)
_1AF1  inc  e
_1AF2  ld   (de),a
_1AF3  ret
;
;
_1AF4  ld   a,($9015)  ; s.a. _1AD6  ... a few frames later in stage-4, and a "bonus-bee" has started
_1AF7  and  a
_1AF8  jr   nz,_1B00
_1AFA  ld   a,$E0
_1AFC  ld   ($9841),a
_1AFF  ret
;
;
_1B00  ld   a,($982D)   ; s.a. _1AF8
_1B03  ld   l,a
_1B04  ld   h,$88
_1B06  ld   a,(hl)
_1B07  dec  a
_1B08  jr   nz,_1B54
_1B0A  ld   h,$92
_1B0C  ld   a,(hl)
_1B0D  bit  7,a
_1B0F  jr   nz,_1B54
_1B11  ld   a,($982F)
_1B14  sub  $04
_1B16  ld   hl,$1B59
_1B19  rst  $08
_1B1A  ld   de,$99B0
_1B1D  ld   a,$03
_1B1F  ld   (de),a
_1B20  inc  e
_1B21  ldi
_1B23  ldi
_1B25  ld   a,($982F)
_1B28  sub  $04
_1B2A  and  $0F
_1B2C  ld   c,a
_1B2D  ld   hl,$1B5F
_1B30  rst  $08
_1B31  ld   e,(hl)
_1B32  inc  hl
_1B33  ld   d,(hl)
_1B34  ld   h,$8B
_1B36  ld   a,($982D)
_1B39  ld   l,a
_1B3A  ld   a,c
_1B3B  rlca
_1B3C  rlca
_1B3D  rlca
_1B3E  add  a,$56
_1B40  ld   c,(hl)
_1B41  ld   (hl),a
_1B42  ld   a,c
_1B43  and  $F8
_1B45  ld   c,a
_1B46  ld   a,($982E)
_1B49  and  $07
_1B4B  or   c
_1B4C  ld   ($982E),a
_1B4F  ld   h,$88
_1B51  call _1083
_1B54  xor  a           ; jr here, s.a. _1AE4, _1B0F
_1B55  ld   ($9004),a
_1B58  ret
;
;
_1B59  defb $1E,$BD,$0A,$B8,$14,$BC ; data...  s.a. _1B16
;
_1B5F  defb $EA,$04,$73,$04,$AB,$04 ; data ... s.a. _1B2D
;
;
_1B65  ld   a,($920B)   ; main-task, in the demo
_1B68  and  a
_1B69  jr   z,_1B75
_1B6B  ld   a,($9015)
_1B6E  ld   c,a
_1B6F  ld   a,($901D)
_1B72  cpl
_1B73  and  c
_1B74  ret  z
;
_1B75  ld   b,$04       ; from _1B69 ... bee docking during demo (to $1BFF)
_1B77  ld   hl,$92CA
_1B7A  ld   a,(hl)
_1B7B  inc  a
_1B7C  jr   nz,_1B8B
_1B7E  inc  l
_1B7F  inc  l
_1B80  inc  l
_1B81  djnz _1B7A
_1B83  ld   a,($92A0)
_1B86  and  $0F
_1B88  jr   z,_1BA8
_1B8A  ret
;
;
_1B8B  ld   (hl),$FF    ; bee divin,returning during demo
_1B8D  dec  a
_1B8E  ld   d,$88
_1B90  ld   e,a
_1B91  res  7,e
_1B93  ex   af,af'
_1B94  ld   a,(de)
_1B95  dec  a
_1B96  ret  nz
_1B97  inc  l
_1B98  ld   e,(hl)
_1B99  inc  l
_1B9A  ld   d,(hl)
_1B9B  ex   af,af'
_1B9C  ld   l,a
_1B9D  ld   h,$88
_1B9F  call _1079
_1BA2  ld   a,$01
_1BA4  ld   ($9AB3),a
_1BA7  ret
;
;
_1BA8  ld   hl,$92C0    ; from _1B88
_1BAB  ld   b,$03
_1BAD  dec  (hl)
_1BAE  jr   z,_1BB4
_1BB0  inc  l
_1BB1  djnz _1BAD
_1BB3  ret
_1BB4  ld   a,($99C4)
_1BB7  ld   c,a
_1BB8  ld   a,($9287)
_1BBB  cp   c
_1BBC  jr   c,_1BC0
_1BBE  inc  (hl)           ; apparently jr not taken when ship about to first shoot in train-mode
_1BBF  ret
;
;
_1BC0  set  2,l            ; from _1BBC
_1BC2  ld   a,(hl)
_1BC3  res  2,l
_1BC5  ld   (hl),a         ; apparently this is called as a main-task, demo with fleet all loaded up
_1BC6  ld   a,b
_1BC7  dec  a
_1BC8  ld   hl,$1BD1       ; ld the table address
_1BCB  rst  $08            ; HL:+=2A
_1BCC  ld   a,(hl)
_1BCD  inc  hl
_1BCE  ld   h,(hl)
_1BCF  ld   l,a
_1BD0  jp   (hl)           ;  call subtask of _1B65...this jp seems to occur when each time enemy attack is launching
;
; _1BD1 jp table, s.a. _1BD0
       defb $D7,$1B,$F7,$1B,$01,$1C
;
_1BD7  ld   b,$14         ; from _1BD0, subtask of _1B65
_1BD9  ld   hl,$8808
_1BDC  ld   de,$034F
_1BDF  ld   a,($982D)     ; from _1BFF
_1BE2  ld   c,a
_1BE3  ld   a,(hl)
_1BE4  dec  a
_1BE5  jr   nz,_1BEB
_1BE7  ld   a,c
_1BE8  cp   l
_1BE9  jr   nz,_1BF0
_1BEB  inc  l
_1BEC  inc  l
_1BED  djnz _1BE3
_1BEF  ret
;
;
_1BF0  ld   ($9AB3),a     ; from _1BE9
_1BF3  call _1083
_1BF6  ret
;
;
_1BF7  ld   b,$10         ; from _1BD0, subtask of _1B65
_1BF9  ld   hl,$8840
_1BFC  ld   de,$03A9
_1BFF  jr   _1BDF
;
;
_1C01  ld   a,($982B)     ; from _1BD0, subtask of _1B65 ... as bosses dive in demo, or in second-train mode as bosses begin to dive
_1C04  and  a
_1C05  jr   nz,_1C30
_1C07  ld   hl,$982C
_1C0A  inc  (hl)
_1C0B  bit  0,(hl)
_1C0D  jr   nz,_1C30
_1C0F  ld   ixl,$02
_1C12  ld   iy,$0454
_1C16  ld   de,$8830
_1C19  ld   b,$04
_1C1B  ld   a,(de)
_1C1C  dec  a
_1C1D  jr   z,_1C24
;
_1C1F  inc  e         ; this bit is not in demo
_1C20  inc  e
_1C21  djnz _1C1B
_1C23  ret
;
;
_1C24  ld   a,$01     ; from _1C1D
_1C26  ld   ($982B),a
_1C29  ld   a,e
_1C2A  ld   ($9828),a
_1C2D  jp   $1CAE
;
; in demo, boss has dived tractor-on, or second train mode as boss diving
_1C30  ld   hl,$1D2C
_1C33  ld   d,$88
_1C35  ld   bc,$0600
_1C38  ld   e,(hl)
_1C39  inc  hl
_1C3A  ld   a,($982D)
_1C3D  cp   e
_1C3E  jr   z,_1C44
_1C40  ld   a,(de)
_1C41  dec  a
_1C42  sub  $01
_1C44  rl   c
_1C46  djnz _1C38
_1C48  ld   ixl,$00
_1C4B  ld   b,$04
_1C4D  ld   ixh,c
_1C4F  ld   a,c
_1C50  and  $07
_1C52  cp   $04
_1C54  jr   z,_1C5B
_1C56  cp   $03
_1C58  call nc,_1C8D   ; call to 1C8D is wierd, it seems to go many frames! it may ret from _1CED
_1C5B  rr   c
_1C5D  djnz _1C4F
_1C5F  inc  ixl
_1C61  ld   c,ixh
_1C63  ld   b,$04
_1C65  ld   a,c
_1C66  and  $07
_1C68  call nz,_1C8D
_1C6B  rr   c
_1C6D  djnz _1C65
_1C6F  inc  ixl
_1C71  ld   de,$8830
_1C74  ld   b,$04
_1C76  ld   a,(de)
_1C77  dec  a
_1C78  jr   z,_1CA0
_1C7A  inc  e
_1C7B  inc  e
_1C7C  djnz _1C76
_1C7E  ld   hl,$8800
_1C81  ld   b,$04
_1C83  ld   a,(hl)
_1C84  dec  a
_1C85  jp   z,_1D25
_1C88  inc  l
_1C89  inc  l
_1C8A  djnz _1C83
_1C8C  ret
;
_1C8D  ld   a,b
_1C8E  bit  1,a
_1C90  jr   z,_1C94
_1C92  xor  $01
_1C94  and  $03
_1C96  sla  a
_1C98  add  a,$30
_1C9A  ld   e,a
_1C9B  ld   a,(de)
_1C9C  cp   $01
_1C9E  ret  nz
_1C9F  pop  hl
_1CA0  ld   iy,$0411
_1CA4  ld   a,($920B)
_1CA7  and  a
_1CA8  jr   nz,_1CAE
_1CAA  ld   iy,$00F1
;
_1CAE  ld   a,e     ; from _1C2D, _1CA8
_1CAF  rrca
_1CB0  rrca
_1CB1  ld   a,e
_1CB2  rla
_1CB3  rrca
_1CB4  ld   ($92CA),a
_1CB7  ex   af,af'
_1CB8  ld   ($92CB),iy
_1CBC  inc  b
_1CBD  ld   a,e
_1CBE  and  $07
_1CC0  ld   hl,$9830
_1CC3  rst  $10
_1CC4  ld   a,ixl
_1CC6  ex   de,hl
_1CC7  ld   hl,$1CFD
_1CCA  rst  $08
_1CCB  ld   a,(hl)
_1CCC  ld   (de),a
_1CCD  inc  hl
_1CCE  inc  e
_1CCF  ld   a,(hl)
_1CD0  ld   (de),a
_1CD1  ld   a,ixl
_1CD3  cp   $02
_1CD5  jr   z,_1CE3
_1CD7  ld   de,$92CD
_1CDA  dec  a
_1CDB  jr   z,_1CE0
_1CDD  call _1D03
_1CE0  call _1D03
;
_1CE3  ld   a,($92CA)    ; from _1CD5
_1CE6  and  $07
_1CE8  ld   l,a
_1CE9  ld   h,$88
_1CEB  ld   a,(hl)
_1CEC  dec  a
_1CED  ret  nz
_1CEE  ld   c,l
_1CEF  ld   hl,$92CA
_1CF2  inc  l
_1CF3  inc  l
_1CF4  inc  l
_1CF5  ld   a,(hl)
_1CF6  inc  a
_1CF7  jr   nz,_1CF2
_1CF9  ex   af,af'
_1CFA  ld   a,c
_1CFB  jr   _1D16
;
_1CFD  defb $0D,$BA,$05,$B7,$01,$B5  ; data, s.a. _1CC7
;
_1D03  rrc  c          ; begin 'call _1D03', s.a. _1CD0,1CE0 ...with beam running in demo?
_1D05  jr   c,_1D0D
_1D07  dec  b          ; after boss docked home with ship
_1D08  rrc  c
_1D0A  jr   c,_1D0D
_1D0C  dec  b
_1D0D  ld   a,b
_1D0E  dec  b
_1D0F  ld   hl,$1D2C
_1D12  rst  $10        ; HL:+=A
_1D13  ex   af,af'
_1D14  ld   a,(hl)
_1D15  ex   de,hl
_1D16  rla             ; from _1CFB
_1D17  rrca
_1D18  ld   (hl),a
_1D19  ex   af,af'
_1D1A  inc  l
_1D1B  defb $FD,$7D    ; ld   a,iyl     TODO: z80-asm?
_1D1D  ld   (hl),a
_1D1E  inc  l
_1D1F  defb $FD,$7C    ; ld   a,iyh     TODO: z80-asm?
_1D21  ld   (hl),a
_1D22  inc  l
_1D23  ex   de,hl
_1D24  ret             ; back to _1CE0, end 'call _1D03'
;
;
_1D25  ld   de,$0444   ; jp here...when? s.a. _1C85
_1D28  call _1083
_1D2B  ret
;
;
_1D2C  defb $4A,$52,$5A,$58,$50,$48  ; s.a. _1D0F
;
;
_1D32  ; main task, likely when changin to player 2
_1D32  ld   hl,$99B4
_1D35  ld   a,(hl)
_1D36  and  $7F
_1D38  sub  $7E
_1D3A  jr   z,_1D72
_1D3C  ld   c,(hl)
_1D3D  inc  (hl)
_1D3E  ld   a,($9215)
_1D41  rlc  c
_1D43  xor  c
_1D44  rrca
_1D45  ld   a,$01
_1D47  jr   c,_1D4B
_1D49  neg
_1D4B  ld   c,a
_1D4C  ld   hl,$9814
_1D4F  ld   b,$06
_1D51  ld   a,(hl)
_1D52  add  a,c
_1D53  ld   (hl),a
_1D54  rra
_1D55  xor  c
_1D56  inc  l
_1D57  rlca
_1D58  jr   nc,_1D5E
_1D5A  ld   a,(hl)
_1D5B  xor  $01
_1D5D  ld   (hl),a
_1D5E  inc  l
_1D5F  djnz _1D51
_1D61  ld   a,($92A0)
_1D64  and  $FC
_1D66  inc  a
_1D67  push af
_1D68  call _23E0
_1D6B  pop  af
_1D6C  add  a,$02
_1D6E  call _23E0
_1D71  ret
;
;
_1D72  ld   ($900E),a   ; s.a. _1D3A
_1D75  ret
;
;
_1D76  ld   a,($9215)   ; main task... only in theme music?
_1D79  ld   b,a
_1D7A  ld   hl,$99B9
_1D7D  ld   a,(hl)
_1D7E  inc  l
_1D7F  and  a
_1D80  jr   z,_1DA8
_1D82  ld   a,(hl)
_1D83  and  a
_1D84  ld   a,$FD
_1D86  jr   nz,_1D9B
_1D88  inc  l
_1D89  ld   a,(hl)
_1D8A  inc  l
_1D8B  cp   (hl)
_1D8C  jr   z,_1D8F
_1D8E  inc  (hl)
_1D8F  ld   a,(hl)
_1D90  inc  l
_1D91  add  a,(hl)
_1D92  ld   c,a
_1D93  and  $3F
_1D95  ld   (hl),a
_1D96  ld   a,c
_1D97  rlca
_1D98  rlca
_1D99  and  $03
_1D9B  bit  0,b
_1D9D  jr   nz,_1DA1
_1D9F  neg
_1DA1  dec  a
_1DA2  and  $07
_1DA4  ld   ($99BE),a  ; s.a. _1DB1
_1DA7  ret
;
;
_1DA8  xor  a          ; s.a. _1D80
_1DA9  ld   (hl),a
_1DAA  inc  l
_1DAB  inc  l
_1DAC  ld   (hl),a
_1DAD  inc  l
_1DAE  ld   (hl),a
_1DAF  ld   a,$07
_1DB1  jr   _1DA4
;
_1DB3  ld   hl,$9200    ; end of theme?  apparently this is called as a main-task, sometime after very first boss appears in train-mode
_1DB6  ld   b,$30
_1DB8  bit  7,(hl)
_1DBA  jr   nz,_1DC1
_1DBC  inc  l
_1DBD  inc  l           ; s.a. _1DD0
_1DBE  djnz _1DB8
_1DC0  ret
;
;
_1DC1  res  7,(hl)      ; train-mode, boss got hit and turned blue
_1DC3  ld   h,$88
_1DC5  ld   (hl),$04
_1DC7  inc  l
_1DC8  ld   (hl),$40
_1DCA  ld   h,$8B
_1DCC  ld   (hl),$0A
_1DCE  ld   h,$92
_1DD0  jr   _1DBD
;
_1DD2  ld   a,($92A2)   ; task $1DD2
_1DD5  and  $01
_1DD7  ret  nz
_1DD8  ld   hl,$92AC
_1DDB  ld   b,$04
_1DDD  ld   a,(hl)
_1DDE  and  a
_1DDF  jr   z,_1DE2
_1DE1  dec  (hl)
_1DE2  inc  l
_1DE3  djnz _1DDD
_1DE5  ret              ; end task $1DD2
;
;
_1DE6  ld  a,($92A0)
_1DE9  and  $03
_1DEB  ret  nz
_1DEC  ld   hl,$920F    ; in game
_1DEF  ld   a,(hl)
_1DF0  ld   e,a
_1DF1  ld   d,$FF
_1DF3  bit  7,a
_1DF5  jr   nz,_1DFC
_1DF7  inc  d           ; when is jr not taken?
_1DF8  inc  d
_1DF9  inc  (hl)
_1DFA  jr   _1DFD
;
_1DFC  dec  (hl)
_1DFD  cp   $1F
_1DFF  jr   nz,_1E03
_1D01  set  7,(hl)      ; when is jr not taken?
_1E03  cp   $81
_1E05  jr   nz,_1E09
_1E07  res  7,(hl)      ; when is jr not taken?
_1E09  ld   c,(hl)
_1E0A  and  $07
_1E0C  ld   a,d
_1E0D  ld   ($9211),a
_1E10  ld   a,e
_1E11  jr   nz,_1E23
_1E13  ld   hl,$1E64    ; ld the table address  ... some particular point here of a bug-dive (and/or explosion) in demo
_1E16  ld   a,c
_1E17  and  $18
_1E19  rst  $08
_1E1A  ld   a,e
_1E1B  ld   de,$9920
_1E1E  ld   bc,$0010
_1E21  ldir
_1E23  ld   hl,$9215
_1E26  rlca
_1E27  xor  (hl)
_1E28  rrca
_1E29  ld   hl,$9920
_1E2C  ld   de,$9900
_1E2F  jr   nc,_1E36
_1E31  ld   bc,$01FF
_1E34  jr   _1E39
_1E36  ld   bc,$FF01
_1E39  ld   ixl,$05
_1E3C  call _1E43
_1E3F  ld   b,c
_1E40  ld   ixl,$0B
_1E43  rrc  (hl)
_1E45  jr   nc,_1E5C
_1E47  ld   a,(de)
_1E48  add  a,b
_1E49  ld   (de),a
_1E4A  ld   d,$98
_1E4C  ld   a,(de)
_1E4D  add  a,b
_1E4E  ld   (de),a
_1E4F  rra
_1E50  xor  b
_1E51  rlca
_1E52  jr   nc,_1E5A
_1E54  inc  e          ; when is jr not taken?
_1E55  ld   a,(de)
_1E56  xor  $01
_1E58  ld   (de),a
_1E59  dec  e
_1E5A  ld   d,$99
_1E5C  inc  e
_1E5D  inc  e
_1E5E  inc  l
_1E5F  dec  ixl
_1E61  jr   nz,_1E43
_1E63  ret
;
; data table, s.a. _1E13
_1E64  defb $FF,$77,$55,$14,$10,$10,$14,$55,$77,$FF,$00,$10,$14,$55,$77,$FF
_1E74  defb $FF,$77,$55,$51,$10,$10,$51,$55,$77,$FF,$00,$10,$51,$55,$77,$FF
_1E84  defb $FF,$77,$57,$15,$10,$10,$15,$57,$77,$FF,$00,$10,$15,$57,$77,$FF
_1E94  defb $FF,$F7,$D5,$91,$10,$10,$91,$D5,$F7,$FF,$00,$10,$91,$D5,$F7,$FF
;
;
_1EA4  ld   a,($92A0)  ; task $1EA4
_1EA7  and  $01
_1EA9  add  a,$02
_1EAB  ld   b,a
_1EAC  ld   a,($9215)
_1EAF  and  a
_1EB0  ld   a,b
_1EB1  jr   z,_1EB5
_1EB3  neg
_1EB5  ld   ixh,a
_1EB7  ld   l,$68
_1EB9  ld   de,$92B0
_1EBC  ld   ixl,$08
_1EBF  ld   h,$8B
_1EC1  ld   a,(hl)
_1EC2  cp   $30
_1EC4  jr   nz,_1EFF
_1EC6  ld   h,$93      ; only in theme ??
_1EC8  ld   a,(hl)
_1EC9  and  a
_1ECA  jr   z,_1EFF
_1ECC  ex   de,hl      ; in game during attack
_1ECD  ld   b,(hl)
_1ECE  ld   a,b
_1ECF  and  $7E
_1ED1  inc  l
_1ED2  add  a,(hl)
_1ED3  ld   c,a
_1ED4  and  $1F
_1ED6  ld   (hl),a
_1ED7  inc  l
_1ED8  ld   a,c
_1ED9  rlca
_1EDA  rlca
_1EDB  rlca
_1EDC  and  $07
_1EDE  bit  7,b
_1EE0  jr   z,_1EE4
_1EE2  neg
_1EE4  ex   de,hl
_1EE5  add  a,(hl)
_1EE6  ld   (hl),a
_1EE7  inc  l
_1EE8  ld   a,(hl)
_1EE9  add  a,ixh
_1EEB  ld   (hl),a
_1EEC  rra
_1EED  xor  ixh
_1EEF  rlca
_1EF0  jr   nc,_1EF9
_1EF2  ld   h,$9B
_1EF4  rrc  (hl)
_1EF6  ccf
_1EF7  rl   (hl)
_1EF9  inc  l          ; from _1EF0,_1F02
_1EFA  dec  ixl
_1EFC  jr   nz,_1EBF
_1EFE  ret             ; ret from task $1EA4
;
;
_1EFF  inc  l          ; jr from task _1EA4
_1F00  inc  e
_1F01  inc  e
_1F02  jr   _1EF9
;
_1F04  ld   a,($9215)
_1F07  add  a,$B6
_1F09  ld   l,a
_1F0A  ld   h,$99
_1F0C  bit  4,(hl)
_1F0E  ret  nz
_1F0F  ld   hl,$9364    ; in train-mode about to shoot at far-right boss...s.a. _172D
_1F12  ld   de,$92A4    ; bee docked durin demo?
_1F15  xor  a
_1F16  cp   (hl)
_1F17  jr   z,_1F1E
_1F19  ld   l,$66
_1F1B  inc  e
_1F1C  cp   (hl)
_1F1D  ret  nz
_1F1E  push de
_1F1F  ex   de,hl
_1F20  ld   hl,$9B63
_1F23  ld   d,h
_1F24  inc  e
_1F25  bit  2,(hl)
_1F27  jr   z,_1F2B
_1F29  pop  de          ; when is jr not taken?
_1F2A  ret
;
;
_1F2B  ldd              ; s.a. _1F27
_1F2D  ld   h,$93
_1F2F  ld   d,h
_1F30  ldi
_1F32  ldd
_1F34  ld   h,$9B
_1F36  ld   d,h
_1F37  ld   b,(hl)
_1F38  ex   de,hl
_1F39  ld   a,($9827)
_1F3C  and  $01
_1F3E  rlca
_1F3F  rlca
_1F40  rlca
_1F41  or   b
_1F42  ld   (hl),a
_1F43  ld   d,$8B
_1F45  ld   a,(de)
_1F46  ld   h,d
_1F47  and  $07
_1F49  ld   c,$30
_1F4B  cp   $05
_1F4D  jr   nc,_1F56
_1F4F  inc  c          ; when does it not take the jr?
_1F50  cp   $02
_1F52  jr   nc,_1F56
_1F54  inc  c
_1F55  inc  c
_1F56  ld   (hl),c
_1F57  cp   $04
_1F59  jr   c,_1F5E
_1F5B  cpl
_1F5C  add  a,$47
_1F5E  sla  a
_1F60  ld   c,a
_1F61  ld   a,b
_1F62  rrca
_1F63  rrca
_1F64  rrca
_1F65  and  $60
_1F67  ld   b,a
_1F68  ld   a,($9215)
_1F6B  and  a
_1F6C  ld   a,b
_1F6D  jr   nz,_1F71
_1F6F  xor  $60
_1F71  or   c
_1F72  pop  de
_1F73  ld   (de),a
_1F74  ld   h,$88
_1F76  ld   (hl),$06
_1F78  ld   a,$01
_1F7A  ld   ($9AAF),a
_1F7D  ld   hl,($9846)
_1F80  inc  hl
_1F81  ld   ($9846),hl
_1F84  ret
;
;
_1F85  ld   a,($9827)
_1F88  ld   e,a
_1F89  ld   a,($9215)
_1F8C  add  a,$B6
_1F8E  ld   l,a
_1F8F  ld   h,$99
_1F91  ld   a,(hl)
_1F92  and  $0A
_1F94  cp   $0A
_1F96  jr   z,_1FCF
_1F98  ld   hl,$9215     ; controller left/right...move ship, to 1FCD, and in train-mode
_1F9B  bit  0,(hl)
_1F9D  jr   z,_1FA1
_1F9F  xor  $0A          ; when is jr not taken?
_1FA1  ld   hl,$92A3
_1FA4  ld   b,a
_1FA5  ld   c,$01
_1FA7  ld   a,(hl)
_1FA8  xor  $01
_1FAA  ld   (hl),a
_1FAB  jr   nz,_1FAE
_1FAD  inc  c            ; when is jr not taken?
_1FAE  ld   hl,$9362
_1FB1  ld   a,(hl)
_1FB2  and  a
_1FB3  ret  z
_1FB4  bit  1,b
_1FB6  jr   nz,_1FC7
_1FB8  ld   a,(hl)      ; ship about to move in train-mode
_1FB9  cp   $D1
_1FBB  jr   c,_1FC0
_1FBD  bit  0,e         ; pretty far into demo
_1FBF  ret  nz
_1FC0  cp   $E1
_1FC2  ret  nc
_1FC3  add  a,c
_1FC4  ld   (hl),a
_1FC5  jr   _1FD4
_1FC7  ld   a,(hl)      ; ship at far-right in train-mode with boss and two reds diving
_1FC8  cp   $12
_1FCA  ret  c
_1FCB  sub  c
_1FCC  ld   (hl),a
_1FCD  jr   _1FD4
_1FCF  xor  a           ; ship at far-right in train-mode before boss and two reds diving
_1FD0  ld   ($92A3),a
_1FD3  ret
;
;
_1FD4  bit  0,e
_1FD6  ret  z           ; ret to _1758
_1FD7  add  a,$0F       ; this occurs way far into demo
_1FD9  ld   ($9360), a
_1FDC  ret
;
;
; 1FDD - 1FFE is $FF    
       org $1FFF
       defb  $8C        ; adc a,h ( $8C )  end ROM1
;
;
       org $2000
_2000  ld   a,($9828)   ; destroyed a bug in DEMO mode?
_2003  ld   l,a
_2004  ld   h,$88
_2006  ld   a,(hl)
_2007  and  a
_2008  jp   nz,_20BF
_200B  ld   a,($928B)
_200E  and  a
_200F  jp   z,_20C7
_2012  dec  a
_2013  jp   z,_20D1
_2016  ld   h,$93       ; rescued ship stop spinning? (DEMO mode?)
_2018  ld   a,(hl)
_2019  cp   $80
_201B  jr   z,_2026
_201D  jp   p,_2023
_2020  inc  (hl)
_2021  jr   _205E
_2023  dec  (hl)
_2024  jr   _205E
;
_2026  inc l           ; rescued your ship??
_2027  ld   a,($9215)
_202A  and  a
_202B  jr   nz,_204C
_202D  ld   a,(hl)
_202E  cp   $29
_2030  jr   nz,_2041
;
_2032  ld   h,$9B      ; when not jr?
_2034  ld   a,(hl)
_2035  ld   h,$93
_2037  dec  a
_2038  jr   nz,_2041
_203A  ld   a,$03
_203C  ld   ($928B),a
_203F  jr   _205E
;
_2041  inc  (hl)
_2042  jr   nz,_205E
_2044  ld   h,$9B      ; your rescued ship is "landing"
_2046  ld   a,(hl)
_2047  xor  $01
_2049  ld   (hl),a
_204A  jr   _205E
;
_204C  ld   a,(hl)    ; s.a. _202B...I have no idea when it jr's here
_204D  cp   $37
_204F  jr   nz,_2059
_2051  ld   h,$9B
_2053  ld   a,(hl)
_2054  ld   h,$93
_2056  and  a
_2057  jr   z,_203A
_2059  dec  (hl)
_205A  ld   a,(hl)
_205B  inc  a
_205C  jr   z,_2044
;
_205E  ld   hl,$8B62   ; jr here, s.a. _2042,_203F
_2061  ld   a,(hl)
_2062  sub  $06
_2064  ld   c,a
_2065  ld   h,$93
_2067  jr   nz,_2075
_2069  ld   a,(hl)
_206A  cp   $71
_206C  jr   z,_2075
_206E  jp   p,_2073
_2071  inc  (hl)       ; when not jp?
_2072  ret
;
_2073  dec  (hl)       ; jp here, s.a. _206E
_2074  ret
;
;
_2075  ld   a,($928B)  ; jr here, s.a. _2067...your rescued ship is "landing"
_2078  cp   $03
_207A  ret  nz
_207B  ld   a,($9828)  ; with both ships docked in demo
_207E  ld   l,a
_207F  ld   (hl),$00
_2081  inc  l
_2082  dec  c
_2083  inc  c
_2084  jr   z,_208F
_2086  ld   de,$9363   ; when not jr?
_2089  xor  a
_208A  ld   ($982B),a
_208D  jr   _2097
;
_208F  ld   a,$01      ; jr here, s.a. _2084
_2091  ld   ($9827),a
_2094  ld   de,$9361
_2097  ld   a,(hl)     ; jr here, s.a. _208D
_2098  ld   (de),a
_2099  ld   h,$9B
_209B  ld   d,h
_209C  ld   a,(hl)
_209D  ld   (de),a
_209E  dec  l
_209F  ld   h,$88
_20A1  ld   (hl),$80
_20A3  ld   h,$8B
_20A5  ld   l,e
_20A6  dec  l
_20A7  ld   (hl),$06
_20A9  inc  l
_20AA  ld   (hl),$09
_20AC  dec  l
_20AD  ld   h,$93
_20AF  ld   (hl),$80
_20B1  ld   a,$01
_20B3  ld   ($9014),a
_20B6  ld   ($9015),a
_20B9  ld   ($9025),a
_20BC  ld   ($99B9),a
_20BF  xor  a           ; starting a new ship after death?
_20C0  ld   ($901D),a
_20C3  ld   ($9AB1),a
_20C6  ret
;
_20C7  inc  a           ; s.a. _200F
_20C8  ld   ($928B),a
_20CB  ld   a,$02
_20CD  ld   ($92AD),a
_20D0  ret
;
_20D1  ld   h,$9B       ; s.a. _2013
_20D3  ld   a,($92AD)
_20D6  ld   e,a
_20D7  ld   a,($9287)
_20DA  or   e
_20DB  ld   ($928D),a
_20DE  call _2188
_20E1  dec  b
_20E2  ret  nz
_20E3  ld   ($9014),a  ; your rescued ship is landing
_20E6  ld   ($9015),a
_20E9  ld   ($9025),a
_20EC  ld   a,$02
_20EE  ld   ($928B),a
_20F1   ret
;
                       ; main task
_20F2  ld   hl,$9B62   ; tractor just got to your ship in demo
_20F5  call _2188
_20F8  bit  0,b
_20FA  jr   nz,_2151
_20FC  ld   a,($928B)
_20FF  bit  7,a
_2101  jr   nz,_215D
_2103  ld   a,($928D)
_2106  and  a
_2107  ret  z
_2108  ld   h,$93
_210A  ld   a,($9828)
_210D  ld   e,a
_210E  ld   d,h
_210F  ld   a,(de)
_2110  cp   (hl)
_2111  jr   z,_211A
_2113  jp   p,_2119    ; when is jr not taken?
_2116  dec  (hl)
_2117  jr   _211A
;
_2119  inc  (hl)
_211A  inc  l          ; tractor just about to grab ship in demo
_211B  ld   a,($9215)
_211E  and  a
_211F  jr   z,_212C
_2121  inc  (hl)       ; when is jr not taken?
_2122  ld   a,(hl)
_2123  cp   $7A
_2125  jr   z,_214C
_2127  cp   $80
_2129  jr   z,_2141
_212B  ret
;
;
_212C  dec  (hl)         ; jr here, s.a. _211F
_212D  ld   a,(hl)
_212E  inc  a
_212F  jr   nz,_2139
_2131  ld   h,$9B
_2133  ld   a,(hl)
_2134  xor  $01
_2136  ld   (hl),a
_2137  ld   h,$93
_2139  ld   a,(hl)    ; jr here, s.a. _212F
_213A  cp   $E6
_213C  jr   z,_214C
_213E  cp   $E0
_2140  ret  nz        ; back to task loop
_2141  xor  a         ; jr here, s.a. _2129
_2142  ld   ($928D),a
_2145  inc  a
_2146  ld   a,$07
_2148  ld   ($8B63),a
_214B  ret
;
_214C  xor  a         ; jr here, s.a. _2125,_213C...tractor got ship, boss almost connect with it
_214D  ld   ($9015),a
_2150  ret
;
_2151  ld   a,($9015) ; boss connected with ship, from _20FA
_2154  and  a
_2155  jr   nz,_215D
_2157  inc  a
_2158  ld   ($920D),a
_215B  jr   _217F
;
_215D  ld   h,$93     ; s.a. _2101,_2155, demo doesn't run code here
_215F  inc  l
_2160  ld   a,($9215)
_2163  and  a
_2164  jr   z,_216D
_2166  ld   a,(hl)
_2167  cp   $37
_2169  jr   z,_217D
_216B  dec  (hl)
_216C  ret
;
;
_216D  ld   a,(hl)    ; s.a. _2164
_216E  cp   $29
_2170  jr   z,_217D
_2172  inc  (hl)
_2173  ret  nz
_2174  ld   h,$9B
_2176  ld   a,(hl)
_2177  xor  $01
_2179  ld   (hl),a
_217A  ld   h,$93
_217C  ret
;
;
_217D  dec  b          ; s.a. _2170
_217E  ret  nz
;
_217F  xor  a          ; jr here, s.a. _215B
_2180  ld   ($901C),a
_2183  inc  a
_2184  ld   ($9025),a
_2187  ret             ; back to task loop
;
;
_2188  ld   a,(hl)     ; demo, tractor-beam about to grab your ship, s.a. _20F5
_2189  ld   c,a
_218A  srl  a
_218C  xor  c
_218D  ld   c,a
_218E  ld   h,$8B
_2190  ld   b,$00
_2192  ld   a,(hl)
_2193  and  $07
_2195  cp   $06
_2197  jr   nz,_21A7
_2199  dec  c          ; tractor beam grabbed ship in demo
_219A  inc  c
_219B  jr   nz,_21A7
_219D  ex   af,af'     ; again, tractor grabbed ship
_219E  ld   a,($928D)
_21A1  and  a
_21A2  jr   nz,_21A6
_21A4  inc  b
_21A5  ret
;
;
_21A6  ex   af,af'    ; jr here, s.a. _21A2
_21A7  bit  0,c       ; s.a. _2197, _219B
_21A9  jr   nz,_21B2
_21AB  cp   $06
_21AD  jr   z,_21B8
_21AF  inc  (hl)
_21B0  jr   _21C0
_21B2  and  a         ; tractor beam grabbing ship (DEMO?)
_21B3  jr   z,_21B8
_21B5  dec  (hl)
_21B6  jr   _21C0
_21B8  dec  c         ; this also have to do with tractor beam grabbing ship (DEMO?)
_21B9  jp   p,_21A7
_21BC  ld   c,$03     ; this also have to do with tractor beam grabbing ship (DEMO?)
_21BE  jr   _21A7
_21C0  ld   a,c
_21C1  bit  1,a
_21C3  jr   z,_21C7
_21C5  xor  $01
_21C7  ld   h,$9B
_21C9  ld   (hl),a
_21CA  ret
;
;
_21CB  ld   hl,$9828   ; main task, boss that tractors start dive demo
_21CE  ld   e,(hl)
_21CF  ld   d,$88
_21D1  ld   a,(de)
_21D2  cp   $09
_21D4  jr   nz,_221A
_21D6  inc  l
_21D7  ld   a,(hl)
_21D8  ld   ixl,a
_21DA  ld   ixh,$91
_21DD  ld   a,(ix+$0a)
_21E0  and  a
_21E1  ret  nz
_21E2  ld   a,$0C       ; tractor boss pretty far into dive
_21E4  bit  0,(ix+$05)
_21E8  jr   z,_21EC
_21EA  neg
_21EC  ld   (ix+$0c),a
_21EF  ld   a,(ix+$05)
_21F2  rrca
_21F3  ld   a,(ix+$04)
_21F6  rra
_21F7  sub  $78
_21F9  cp   $10
_21FB  ret  nc
_21FC  ld   a,($99C6)   ; tractor boss dive fairly complete
_21FF  ld   ($982A),a
_2202  xor  a
_2203  ld   (ix+$0c),a
_2206  ld   ($9019),a
_2209  ld   ($928B),a
_220C  ld   ($920D),a
_220F  inc  a
_2210  ld   ($9018),a
_2213  ld   ($928C),a
_2216  ld   ($928D),a
_2219  ret


_221A  xor  a          ; s.a. _21D4, who knows what it does?
_221B  ld   ($9019),a
_221E  ld   ($982B),a
_2221  ret
;
;
_2222  ld   a,($92A0)  ; main task,  demo boss about to start tractor, also for game
_2225  ld   c,a
_2226  and  $03
_2228  jr   nz,_2257
_222A  ld   a,($928A)  ; after tractor just start
_222D  neg
_222F  sub  $18
_2231  ld   h,$21
_2233  rlca
_2234  rl   h
_2236  rlca
_2237  rl   h
_2239  and  $E0
_223B  add  a,$15
_223D  ld   l,a
_223E  ld   a,c
_223F  rrca
_2240  rrca
_2241  and  $03
_2243  jr   nz,_2246
_2245  inc  a
_2246  add  a,$17
_2248  ld   de,$0016
_224B  ld   c,$06
_224D  ld   b,$0A
_224F  ld   (hl),a
_2250  inc  l
_2251  djnz _224F
_2253  add  hl,de
_2254  dec  c
_2255  jr   nz,_224D
_2257  ld   hl,$928B   ; s.a. _2228
_225A  bit  7,(hl)
_225C  jr   nz,_226A
_225E  ld   a,($9828)
_2261  ld   e,a
_2262  ld   d,$88
_2264  ld   a,(de)
_2265  cp   $09
_2267  jp   nz,_2327
_226A  ld   hl,$928C
_226D  dec  (hl)
_226E  jp   nz,_233D
_2271  ld   a,($982A)
_2274  ld   (hl),a
_2275  ld   hl,$928B
_2278  bit  7,(hl)
_227A  jr   nz,_22AB
_227C  ld   ($9AA5),a
_227F  ld   a,($9829)
_2282  add  a,$0D
_2284  ld   e,a
_2285  ld   d,$91
_2287  ld   a,$FF
_2289  ld   (de),a
_228A  inc  (hl)
_228B  ld   a,(hl)
_228C  and  $0F
_228E  cp   $0B
_2290  jr   z,_22D2
_2292  bit  6,(hl)
_2294  jr   nz,_22C1
_2296  push af
_2297  ld   c,a
_2298  rlca
_2299  add  a,c
_229A  ld   hl,$239B    ; get data src, getting ready to shoot the tractor beam
_229D  rst  $08         ; HL:+=2A
_229E  pop  af
_229F  call _238A
_22A2  ld   b,$06
_22A4  ld   a,(hl)
_22A5  ld   (de),a
_22A6  inc  hl
_22A7  rst  $20
_22A8  djnz _22A4
_22AA  ret
;
;
_22AB  inc  (hl)        ; jr here, s.a. _227A
_22AC  ld   a,(hl)
_22AD  and  $0F
_22AF  cp   $0B
_22B1  jr   nz,_22C5
_22B3  xor  a
_22B4  ld   ($9018),a
_22B7  ld   ($9AA5),a
_22BA  ld   ($9AA6),a
_22BD  ld   ($982B),a
_22C0  ret
;
;
_22C1  neg              ; boss almost ready to attach to the ship, s.a. _2294
_22C3  add  a,$0B
_22C5  call _238A
_22C8  ld   b,$06
_22CA  ld   c,$24
_22CC  ld   a,c
_22CD  ld   (de),a
_22CE  rst  $20
_22CF  djnz _22CC
_22D1  ret
;
;
_22D2  bit  6,(hl)     ; got the ship, ship is red, beam gone, s.a. _2290
_22D4  jr   z,_231C
_22D6  ld   a,($920D)
_22D9  and  a
_22DA  jr   z,_22E3
_22DC  bit  5,(hl)
_22DE  jr   nz,_22E3
_22E0  ld   (hl),$68
_22E2  ret
;
;
_22E3  xor  a          ; again, got the ship, ship is red, beam gone, s.a. _2290
_22E4  ld   ($9018),a
_22E7  ld   ($9AA5),a
_22EA  ld   ($9AA6),a
_22ED  ld   a,($920D)
_22F0  and  a
_22F1  ld   a,($9829)
_22F4  jr   nz,_2305
_22F6  add  a,$0D
_22F8  ld   e,a
_22F9  ld   d,$91
_22FB  xor  a
_22FC  ld   ($982B),a
_22FF  inc  a
_2300  ld   ($9828),a
_2303  ld   (de),a
_2304  ret
;
;
_2305  add  a,$08       ; s.a. _22F4
_2307  ld   l,a
_2308  ld   h,$91
_230A  ld   de,$046B
_230D  ld   (hl),e
_230E  inc  l
_230F  ld   (hl),d
_2310  xor  a
_2311  ld   ($99BA),a
_2314  inc  a
_2315  ld   ($9011),a
_2318  ld   ($928E),a
_231B  ret
;
;
_231C  ld   a,$40       ; s.a. _22D4 ... beam just about got ship
_231E  ld   ($928C),a
_2321  ld   a,$40
_2323  ld   ($928B),a
_2326  ret
;
;
_2327  ld   a,$03       ; s.a. _2267
_2329  ld   ($982A),a
_232C  ld   (hl),$80
_232E  xor  a
_232F  ld   ($928D),a
_2332  ld   ($99BA),a
_2335  inc  a
_2336  ld   ($928C),a
_2339  ld   ($9014),a
_233C  ret
;
;
_233D  ld   a,($928B)   ; s.a. _226E... tractor just started
_2340  cp   $40
_2342  ret  nz
_2343  ld   a,($9215)   ; tractor just about to grab ship
_2346  ld   c,a
_2347  ld   a,($9362)
_234A  bit  0,c
_234C  jr   z,_2352
_234E  add  a,$0E
_2350  neg
_2352  ld   b,a
_2353  ld   a,($928A)
_2356  sub  b
_2357  add  a,$1B
_2359  cp   $36
_235B  ret  nc
_235C  ld   a,($9201)
_235F  dec  a
_2360  jr   z,_236D
_2362  ld   a,($9014)
_2365  ld   c,a
_2366  ld   a,($9213)
_2369  xor  $01
_236B  and  c
_236C  ret  z
_236D  xor  a
_236E  ld   ($9014),a
_2371  ld   ($9AA5),a
_2374  ld   ($9025),a
_2377  ld   ($9213),a
_237A  inc  a
_237B  ld   ($901C),a
_237E  ld   ($9AA6),a
_2381  ld   ($99BA),a
_2384  ld   a,$0A
_2386  ld   ($982A),a
_2389  ret
;
;
_238A  ld   c,a        ; begin 'call _238A', demo boss about to start tractor...s.a. _229F
_238B  ld   a,($928A)
_238E  neg
_2390  add  a,$10
_2392  ld   d,$20
_2394  rlca
_2395  rl   d
_2397  rlca
_2398  rl   d
_239A  and  $E0
_239C  add  a,$14
_239E  add  a,c
_239F  ld   e,a
_23A0  ret
;
;
_23A1  ; data, 6-bytes per entry, s.a. _229A (table starts 6-bytes past the value we ld to HL)
       defb $24,$4E,$4F,$50,$51,$24,$24,$52,$53,$54
       defb $55,$24,$24,$56,$57,$58,$59,$24,$24,$5A,$5B,$5C,$5D,$24,$24,$5E
       defb $5F,$60,$61,$24,$62,$63,$64,$65,$66,$67,$68,$69,$6A,$6B,$6C,$6D
       defb $6E,$6F,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7A,$7B,$7C,$7D
       defb $7E,$7F
;
;
_23DD  ld   a,($92A0)  ; task $23DD
_23E0  bit  0,a        ; begin 'call _23E0', s.a. _1D68,_1D6E
_23E2  jp   z,_2596
_23E5  and  $02
_23E7  ld   e,a
_23E8  ld   a,($92A6)
_23EB  ld   ixl,a
_23ED  ld   b,$20
_23EF  ld   d,$88      ; from $241A
_23F1  ld   a,(de)
_23F2  sla  a
_23F4  jr   c,_2416
_23F6  ld   hl,$23FF   ; ld the table address
_23F9  rst  $10
_23FA  ld   a,(hl)
_23FB  inc  hl
_23FC  ld   h,(hl)
_23FD  ld   l,a
_23FE  jp   (hl)        ; to _2488
;
_23FF  ; jp table for _23FE, s.a. _23F6
       defb $16,$24,$88,$24,$5F,$24,$4D,$25,$B2,$24,$35,$25,$4D,$25,$90,$25,$3C,$24,$22,$24
;
_2413  dec  e           ; from $2439 when ship is up in Train Mode, s.a. _2439,_24AF
_2414  inc  ixl         ; from $2498
_2416  ld   a,$04       ; subtask of _23DD, s.a. _2448, _244E, _245C
_2418  add  a,e
_2419  ld   e,a
_241A  djnz _23EF
_241C  ld   a,ixl
_241E  ld   ($92A6),a
_2421  ret              ; ret from task $23DD
;
;
_2422  ld   l,e         ; subtask of _23DD...shooting at first wave in demo Mode
_2423  ld   h,$01
_2425  ld   c,(hl)
_2426  inc  l
_2427  ld   l,(hl)
_2428  ld   h,$99
_242A  ld   a,(hl)
_242B  ex   af,af'
_242C  ld   l,c
_242D  ld   c,(hl)
_242E  inc  e
_242F  ld   a,(de)
_2430  add  a,$11
_2432  ld   l,a
_2433  ld   h,$91
_2435  ex   af,af'
_2436  ld   (hl),a
_2437  inc  l
_2438  ld   (hl),c
_2439  jp   _2413
;
;
_243C  ld   h,$8B       ; subtask of _23DD, s.a. _23FE, your doubled ship got blew up in demo
_243E  ld   l,e
_243F  inc  e
_2440  ld   a,(de)
_2441  dec  a
_2442  jr   z,_2451
_2444  ld   (de),a
_2445  dec  e
_2446  and  $03
_2448  jr   nz,_2416
_244A  ld   a,(hl)      ; shortly after _243C
_244B  add  a,$04
_244D  ld   (hl),a
_244E  jp   _2416
;
_2451  ld   h,$93       ; after _244A
_2453  xor  a    
_2454  ld   (hl),a
_2455  ld   h,$9B
_2457  ld   (hl),a
_2458  dec  e
_2459  ld   a,$80
_245B  ld   (de),a
_245C  jp   _2416

      ; subtask of _23DD, s.a. _23FE, in demo, first attack-wave, something exploded
_245F  ld   h,$9B
_2461  ld   l,e
_2462  ld   a,(hl)
_2463  and  $01
_2465  ld   h,$8B
_2467  jr   nz,_2473
_2469  ld   a,(hl)
_246A  and  $07
_246C  cp   $06
_246E  jr   z,_2483
_2470  inc  (hl)
_2471  jr   _249B
;
_2473  ld   a,(hl)       ; pretty far in demo, but before _243C occurs
_2474  and  $07
_2476  jr   nz,_2480
_2478  ld   h,$9B        ; just after _2473 occurs
_247A  res  0,(hl)
_247C  ld   h,$8B
_247E  jr   _249B
_2480  dec  (hl)
_2481  jr   _249B
;
_2483  ld   a,$01
_2485  ld   (de),a
_2486  jr   _249B
;
_2488  ld   h,$8B        ; subtask of _23DD
_248A  ld   l,e
_248B  ld   a,($92A2)
_248E  rrc  (hl)
_2490  rrca
_2491  rrca
_2492  rl   (hl)         ; there is something here about changing the sprite-character-code value to do the "bug-flap" animation
_2494  ld   a,($920B)
_2497  and  a
_2498  jp   z,_2414
_249B  ld   h,$01        ; jr here, s.a. _2471, _247E, _2481, _2486 ...demo-mode
_249D  ld   c,(hl)
_249E  inc  l
_249F  ld   l,(hl)
_24A0  ld   h,$98
_24A2  ld   a,(hl)
_24A3  ld   d,$93
_24A5  ld   (de),a
_24A6  inc  e
_24A7  ld   l,c
_24A8  ld   a,(hl)
_24A9  ld   (de),a
_24AA  ld   d,$9B
_24AC  inc  l
_24AD  ld   a,(hl)
_24AE  ld   (de),a
_24AF  jp   _2413
;
_24B2  ld   l,e          ; subtask of _23DD, s.a. _23FE, the far-right boss turns yellow when first gets second-hit
_24B3  inc  e
_24B4  ld   a,(de)
_24B5  cp   $45
_24B7  jr   z,_24E6
_24B9  inc  a
_24BA  ld   (de),a
_24BB  dec  e
_24BC  cp   $45
_24BE  jr   nz,_24C2
_24C0  add  a,$03        ; this is when boss actually is exploding
_24C2  cp   $44
_24C4  jr   nz,_24E0
_24C6  ld   h,$93        ; this also is exploding, but a different part of the explosion
_24C8  ex   af,af'
_24C9  ld   a,(hl)
_24CA  sub  $08
_24CC  ld   (hl),a
_24CD  inc  l
_24CE  ld   a,(hl)
_24CF  sub  $08
_24D1  ld   (hl),a
_24D2  jr   nc,_24DA
_24D4  ld   h,$9B        ; plugged the boss that had my ship in the demo
_24D6  ld   a,(hl)
_24D7  xor  $01
_24D9  ld   (hl),a
_24DA  dec  l
_24DB  ld   h,$9B
_24DD  ld   (hl),$0C
_24DF  ex   af,af'
_24E0  ld   h,$8B
_24E2  ld   (hl),a
_24E3  jp   _2416
_24E6  dec  e           ; far right boss nearly done exploding in train-mode
_24E7  ld   h,$92
_24E9  ld   a,(hl)
_24EA  cp   $01
_24EC  jr   nz,_24FD
_24EE  ld   h,$93
_24F0  ld   (hl),$00
_24F2  ld   h,$9B
_24F4  ld   (hl),$00
_24F6  ld   h,$88
_24F8  ld   (hl),$80
_24FA  jp   _2416
_24FD  ld   h,$8B      ; far-left boss almost done exploding
_24FF  ld   (hl),a
_2500  cp   $37
_2502  jr   c,_250E
_2504  ld   c,$0D      ; galaga that had your ship in demo almost done exploding (to _250D)
_2506  inc  l
_2507  cp   $3A
_2509  jr   c,_250C
_250B  inc  c
_250C  ld   (hl),c
_250D  dec  l
_250E  ld   h,$93
_2510  ld   c,$08
_2512  cp   $3B
_2514  jr   nc,_251C
_2516  ld   c,$00
_2518  ld   a,(hl)
_2519  add  a,$08
_251B  ld   (hl),a
_251C  inc  l
_251D  ld   a,(hl)
_251E  add  a,$08
_2520  ld   (hl),a
_2521  ld   h,$9B
_2523  jr   nc,_2529
_2525  ld   a,(hl)     ; another part with galaga that had your ship in demo almost done exploding (to _2528)
_2526  xor  $01
_2528  ld   (hl),a
_2529  dec  l
_252A  ld   (hl),c
_252B  ld   h,$88
_252D  ld   (hl),$05
_252F  inc  l
_2530  ld   (hl),$13
_2532  jp   _2416
;
;
_2535  ld   l,e        ; subtask of _23DD, s.a. _23FE, just hit far-left boss in train-mode, 150 character appears
_2536  inc  l
_2537  ld   h,d
_2538  dec  (hl)
_2539  jp   nz,_2416
_253C  dec  l          ; again, the '150' shows... now NAMCO copyright and NAMCO logo just appeared
_253D  ld   (hl),$80
_253F  ld   h,$93
_2541  ld   (hl),$00
_2543  ld   h,$9B
_2545  ld   (hl),$00
_2547  ld   a,$80
_2549  ld   (de),a
_254A  jp   _2416
;
                       ; this is perhaps the ship firing a bullet
_254D  ld   h,$93      ; subtask of _23DD, s.a. _23FE, now the demo has started, very beginning of first attack shows at top of screen
_254F  ld   l,e
_2550  set  7,l
_2552  ld   a,(hl)
_2553  cp   $F4
_2555  jr   nc,_2571
_2557  inc  l
_2558  ld   c,(hl)
_2559  ld   h,$9B
_255B  ld   a,(hl)
_255C  dec  l
_255D  rrca
_255E  ld   a,c
_255F  rra
_2560  cp   $0B
_2562  jr   c,_2571
_2564  cp   $A5
_2566  jr   nc,_2571
_2568  ld   a,(de)
_2569  cp   $06
_256B  jp   nz,_2414
_256E  jp   _2416
;
_2571  res  7,l          ; bugs diving in DEMO?
_2573  ld   a,(de)
_2574  cp   $03
_2576  jr   z,_2582
_2578  ld   a,$80
_257A  ld   (de),a
_257B  ld   h,$93
_257D  ld   (hl),$00
_257F  jp   _2416
;
_2582  inc  e            ; jr to this, s.a. _2576... when?
_2583  ld   a,(de)
_2584  dec  e
_2585  add  a,$13
_2587  ld   l,a
_2588  ld   h,$91
_258A  ld   (hl),$00
_258C  ld   l,e
_258D  jp   _2578
;
;
_2590  ld   a,$03        ; subtask of _23DD, s.a. _23FE
_2592  ld   (de),a
_2593  jp   _2414        ; something happen here when Attract changes from Train Mode to Demo Mode
_2596  bit  1,a          ; from $23E2
_2598  ret  z
_2599  ld   hl,$92A6
_259C  ld   a,(hl)
_259D  ld   (hl),$00
_259F  inc  l
_25A0  ld   (hl),a
_25A1  ret               ; ends task $23DD
;
_25A2  ld   hl,$286E     ; begin 'call $25A2' at start of demo-mode just before any bugs appear...in challenge stage?
_25A5  ld   ($92E0),hl
_25A8  ld   a,($9821)
_25AB  ld   c,a
_25AC  cp   $17
_25AE  jr   c,_25B4
_25B0  sub  $04          ; when is jr not taken?
_25B2  jr   _25AC
_25B4  ld   b,a
_25B5  inc  a
_25B6  and  $03
_25B8  jr   z,_25D3
_25BA  ld   a,($9984)    ; again, start of demo-mode just before any bugs appear
_25BD  ld   l,$11
_25BF  call $104E
_25C2: ld   a,l
_25C3: ld   hl,$26A8
_25C6: rst  $10          ; HL:+=A
_25C7: ld   de,$26F4
_25CA: ld   a,b
_25CB: srl  b
_25CD: srl  b
_25CF: sub  b
_25D0: dec  a
_25D1: jr   _25E0
;
_25D3  ld   hl,$26EC     ; at start of challenge stage
_25D6  ld   a,c
_25D7  srl  a
_25D9  srl  a
_25DB  and  $07
_25DD  ld   de,$27DE
;
_25E0  rst  $10          ; HL:+=A
_25E1  ld   a,(hl)       ; HL contain something offset from $26A8
_25E2  ex   de,hl        ; now load DE into HL (to get an offset from $26F4)
_25E3  rst  $10          ; HL:+=A (i.e. the offset from table _26A8 adds to _26F4
_25E4  ld   a,(hl)       ; HL contain something offset from $26F4
_25E5  inc  hl
_25E6  ld   ($92E2),a
_25E9  ld   a,(hl)
_25EA  inc  hl
_25EB  ld   ($92E3),a
_25EE  ld   de,$8920
_25F1  ld   a,$7E
_25F3  ld   (de),a
_25F4  inc  e
_25F5  ld   a,(hl)       ; begins a "while" loop, s.a. _25F9 and _267E
_25F6  inc  hl
_25F7  cp   $FF
_25F9  jp   z,_2681
_25FC  ld   c,a
_25FD  push de
_25FE  push hl
_25FF  ld   hl,$9100
_2602  ld   a,$FF
_2604  ld   b,$10
_2606  rst  $18           ; memset((HL), A, B) 
_2607  ld   a,c
_2608  and  $0F
_260A  jr   z,_2636
;
_260C  ld   b,a           ; after first bonus-round
_260D  srl  a
_260F  add  a,$04
_2611  ld   e,a
_2612  call _1000
_2615  ld   l,a
_2616  ld   h,$00
_2618  ld   a,e
_2619  call _1061
_261C  bit  0,b
_261E  jr   z,_2622
_2620  set  3,a
_2622  ld   h,$91
_2624  ld   l,a
_2625  ld   a,(hl)
_2626  inc  a
_2627  jr   nz,_2612
_2629  ld   a,b
_262A  rlca
_262B  rlc  c
_262D  jr   nc,_2631
_262F  or   $40
_2631  or   $38
_2633  ld   (hl),a
_2634  djnz _2612
;
_2636  ld   hl,$9100
_2639  ld   de,($92E0)
_263D  ld   b,$08
_263F  ld   a,(hl)
_2640  cp   $FF
_2642  jr   z,_2647
_2644  inc  hl       ; cleared first bonus-round
_2645  jr   _263F
_2647  ld   a,(de)
_2648  ld   (hl),a
_2649  inc  de
_264A  inc  hl
_264B  ld   a,b
_264C  cp   $05
_264E  jr   nz,_2652
_2650  ld   l,$08
_2652  djnz _263F
_2654  ld   ($92E0),de
_2658  pop  hl
_2659  pop  de
_265A  ld   b,(hl)
_265B  inc  hl
_265C  ld   c,(hl)
_265D  inc  hl
_265E  push hl
_265F  ld   hl,$9100
_2662  ld   a,b       ; begins a "while" loop, s.a. _2667 and _2677
_2663  ld   (de),a
_2664  ld   a,(hl)
_2665  cp   $FF
_2667  jr   z,_2679
_2669  inc  e
_266A  ld   (de),a
_266B  inc  e
_266C  ld   a,c
_266D  ld   (de),a
_266E  inc  e
_266F  set  3,l
_2671  ld   a,(hl)
_2672  ld   (de),a
_2673  inc  e
_2674  res  3,l
_2676  inc  hl
_2677  jr   _2662      ; end "while..." s.a. _2662 and _2667
_2679  ld   a,$7E
_267B  ld   (de),a
_267C  inc  e
_267D  pop  hl
_267E  jp   _25F5      ; end "while" loop, s.a. _25F5 and _25F9
_2681  dec  e          ; when get here?
_2682  ld   a,($982B)
_2685  ld   b,a
_2686  ld   a,($9827)
_2689  dec  a
_268A  and  b
_268B  jr   z,_26A4    ; "GAME OVER" showing
;
_268D  ld   a,($9825)  ; "GAME OVER" showing
_2690  and  a
_2691  jr   z,_26A4
_2693  ld   h,d
_2694  ld   a,e
_2695  sub  $04
_2697  ld   l,a
_2698  ld   a,(hl)
_2699  ld   (de),a
_269A  inc  e
_269B  ld   a,$04
_269D  ld   (de),a
_269E  inc  e
_269F  ld   a,$87
_26A1  ld   ($8B04),a
_26A4  ld   a,$7F       ; "GAME OVER" shows, demo just started
_26A6  ld   (de),a
_26A7  ret              ; to _01D0?
;
;_26A8          ; s.a. _25C3
;_26EC          ; s.a. _25D3
;_26F4          ; s.a. _25C7 (this one ld's de)
;_27DE          ; s.a. _25DD
;_286E          ; s.a. _25A2
;
_26A8  defb $00,$12,$24,$36,$00,$48,$6C,$5A,$48,$6C,$00,$7E,$A2,$90,$B4,$D8
_26B8  defb $C6,$00,$12,$48,$6C,$5A,$7E,$A2,$00,$7E,$D8,$C6,$B4,$D8,$C6,$B4
_26C8  defb $D8,$C6,$00,$12,$7E,$A2,$90,$7E,$D8,$C6,$B4,$D8,$C6,$B4,$D8,$C6
_26D8  defb $B4,$D8,$C6,$00,$12,$48,$36,$24,$48,$6C,$00,$7E,$A2,$90,$B4,$D8
_26E8  defb $00,$B4,$D8,$C6,$00,$12,$24,$36,$48,$5A,$6C,$7E,$14,$00,$00,$00
_26F8  defb $C0,$00,$01,$01,$00,$41,$41,$00,$40,$40,$00,$00,$00,$FF,$14,$01
_2708  defb $00,$42,$82,$00,$03,$85,$00,$43,$C5,$00,$42,$C4,$00,$02,$84,$FF
_2718  defb $14,$01,$82,$00,$C0,$00,$01,$01,$00,$41,$41,$02,$40,$40,$02,$00
_2728  defb $00,$FF,$14,$01,$82,$02,$C2,$00,$03,$85,$00,$43,$C5,$02,$42,$C4
_2738  defb $02,$02,$84,$FF,$14,$01,$82,$00,$C0,$00,$01,$C1,$00,$41,$81,$02
_2748  defb $40,$80,$02,$40,$80,$FF,$14,$01,$82,$00,$C0,$42,$01,$01,$F2,$41
_2758  defb $41,$02,$40,$40,$02,$00,$00,$FF,$14,$01,$A4,$02,$C2,$52,$03,$85
_2768  defb $F2,$43,$C5,$02,$42,$C4,$02,$02,$84,$FF,$14,$01,$82,$00,$C0,$52
_2778  defb $01,$C1,$F2,$41,$81,$02,$40,$80,$02,$40,$80,$FF,$14,$01,$A4,$00
_2788  defb $C0,$42,$01,$01,$F4,$41,$41,$04,$40,$40,$04,$00,$00,$FF,$14,$01
_2798  defb $A4,$02,$C2,$52,$03,$85,$F4,$43,$C5,$04,$42,$C4,$04,$02,$84,$FF
_27A8  defb $14,$03,$A4,$00,$C0,$54,$01,$C1,$F4,$41,$81,$04,$40,$80,$04,$40
_27B8  defb $80,$FF,$14,$03,$A4,$00,$C0,$54,$01,$01,$F4,$41,$41,$04,$40,$40
_27C8  defb $04,$00,$00,$FF,$14,$03,$A4,$02,$C2,$54,$03,$85,$F4,$43,$C5,$04
_27D8  defb $42,$C4,$04,$02,$84,$FF,$FF,$00,$00,$06,$C6,$00,$07,$07,$00,$47
_27E8  defb $47,$00,$46,$46,$00,$06,$06,$FF,$FF,$00,$00,$08,$C8,$00,$09,$C9
_27F8  defb $00,$09,$C9,$00,$48,$48,$00,$08,$08,$FF,$FF,$00,$00,$0A,$4A,$00
_2808  defb $0B,$CB,$00,$0B,$CB,$00,$0A,$4A,$00,$16,$56,$FF,$FF,$00,$00,$0C
_2818  defb $CC,$00,$0D,$0D,$00,$4D,$4D,$00,$0C,$CC,$00,$17,$D7,$FF,$FF,$00
_2828  defb $00,$0E,$0E,$00,$0F,$0F,$00,$4F,$4F,$00,$0E,$0E,$00,$4E,$4E,$FF
_2838  defb $FF,$00,$00,$10,$10,$00,$11,$D1,$00,$11,$D1,$00,$50,$50,$00,$10
_2848  defb $10,$FF,$FF,$00,$00,$12,$12,$00,$13,$13,$00,$53,$53,$00,$52,$52
_2858  defb $00,$12,$12,$FF,$FF,$00,$00,$14,$D4,$00,$15,$15,$00,$55,$55,$00
_2868  defb $14,$D4,$00,$14,$D4,$FF,$58,$5A,$5C,$5E,$28,$2A,$2C,$2E,$30,$34
_2878  defb $36,$32,$50,$52,$54,$56,$42,$46,$40,$44,$4A,$4E,$48,$4C,$1A,$1E
_2888  defb $20,$24,$22,$26,$18,$1C,$08,$0C,$12,$16,$10,$14,$0A,$0E
;
;
_2896  ld   hl,$8920    ; $21$20$89  begin 'call $2896' ...in start of demo, or in challenge stage?
_2899  ld   ($9822),hl
_289C  ld   iy,$2908
_28A0  ld   a,($9825)
_28A3  and  a
_28A4  jr   nz,_28CD
_28A6  ld   a,($9821)
_28A9  rrca
_28AA  rrca
_28AB  ld   c,a
_28AC  rrca
_28AD  ld   b,a
_28AE  and  $1C
_28B0  ld   a,b
_28B1  jr   z,_28B5
_28B3  ld   a,$03       ; when is jr not taken?
_28B5  and  $03
_28B7  ld   hl,$2900    ; when is this used...it points into some const data
_28BA  rst  $08
_28BB  ld   de,$9284
_28BE  ld   a,c
_28BF  ldi              ; some  copy operation from _2900
_28C1  ldi
_28C3  ld   hl,$290E    ; when is this used...it points into some const data
_28C6  and  $07
_28C8  rst  $10
_28C9  ld   d,(hl)      ; ld'ing from some offset of _290E
_28CA  ld   e,d
_28CB  jr   _28D0
_28CD  ld   de,$3624    ; demo screen with "GAME OVER" showing just showed
_28D0  ld   hl,$8B08
_28D3  ld   ixl,$01
_28D6  ld   b,$14
_28D8  ld   ixh,d
_28DA  call _28E9
_28DD  ld   b,$08
_28DF  ld   ixh,$10
_28E2  call _28E9
_28E5  ld   b,$10
_28E7  ld   ixh,e
_28E9  dec  ixl
_28EB  jr   nz,_28F5
_28ED  ld   c,(iy+$00)
_28F0  inc  iy
_28F2  ld   ixl,$08
_28F5  rlc  c
_28F7  ld   a,ixh
_28F9  rra
_28FA  ld   (hl),a
_28FB  inc  l
_28FC  inc  l
_28FD  djnz _28E9
_28FF  ret
;
;

_2900                   ; s.a. _28B7
       defb $0A,$B8,$0F,$B9,$14,$BC,$1E,$BD,$A5,$5A,$A9,$0F,$0A,$50
;
_290E                   ; s.a. _28C3
       defb $36,$24,$D4,$BA,$E4,$CC,$A8,$F4
;
;
                        ; immediately before first wave appear in demo
_2916  ld   hl,($9822)  ; also...? blow shit up (to $2AD5), something that was called after entered challenge stage
_2919  ld   a,(hl)
_291A  cp   $7F
_291C  jp   z,_2A29
_291F  cp   $7E
_2921  jr   nz,_2953
_2923  ld   a,($9842)
_2926  and  a
_2927  ret  z
_2928  ld   a,($9287)
_292B  and  a
_292C  jr   nz,_294D
_292E  ld   a,($9825)   ; in demo, "GAME OVER" just showed, before "CREDIT 0" showed
_2931  ld   b,a
_2932  and  a
_2933  jr   nz,_2944
_2935  ld   a,($92AC)   ; when is jr not taken?
_2938  cp   $01
_293A  jr   nz,_2942
_293C  ld   a,$08
_293E  ld   ($92A8),a
_2941  ret
;
_2942  and  a           ; how's it get here?
_2943  ret  nz
;
_2944  inc  hl
_2945  ld   ($9822),hl
_2948  ld   hl,$9826
_294B  inc  (hl)
_294C  ret
;
;
_294D  ld   a,$02      ; how's it get here? s.a. _292C
_294F  ld   ($92AC),a
_2952  ret
;
;
_2953  ld   c,a        ; how's it get here? s.a. _2921
_2954  bit  7,a
_2956  jr   nz,_295E
_2958  ld   a,($92A0)
_295B  and  $07
_295D  ret  nz
_295E  sla  c          ; this occurs just when demo-mode start with "GAME OVER" showing and ship on-screen
_2960  ld   b,$0C
_2962  ld   de,$0014
_2965  ld   ix,$9100
_2969  bit  0,(ix+$13)
_296D  jr   z,_2974
_296F  add  ix,de
_2971  djnz _2969
_2973  ret            ; how's it get here?
;
;
_2974  inc  hl        ; jr here, s.a. _296D
_2975  ld   a,(hl)
_2976  ld   b,a
_2977  and  $78
_2979  cp   $78
_297B  ld   a,b
_297C  jr   nz,_2980
_297E  res  6,a         ; when is jr not taken?
_2980  ld   (ix+$10),a
_2983  inc  hl
_2984  ld   ($9822),hl
_2987  ld   h,$88
_2989  ld   l,a
_298A  ld   (hl),$07
_298C  inc  l
_298D  ld   e,ixl
_298F  ld   (hl),e
_2990  ld   h,$93
_2992  and  $38
_2994  cp   $38
_2996  jr   z,_29B3
_2998  dec  l
_2999  ld   h,$8B
_299B  ld   a,(hl)
_299C  ld   d,a
_299D  and  $78
_299F  ld   (hl),a
_29A0  inc  l
_29A1  ld   a,d
_29A2  and  $07
_29A4  bit  7,d
_29A6  ld   (hl),a
_29A7  ld   a,$00
_29A9  jr   z,_29AE
_29AB  ld   a,($92E3)
_29AE  ld   (ix+$0f),a
_29B1  jr   _29D1
;
_29B3  ld   de,$0210     ; jr here, s.a. _2996
_29B6  bit  6,b
_29B8  jr   nz,_29C7
_29BA  ld   de,$0318
_29BD  ld   a,($9826)
_29C0  cp   $02
_29C2  jr   nz,_29C7
_29C4  ld   de,$0008
_29C7  ld   h,$8B
_29C9  ld   (hl),d
_29CA  dec  l
_29CB  ld   (hl),e
_29CC  inc  l
_29CD  ld   (ix+$0f),$00
;
_29D1  ld   d,c          ; jr here, s.a. _29B1
_29D2  res  7,c
_29D4  ld   b,$08
_29D6  bit  1,c
_29D8  jr   z,_29DC
_29DA  ld   b,$44
_29DC  ld   (ix+$0e),b
_29DF  ld   b,$00
_29E1  ld   hl,$2A3C     ; ld the table address
_29E4  add  hl,bc
_29E5  ld   a,(hl)
_29E6  inc  hl
_29E7  ld   (ix+$08),a
_29EA  xor  a
_29EB  rld               ; rld (hl)
_29ED  ld   b,a
_29EE  ld   a,(hl)
_29EF  and  $1F
_29F1  ld   (ix+$09),a
_29F4  ld   a,b
_29F5  and  $0E
_29F7  ld   b,a
_29F8  rlca
_29F9  add  a,b
_29FA  ld   hl,$2A6C       ; ld the table address
_29FD  rst  $10
_29FE  bit  7,d
_2A00  jr   z,_2A05
_2A02  inc  hl
_2A03  inc  hl
_2A04  inc  hl
_2A05  ld   a,(hl)
_2A06  inc  hl
_2A07  ld   (ix+$01),a
_2A0A  ld   a,(hl)
_2A0B  inc  hl
_2A0C  ld   (ix+$03),a
_2A0F  ld   a,(hl)
_2A10  inc  hl
_2A11  ld   (ix+$05),a
_2A14  xor  a
_2A15  ld   (ix+$00),a
_2A18  ld   (ix+$02),a
_2A1B  ld   (ix+$04),a
_2A1E  inc  a
_2A1F  ld   (ix+$0d),a
_2A22  or   d
_2A23  and  $81
_2A25  ld   (ix+$13),a
_2A28  ret
;
;
_2A29  ld   a,($9287)   ; in DEMO (bees diving?) s.a. _291C
_2A2C  and  a
_2A2D  ret  nz
_2A2E  ld   ($9008),a   ; in DEMO (bee back to formation?)
_2A31  inc  a
_2A32  ld   ($9004),a
_2A35  ld   ($9010),a
_2A38  ld   ($9824),a
_2A3B  ret
;
_2A3C ; data, s.a. _29E1
       defb $1D,$00,$67,$20,$9F,$40,$D4,$20,$7B,$01,$B0,$61,$E8,$01,$F5,$21
       defb $0B,$02,$1B,$22,$2B,$82,$41,$22,$5D,$82,$79,$22,$9E,$02,$BA,$22
       defb $D9,$02,$FB,$22,$1D,$03,$33,$23,$DA,$0F,$F0,$2F,$2B,$A2,$5D,$A2

_2A6C ; data, s.a. _29FA
       defb $9B,$34,$03,$9B,$44,$03,$23,$00,$00,$23,$78,$02,$9B,$2C,$03,$9B
       defb $4C,$03,$2B,$00,$00,$2B,$78,$02,$9B,$34,$03,$9B,$34,$03,$9B,$44
       defb $03,$9B,$44,$03
;
;
_2A90  ld   a,($92A0)  ; main-task, in the first frame after the _2590
_2A93  dec  a
_2A94  and  $03
_2A96  ret  nz
_2A97  ld   a,($92A7)  ; takes a few frames to get to this, first wave of demo just starting
_2A9A  ld   b,a
_2A9B  ld   a,($9008)
_2A9E  or   b
_2A9F  jr   z,_2AE9
_2AA1  ld   a,($920F)
_2AA4  and  a
_2AA5  ld   c,$01
_2AA7  jr   z,_2AAB
_2AA9  dec  c          ; when is jr not taken?
_2AAA  dec  c
_2AAB  ld   l,$00
_2AAD  ld   b,$0A
_2AAF  ld   h,$99
_2AB1  ld   a,(hl)
_2AB2  add  a,c
_2AB3  ld   (hl),a
_2AB4  ld   h,$98
_2AB6  ld   a,(hl)
_2AB7  add  a,c
_2AB8  ld   (hl),a
_2AB9  inc  l
_2ABA  inc  l
_2ABB  djnz _2AAF
_2ABD  ld   a,($9824)
_2AC0  and  a
_2AC1  ld   a,($9900)
_2AC4  jr   z,_2AC9
_2AC6  and  a           ; when is jr not taken?
_2AC7  jr   z,_2ADA
_2AC9  cp   $20
_2ACB  jr   nz,_2AD3
_2ACD  ld   a,$01       ; when is jr not taken?
_2ACF  ld   ($920F),a  
_2AD2  ret
;
;
_2AD3  sub  $E0         ; how's it get here? s.a. _2ACB
_2AD5  ret  nz
_2AD6  ld   ($920F),a   ; red bugs entering on right DEMO?
_2AD9  ret
;
;
_2ADA  xor  a           ; demo, s.a. _2AC7
_2ADB  ld   ($920F),a
_2ADE  ld   ($900A),a
_2AE1  inc  a
_2AE2  ld   ($9AA0),a
_2AE5  ld   ($9009),a
_2AE8  ret
;
;
_2AE9  ld   ($900A),a   ; when get here? s.a. _2A9F
_2AEC  ret
;
; there is $FF till $2C00
;
       org $2C00        ; begin 'call  _2C00', called from call-01C5, s.a. _0215 - something at start of demo... or in theme music?
_2C00  ld   a,($9821)
_2C03  cp   $1B
_2C05  jr   c,_2C0B
_2C07  sub  $04         ; when not take jr? don't know
_2C09  jr   _2C03
_2C0B  dec  a
_2C0C  ld   l,a
_2C0D  rlca
_2C0E  rlca
_2C0F  add  a,l
_2C10  ld   e,a
_2C11  ld   a,($9984)   ; difficulty_setting
_2C14  ld   hl,$2C65    ; ld the table of address
_2C17  rst  $08         ; HL:+=2A
_2C18  ld   a,(hl)
_2C19  inc  hl
_2C1A  ld   h,(hl)
_2C1B  ld   l,a
_2C1C  ld   a,e
_2C1D  rst  $10         ; HL:+=A
_2C1E  ld   de,$99C0
_2C21  ld   b,$05
_2C23  ld   a,(hl)
_2C24  ld   c,a
_2C25  rlca
_2C26  rlca
_2C27  rlca
_2C28  rlca
_2C29  and  $0F
_2C2B  ld   (de),a
_2C2C  inc  e
_2C2D  ld   a,c
_2C2E  and  $0F
_2C30  ld   (de),a
_2C31  inc  e
_2C32  inc  hl
_2C33  djnz _2C23
_2C35  ld   a,($9821)
_2C38  cp   $03
_2C3A  jr   nc,_2C3F
_2C3C  xor  a
_2C3D  jr   _2C46
;
_2C3F  or   $FC       ; challenge stage!
_2C41  inc  a
_2C42  jr   z,_2C46
_2C44  ld   a,$0A     ; when not take jr?
_2C46  ld   (de),a
_2C47  ld   bc,$0216
_2C4A  ld   ($92C1),bc
_2C4E  ld   ($92C0),bc
_2C52  ld   a,($9821)
_2C55  cp   $10
_2C57  jr   c,_2C5B
_2C59  ld   a,$10     ; when not take jr?
_2C5B  rlca
_2C5C  rlca
_2C5D  and  $70
_2C5F  add  a,$40
_2C61  ld   ($99BB),a
_2C64  ret
;
_2C65  ; table of address, from which further data is read, s.a. _2C14
       defb $EF,$2C,$71,$2D,$F3,$2D,$6D,$2C
;
; each of these table entries if $82 bytes
;_2C6D
;_2CEF
;_2D71
;_2DF3
;
_2C6D  defb $00,$00,$22,$C6,$00,$00,$11,$23
_2C75  defb $C7,$00,$00,$00,$00,$C0,$00,$11,$12,$23,$97,$00,$11,$23,$23,$98
_2C85  defb $00,$21,$24,$33,$98,$00,$00,$00,$00,$90,$00,$22,$25,$33,$99,$10
_2C95  defb $22,$36,$34,$69,$10,$10,$11,$23,$97,$00,$00,$00,$00,$60,$00,$32
_2CA5  defb $46,$34,$67,$11,$32,$67,$44,$68,$11,$32,$67,$45,$68,$11,$00,$00
_2CB5  defb $00,$60,$00,$42,$78,$45,$69,$11,$42,$78,$45,$69,$11,$11,$22,$23
_2CC5  defb $97,$11,$00,$00,$00,$60,$00,$52,$88,$46,$3A,$11,$52,$88,$56,$3A
_2CD5  defb $11,$52,$88,$56,$3C,$11,$00,$00,$00,$30,$00,$62,$89,$57,$3C,$11
_2CE5  defb $62,$99,$57,$3C,$11,$62,$99,$57,$3C,$11,$00,$00,$12,$C6,$00,$00
_2CF5  defb $11,$22,$C6,$00,$00,$00,$00,$C0,$00,$11,$12,$23,$97,$00,$11,$12
_2D05  defb $23,$97,$00,$00,$11,$23,$C7,$00,$00,$00,$00,$90,$00,$21,$23,$33
_2D15  defb $98,$10,$21,$24,$33,$98,$10,$21,$25,$34,$98,$10,$00,$00,$00,$60
_2D25  defb $00,$22,$25,$34,$68,$11,$32,$36,$44,$68,$11,$11,$11,$23,$67,$01
_2D35  defb $00,$00,$00,$60,$00,$32,$36,$45,$68,$11,$32,$46,$45,$69,$11,$32
_2D45  defb $67,$45,$69,$11,$00,$00,$00,$60,$00,$42,$67,$46,$3A,$11,$42,$78
_2D55  defb $56,$3A,$11,$52,$78,$56,$3A,$11,$00,$00,$00,$30,$00,$52,$88,$56
_2D65  defb $3C,$11,$62,$99,$57,$3C,$11,$62,$99,$57,$3C,$11,$00,$00,$23,$C6
_2D75  defb $00,$10,$11,$23,$97,$00,$00,$00,$00,$C0,$00,$11,$12,$33,$98,$00
_2D85  defb $21,$23,$34,$68,$00,$21,$24,$34,$68,$00,$00,$00,$00,$90,$00,$32
_2D95  defb $36,$34,$67,$10,$32,$46,$44,$68,$10,$11,$11,$23,$97,$10,$00,$00
_2DA5  defb $00,$60,$00,$42,$67,$45,$68,$11,$42,$67,$45,$69,$11,$42,$78,$46
_2DB5  defb $69,$11,$00,$00,$00,$60,$00,$52,$78,$46,$3A,$11,$52,$88,$56,$3A
_2DC5  defb $11,$52,$88,$56,$3A,$11,$00,$00,$00,$60,$00,$62,$88,$56,$3C,$11
_2DD5  defb $62,$89,$57,$3C,$11,$62,$89,$57,$3E,$11,$00,$00,$00,$30,$00,$72
_2DE5  defb $99,$57,$3E,$11,$72,$99,$68,$3E,$11,$72,$99,$68,$3E,$11,$00,$00
_2DF5  defb $23,$C6,$00,$10,$11,$23,$97,$00,$00,$00,$00,$C0,$00,$11,$12,$34
_2E05  defb $98,$00,$21,$23,$34,$68,$00,$21,$24,$34,$68,$00,$00,$00,$00,$90
_2E15  defb $00,$32,$36,$45,$67,$11,$32,$46,$46,$68,$11,$32,$56,$46,$69,$11
_2E25  defb $00,$00,$00,$60,$00,$42,$67,$56,$6A,$11,$42,$67,$56,$6A,$11,$42
_2E35  defb $78,$57,$6A,$11,$00,$00,$00,$60,$00,$52,$78,$57,$3A,$11,$52,$88
_2E45  defb $57,$3A,$11,$52,$88,$68,$3C,$11,$00,$00,$00,$60,$00,$62,$88,$68
_2E55  defb $3C,$11,$62,$89,$68,$3C,$11,$62,$89,$68,$3E,$11,$00,$00,$00,$30
_2E65  defb $00,$72,$99,$68,$3E,$11,$72,$99,$68,$3E,$11,$72,$99,$68,$3E,$11
;
;
;
; 2E75 - 2FFE is rst $38
       org $2FFF
_2FFF  defb $74   ; ld hl, h ... end ROM2
;
       org $3000 
_3000  ld   hl,$83FD    ; begin 'call _3000', gameover?   s.a. _0547
_3003  ld   a,($9840)
_3006  and  a
_3007  jr   z,_300C
_3009  ld   hl,$83E8
_300C  ld   ($8A00),hl
_300F  ld   de,$8A3D
_3012  call _31F7
_3015  ret  nc
_3016  ld   de,$8A37    ; going into the high-score name entry
_3019  call _31F7
_301C  ld   a,$05
_301E  jr   nc,_3047
_3020  ld   de,$8A31
_3023  call _31F7
_3026  ld   a,$04
_3028  jr   nc,_3047
_302A  ld   de,$8A2B
_302D  call _31F7
_3030  ld   a,$03
_3032  jr   nc,_3047
_3034  ld   de,$8A25
_3037  call _31F7
_303A  ld   a,$02
_303C  jr   nc,_3047
_303E  ld   a,$FF
_3040  ld   ($9AAC),a
_3043  ld   a,$01
_3045  jr   _304A
;
_3047  ld   ($9AB0),a   ; jr here, s.a. _301E
_304A  ld   ($8A11),a
_304D  ld   hl,$31A6    ; ld the jp table address
_3050  dec  a
_3051  rst  $08
_3052  call _3118
_3055  ld   a,($8A11)
_3058  ld   hl,$31A1    ; ld the table address
_305B  dec  a
_305C  rst  $10
_305D  ld   a,(hl)
_305E  ld   hl,$8A49
_3061  ld   de,$8A4C
_3064  and  a
_3065  jr   z,_306C
_3067  ld   c,a
_3068  ld   b,$00
_306A  lddr
_306C  ld   b,$03
_306E  ld   a,$24
_3070  ld   ($8A04),hl
_3073  inc  l
_3074  ld   (hl),a
_3075  djnz _3073
_3077  ld   a,$49
_3079  ld   ($8A10),a
_307C  ld   hl,$327F     ; ld the table address
_307F  call _3328
_3082  call _331B        ; HL==$3298, show 'SCORE  NAME' text, just below 'ENTER YOUR INITIALS' 
_3085  call _3328
_3088  ld   de,$8309
_308B  ld   hl,($8A00)
_308E  call _3275
_3091  ld   hl,$8149
_3094  ld   de,$FFE0
_3097  ld   (hl),$0A
_3099  add  hl,de
_309A  ld   (hl),$0A
_309C  add  hl,de
_309D  ld   (hl),$0A
_309F  call _321D
_30A2  call _3180
_30A5  ld   a,$04
_30A7  ld   ($92AE),a
_30AA  ld   a,($92AE)
_30AD  and  a
_30AE  jr   nz,_30AA
_30B0  ld   a,$28       ; high-score entry
_30B2  ld   ($92AE),a
_30B5  call _321D
_30B8  call _3180
_30BB  ld   a,($92A0)
_30BE  ld   c,a
_30BF  call _32ED      ; jp here, s.a. _30FB,_3115
_30C2  ld   a,($92A0)
_30C5  cp   c
_30C6  jr   z,_30BF
_30C8  ld   c,a
_30C9  and  $0F
_30CB  call z,_3141
_30CE  ld   hl,$99B6
_30D1  ld   a,($9215)
_30D4  and  a
_30D5  jr   z,_30D8
_30D7  inc  hl         ; when not jr?
_30D8  bit  4,(hl)
_30DA  jp   z,_314C
_30DD  ld   a,(hl)
_30DE  and  $0A
_30E0  ld   hl,$8A02
_30E3  ld   de,$8A03
_30E6  cp   (hl)
_30E7  jr   z,_30ED
_30E9  ld   (hl),a     ; when not jr?
_30EA  ld   a,$FD
_30EC  ld   (de),a
_30ED  ld   a,(de)
_30EE  inc  a
_30EF  ld   (de),a
_30F0  and  $0F
_30F2  jr   nz,_30BF
_30F4  ld   a,(hl)
_30F5  cp   $08
_30F7  jr   z,_311D
_30F9  cp   $02
_30FB  jr   nz,_30BF
_30FD  ld   a,$28       ; when jr not taken?
_30FF  ld   ($92AE),a
_3102  ld   a,($8A10)
_3105  ld   l,a
_3106  ld   h,$81
_3108  ld   a,(hl)
_3109  dec  a
_310A  cp   $09
_310C  call z,_3138
_310F  cp   $29
_3111  call z,_313B
_3114  ld   (hl),a
_3115  jp   _30BF
;
;
_3118  ld   a,(hl)      ; begin 'call _3118', s.a. _3052
_3119  inc  hl
_311A  ld   h,(hl)
_311B  ld   l,a
_311C  jp   (hl)
;
;
_311D  ld   a,($8A10)   ; jr here, s.a. _30F7
_3120  ld   l,a
_3121  ld   h,$81
_3123  ld   a,$28
_3125  ld   ($92AE),a
_3128  ld   a,(hl)
_3129  inc  a
_312A  cp   $2B
_312C  call z,_313E
_312F  cp   $25
_3131  call z,_3138
_3134  ld   (hl),a
_3135  jp   _30BF
_3138  ld   a,$2A       ; begin 'call _3138'... s.a. _310C, _3131
_313A  ret
_313B  ld   a,$24       ; begin 'call _313B'... s.a. _3111
_313D  ret
_313E  ld   a,$0A
_3140  ret
;
;
_3141  ld   a,($8A10)   ; begin 'call _3141', s.a. _30CB ... high-score entry?
_3144  ld   l,a
_3145  ld   h,$85
_3147  ld   a,(hl)
_3148  xor  $05
_314A  ld   (hl),a
_314B  ret
_314C  ld   a,($8A10)
_314F  ld   l,a
_3150  ld   h,$85
_3152  ld   (hl),$00
_3154  ld   h,$81
_3156  ld   c,(hl)
_3157  ld   a,$28
_3159  ld   ($92AE),a
_315C  ld   hl,($8A04)
_315F  inc  hl
_3160  ld   (hl),c
_3161  ld   ($8A04),hl
_3164  ld   hl,$8A10
_3167  ld   a,(hl)
_3168  sub  $20
_316A  ld   (hl),a
_316B  jp   nc,_30B5
_316E  call _321D
_3171  call _3180
_3174  ld   a,$4C
_3176  ld   ($92A0),a
_3179  ld   a,($92A0)
_317C  and  a
_317D  jr   nz,_3179
_317F  ret
;
;
_3180  ld   a,($8A11)   ; begin 'call _3180'
_3183  ld   hl,$3197
_3186  dec  a
_3187  rst  $08
_3188  ld   a,(hl)
_3189  inc  hl
_318A  ld   h,(hl)
_318B  ld   l,a
_318C  ld   b,$16
_318E  ld   de,$FFE0
_3191  ld   (hl),$05
_3193  add  hl,de
_3194  djnz _3191
_3196  ret
;
;
_3197  ; data   s.a. _3183
       defb $74,$87,$76,$87,$78,$87,$7A,$87,$7C,$87
;
_31A1  ; data   s.a. _3058
       defb $0C,$09,$06,$03,$00
;
_31A6  ; data   s.a. _304D  ... jp table for _3118
       defb $B0,$31,$B4,$31,$B8,$31,$CE,$31,$D9,$31
;
;
_31B0  ld   a,$12       ; subtask of _3000, s.a. _311C
_31B2  jr   _31BA
;
_31B4  ld   a,$0C       ; subtask of _3000, s.a. _311C
_31B6  jr   _31BA
;
_31B8  ld   a,$06       ; subtask of _3000, s.a. _311C
_31BA  ld   hl,$8A37    ; at hi-score? s.a. _31B2
_31BD  ld   de,$8A3D
_31C0  ld   bc,$0006
_31C3  lddr
_31C5  ld   de,$8A37
_31C8  ld   c,a
_31C9  lddr
_31CB  jp   _31D9
;
_31CE  ld   de,$8A3D    ; subtask of _3000, s.a. _311C
_31D1  ld   hl,$8A37
_31D4  ld   bc,$0006
_31D7  lddr
;
_31D9  ld   a,($8A11)   ; subtask of _3000, s.a. _311C,_31CB
_31DC  dec  a
_31DD  ld   hl,$31ED    ; ld the table address
_31E0  rst  $08
_31E1  ld   e,(hl)
_31E2  inc  hl
_31E3  ld   d,(hl)
_31E4  ld   hl,($8A00)
_31E7  ld   bc,$0006
_31EA  lddr
_31EC  ret
;
_31ED  ; data, s.a. _31DD
       defb $25,$8A,$2B,$8A,$31,$8A,$37,$8A,$3D,$8A
;
;
_31F7  ld   hl,($8A00)  ; begin 'call $31F7'
_31FA  ld   b,$06
_31FC  ld   a,(de)
_31FD  cp   $24
_31FF  jr   z,_320E
_3201  ld   a,(hl)
_3202  cp   $24
_3204  ret  z
_3205  ld   a,(de)   ; when not ret?
_3206  cp   (hl)
_3207  ret  nz       ; when not ret?
_3208  dec  l
_3209  dec  e
_320A  djnz _31FC
_320C  xor  a        ; when?
_320D  ret
;
;
_320E  cp   (hl)     ; s.a. _31FF
_320F  jr   z,_3208
_3211  xor  a
_3212  jr   _3206
;
;
; begin 'call  $3214' ... used by $17E1 sub task
_3214  ld   hl,$3345  ; ld the table address, 'GALACTIC HEROES'
_3217  call _3328
_321A  call _3328
_321D  ld   hl,$32B4  ; ld the string address, 'SCORE     NAME'
_3220  call _331B
_3223  ld   b,$01
_3225  call _3231
_3228  call _3231
_322B  call _3231
_322E  call _3231
_3231  ld   a,b       ; begin 'call _3231'
_3232  dec  a
_3233  add  a,a
_3234  add  a,a
_3235  add  a,a
_3236  ld   hl,$32C5  ; ld the data address
_3239  rst  $10
_323A  ld   e,(hl)
_323B  inc  hl
_323C  ld   d,(hl)
_323D  inc  hl
_323E  ld   a,b
_323F  ld   (de),a
_3240  call _3273
_3243  call _3270
_3246  call _3270
_3249  call _3273
_324C  call _3273
_324F  ld   a,(hl)
_3250  inc  hl
_3251  ld   c,(hl)
_3252  inc  hl
_3253  push hl
_3254  ld   h,c
_3255  ld   l,a
_3256  call _3275
_3259  ld   a,e
_325A  sub  $C0
_325C  ld   e,a
_325D  jr   nc,_3260
_325F  dec  d         ; when not jr?
_3260  pop  hl
_3261  ld   a,(hl)
_3262  inc  hl
_3263  ld   h,(hl)
_3264  ld   l,a
_3265  call _3270
_3268  call _3270
_326B  call _3270
_326E  inc  b
_326F  ret             ; end 'call _3214'
;
_3270  ld   a,(hl)     ; begin 'call _3270' ... sub used by sub $3214
_3271  ld   (de),a
_3272  inc  hl
                       ; begin 'call _3273' ... s.a. _3240
_3273  rst  $20        ; DE:-=$20
_3274  ret             ; end 'call _3270'
;
;
_3275  ld   c,$06      ; begin 'call _3275' ... sub used by sub $3214
_3277  ld   a,(hl)
_3278  ld   (de),a
_3279  dec  hl
_327A  rst  $20
_327B  dec  c
_327C  jr   nz,_3277
_327E  ret             ; end 'call _3275'
;
;
_327F                  ; data, s.a. _307C ..."4ENTER YOUR INITIALS !"
       defb $24,$83
       defb $15
       defb $04,$0E,$17,$1D,$0E,$1B,$24,$22,$18,$1E,$1B,$24,$12,$17,$12,$1D,$12,$0A,$15,$1C,$24,$2C
;
_3298                  ; string 'SCORE       NAME' ... s.a. _3082
       defb $E7,$82
       defb $10
       defb $1C,$0C,$18,$1B,$0E,$24,$24,$24,$24,$24,$24,$24,$17,$0A,$16,$0E
;
_32AB                  ;  string '4TOP 5'
       defb $50,$82
       defb $05,
       defb $04,$1D,$18,$19,$24,$05
;
_32B4                  ; string 'SCORE     NAME'
       defb $92,$82
       defb $0E
       defb $1C,$0C,$18,$1B,$0E,$24,$24,$24,$24,$24,$17,$0A,$16,$0E
;
_32C5  ; formatting for score table list, s.a. _3236
       defb $54,$83,$1C,$1D,$25,$8A,$3E,$8A ; "ST"
       defb $56,$83,$17,$0D,$2B,$8A,$41,$8A ; "ND"
       defb $58,$83,$1B,$0D,$31,$8A,$44,$8A ; "RD"
       defb $5A,$83,$1D,$11,$37,$8A,$47,$8A ; "TH"
       defb $5C,$83,$1D,$11,$3D,$8A,$4A,$8A ; "TH"
;
;
_32ED  ld   a,($99B5)  ; begin 'call _32ED', s.a. _30BF
_32F0  cp   $A0
_32F2  jr   z,_32FB
_32F4  ld   b,a
_32F5  ld   a,($99B8)
_32F8  cp   b
_32F9  jr   c,_3300
_32FB  ld   a,($92AE)
_32FE  and  a
_32FF  ret  nz
_3300  pop  hl
_3301  ld   h,$81
_3303  ld   a,($8A10)
_3306  ld   l,a
_3307  ld   de,($8A04)
_330B  inc  de
_330C  ldi
_330E  ld   a,$DF
_3310  dec  h
_3311  add  a,l
_3312  jr   nc,_3315
_3314  inc  h
_3315  ld   l,a
_3316  bit  0,h
_3318  jr   nz,_330C
_331A  ret
;
;
; display text string, used in POST and in GALACTIC HERO screen
; start address of src string in HL
_331B  ld   e,(hl)     ; let E=[LSB of dest address]
_331C  inc  hl
_331D  ld   d,(hl)     ; let D=[MSB of dest address]
_331E  inc  hl
_331F  ld   b,(hl)     ; let B=[strlen]
_3320  inc  hl
_3321  ld   a,(hl)     ; let A=[character to display]
_3322  ld   (de),a     ; put character in tile RAM
_3323  inc  hl         ; offset to next character in src
_3324  rst  $20        ; let DE-=$20
_3325  djnz _3321
_3327  ret             ; end 'call _331B'
;
;
_3328  ld   e,(hl)     ; begin 'call _3328', used by sub $3214
_3329  inc  hl
_332A  ld   d,(hl)
_332B  inc  hl
_332C  ld   b,(hl)
_332D  inc  hl
_332E  ld   c,(hl)
_332F  inc  hl
_3330  ex   de,hl
_3331  ld   a,(de)
_3332  ld   (hl),a
_3333  set  2,h
_3335  ld   (hl),c
_3336  res  2,h
_3338  inc  de
_3339  ld   a,$E0
_333B  dec  h
_333C  add  a,l
_333D  jr   nc,_3340
_333F  inc  h
_3340  ld   l,a
_3341  djnz _3331
_3343  ex   de,hl
_3344  ret             ; end 'call _3328'
;
_3345  ; data, s.a. _3214, "2 THE GALACTIC HEROES"
       defb $25,$83
       defb $13
       defb $02,$1D,$11,$0E,$24,$10,$0A,$15,$0A,$0C,$1D,$12,$0C,$24,$11,$0E,$1B,$18,$0E,$1C
;
_335C  ; data, "4-- BEST 5 --"
       defb $CC,$82
       defb $0C
       defb $04,$26,$26,$24,$0B,$0E,$1C,$1D,$24,$05,$24,$26,$26
;
;
; start of self-tests in bootup, jp here from _02D0 the reset vector
_336C  xor  a          ; make sure a==0
_336D  ld   ($6823),a  ; if 0, halt CPU #2 and #3
_3370  inc  a          ; a==1
_3371  ld   ($6822),a  ; cpu #3 nmi acknowledge/enable
_3374  di              ; disable interrupts?
;_3375  ld   ($6830),a  ; Watchdog reset?     ; 32 30 68
;
       jp   _3550 ; C3 50 35     ; PATCH
; beginning of tests and such, jp $3550 to skip!
_3378  ld   b,$0A
_337A  exx
_337B  ld   de,$8000
_337E  ld   hl,$0000
_3381  ld   bc,$0400
_3384  ld   a,l        ; a==0
_3385  xor  h
_3386  cpl
_3387  add  a,a
_3388  add  a,a
_3389  adc  hl,hl
_338B  ld   a,l
_338C  ld   ($6830),a  ; Watchdog reset?
_338F  ld   (de),a     ; a==1, de==$8000
_3390  inc  de
_3391  dec  bc
_3392  ld   a,b
_3393  or   c
_3394  jr   nz,_3384
_3396  ld   de,$8000
_3399  ld   hl,$0000
_339C  ld   bc,$0400
_339F  ld   a,l
_33A0  xor  h
_33A1  cpl
_33A2  add  a,a
_33A3  add  a,a
_33A4  adc  hl,hl
_33A6  ld   a,(de)
_33A7  xor  l
_33A8  jp   nz,$34C0
_33AB  inc  de
_33AC  ld   ($6830),a
_33AF  dec  bc
_33B0  ld   a,b
_33B1  or   c
_33B2  jr   nz,_339F
_33B4  ld   de,$8000
_33B7  ld   hl,$5555
_33BA  ld   bc,$0400
_33BD  ld   a,l
_33BE  xor  h
_33BF  cpl
_33C0  add  a,a
_33C1  add  a,a
_33C2  adc  hl,hl
_33C4  ld   a,l
_33C5  ld   ($6830),a
_33C8  ld   (de),a
_33C9  inc  de
_33CA  dec  bc
_33CB  ld   a,b
_33CC  or   c
_33CD  jr   nz,_33BD
_33CF  ld   de,$8000
_33D2  ld   hl,$5555
_33D5  ld   bc,$0400
_33D8  ld   a,l
_33D9  xor  h
_33DA  cpl
_33DB  add  a,a
_33DC  add  a,a
_33DD  adc  hl,hl
_33DF  ld   a,(de)
_33E0  xor  l
_33E1  jp   nz,_34C0
_33E4  inc  de
_33E5  ld   ($6830),a
_33E8  dec  bc
_33E9  ld   a,b
_33EA  or   c
_33EB  jr   nz,_33D8
_33ED  ld   de,$8000
_33F0  ld   hl,$AAAA
_33F3  ld   bc,$0400
_33F6  ld   a,l
_33F7  xor  h
_33F8  cpl
_33F9  add  a,a
_33FA  add  a,a
_33FB  adc  hl,hl
_33FD  ld   a,l
_33FE  ld   ($6830),a
_3401  ld   (de),a
_3402  inc  de
_3403  dec  bc
_3404  ld   a,b
_3405  or   c
_3406  jr   nz,_33F6
_3408  ld   de,$8000
_340B  ld   hl,$AAAA
_340E  ld   bc,$0400
_3411  ld   a,l
_3412  xor  h
_3413  cpl
_3414  add  a,a
_3415  add  a,a
_3416  adc  hl,hl
_3418  ld   a,(de)
_3419  xor  l
_341A  jp   nz,_34C0
_341D  inc  de
_341E  ld   ($6830),a
_3421  dec  bc
_3422  ld   a,b
_3423  or   c
_3424  jr   nz,_3411
_3426  exx
_3427  dec  b
_3428  jp   nz,_337A
_342B  ld   sp,$8400
_342E  ld   de,$8400
_3431  call _347F
_3434  ld   de,$8800
_3437  call _347F
_343A  ld   de,$9000
_343D  call _347F
_3440  ld   hl,$99E0
_3443  ld   de,$9000
_3446  ld   bc,$0020
_3449  ldir
_344B  ld   de,$9800
_344E  call _347F
_3451  ld   hl,$9000
_3454  ld   de,$99E0
_3457  ld   bc,$0020
_345A  ldir
_345C  ld   sp,$8B00
_345F  ld   de,$8000
_3462  call _347F
_3465  call _3958      ; fills tile RAM
; so called "end of boot"
_3468  ld   hl,$3B7E   ; load start address of src string "RAM  OK"
_346B  call _331B      ; display "RAM  OK"
_346E  ld   ($6830),a  ; Watchdog
_3471  call _3A3C      ; 0 out $40 bytes starting at $9AA0
_3474  ld   a,$07
_3476  ld   ($9020),a
_3479  call _3972      ; fill sprite position RAM
_347C  jp   _3550      ; this is pretty much the end of the BOOT 
;
;
_347F  ld   b,$1E      ; begin 'call _347F' ... subroutine for BOOT
_3481  ld   hl,$0000
_3484  push bc
_3485  call _348C
_3488  pop  bc
_3489  djnz _3484
_348B  ret             ; end 'call _347F'
;
;
_348C  push de         ; begin 'call _348C' ... subroutine for BOOT
_348D  push hl
_348E  ld   bc,$0400
_3491  ld   a,l
_3492  xor  h
_3493  cpl
_3494  add  a,a
_3495  add  a,a
_3496  adc  hl,hl
_3498  ld   a,l
_3499  ld   ($6830),a
_349C  ld   (de),a
_349D  inc  de
_349E  dec  bc
_349F  ld   a,b
_34A0  or   c
_34A1  jr   nz,_3491
_34A3  pop  hl
_34A4  pop  de
_34A5  push de
_34A6  ld   bc,$0400
_34A9  ld   a,l
_34AA  xor  h
_34AB  cpl
_34AC  add  a,a
_34AD  add  a,a
_34AE  adc  hl,hl
_34B0  ld   a,(de)
_34B1  xor  l
_34B2  jp   nz,_34C0
_34B5  inc  de
_34B6  ld   ($6830),a
_34B9  dec  bc
_34BA  ld   a,b
_34BB  or   c
_34BC  jr   nz,_34A9
_34BE  pop  de
_34BF  ret             ; end 'call _348C'
;
;
_34C0  ld   b,a        ; jp here, s.a. _34B2
_34C1  ld   a,d
_34C2  rra
_34C3  rra
_34C4  and  $07
_34C6  cp   $04
_34C8  jr   c,_34CB
_34CA  dec  a
_34CB  cp   $05
_34CD  jr   c,_34D0
_34CF  dec  a
_34D0  ld   e,a
_34D1  ld   a,b
_34D2  ld   d,$15
_34D4  and  $0F
_34D6  jr   nz,_34DA
_34D8  ld   d,$11
_34DA  ld   ($6830),a
_34DD  exx
_34DE  ld   hl,$8000
_34E1  ld   de,$8001
_34E4  ld   bc,$0400
_34E7  ld   (hl),$24
_34E9  ldir
_34EB  ld   (hl),$00
_34ED  ld   bc,$03FF
_34F0  ldir
_34F2  ld   ($6830),a
_34F5  exx
_34F6  ld   hl,$82E2
_34F9  ld   (hl),$1B
_34FB  ld   a,$E0
_34FD  dec  h
_34FE  rst  $10
_34FF  ld   (hl),$0A
_3501  ld   a,$E0
_3503  dec  h
_3504  rst  $10
_3505  ld   (hl),$16
_3507  ld   a,$A0
_3509  dec  h
_350A  rst  $10
_350B  ld   (hl),e
_350C  ld   a,$E0
_350E  dec  h
_350F  rst  $10
_3510  ld   (hl),d
_3511  ld   hl,$9380
_3514  ld   b,$80
_3516  ld   (hl),$F1
_3518  inc  hl
_3519  djnz _3516
_351B  ld   ($6830),a
_351E  jp   _351B
;
;
_3521  push hl         ; begin 'call _3521' ... it's like a checksum routine
_3522  ex   de,hl      ; at entry, DE contains start address for checksum
_3523  ld   d,$10      ; D is the MSB of the count ... BC is the LSB of the count
_3525  xor  a          ; A==$00
_3526  ld   b,a        ; B==$00, C will be a count value specified by caller, with C==$00 it's essentially a count to $00 from $100
_3527  add  a,(hl)     ; HL will be a read address specified by caller
_3528  ld   ($6830),a  ; Watchdog
_352B  inc  hl
_352C  djnz _3527      ;  CPU 1 & CPU 2 kick in around the time this is first called
_352E  dec  d
_352F  jr   nz,_3527
_3531  ex   de,hl
_3532  pop  hl
_3533  cp   c          ; somehow the final sum must be $00...but how?
_3534  ret  z          ; end 'call _3521'
;
_3535  ld   hl,$3B88   ; s.a. _35A2, when CPU1 or CPU2 "checksums" fail
_3538  call _331B
_353B  ld   de,$8244
_353E  ld   hl,$9102
_3541  xor  a
_3542  rld             ; rld  (hl)
_3544  ld   (de),a
_3545  rst  $20
_3546  xor  a
_3547  rld             ; rld  (hl)
_3549  ld   (de),a
_354A  ld   ($6830),a
_354D  jp   _354A
;
;
; TODO: the $3521 calls are a cksum on ROM but don't work right now
;
_3550  ld   hl,$9100   ; jp here from $347C, it's start of the POST phase
_3553  ld   (hl),$00
_3555  inc  hl         ; HL==$9101
_3556  ld   (hl),$00
_3558  inc  hl         ; HL==$9102
_3559  ld   (hl),$01
_355B  xor  a          ; A==0
_355C  ld   ($9270),a
_355F  inc  a          ; A==1
_3560  ld   ($6823),a  ; if 0, halt CPU #2 and #3
_3563  ld   de,$0000
_3566  ld   c,$00
_3568  defb $00,$00,$00 ; PATCH: call _3521      ; checksum ROM region 0
_356B  inc  (hl)        ; HL=$9102
_356C  ld   c,$00
_356E  defb $00,$00,$00 ; PATCH: call _3521      ; checksum ROM region 1
_3571  inc  (hl)
_3572  ld   c,$00
_3574  defb $00,$00,$00 ; PATCH: call _3521      ; checksum ROM region 2        ; HL=$9102, (HL)==$03
_3577  inc  (hl)
_3578  ld   c,$00
_357A  defb $00,$00,$00 ; PATCH: call _3521      ; checksum ROM region 3
;
;
;       jr _35B5 ; $18 $36; skip the checksum of the CPUs
_357D  ld   (hl),$FF   ; HL==$9102, ($9102)==$04            $36 $FF
;
;
; the next piece does a "checksum" of the ROM contents of CPU1 and CPU2
_357F  ld   a,($9100)  ; ld the CPU "checksum" value...
_3582  ld   ($6830),a  ; ...and kick the dog...
_3585  and  a
_3586  jr   z,_357F    ; ...and spin as long as "checksum" is zero
_3588  inc  a          ; if checksum==$FF...
_3589  jr   _3592      ; PATCH: jr   z,_3592    ; ...then we will proceed...
_358B  dec  a          ; other CPU writes a $11 into $9101 for a failure
_358C  ld   ($9102),a
_358F  jp   _3535      ; ends there on failure
;
;
_3592  ld   a,($9101)  ; ...then check the next CPU, CPU1 may actually finish first, but it doesn't seem to matter
_3595  ld   ($6830),a  ; Watchdog
_3598  and  a
_3599  jr   z,_3592
_359B  inc  a
_359C  jr   _35B5      ; PATCH: jr   z,_35B5
_359E  dec  a          ; other CPU writes a $11 into $9101 for a failure
_359F  ld   ($9102),a
_35A2  jp   _3535      ; ends there on failure
;
;
_35A5  defb $05,$05,$05,$05  ; data, s.a. _35CD
;
_35A9  ; data, s.a. _35F0... a total of $0C parameters
       defb $30,$40,$00,$02,$DF
       defb $40,$30,$30,$03,$DF
       defb $10,$20
;
;
_35B5  ld   hl,$3B88   ; ld src address of string "ROM  OK", s.a. _359C
_35B8  call _331B      ; display "ROM OK" (upside down)
_35BB  call _37F4      ; prints all the rest of the dsw configured options
_35BE  ld   hl,$9100
_35C1  ld   b,$03      ; loop 3 times
_35C3  ld   (hl),$00   ; $9100 $9102 $9103 set to $00       $9100 is a "sync" that lets CPU1 and CPU2 continue when it becomes 0
_35C5  inc  hl
_35C6  djnz _35C3
_35C8  ld   a,$20
_35CA  ld   ($9000),a
_35CD  ld   hl,$35A5   ; start address of parameters/commands for IO chip??
_35D0  ld   de,$7000   ; "custom IO chip return values" (destination address to write the commands to using the ldi instruction during the nmi)
_35D3  ld   bc,$0004   ; 4 commands to write to IO chip
_35D6  exx             ; nmi will find these parameters in the secondary regs
_35D7  ld   a,$A1      ; command for IO chip to execute?
_35D9  ld   ($7100),a  ; custom IO chip status ($10 = command executed)
_35DC  ld   ($6830),a  ; Watchdog
_35DF  call _37EC      ; it waits for the IO command nmi opeerations to complete
_35E2  xor  a          ; A==0
_35E3  ld   ($6830),a  ; Watchdog
_35E6  ld   ($92A0),a
_35E9  ld   a,($92A0)  ; some timer?
_35EC  cp   $02        ; wait for 02 counts on the timer
_35EE  jr   nz,_35E9
_35F0  ld   hl,$35A9   ; src of IO parameters
_35F3  ld   de,$7000   ; IO parameter ports
_35F6  ld   bc,$000C   ; num params
_35F9  exx
_35FA  ld   a,$A8      ; IO command to execute
_35FC  ld   ($7100),a  ; do it!
_35FF  ld   ($6830),a  ; Watchdog
_3602  call _37EC      ; wait for IO command command executed
_3605  ld   ($6830),a  ; Watchdog
_3608  im   1
_360A  ld   hl,$6820   ; cpu #1 irq acknowledge/enable
_360D  ld   (hl),$00
_360F  ld   (hl),$01
_3611  ei
_3612  call _39F2      ; do sound check
_3615  xor  a          ; clear A
_3616  ld   ($92A0),a  ; reset the "timer"
_3619  ld   a,($92A0)
_361C  and  $08        ; test for 8 count
_361E  jr   z,_3619    ; wait for 8 count, sometime in here the first INT fires
;
_3620  ld   a,($92A0)  ; come back here if staying in svc mode, s.a. _367C,_3696
_3623  ld   c,a        ; A==$08
_3624  ld   a,($92A0)
_3627  cp   c          ; A==$09, C==$08
_3628  jr   z,_3624    ; stay here until timer changes once more 
_362A  ld   hl,$9116
_362D  ld   de,$9117
_3630  ld   bc,$0007
_3633  lddr
_3635  ex   de,hl
_3636  ld   de,$99B5   ; count of credits avilable from coin-box
_3639  ld   a,(de)
_363A  bit  7,a
_363C  jp   nz,_36BA   ; if bit-7 is off, it apparently means that svc-mode is on
;
_363F  ld   (hl),a     ; do this part when we're staying in svc mode
_3640  inc  hl
_3641  or   (hl)
_3642  inc  hl
_3643  cpl
_3644  and  (hl)
_3645  inc  hl
_3646  and  (hl)
_3647  ld   (hl),a
_3648  ld   b,a
_3649  inc  hl
_364A  inc  de
_364B  ld   a,(de)
_364C  ld   (hl),a
_364D  inc  hl
_364E  or   (hl)
_364F  inc  hl
_3650  cpl
_3651  and  (hl)
_3652  inc  hl
_3653  and  (hl)
_3654  ld   (hl),a
_3655  ld   l,a
_3656  ld   h,b
_3657  ld   b,$10
_3659  add  hl,hl
_365A  call c,_39D6
_365D  djnz _3659
_365F  call _37F4
_3662  ld   hl,($9272)
_3665  ld   a,h
_3666  or   l
_3667  jr   z,_3672
_3669  dec  hl
_366A  ld   ($9272),hl
_366D  ld   a,h
_366E  or   l
_366F  call z,_39BB    ; when does this call get taken?
_3672  ld   a,($9110)
_3675  rra
_3676  jr   nc,_367F   ; when does this call get taken?
_3678  xor  a
_3679  ld   ($9271),a
_367C  jp   _3620
;
;
_367F  ld   a,($9117)   ; call this from svc-mode, s.a. _3676
_3682  and  $0F
_3684  jp   z,_3620
_3687  ld   c,a
_3688  ld   hl,$3782
_368B  ld   de,$9271
_368E  ld   a,(de)
_368F  rst  $10
_3690  ld   a,(hl)
_3691  cp   c
_3692  jr   z,_3699
_3694  xor  a
_3695  ld   (de),a
_3696  jp   _3620
;
_3699  ex   de,hl
_369A  inc  (hl)
_369B  inc  de
_369C  ld   a,(de)
_369D  inc  a
_369E  jp   nz,_3620
_36A1  call _3958
_36A4  call _3972
_36A7  ld   de,$3798
_36AA  ld   hl,$8042
_36AD  ld   b,$1C
_36AF  call _3766
_36B2  djnz _36AF
_36B4  ld   a,($99B5)
_36B7  add  a,a
_36B8  jr   nc,_36B4
;
;
_36BA  xor  a          ; svc mode, jp here, s.a. _363C
_36BB  ld   ($92A0),a
_36BE  ld   a,($92A0)
_36C1  cp   $08
_36C3  jr   c,_36BE    ; wait for an 8 count on "timer"
_36C5  ld   a,($99B5)  ; count of credits avilable from coin-box
_36C8  add  a,a
_36C9  jp   nc,_3620
_36CC  call _3972      ; initialize sprite position RAM
_36CF  ld   hl,$8000
_36D2  ld   b,$10
_36D4  ld   (hl),$28
_36D6  inc  hl
_36D7  ld   (hl),$27
_36D9  inc  hl
_36DA  djnz _36D4
_36DC  ld   b,$10
_36DE  ld   (hl),$2D
_36E0  inc  hl
_36E1  ld   (hl),$2B
_36E3  inc  hl
_36E4  djnz _36DE
_36E6  ld   b,$10
_36E8  ld   (hl),$28
_36EA  inc  hl
_36EB  ld   (hl),$2D
_36ED  inc  hl
_36EE  djnz _36E8
_36F0  ld   b,$10
_36F2  ld   (hl),$27
_36F4  inc  hl
_36F5  ld   (hl),$2B
_36F7  inc  hl
_36F8  djnz _36F2
_36FA  ex   de,hl
_36FB  ld   hl,$8040
_36FE  ld   bc,$0340
_3701  ldir            ; now we've already wrote some squares to the screen so now copy those into the rest of the screen
_3703  ld   hl,$8000
_3706  ld   bc,$0040
_3709  ldir
_370B  xor  a
_370C  ld   ($92A0),a
_370F  ld   a,($92A0)
_3712  add  a,a        ; must be waiting for a count of like $80
_3713  jr   nc,_370F
_3715  ld   a,($99B5)  ; count of credits avilable from coin-box
_3718  add  a,a
_3719  jr   nc,_3715
_371B  di
_371C  call _37EC      ; it waits for the IO command nmi opeerations to complete
_371F  ld   a,$FE
_3721  ld   ($92A0),a
_3724  ld   a,($92A0)
_3727  and  a          ; waitin for 2 counts on the timer (hence A will be 0 at time up)
_3728  jr   nz,_3724
_372A  ld   ($6830),a  ; Watchdog reset?
_372D  ld   hl,$9280
_3730  ld   de,$7000   ; custom IO chip parameters
_3733  ld   bc,$0008
_3736  exx
_3737  ld   a,$E1      ; command to IO chip
_3739  ld   ($7100),a
_373C  call _37EC      ; IO chip command wait  
_373F  ld   hl,$7000   ; custom IO chip parameters
_3742  ld   de,$9288
_3745  ld   bc,$0003
_3748  exx
_3749  ld   a,$B1
_374B  ld   ($7100),a
_374E  call _37EC      ; IO chip command wait  
_3751  ld   a,($9288)
_3754  cp   $A1
_3756  jr   nc,_372D
_3758  and  $0F
_375A  cp   $0A
_375C  jr   nc,_372D
_375E  ei
_375F  xor  a
_3760  ld   ($8210),a  ; 0 in middle of screen
_3763  jp   _02D3      ; leave "service mode" jump to the prequel to attract mode
;
;
_3766  call _3774      ; begin 'call _3766', s.a. _36AF
_3769  call _3774
_376C  call _3774
_376F  ld   a,$05
_3771  jp   _0010
_3774  ld   a,(de)
_3775  ld   c,$08
_3777  add  a,a
_3778  jr   nc,_377B
_377A  inc  (hl)
_377B  inc  hl
_377C  dec  c
_377D  jr   nz,_3777
_377F  inc  de
_3780  inc  hl
_3781  ret
;
;
_3782  ; data, s.a. _3688, not sure of format or when used...TODO
     defb $02,$02,$02,$02,$02,$08,$08,$08,$08,$08,$08,$02,$02,$02,$08,$08
     defb $08,$08,$08,$08,$08,$FF,$01,$3E,$00,$7F,$41,$00,$21,$41,$00,$00
     defb $41,$00,$36,$3E,$00,$49,$00,$03,$49,$22,$03,$49,$41,$00,$36,$41
     defb $3E,$00,$3E,$41,$3E,$00,$41,$49,$7F,$41,$49,$20,$7F,$49,$18,$00
     defb $32,$20,$40,$00,$7F,$40,$01,$00,$7F,$7F,$3F,$40,$21,$44,$40,$00
     defb $44,$00,$3C,$44,$01,$42,$3F,$01,$81,$00,$01,$A5,$7F,$01,$A5,$04
     defb $7F,$99,$08,$00,$42,$10,$00,$3C,$7F,$00
;
;
;       org $37EC
_37EC  ld   a,($7100)  ; begin 'call $37EC' ... custom IO chip status ($10 = command executed)
_37EF  cp   $10        ; A still == $A1
_37F1  ret  z          ; if A == $10, ret
_37F2  jr   _37EC      ; end 'call _37EC'
;
;
; begin 'call _37F4'   ; this long-ass function displays dip switch stuff called from _35BB
_37F4  ld   a,($6807)  ; A==$03   cocktail/upright is on bit-1/dws2, of switch-7
_37F7  rra             ; A==$01   bit-1 of switch-7 was set, 1==upright
_37F8  inc  a          ; A==$02
_37F9  and  $01        ; A==$00   (A==1 for "TABLE")
_37FB  ld   ($9983),a  ; save off the cabinet type
_37FE  ld   hl,$3ACC   ; "base" address of cabinet-type display texts
_3801  rst  $08        ; HL:+=2A, it offsets HL to the display-text for the cabinet type
_3802  call _3A61      ; load start-address of cabinet-type texts, it will be HL==$3ACC or HL==$3ACD
;
_3805  ld   a,($99B5)  ; count of credits avilable from coin-box... A:=$82 ???
_3808  ld   c,$00
_380A  and  $0C
_380C  jr   nz,_380F
_380E  inc  c
_380F  ld   a,c
;
_3810  ld   ($A007),a  ; A==1, flip screen, wotsit have2 do wit credit-available?
;
_3813  ld   hl,$6800   ; HL:=$6800...dsw2, positions 0 and 1 for "difficulty"
_3816  ld   a,(hl)
_3817  rra             ; rotate right...
_3818  and  $01        ; ...so that the first position of dsw-2 is in bit-0, it's the lo-bit of the "difficulty" setting
_381A  ld   c,a        ; save off the hi-bit to c
_381B  inc  hl         ; HL:=$6801
_381C  ld   a,(hl)
_381D  and  $02        ; mask off bit-1, it's the hi-bit of the difficulty setting
_381F  or   c          ; add the lo-bit from c... 
_3820  ld   ($9984),a  ; ...and save off the difficulty setting to RAM... 3==EASY, 2==HARDEST, 1==HARD, 0==MEDIUM
_3823  ld   hl,$3A68   ; base_address of A-B-C-D characters
_3826  rst  $10        ; HL+=A
_3827  ld   de,$822C   ; dest for the rank-characterm, one of A-B-C-D
_382A  ldi             ; (DE)<-(HL) ..."?" of "RANK ?" displayed
_382C  ld   hl,$3AE4   ; src address of "RANK" string
_382F  call _331B      ; display "RANK"
;
; number_of_lives, 2-3-4-5
_3832  ld   hl,$6806   ; position 6-7 of dsw1 is the number_of_lives setting, hi-bit
_3835  ld   a,(hl)
_3836  inc  hl         ; position-7, at $6807, is the lo-bit
_3837  ld   c,(hl)     ; save off lo-bit to C
_3838  rr   c          ; if C!=0, set Cy flag, the Cy flag adds in as the lo-bit of the number_of_lives value
_383A  adc  a,a        ; A:=A*2, it was the value from position-6, the hi-bit was in $6806
_383B  and  $03        ; should only be in lower 2 bits
_383D  inc  a
_383E  ld   ($9982),a  ; save number of lives from dsw settings, $04==5-lives_setting
_3841  inc  a          ; A++, to give us 'exact' number (for screen-display purpose)
_3842  ld   ($82EA),a  ; "?" of "? SHIPS" displayed
_3845  ld   hl,$3AEB   ; src address of "SHIPS"
_3848  call _331B
;
; coin settings at $6800-01-02: the bits are msb-first
; 00 00 00 - free play
; 00 00 01 - 4-coin/1-credit   A==1
; 00 01 00 - 3-coin/1-credit   A==2
; 00 01 01 - 2-coin/1-credit   A==3
; 01 00 00 - 2-coin/3-credit
; 01 00 01 - 1-coin/3-credit
; 01 01 00 - 1-coin/2-credit
; 01 01 01 - 1-coin/1-credit   A==7
;
_384B  ld   hl,$3AC4   ;some 8-bytes are copied, not sure why
_384E  ld   de,$9280
_3851  ld   bc,$0008
_3854  ldir
; read out the bit-0 of $6800,$6801,$6802...read into A as a 3-bit value with high-bit from $6800
_3856  ld   hl,$6800   ; bit 0-2 coins per play (dsw1)
_3859  ld   b,$03
_385B  xor  a
_385C  ld   c,(hl)     ; read bits out of bit-0 position which is the mapping of dsw1...
_385D  rr   c          ; ...then rotate the bit right.  each bit that's read will be added into A from the Cy flag...
_385F  adc  a,a        ; ...but first the value in A is effectively doubled, then the carry is added to A 
_3860  inc  hl         ; get the next dsw bit
_3861  djnz _385C
;
_3863  and  $07        ; check for non-zero value in A...
_3865  jr   z,_389B    ; ...jump on past when in free play mode
;
;
; get the offset against HL for the COIN/CREDIT parameter block
_3867  dec  a          ; A:=(A-1)*8, this gets offsets of $00,$08,$10,$18,$20,$28,$30
_3868  add  a,a
_3869  add  a,a
_386A  add  a,a
_386B  ld   hl,$3A6C
_386E  rst  $10        ; HL:+=A
_386F  ld   de,$9281   ; copy first 4-bytes from COIN/CREDIT parameter block
_3872  ld   bc,$0004
_3875  ldir
_3877  ld   de,$82E8
_387A  ldi             ; show digit for number of coins
_387C  ld   de,$8228   ; 
_387F  ldi             ; show " " or "s"
_3881  ld   de,$81E8
_3884  ldi             ; show digit for number of credits
_3886  ld   de,$80E8
_3889  ldi             ; show " " or "s"
_388B  ld   a,$24
_388D  ld   ($8208),a  ; show a space after "COINS" or "COIN " as the case may be
;
_3890  ld   hl,$3AF3   ; src address of " COIN"
_3893  call _331B
_3896  call _331B      ; "CREDIT" of "1 CREDIT" displayed
_3899  jr   _38AB
;
                       ; jr here from _3865 for free-play mode
_389B  ld   hl,$9281   ; clear out the 4-bytes of the coins-to-play dsw setting
_389E  ld   b,$04
_38A0  ld   (hl),$00
_38A2  inc  hl
_38A3  djnz _38A0
_38A5  ld   hl,$3B04   ; src address of string "FREE PLAY"
_38A8  call _331B
;
;
; bonus-settings: dsw configuration maps out as follows:
;
;20-60-60    ; 00 00 01 - 1  $2-index into the configuration table at _3AA4
;20-70-70    ; 00 01 00 - 2  $4
;20-80-80    ; 00 01 01 - 3  $6
;30-100-100  ; 01 00 00 - 4  $8
;30-120-120  ; 01 00 01 - 5  $A
;20-60       ; 01 01 00 - 6  $C
;30-80       ; 01 01 01 - 7  $E
;None        ; 00 00 00 - 0
;
; display bonus info in following format:
;1ST BONUS  X0000 PTS
;2ND BONUS XX0000 PTS
;AND EVERY XX0000 PTS
;
_38AB  ld   hl,$6803   ; bit 3-5 bonus (dsw1)
_38AE  ld   b,$03
_38B0  xor  a
_38B1  ld   c,(hl)
_38B2  rr   c
_38B4  adc  a,a
_38B5  inc  hl
_38B6  djnz _38B1      ; ...a total of 3 positions to read
_38B8  and  $07        ; check for non-zero value of bonus dsw settings
_38BA  jp   z,_392D    ; if it's zero, display "BONUS NOTHING" and ret to _35BE
;
_38BD  ld   c,a        ; save off A
_38BE  ld   a,($9982)  ; load the setting for number of lives????????......, WTF???
_38C1  and  $04        ; ...$9982==$04 when number_of_lives is 5
_38C3  add  a,a        ; ...again, what's with $9982
_38C4  add  a,c        ; add the value of the dsw bits
_38C5  add  a,a        ; ...double the value...it's the offset into the bonus_configuration_parameter_table at $3AA4
_38C6  ld   hl,$3AA4   ; base-address of the Table, we'll add the offset to it from A
_38C9  rst  $10        ; HL:+=A...A==2,C,4,6,E,8,A
_38CA  ld   de,$9980   ; store the bonus settings, two-bytes
_38CD  ldi
_38CF  ldi
_38D1  dec  hl         ; point us back to the second byte of the two-byte Table entry
_38D2  ld   c,$01      ; this flag tells _38DA that it was 'called' and allows the "normal" return to occur at _392C
_38D4  call _38DA      ; display 'second and every' bonus settings
_38D7  dec  hl         ; point us back to the first byte of the two-byte table entry
_38D8  ld   c,$00      ; this flag will allow _3904 ret to occur
;
_38DA  ld   a,(hl)     ; begin 'call _38DA' ...ld one byte from the two-byte table entry
_38DB  inc  a          ; do this just to test for the $FF value in the bonus-none parameters
_38DC  jp   z,_393B    ; if 'bonus none', skip the 'second and every' display, not sure when this would happen though
_38DF  ld   a,c        ; first-pass (second-and-every) is indicated by 1, second-pass indicated by 0...
_38E0  add  a,a        ; ...so A==2 or A==0, they are indexes from $3B1A into the address of texts to load into HL...
_38E1  push hl         ; save the address of the table-entry
_38E2  ld   hl,$3B1A   ; i.e., 1E 3B "1ST BONUS ", 36 3B "2ND BONUS"
_38E5  rst  $10        ; HL:+=A
_38E6  ld   a,(hl)     ; get the LSB of the src address
_38E7  inc  hl
_38E8  ld   h,(hl)     ; get the MSB of the src address
_38E9  ld   l,a        ; ld the LSB back to L
_38EA  push bc         ; C holds the so-called 'first-bonus/second-bonus' flag, save it!
_38EB  call _331B      ; display "2ND BONUS" or "1ST BONUS"
_38EE  call _331B      ; display "0000 PTS" of "??? BONUS XX0000 PTS"... HL==$3B2B or HL==$3B42, as there are two copies of "0000 PTS"
                       ; DE==$80B2, that value will be used later......?
_38F1  pop  bc         ; get back the first-pass-second-pass flag
_38F2  pop  hl         ; get back the address of the table-entry
;
_38F3  ld   a,(hl)     ; ld the table-entry...
_38F4  and  $7F        ; ... and mask out the bit-7 which indicates when there is no 'and-every' setting
_38F6  ex   de,hl      ; save the address of the table-entry from HL,    DE==$80B2... the address of ' ' in "PTS " ....
_38F7  ld   hl,$81F0   ; video ram address.....
_38FA  ld   b,c        ; the first time through here, C==1... 
_38FB  djnz _38FF      ; ... so the second time, when the Flag is 0 we skip next two lines
_38FD  inc  hl
_38FE  inc  hl         ; .....now we've dropped two rows from $81F0, getting address of character X in "2ND BONUS X 0000 PTS"
_38FF  call _391E      ; display "X" of "??? BONUS XX0000 PTS"
_3902  ex   de,hl      ; HL:= to second-or-first-table-entry again
_3903  dec  c          ; C:=$00 at end of first-pass...
_3904  ret  nz         ; ...after second-pass, ret to _35BE, end 'call _37F4' (displaying dsw options)
;
_3905  ex   de,hl      ; save the current bonus-parameter-table-entry into DE
_3906  ld   a,(de)     ; A:=$86 for 20-60 setting, the second of the two byte-parameters
_3907  bit  7,a        ; if (bit-7)...
_3909  jp   nz,_3949   ; ... then (there's no Z-flag) take the jp (bit-7 on when there's no 'and-every' bonus)
;
_390C  ld   hl,$81F4   ; address of character X in "AND EVERY X 0000 PTS"
_390F  call _391E      ; display XX of "AND EVERY XX0000 PTS"
_3912  push de
_3913  ld   hl,$3B4D   ; src address of "AND EVERY"
_3916  call _331B
_3919  call _331B      ; display "0000 PTS" of "AND EVERY XX0000 PTS"  ( HL expected to be $3B59)
_391C  pop  hl
_391D  ret             ; end 'call 38DA', ret to _38D7
;
; begin 'call  $391E' ... converts bonus levels to decimal and display on screen
; on entry, HL==address_to_write_to
;           A==value from bonus-parameter-table
_391E  cp   $0A        ; check if value if > 10
_3920  ld   b,$24      ; start with a ' ' (space) character in B
_3922  jr   c,_3928    ; if Cy, it means that A<$0A, so jr past the display of the 10's place digit
_3924  ld   b,$01      ; value is 10 or greater...
_3926  sub  $0A        ; ...so subtract off the value of 10...
_3928  ld   (hl),b     ; ...and write a "1" to screen for the "10's" place
_3929  res  5,l        ; effectively, HL:-=$20, which will offset 1 column to the right on the screen
_392B  ld   (hl),a     ; write the "one's" place to the screen
_392C  ret             ; end 'call _391E'
;                      
                       ; jp here from $38BA for the setting of "NONE" for the bonuses
_392D  ld   hl,$3B64   ; src of "BONUS NOTHING"
_3930  call _331B
_3933  ld   hl,$9980   ; store off bonus settings, two bytes
_3936  ld   (hl),$FF
_3938  inc  hl
_3939  ld   (hl),$FF
;                      ; put space characters on the line where "2ND BONUS ?????? PTS" goes       ( jp here from $38DC??? )
_393B  ex   de,hl      ; this is saving HL to DE...
_393C  ld   hl,$8332   ; ...since we're loading HL again
_393F  ld   b,$16      ; we'll be writing out $16 space ' ' characters ($24)
_3941  ld   (hl),$23
_3943  ld   a,$E0
_3945  dec  h          ; effectively, HL:-=$100
_3946  rst  $10        ; HL:+=A, which adds back $E0, effectively we've done HL:-=$20
_3947  djnz _3941
;
_3949  ld   hl,$8334   ; jp here from $3909, it put space character on the line where "AND EVERY ?????? PTS" goes
_394C  ld   b,$16
_394E  ld   (hl),$20
_3950  ld   a,$E0
_3952  dec  h
_3953  rst  $10
_3954  djnz _394E
_3956  ex   de,hl
_3957  ret             ; if jp'd to _392D, ret to _35BE... end 'call _37F4' (displaying dsw options)
                       ; if jp'd to _393B, _3949, end 'call 38DA', ret to _35BE
;
;
_3958  ld   hl,$8000   ; begin 'call _3958' (fill tile RAM)
_395B  ld   de,$8001
_395E  ld   bc,$0400
_3961  ld   (hl),$24
_3963  ldir
_3965  ld   (hl),$03
_3967  ld   bc,$03FF
_396A  ldir
_396C  ld   a,$07
_396E  ld   ($99BE),a
_3971  ret             ; end 'call _3958'
;
;
_3972  ld   hl,$9380   ; begin 'call _3972' fill sprite position RAM
_3975  ld   b,$80      ; length of sprite position RAM
_3977  ld   (hl),$F1   ; fill with $F1
_3979  inc  hl
_397A  djnz _3977
_397C  ret             ; end 'call _3972'      ; extra garbage on screen gone with RAM OK showing 
;
; 
_397D  ld   hl,$99E0   ; begin 'call _397D', s.a. _397A
_3980  ld   de,$835E
_3983  ld   c,$02
_3985  ld   b,$01
_3987  call _3997
_398A  ld   b,$03
_398C  call _3997
_398F  ld   b,$02
_3991  call _3997
_3994  inc  hl
_3995  ld   b,$01
_3997  call _39AA      ; begin 'call _3997'
_399A  call _39A0
_399D  djnz _399A
_399F  ret
;
;
_39A0  ld   a,$99      ; begin 'call _39A0', s.a. _3997
_39A2  sub  (hl)
_39A3  rra
_39A4  rra
_39A5  rra
_39A6  rra
_39A7  call _39AE
_39AA  ld   a,$99
_39AC  sub  (hl)
_39AD  inc  hl
_39AE  and  $0F        ; begin 'call _39AE'
_39B0  ld   (de),a
_39B1  rst  $20
_39B2  dec  c
_39B3  ret  nz
_39B4  ld   a,$2A
_39B6  ld   c,$04
_39B8  ld   (de),a
_39B9  rst  $20
_39BA  ret
;
;
_39BB  ld   hl,$835E   ; begin 'call _39BB', s.a. _366F
_39BE  ld   b,$17
_39C0  ld   de,$FFE0
_39C3  ld   (hl),$24
_39C5  add  hl,de
_39C6  djnz _39C3
_39C8  ret
;
;
_39C9  push hl         ; jr to this, see _39DA
_39CA  call _397D
_39CD  ld   hl,$0384
_39D0  ld   ($9272),hl
_39D3  pop  hl
_39D4  pop  bc
_39D5  ret
;
;
_39D6  push bc         ; begin 'call _39D6'...these bits have to do with staying in svc mode, s.a. _36FA
_39D7  ld   a,b
_39D8  cp   $0F
_39DA  jr   z,_39C9    ; when does this jr get taken?
_39DC  cp   $02
_39DE  jr   z,_39F5    ; when does this jr get taken?
_39E0  cp   $04
_39E2  jr   nz,_3A21
;
_39E4  ld   a,($9270)
_39E7  sub  $01
_39E9  jr   nc,_39ED
_39EB  ld   a,$11
_39ED  ld   ($9270),a
_39F0  jr   _39FC
;
_39F2  push bc         ; begin 'call _39F2' (sound check)
_39F3  jr   _39FC
_39F5  ld   a,($9270)  ; _39F5-_39F9 called from _39DE, but when?
_39F8  inc a
_39F9  ld   ($9270),a  
_39FC  ld   a,($9270)
_39FF  cp   $12
_3A01  jr   c,_3A04
_3A03  xor  a          ; when does this happen?
_3A04  ld   ($9270),a
_3A07  push hl
_3A08  ld   c,$00      ; character "0"
_3A0A  cp   $0A
_3A0C  jr   c,_3A11
_3A0E  inc  c          ; when is that jr taken?
_3A0F  sub  $0A
_3A11  ld   hl,$822E   ; dest address of "0"
_3A14  ld   (hl),c     ; displayed "0" of "SOUND 00"
_3A15  ld   l,$0E
_3A17  ld   (hl),a     ; displayed (2nd) "0" of "SOUND 00"
_3A18  ld   hl,$3A47
_3A1B  call _331B      ; display "SOUND" of "SOUND 00"
_3A1E  pop  hl
_3A1F  pop  bc
_3A20  ret             ; end 'call _39F2' (sound check)
;
;
; these bits have to do with staying in svc mode
_3A21  ld   a,($9270)
_3A24  cp   $12
_3A26  jr   c,_3A29
_3A28  xor  a            ; when is this jr taken?
_3A29  ld   ($9270),a
_3A2C  ex   de,hl
_3A2D  call _3A3C
_3A30  ld   hl,$3A4F     ; ld table address
_3A33  rst  $10
_3A34  ld   l,(hl)
_3A35  ld   h,$9A
_3A37  ld   (hl),$01
_3A39  ex   de,hl
_3A3A  pop  bc
_3A3B  ret
;
;
_3A3C  ld   hl,$9AA0   ; begin 'call  $3A3C' ... clear $40 bytes at $9AA0
_3A3F  ld   b,$40      ; length to fill
_3A41  ld   (hl),$00   ; fill with 0
_3A43  inc  hl
_3A44  djnz _3A41
_3A46  ret             ; end call _3A3C
;
_3A47
       defb $EE,$82
       defb $05
       defb $1C,$18,$1E,$17,$0D ; "SOUND", s.a. _3A18
;
_3A4F  ; data, s.a. _3A30
       defb $A1,$A2,$A3,$A4,$A7,$AA,$AB,$AC,$AD,$AE,$AF,$B0,$B2,$B3,$B4,$B5,$B6,$B9
;
                       ; loads cabinet type texts from (HL), into HL for calling _331B text display routine
_3A61  ld   a,(hl)     ; load start address LSB of cabinet type text
_3A62  inc  hl         ; load start address MSB of cabinet type text
_3A63  ld   h,(hl)     ; HL:=$3A
_3A64  ld   l,a        ; HL==start address of src string to display
_3A65  jp   _331B      ; display the text, jp instead of calling so we only have to ret once
;                      ; end 'call _3A61' (it will ret from subroutine at $331B)
;
_3A68  ; text-characters for difficulty settings-MEDIUM,HARD,HARDEST,EASY respectively, s.a. _3823
       defb $0B,$0C,$0D,$0A
;
_3A6C  ; format characters for COIN/CREDIT display, s.a. _3867
       defb $04,$01,$04,$01,$04,$1C,$01,$24
       defb $03,$01,$03,$01,$03,$1C,$01,$24
       defb $02,$01,$02,$01,$02,$1C,$01,$24
       defb $02,$03,$02,$03,$02,$1C,$03,$1C
       defb $01,$03,$01,$03,$01,$24,$03,$1C
       defb $01,$02,$01,$02,$01,$24,$02,$1C
       defb $01,$01,$01,$01,$01,$24,$01,$24
;
; bonus-setting parameters...two-bytes for each setting, take each one times 10-decimal
; e.g. $02,$06 gives us "20000-60000-60000"
; s.a. _38C6
_3AA4  defb $FF,$FF,                                  ; default, or 'none' settings?
       defb $02,$06,$02,$07,$02,$08,$03,$0A,$03,$0C   ; 
       defb $02,$86,$03,$88                           ; bit-7 means there's no 'and-every' bonus
;
_3AB4  defb $FF,$FF,$03,$0A,$03,$0C,$03,$0F,$03,$8A,$03,$8C,$03,$8F,$03,$FF  ; ???????????
;
_3AC4  ; some 8-bytes of unknown data here, s.a. _384B
       defb $01,$01,$01,$01,$01,$02,$03,$00
;
_3ACC                  ; addresses of cabinet-types, for function, s.a. _37FE
       defb $D0,$3A    ; start address of "UPRIGHT" text
       defb $DA,$3A    ; start address of "TABLE" text
_3AD0
       defb $E6,$82
       defb $07
       defb $1E,$19,$1B,$12,$10,$11,$1D ; "UPRIGHT"
_3ADA
       defb $E6,$82
       defb $07
       defb $1D,$0A,$0B,$15,$0E,$24,$24 ; "TABLE  "
_3AE4
       defb $EC,$82
       defb $04
       defb $1B,$0A,$17,$14 ; "RANK", s.a. _382C
_3AEB
       defb $AA,$82
       defb $05
       defb $1C,$11,$12,$19,$1C ; "SHIPS", s.a. _3845
_3AF3
       defb $C8,$82
       defb $05
       defb $24,$0C,$18,$12,$17 ; " COIN", s.a. _3890
_3AFB
       defb $A8,$81
       defb $06
       defb $0C,$1B,$0E,$0D,$12,$1D ; "CREDIT"
_3B04
       defb $E8,$82
       defb $12
       defb $0F,$1B,$0E,$0E,$24,$19,$15,$0A,$22 ; "FREE PLAY"
       defb $24,$24,$24,$24,$24,$24,$24,$24,$24
;
_3B19  defb $24 ; I don't know what it goes with
;
_3B1A  ; s.a. _38E2
       defb $1E,$3B ; src address of "1ST BONUS "
       defb $36,$3B ; src address of "2ND BONUS"
;
_3B1E
       defb $30,$83
       defb $0A
       defb $01,$1C,$1D,$24,$0B,$18,$17,$1E,$1C,$24 ; "1ST BONUS "
_3B2B
       defb $B0,$81
       defb $08
       defb $00,$00,$00,$00,$24,$19,$1D,$1C ; "0000 PTS"
_3B36
       defb $32,$83
       defb $09
       defb $02,$17,$0D,$24,$0B,$18,$17,$1E,$1C ; "2ND BONUS"
_3B42
       defb $B2,$81
       defb $08
       defb $00,$00,$00,$00,$24,$19,$1D,$1C ; "0000 PTS"
_3B4D
       defb $34,$83
       defb $09
       defb $0A,$17,$0D,$24,$0E,$1F,$0E,$1B,$22 ; "AND EVERY", s.a. _3913
_3B59
       defb $B4,$81
       defb $08
       defb $00,$00,$00,$00,$24,$19,$1D,$1C ; "0000 PTS"
_3B64
       defb $30,$83
       defb $16
       defb $0B,$18,$17,$1E,$1C,$24,$17,$18,$1D,$11,$12,$17,$10 ; "BONUS NOTHING"
       defb $24,$24,$24,$24,$24,$24,$24,$24,$24
       defb $24 ; this seems to be extra character, len is only $16, s.a. _392D
_3B7E
       defb $E2,$82
       defb $07
       defb $1B,$0A,$16,$24,$24,$18,$14 ; "RAM  OK", s.a. _3468
_3B88
       defb $E4,$82
       defb $07
       defb $1B,$18,$16,$24,$24,$18,$14 ; "ROM  OK", s.a. _35B5
;
                       ; 3B92 - 3FFE is rst  $38
       org $3FFF
       defb $2E        ; _3FFF   ld  l, $00 ($2E)
;
; </end>

















