Home Journal Contact Me Tools Comments

Misc
Hidden message Easter egg Program Entry Start of the VBLANK
End of the VBLANK RAM usage Hardware/machine info
Demo Commands
Images
Character font (8x8)
Aliens (2 images each)
Player sprite (plus 2 images of blowing up)
Exploding alien (1 image)
Flying saucer (1 image)
Alien pulling upside down Y (1st of 2)
Alien pulling upside down Y (2nd of 2)
Alien pushing Y (1st of 2)
Alien pushing Y (2nd of 2)
Messages
'INSERT COIN'
'CREDIT '
'PUSH '
'TILT'
'GAME OVER PLAYER< >'
'1 OR 2PLAYERS BUTTON'
'ONLY 1PLAYER BUTTON '
' SCORE<1> HI-SCORE SCORE<2>'
'*TAITO CORPORATION*'
'*TAITO COP*'
'*SCORE ADVANCE TABLE*'
'=? MYSTERY'
'=30 POINTS'
'=20 POINTS'
'=10 POINTS'
'PLAy' with upside down Y
'PLAY' with normal Y
'SPACE INVADERS'
; Space Invaders
; Disassembly comments by Chris Cantrell 2010
; See http://www.computerarcheology.com for discussion.

; TODO Look at the various versions of the ROMs and see what's different

; TODO All references to X,Y should be to the standard screen before it is rotated or not. Haven't
;  decided but the comments actually switch between reference frames. Need to be consistent.





; RAM

; #+2000    waitOnDraw          (1B00:01)  Cleared by alien-draw and set by next-alien. This ensures no alien gets missed while drawing. @ 0137 0146 0176
; #+2002    alienIsExploding    (1B02:00)  Not-0 if an alien is exploding, 0 if not exploting @ 0426 14EA 154B
; #+2003    expAlienTimer       (1B03:10)  Time (ISR ticks) left in alien-explosion @ 152C
; #+2004    alienRow            (1B04:00)  Row number of current alien (cursor) @ 0171
; #+2005    alienFrame          (1B05:00)  Animation frame number (0 or 1) for current alien (cursor)
; #+2006    alienCurIndex       (1B06:00)  Alien cursor index (from 0 to 54) @ 0109 014F 0160 
; #+2007    refAlienDX          (1B07:00)  Reference alien deltaX @ 15B3
; #+2008    refAlienDY          (1B08:02)  Reference alien deltaY @ 00C8 0878 15AD
; #+2009    refAlienXX          (1B09:78)  Reference alien X coord @ 00B9 087C 0913 14F8 1562 
; #+200A    refAlienYY          (1B0A:38)  Reference alien Y coord @ 156F 
; #+200B    alienPosLSB         (1B0B:78)  Alien cursor bit pos (LSB)  @ 00BC 012E 0167 
; #+200C    alienPosMSB         (1B0C:38)  Alien cursor bit pos (MSB)
; #+201E    hidMessSeq          (1B1E:00)  Set to 1 after 1st of 2 sequences are entered for hidden-message display @ 199A 19A9 
; #+2061    collision           (1B61:00)  Set to 1 if sprite-draw detects collision @ 0421 05FB 1495 14A6 14BA 
; #+2067    playerDataMSB       (1B67:21)  Current player's data-pointer MSB (21xx or 22xx) @ 010D 014B 02ED 0312 0630 0807 0886 0898 08C1 09CA 09F9 0A01 0A04 158B 1613 16AE 17C0 18E7 1913 
; #+2072    vblankStatus        (1B72:00)  80=screen is being drawn (don't touch), 0=blanking in progress (ok to change) @ 0016 008D 
; #+2081    tmp2081             (1B81:FF)  Used to hold the remember/restore flag in shield-copy routine @ 021E 022B 
; #+2082    numAliens           (1B82:FF)  Number of aliens on screen @ 04FC 069E 082B 08D8 1605 1759 1782 18F3 
; #+2087    mysPriLocL          (1B87:64)  Mystery ship print descriptor ... coordinate LSB @ 0729 0759 
; #+2088    mysPriLocM          (1B88:1D)  Mystery ship print descriptor ... coordinate MSB 
; #+2089    mysPriPicL          (1B89:D0)  Mystery ship print descriptor ... message LSB 
; #+208A    mysPriPicM          (1B8A:29)  Mystery ship print descriptor ... message MSB @ 06C1 
; #+208B    mysPriSiz           (1B8B:18)  Mystery ship print descriptor ... number of characters 
; #+208C    mysDeltaY           (1B8C:02)  Mystery ship delta Y
; #+208D    sauScoreLSB         (1B8D:54)  Pointer into mystery-ship score table (MSB) @ 0447 0453 0711 
; #+208E    sauScoreMSB         (1B8E:1D)  Pointer into mystery-ship score table (LSB)
; #+208F    shotCount           (1B8F:00)  Bumped every shot-removal. Saucer's direction is bit 0. (0=2/29, 1=-2/E0) @ 0456 045A 
; #+2093    waitStartLoop       (1B93:00)  1=in wait-for-start loop, 0=in splash screens @ 005D 0767 17FE 
; #+2094    soundPort3          (1B94:00)  Current status of sound port (out $03) @ 18FA 18FE 19DC 19E0 
; #+2098    soundPort5          (1B98:01)  Current status of sound port (out $05) @ 0320 0A27 176D 
; #+2099    extraHold           (1B99:00)  Duration counter for extra-ship sound @ 0974 
; #+209A    tilt                (1B9A:00)  1 if tilt handling is in progress @ 17D2 17E5 17FB 
; #+20C0    isrDelay            (1BC0:00)  Delay counter decremented in ISR @ 08A6 08A9 0A44 0A47 0A9B 0A9E 0AD7 0ADA 
; #+20E9    suspendPlay         (1BE9:01)  1=game things are moving, 0=game things are suspended @ 0042 0090 09F3 19D3 
; #+20EA    coinSwitch          (1BEA:00)  1=switch down, 0=switch up (used to debounce coin switch) @ 0026 003F 0069 
; #+20EB    numCoins            (1BEB:00)  number of coin credits in BCD format (99 max) @ 002D 0038 0050 077F 079E 07A3 1947 
; #+20EF    gameMode            (1BEF:00)  1=game running, 0=demo or splash screens @ 0049 0097 02CB 034E 07BF 0A5F 162B 16DB 
; #+20F1    adjustScore         (1BF1:00)  Set to 1 if score needs adjusting @ 070E 098B 0991 
; #+20F2    scoreDeltaLSB       (1BF2:00)  Score adjustment (LSB) @ 0733 0995 
; #+20F3    scoreDeltaMSB       (1BF3:00)  Score adjustment (MSB)
;



; Move up from below as finalized

;  +2090    shotCountMSB        (1B90:08) Read as two-bytes with 208F, but never used as such.

;  +2001    ??2001              (1B01:00)  

;  +200D    ??200D              (1B0D:00)  @ 00D3 1597 15A9 
;  +200E    ??200E              (1B0E:F8)  @ 15B0 
;  +200F    ??200F              (1B0F:00)  
;  +2010    ??2010              (1B10:00)  
;  +2011    ??2011              (1B11:80)  @ 0319 
;  +2012    ??2012              (1B12:00)  @ 037D 
;  +2013    ??2013              (1B13:8E)  
;  +2014    ??2014              (1B14:02)  
; #+2015    playerAlive         (1B15:FF)  Checked to see if player is alive (FF=alive). Toggles between 0 and 1 for blow-up images. @ 039E 060F 0A59 1618 16EB 
;  +2016    ??2016              (1B16:05)  
;  +2017    ??2017              (1B17:0C)  
; #+2018    PlyrSprPicL         (1B18:60)  Player sprite descriptor ... picture LSB @ 03AA 
; #+2019    PlyrSprPicM         (1B19:1C)  Player sprite descriptor ... picture MSB 
; #+201A    PlyrSprLocL         (1B1A:20)  Player sprite descriptor ... location LSB @ 02AE 
; #+201B    PlyrSprLocM         (1B1B:30)  Player sprite descriptor ... location MSB @ 034A 0388 0395 03FC 061B 
; #+201C    PlyrSprSiz          (1B1C:10)  Player sprite descriptor ... size of sprite 
; #+201D    ?nextDemo?          (1B1D:01)  Next movement command for demo @ 0355 1667 
; #+207E    aShotSpeed          (1B7E:FC)  Alien shot speed. Normally -1 but set to -4 with less than 9 aliens @ 05E9 08E0 18B0

;  +201F    ??201F              (1B1F:00)  
;  +2020    ??2020              (1B20:00)  
;  +2021    ??2021              (1B21:00)  
;  +2022    ??2022              (1B22:00)  
;  +2023    ??2023              (1B23:BB)  
;  +2024    ??2024              (1B24:03)  
; #+2025    PlyrShotStat        (1B25:00)  0 if available, 1 if just initiated, 5 if alien explosion is in progress, 4 if alien has exploded (remove from active duty) @ 0B80 14D8 1514 1532 1547 1626 1641 172C 
;  +2026    ??2026              (1B26:10)  
;  +2027    ??2027              (1B27:90)  
;  +2028    ??2028              (1B28:1C)  
; #+2029    ?PlyrShotY?         (1B29:28)  Player shot Y coordinate?? @ 041B 14E1 
;  +202A    ??202A              (1B2A:30)  @ 0401 1508 
;  +202B    ??202B              (1B2B:01)  
;  +202C    ??202C              (1B2C:04)  @ 0416 
; #+202D    fireBounce          (1B2D:00)  1 if button has been handled but remains down @ 1632 1644 164E 
;  +202E    ??202E              (1B2E:FF)  
;  +202F    ??202F              (1B2F:FF)  
;  +2030    ??2030              (1B30:00)  
;  +2031    ??2031              (1B31:00)  
;  +2032    ??2032              (1B32:02)  @ 0072 047A 
;  +2033    ??2033              (1B33:76)  
;  +2034    ??2034              (1B34:04)  
;  +2035    ??2035              (1B35:00)  
;  +2036    ??2036              (1B36:00)  @ 04CA 051D 
;  +2037    ??2037              (1B37:00)  
;  +2038    ??2038              (1B38:00)  @ 047D 0486 
;  +2039    ??2039              (1B39:00)  
;  +203A    ??203A              (1B3A:04)  
;  +203B    ??203B              (1B3B:EE)  
;  +203C    ??203C              (1B3C:1C)  
;  +203D    ??203D              (1B3D:00)  
;  +203E    ??203E              (1B3E:00)  
;  +203F    ??203F              (1B3F:03)  
;  +2040    ??2040              (1B40:00)  
;  +2041    ??2041              (1B41:00)  
;  +2042    ??2042              (1B42:00)  
;  +2043    ??2043              (1B43:B6)  
;  +2044    ??2044              (1B44:04)  
;  +2045    ??2045              (1B45:00)  
;  +2046    ??2046              (1B46:00)  @ 0492 0517 
;  +2047    ??2047              (1B47:01)  
;  +2048    ??2048              (1B48:00)  @ 067E 
;  +2049    ??2049              (1B49:1D)  
;  +204A    ??204A              (1B4A:04)  
;  +204B    ??204B              (1B4B:E2)  
;  +204C    ??204C              (1B4C:1C)  
;  +204D    ??204D              (1B4D:00)  
;  +204E    ??204E              (1B4E:00)  
;  +204F    ??204F              (1B4F:03)  
;  +2050    ??2050              (1B50:00)  
;  +2051    ??2051              (1B51:00)  
;  +2052    ??2052              (1B52:00)  
;  +2053    ??2053              (1B53:82)  
;  +2054    ??2054              (1B54:06)  
;  +2055    ??2055              (1B55:00)  @ 18B8 18C0 
;  +2056    ??2056              (1B56:00)  @ 0498 04D0 0691 
;  +2057    ??2057              (1B57:01)  
;  +2058    ??2058              (1B58:06)  @ 054C 
;  +2059    ??2059              (1B59:1D)  
;  +205A    ??205A              (1B5A:04)  
;  +205B    ??205B              (1B5B:D0)  
;  +205C    ??205C              (1B5C:1C)  
;  +205D    ??205D              (1B5D:00)  
;  +205E    ??205E              (1B5E:00)  
;  +205F    ??205F              (1B5F:03)  
;  +2060    ??2060              (1B60:FF)  

;  +2062    ??2062              (1B62:C0)  
;  +2063    ??2063              (1B63:1C)  
; #+2064    ?expAlienLoc?       (1B64:00)  Location of exploding alien @ 150F 153D 
;  +2065    ??2065              (1B65:00)  
;  +2066    ??2066              (1B66:10)  
;  +2068    ??2068              (1B68:01)  @ 0141 029B 1747 
;  +2069    ??2069              (1B69:00)  @ 029E 0571 
;  +206A    ??206A              (1B6A:30)  @ 02A3 
; #+206B    oneAlien            (1B6B:00)  1 when only one alien is on screen 
; #+206C    temp206C            (1B6C:12)  Holds the value ten ... number of characters in each "=xx POINTS" string but gets set to 18 in mem copy before game. FRUSTRATING ??? @ 1822 184D 
;  +206D    ??206D              (1B6D:00)  @ 02C6 1973 
;  +206E    ??206E              (1B6E:00)  @ 04B7 0505 
;  +206F    ??206F              (1B6F:00)  
;  +2070    ??2070              (1B70:0F)  @ 0495 04CD 051A 057C 
;  +2071    ??2071              (1B71:0B)  @ 049B 04D3 0520 0589 
;  +2073    ??2073              (1B73:18)  @ 0612 0617 
;  +2074    ??2074              (1B74:26)  
;  +2075    ??2075              (1B75:0F)  
;  +2076    ??2076              (1B76:0B)  @ 04D9 04E4 0508 0526 0531 0549 059C 05A2 
;  +2077    ??2077              (1B77:00)  
;  +2078    ??2078              (1B78:18)  @ 04A1 04E7 0534 
;  +2079    ??2079              (1B79:04)  @ 05D4 05E2 0654 
;  +207A    ??207A              (1B7A:11)  
;  +207B    ??207B              (1B7B:24)  @ 05B4 05E5 05ED 05F3 0600 
;  +207C    ??207C              (1B7C:1B)  
;  +207D    ??207D              (1B7D:25)  @ 0661 
;  +207E    ??207E              (1B7E:FC)  @ 05E9 08E0 18B0 
;  +207F    ??207F              (1B7F:00)  @ 0550 
;  +2080    ??2080              (1B80:01)  @ 0075 04BC 0683 18AB 


;  +2083    ??2083              (1B83:00)  @ 0926 
;  +2084    ??2084              (1B84:00)  @ 045D 
;  +2085    ??2085              (1B85:00)  @ 157B 
;  +2086    ??2086              (1B86:20)   


;  +2091    ??2091              (1B91:00)  @ 0919 092A 
;  +2092    ??2092              (1B92:06)  

;  +2095    ??2095              (1B95:01)  @ 1775 17A7 
;  +2096    ??2096              (1B96:40)  
;  +2097    ??2097              (1B97:00)  @ 178F 

;  +209B    ??209B              (1B9B:10)  @ 1769 
;  +209C    ??209C              (1B9C:9E)  
;  +209D    ??209D              (1B9D:00)  
;  +209E    ??209E              (1B9E:20)  
;  +209F    ??209F              (1B9F:1C)  
;  +20A0    ??20A0              (1BA0:00)  
;  +20A1    ??20A1              (1BA1:03)  
;  +20A2    ??20A2              (1BA2:04)  
;  +20A3    ??20A3              (1BA3:78)  
;  +20A4    ??20A4              (1BA4:14)  
;  +20A5    ??20A5              (1BA5:13)  
;  +20A6    ??20A6              (1BA6:08)  
;  +20A7    ??20A7              (1BA7:1A)  
;  +20A8    ??20A8              (1BA8:3D)  
;  +20A9    ??20A9              (1BA9:68)  
;  +20AA    ??20AA              (1BAA:FC)  
;  +20AB    ??20AB              (1BAB:FC)  
;  +20AC    ??20AC              (1BAC:68)  
;  +20AD    ??20AD              (1BAD:3D)  
;  +20AE    ??20AE              (1BAE:1A)  
;  +20AF    ??20AF              (1BAF:00)  
;  +20B0    ??20B0              (1BB0:00)  
;  +20B1    ??20B1              (1BB1:00)  
;  +20B2    ??20B2              (1BB2:01)  
;  +20B3    ??20B3              (1BB3:B8)  
;  +20B4    ??20B4              (1BB4:98)  
;  +20B5    ??20B5              (1BB5:A0)  
;  +20B6    ??20B6              (1BB6:1B)  
;  +20B7    ??20B7              (1BB7:10)  
;  +20B8    ??20B8              (1BB8:FF)  
;  +20B9    ??20B9              (1BB9:00)  
;  +20BA    ??20BA              (1BBA:A0)  
;  +20BB    ??20BB              (1BBB:1B)  
;  +20BC    ??20BC              (1BBC:00)  
;  +20BD    ??20BD              (1BBD:00)  
;  +20BE    ??20BE              (1BBE:00)  
;  +20BF    ??20BF              (1BBF:00)  

;  +20C1    ??20C1              (1BC1:10)  @ 009E 056C 0801 0A82 0A8F 0ABF 0B6B 0B8A 18B5 1982 
;  +20C2    ??20C2              (1BC2:00)  @ 1879 
;  +20C3    ??20C3              (1BC3:0E)  
;  +20C4    ??20C4              (1BC4:05)  
;  +20C5    ??20C5              (1BC5:00)  
;  +20C6    ??20C6              (1BC6:00)  
;  +20C7    ??20C7              (1BC7:00)  @ 1888 
;  +20C8    ??20C8              (1BC8:00)  
;  +20C9    ??20C9              (1BC9:00)  
;  +20CA    ??20CA              (1BCA:07)  @ 1872 
;  +20CB    ??20CB              (1BCB:D0)  @ 0A87 189A 
;  +20CC    ??20CC              (1BCC:1C)  @ 187E 
;  +20CD    ??20CD              (1BCD:C8)  
; #+20CE    twoPlayers          (1BCE:9B)  0 means 1 player @ 02E6 079B 08E4 1698 
;  +20CF    ??20CF              (1BCF:03)  @ 0584 0591 1728 18E1 
;  +20D0    ??20D0              (1BD0:00)  
;  +20D1    ??20D1              (1BD1:00)  
;  +20D2    ??20D2              (1BD2:03)  
;  +20D3    ??20D3              (1BD3:04)  
;  +20D4    ??20D4              (1BD4:78)  
;  +20D5    ??20D5              (1BD5:14)  
;  +20D6    ??20D6              (1BD6:0B)  
;  +20D7    ??20D7              (1BD7:19)  
;  +20D8    ??20D8              (1BD8:3A)  
;  +20D9    ??20D9              (1BD9:6D)  
;  +20DA    ??20DA              (1BDA:FA)  
;  +20DB    ??20DB              (1BDB:FA)  
;  +20DC    ??20DC              (1BDC:6D)  
;  +20DD    ??20DD              (1BDD:3A)  
;  +20DE    ??20DE              (1BDE:19)  
;  +20DF    ??20DF              (1BDF:00)  
;  +20E0    ??20E0              (1BE0:00)  
;  +20E1    ??20E1              (1BE1:00)  
;  +20E2    ??20E2              (1BE2:00)  
; #+20E3    Player1Ex           (1BE3:00)  Extra ship has been awarded = 0 
; #+20E4    Player2Ex           (1BE4:00)  Extra ship has been awarded = 0 
;  +20E5    ??20E5              (1BE5:00)  @ 07C5 
;  +20E6    ??20E6              (1BE6:00)  
;  +20E7    ??20E7              (1BE7:00)  @ 07C2 
;  +20E8    ??20E8              (1BE8:00)  
; #+20EC    splashAnimate       (1BEC:01)  0 for animation during splash and 1 for not. This alternates after every cycle. @ 0AF6 0B17 0B9E 0BC6 
; #+20ED    ?demoPtr?           (1BED:74)  pointer to demo commands 1663 @ 1657 1663 
;  +20EE    ??20EE              (1BEE:1F)  
;  +20F0    ??20F0              (1BF0:80)  

; #+20F4    HiScorL             (1BF4:00)  Hi-score descriptor ... value LSB 
; #+20F5    HiScorM             (1BF5:00)  Hi-score descriptor ... value MSB 
; #+20F6    HiScorLoL           (1BF6:1C)  Hi-score descriptor ... location LSB 
; #+20F7    HiScorLoM           (1BF7:2F)  Hi-score descriptor ... location MSB 
; #+20F8    P1ScorL             (1BF8:00)  Hi-score descriptor ... value LSB @ 07AC 
; #+20F9    P1ScorM             (1BF9:00)  Hi-score descriptor ... value MSB 
; #+20FA    P1ScorLoL           (1BFA:1C)  Hi-score descriptor ... location LSB 
; #+20FB    P1ScorLoM           (1BFB:27)  Hi-score descriptor ... location MSB 
; #+20FC    P2ScorL             (1BFC:00)  Hi-score descriptor ... value LSB @ 07AF 
; #+20FD    P2ScorM             (1BFD:00)  Hi-score descriptor ... value MSB 
; #+20FE    P2ScorLoL           (1BFE:1C)  Hi-score descriptor ... location LSB 
; #+20FF    P2ScorLoM           (1BFF:39)  Hi-score descriptor ... location MSB 


;  +21FB    ??21FB              @ 00D9 
;  +21FC    ??21FC              @ 07ED 
;  +21FE    ??21FE              @ 07DE 
;  +21FF    ??21FF              @ 07D4 0B4D 0B57 
;  +22FB    ??22FB              @ 00DC 
;  +22FC    ??22FC              @ 07F0 
;  +22FE    ??22FE              @ 07E1 
;  +22FF    ??22FF              @ 07D7 


;Player Data is 0100 bytes long
;Player1 2100-21FF
;Player2 2200-22FF
;2p00 - 2p37 : Alien ship indicators (0=dead)
; 11 byte descriptors ... how many?
;2pFF: Ships remaining after current dies



;Dig Notes

;The code isn't constructed all that well. There is a lot
;of jumping around making the code hard to follow. Take the
;credit registration routine in the ISR.

;There are a lot of NOPs all over the place for questionable
;reasons. For insta

;Needless stacks at 1439 for instance -- a loop with a
;push/pop in it. What a waste. Memory access? How else
;could it be done?


;At 142D, HL is incremented then POPed from the stack. Why?




; Hardware
; invaders.h 0000-07FF
; invaders.g 0800-0FFF
; invaders.f 1000-17FF
; invaders.e 1800-1FFF

; Interrupt RST 8 at the start of vblank
; Interrupt RST 10 at the end of vblank

; Video = 256x * 224y @60Hz vertical
; Video hardware 7168 bytes lbpp bitmap (32 bytes per scanline)

;0000-1FFF   8K ROM
;2000-23FF   1K RAM
;2400-3FFF   7K Video RAM
;4000- RAM mirror

;I/O ports:
;read:
;00        INPUTS (Mapped in hardware but never used by the code)
;01        INPUTS
;02        INPUTS
;03        bit shift register read
;write:
;02        shift amount (3 bits)
;03        sound bits
;04        shift data
;05        sound bits
;06        watch-dog
;07        * See below

; Dedicated shift hardware goes like this:
; Write LSB of 16bit value to port 4
; Write MSB of 16bit value to port 4
; Write left-shift-amount to port 2
; Read port 3 returns the upper byte of the 16bit value
; after it has been shifted left N bits

;Space Invaders
;--------------
;Input:
;Port 0
;   bit 0 DIP4 (Cocktail???)
;   bit 1 Always 1
;   bit 2 Always 1
;   bit 3 Always 1
;   bit 4 Fire
;   bit 5 Left
;   bit 6 Right
;   bit 7 * See below
;Port 1
;   bit 0 = CREDIT (1 if deposit)
;   bit 1 = 2P start (1 if pressed)
;   bit 2 = 1P start (1 if pressed)
;   bit 3 = Always 1
;   bit 4 = 1P shot (1 if pressed)
;   bit 5 = 1P left (1 if pressed)
;   bit 6 = 1P right (1 if pressed)
;   bit 7 = Not connected
;Port 2
;   bit 0 = DIP3 00 = 3 ships  10 = 5 ships
;   bit 1 = DIP5 01 = 4 ships  11 = 6 ships
;   bit 2 = Tilt
;   bit 3 = DIP6 0 = extra ship at 1500, 1 = extra ship at 1000
;   bit 4 = P2 shot (1 if pressed)
;   bit 5 = P2 left (1 if pressed)
;   bit 6 = P2 right (1 if pressed)
;   bit 7 = DIP7 Coin info displayed in demo screen 0=ON
; Port 3
;   bit 0-7 Shift register data
;
; Output
;Port 2:
;  bit 0,1,2 Shift amount
;Port 3:
;  bit 0=UFO (repeats)        SX0 0.raw
;  bit 1=Shot                 SX1 1.raw
;  bit 2=Flash (player die)   SX2 2.raw
;  bit 3=Invader die          SX3 3.raw
;  bit 4=Extended play        SX4
;  bit 5= AMP enable          SX5
;  bit 6= NC (not wired)
;  bit 7= NC (not wired)
;Port 4:
;  bit 0-7 shift data (LSB on 1st write, MSB on 2nd)
;Port 5:
;  bit 0=Fleet movement 1     SX6 4.raw
;  bit 1=Fleet movement 2     SX7 5.raw
;  bit 2=Fleet movement 3     SX8 6.raw
;  bit 3=Fleet movement 4     SX9 7.raw
;  bit 4=UFO Hit              SX10 8.raw
;  bit 5= NC
;  bit 6= NC (not wired)
;  bit 7= NC (not wired)
;
;Port 6:
;  Watchdog ... read or write to reset


;16 bit shift register:
;	f              0	bit
;	xxxxxxxxyyyyyyyy
;	
;	Writing to port 4 shifts x into y, and the new value into x, eg.
;	$0000,
;	write $aa -> $aa00,
;	write $ff -> $ffaa,
;	write $12 -> $12ff, ..
;	
;	Writing to port 2 (bits 0,1,2) sets the offset for the 8 bit result, eg.
;	offset 0:
;	rrrrrrrr		result=xxxxxxxx
;	xxxxxxxxyyyyyyyy
;	
;	offset 2:
;	  rrrrrrrr	result=xxxxxxyy
;	xxxxxxxxyyyyyyyy
;	
;	offset 7:
;	       rrrrrrrr	result=xyyyyyyy
;	xxxxxxxxyyyyyyyy
;	
;	Reading from port 3 returns said result.


; Screen Geometry
; 2400 - 3FFF (1C00 bytes = 256 * 28) 28*8=224. Screen is 256x224 pixels.
; Screen layout. Take this map and rotate it counter clockwise once. Thus the first
; byte is lower left. First "row" ends upper left. Last byte is upper right.
;  
; 
;     2400     2401     2402        ....   241F
;     01234567 01234567 01234567    ....   01234567
; 
;     2420     2421     2422        ....   243F
;     01234567 01234567 01234567    ....   01234567
;    
;     .                                    .
;     .                                    .
;     .                                    .
;     .                                    .
; 
;     3FE0     3FE1     3FE2        ....   3FFF
;     01234567 01234567 01234567    ....   01234567

 
; Reset
0000: 00              NOP                         ; %% Interesting. Why waste the ...
0001: 00              NOP                         ; ... CPU cycles with NOPs ? ...
0002: 00              NOP                         ; ... Slot for jump in development?
0003: C3 D4 18        JMP     $18D4               ; Continue startup at 18D4
0006: 00 00  ; Padding

; StartVblank
; Interrupt brings us here at the start of the vertical blanking. This is the perfect time
; to make screen changes.
0008: F5              PUSH    PSW                 ; Save ...
0009: C5              PUSH    B                   ; ...
000A: D5              PUSH    D                   ; ...
000B: E5              PUSH    H                   ; ... everything
000C: C3 8C 00        JMP     $008C               ; Continue ISR at 8C
000F: 00     ; Padding

; EndVblank
; Interrupt brings us here at the end of the vertical blanking. Screen should be left alone.
0010: F5              PUSH    PSW                 ; Save ...
0011: C5              PUSH    B                   ; ...
0012: D5              PUSH    D                   ; ...
0013: E5              PUSH    H                   ; ... everything
0014: 3E 80           MVI     A,$80               ; Screen should be ...
0016: 32 72 20        STA     vblankStatus        ; ... locked now that VBlank is over
0019: 21 C0 20        LXI     H,$20C0             ; Decrement ...
001C: 35              DCR     M                   ; ... the general countdown (used for pauses)
001D: CD CD 17        CALL    CheckHandleTilt     ; Check and handle TILT
0020: DB 01           IN      $01                 ; Read coin switch
0022: 0F              RRC                         ; Has a coin been deposited (bit 0)?
0023: DA 67 00        JC      $0067               ; Yes ... note that it is closed and continue at 3F with A=1
0026: 3A EA 20        LDA     coinSwitch          ; Switch is now open. Was it ...
0029: A7              ANA     A                   ; ... closed last time?
002A: CA 42 00        JZ      $0042               ; No ... skip registering the credit
;
; Handle bumping credit count
002D: 3A EB 20        LDA     numCoins            ; Number of credits in BCD
0030: FE 99           CPI     $99                 ; 99 credits already?
0032: CA 3E 00        JZ      $003E               ; Yes ... ignore this
0035: C6 01           ADI     $01                 ; Bump number of credits
0037: 27              DAA                         ; Make it decimal coded binary
0038: 32 EB 20        STA     numCoins            ; New number of credits
003B: CD 47 19        CALL    DrawNumCredits      ; Draw credits on screen
003E: AF              XRA     A                   ; Credit switch ...
003F: 32 EA 20        STA     coinSwitch          ; ... has opened
;
0042: 3A E9 20        LDA     suspendPlay         ; Are we moving ...
0045: A7              ANA     A                   ; ... game objects?
0046: CA 82 00        JZ      $0082               ; No ... restore registers and out
0049: 3A EF 20        LDA     gameMode            ; Are we in ...
004C: A7              ANA     A                   ; ... game mode?
004D: C2 6F 00        JNZ     $006F               ; Yes ... ?? time down fleet
0050: 3A EB 20        LDA     numCoins            ; Number of credits
0053: A7              ANA     A                   ; Are there any credits (player standing there)?
0054: C2 5D 00        JNZ     $005D               ; Yes ... skip any ISR animations for the splash screens
0057: CD BF 0A        CALL    ISRSplTasks         ; Process ISR tasks for splash screens
005A: C3 82 00        JMP     $0082               ; Restore registers and out
;
; At this point no game is going and there are credits
005D: 3A 93 20        LDA     waitStartLoop       ; Are we in the ...
0060: A7              ANA     A                   ; ... "press start" loop?
0061: C2 82 00        JNZ     $0082               ; Yes ... restore registers and out
0064: C3 65 07        JMP     WaitForStart        ; Start the "press start" loop
;
; Mark credit as needing registering
0067: 3E 01           MVI     A,$01               ; Remember switch ...
0069: 32 EA 20        STA     coinSwitch          ; ... state for debounce
006C: C3 3F 00        JMP     $003F               ; Continue
;
; Main game-play timing loop
;
; ??TOPHER working here. What is all this stuff?
;
006F: CD 40 17        CALL    TimeFleetSound      ; Time down fleet and sets flag if needs handling
0072: 3A 32 20        LDA     $2032               ; ?? Something to do with task 2030 ... the missile-alien-shot
0075: 32 80 20        STA     $2080               ; ?? NOPing this out and player doesn't move and alien shots are fast
0078: CD 00 01        CALL    DrawAlien           ; Draw the current alien (or exploding alien)
007B: CD 48 02        CALL    RunGameObjs         ; Process game objects (including player object)
007E: CD 13 09        CALL    $0913               
0081: 00              NOP                         ; %% Why are we waiting?
;
0082: E1              POP     H                   ; Restore ...
0083: D1              POP     D                   ; ...
0084: C1              POP     B                   ; ...
0085: F1              POP     PSW                 ; ... everything
0086: FB              EI                          ; Enable interrupts
0087: C9              RET                         ; Return from interrupt

0088: 00 00 00 00                

; Continues here at start of VBLANK
;
008C: AF              XRA     A                   ; Screen is
008D: 32 72 20        STA     vblankStatus        ; ... unlocked now that VBlank has begun
0090: 3A E9 20        LDA     suspendPlay         ; Are we moving ...
0093: A7              ANA     A                   ; ... game objects?
0094: CA 82 00        JZ      $0082               ; No ... restore and return
0097: 3A EF 20        LDA     gameMode            ; Are we in ...
009A: A7              ANA     A                   ; ... game mode?
009B: C2 A5 00        JNZ     $00A5               ; Yes .... ?? go do something game related
009E: 3A C1 20        LDA     $20C1               ; Splash-animation tasks
00A1: 0F              RRC                         ; Is this ??? task 1?
00A2: D2 82 00        JNC     $0082               ; No ... we are done
;
00A5: 21 20 20        LXI     H,$2020             ; Game objects (except player object)
00A8: CD 4B 02        CALL    $024B               ; Process all game objects (except player object)
00AB: CD 41 01        CALL    CursorNextAlien     ; Advance cursor to next alien (move the alien if it is last one)
00AE: C3 82 00        JMP     $0082               ; Restore and return


00B1: CD 86 08        CALL    $0886               
00B4: E5              PUSH    H                   
00B5: 7E              MOV     A,M                 
00B6: 23              INX     H                   
00B7: 66              MOV     H,M                 
00B8: 6F              MOV     L,A                 
00B9: 22 09 20        SHLD    refAlienXX          ; Alien's X,Y ...
00BC: 22 0B 20        SHLD    alienPosLSB         ; ... to bit draw position
00BF: E1              POP     H                   
00C0: 2B              DCX     H                   
00C1: 7E              MOV     A,M                 
00C2: FE 03           CPI     $03                 
00C4: C2 C8 00        JNZ     $00C8               
00C7: 3D              DCR     A                   
00C8: 32 08 20        STA     refAlienDY          ; ?? reference alien deltaX
00CB: FE FE           CPI     $FE                 
00CD: 3E 00           MVI     A,$00               
00CF: C2 D3 00        JNZ     $00D3               
00D2: 3C              INR     A                   
00D3: 32 0D 20        STA     $200D               
00D6: C9              RET                         

00D7: 3E 02           MVI     A,$02               
00D9: 32 FB 21        STA     $21FB               
00DC: 32 FB 22        STA     $22FB               
00DF: C3 E4 08        JMP     $08E4               

00E2: 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

; DrawAlien
; 2006 holds the index into the alien flag data grid. 2067 holds the MSB of the pointer (21xx or 22xx).
; If there is an alien exploding time it down. Otherwise draw the alien if it alive (or skip if
; it isn't). If an alien is drawn (or blank) then the 2000 alien-drawing flag is cleared.
;
0100: 21 02 20        LXI     H,$2002             ; Is there an ...
0103: 7E              MOV     A,M                 ; ... alien ...
0104: A7              ANA     A                   ; ... exploding?
0105: C2 38 15        JNZ     AExplodeTime        ; Yes ... go time it down and out
;
0108: E5              PUSH    H                   ; 2002 on the stack
0109: 3A 06 20        LDA     alienCurIndex       ; Get alien index ...
010C: 6F              MOV     L,A                 ; ... for the 21xx or 22xx pointer
010D: 3A 67 20        LDA     playerDataMSB       ; Get MSB ...
0110: 67              MOV     H,A                 ; ... of data area (21xx or 22xx)
0111: 7E              MOV     A,M                 ; Get alien status flag
0112: A7              ANA     A                   ; Is the alien alive?
0113: E1              POP     H                   ; HL=2002
0114: CA 36 01        JZ      $0136               ; No alien ... skip drawing alien sprite (but flag done)
0117: 23              INX     H                   ; HL=2003 Bump descriptor
0118: 23              INX     H                   ; HL=2004 Point to alien's row
0119: 7E              MOV     A,M                 ; Get alien type
011A: 23              INX     H                   ; HL=2005 Bump descriptor
011B: 46              MOV     B,M                 ; Get animation number
011C: E6 FE           ANI     $FE                 ; Translate row to type offset as follows: ...
011E: 07              RLC                         ; ... 0,1 -> 32 (type 1) ...
011F: 07              RLC                         ; ... 2,3 -> 16 (type 2) ...
0120: 07              RLC                         ; ...   4 -> 32 (type 3) on top row
0121: 5F              MOV     E,A                 ; Sprite offset LSB
0122: 16 00           MVI     D,$00               ; MSB is 0
0124: 21 00 1C        LXI     H,$1C00             ; Position 0 alien sprites
0127: 19              DAD     D                   ; Offset to sprite type
0128: EB              XCHG                        ; Sprite offset to DE
0129: 78              MOV     A,B                 ; Animation frame number
012A: A7              ANA     A                   ; Is it position 0?
012B: C4 3B 01        CNZ     $013B               ; No ... add 30 and use position 1 alien sprites
012E: 2A 0B 20        LHLD    alienPosLSB         ; Pixel position
0131: 06 10           MVI     B,$10               ; 16 rows in alien sprites
0133: CD D3 15        CALL    DrawSprite          ; Draw shifted sprite
;
0136: AF              XRA     A                   ; Let the VBLANK routine ...
0137: 32 00 20        STA     waitOnDraw          ; ... advance the cursor to the next alien
013A: C9              RET                         ; Out
;
013B: 21 30 00        LXI     H,$0030             ; Offset sprite pointer ...
013E: 19              DAD     D                   ; ... to animation frame 1 sprites
013F: EB              XCHG                        ; Back to DE
0140: C9              RET                         ; Out

; CursorNextAlien
; This is called at the end of every VBLANK (while the screen is drawing) to set the cursor
; for the next alien to draw. When the cursor moves over all aliens then it is reset to
; the beginning and the reference alien is moved to its next position.
;
; The flag at 2000 keeps this in sync with the alien-draw routine called in at the start of
; every VBLANK (while the screen is idle). When the cursor is moved here then the flag
; at 2000 is set to 1. This routine will not change the cursor until the alien-draw routine
; at 100 clears the flag. Thus no alien is skipped.
;
0141: 3A 68 20        LDA     $2068               ; Is the player ...
0144: A7              ANA     A                   ; ... blowing up?
0145: C8              RZ                          ; Yes ... ignore the aliens
0146: 3A 00 20        LDA     waitOnDraw          ; Still waiting on ...
0149: A7              ANA     A                   ; ... this alien to be drawn?
014A: C0              RNZ                         ; Yes ... leave cursor in place
014B: 3A 67 20        LDA     playerDataMSB       ; Load alien-data ...
014E: 67              MOV     H,A                 ; ... MSB (either 21xx or 22xx)
014F: 3A 06 20        LDA     alienCurIndex       ; Load the xx part of the alien flag pointer
0152: 16 02           MVI     D,$02               ; When all are gone this triggers 1A1 to return from this stack frame
0154: 3C              INR     A                   ; Have we drawn all aliens ...
0155: FE 37           CPI     $37                 ; ... at last position?
0157: CC A1 01        CZ      MoveRefAlien        ; Yes ... move the bottom/right alien and reset index to 0
015A: 6F              MOV     L,A                 ; HL now points to alien flag
015B: 46              MOV     B,M                 ; Is alien ...
015C: 05              DCR     B                   ; ... alive?
015D: C2 54 01        JNZ     $0154               ; No ... skip to next alien
0160: 32 06 20        STA     alienCurIndex       ; New alien index
0163: CD 7A 01        CALL    GetAlienCoords      ; Calculate bit position and type for index
0166: 61              MOV     H,C                 ; The calculation returns the MSB in C
0167: 22 0B 20        SHLD    alienPosLSB         ; Store new bit position
016A: 7D              MOV     A,L                 ; Has this alien ...
016B: FE 28           CPI     $28                 ; ... reached the end of screen?
016D: DA 71 19        JC      $1971               ; Yes ... kill the player
0170: 7A              MOV     A,D                 ; This alien's ...
0171: 32 04 20        STA     alienRow            ; ... row index
0174: 3E 01           MVI     A,$01               ; Set the wait-flag for the ...
0176: 32 00 20        STA     waitOnDraw          ; ... draw-alien routine to clear
0179: C9              RET                         ; Done

; GetAlienCoords
; Convert alien index in L to bit position in C,L.
; Return alien row index (converts to type) in D.
; 
017A: 16 00           MVI     D,$00               ; Row 0
017C: 7D              MOV     A,L                 ; Hold onto alien index
017D: 21 09 20        LXI     H,$2009             ; Get alien X ...
0180: 46              MOV     B,M                 ; ... to B
0181: 23              INX     H                   ; Get alien y ...
0182: 4E              MOV     C,M                 ; ... to C
0183: FE 0B           CPI     $0B                 ; Can we take a full row off of index?
0185: FA 94 01        JM      $0194               ; No ... we have the row
0188: DE 0B           SBI     $0B                 ; Subtract off 11 (one whole row)
018A: 5F              MOV     E,A                 ; Hold the new index
018B: 78              MOV     A,B                 ; Add ...
018C: C6 10           ADI     $10                 ; ... 16 to bit ...
018E: 47              MOV     B,A                 ; ... position Y (1 row in rack)
018F: 7B              MOV     A,E                 ; Restore tallied index
0190: 14              INR     D                   ; Next row
0191: C3 83 01        JMP     $0183               ; Keep skipping whole rows
;
0194: 68              MOV     L,B                 ; We have the LSB (the row)
0195: A7              ANA     A                   ; Are we in the right column?
0196: C8              RZ                          ; Yes ... X and Y are right
0197: 5F              MOV     E,A                 ; Hold index
0198: 79              MOV     A,C                 ; Add ...
0199: C6 10           ADI     $10                 ; ... 16 to bit ...
019B: 4F              MOV     C,A                 ; ... position X (1 column in rack)
019C: 7B              MOV     A,E                 ; Restore index
019D: 3D              DCR     A                   ; We adjusted for 1 column
019E: C3 95 01        JMP     $0195               ; Keep moving over column


; MoveRefAlien
; The "reference alien" is the bottom right. All other aliens are drawn relative to this
; reference. This routine moves the reference alien (the delta is set elsewhere) and toggles
; the animation frame number between 0 and 1.
01A1: 15              DCR     D                   ; This decrements with each call to move
01A2: CA CD 01        JZ      ReturnTwo           ; Return out of TWO call frames (only used if no aliens left)
01A5: 21 06 20        LXI     H,$2006             ; Set current alien ...
01A8: 36 00           MVI     M,$00               ; ... index to 0
01AA: 23              INX     H                   ; Point to DeltaX
01AB: 4E              MOV     C,M                 ; Load DX into C
01AC: 36 00           MVI     M,$00               ; Set DX to 0
01AE: CD D9 01        CALL    AddDelta            ; Move alien
01B1: 21 05 20        LXI     H,$2005             ; Alien animation frame number
01B4: 7E              MOV     A,M                 ; Toggle ...
01B5: 3C              INR     A                   ; ... animation ...
01B6: E6 01           ANI     $01                 ; ... number between ...
01B8: 77              MOV     M,A                 ; ... 0 and 1
01B9: AF              XRA     A                   ; Alien index in A is now 0
01BA: 21 67 20        LXI     H,$2067             ; Restore H ...
01BD: 66              MOV     H,M                 ; ... to player data MSB (21 or 22)
01BE: C9              RET                         ; Done

01BF: 00                      

; InitAliens
; Initialize the 55 aliens from last to 1st. 1 means alive.
01C0: 21 00 21        LXI     H,$2100             ; Start of alien structures (this is the last alien)
01C3: 06 37           MVI     B,$37               ; Count to 55 (that's five rows of 11 aliens)
01C5: 36 01           MVI     M,$01               ; Bring alien to live
01C7: 23              INX     H                   ; Next alien
01C8: 05              DCR     B                   ; All done?
01C9: C2 C5 01        JNZ     $01C5               ; No ... keep looping
01CC: C9              RET                         ; Done

; ReturnTwo
; If there are no aliens left on the screen then MoveDrawAlien comes here which returns from the
; caller's stack frame.
01CD: E1              POP     H                   ; Drop return to caller
01CE: C9              RET                         ; Return to caller's caller

; DrawLeftLine
; Draw a 1px line down the screen 3 bytes over from the left side.
01CF: 3E 01           MVI     A,$01               ; Bit 1 set ... going to draw a 1-pixel stripe down left side
01D1: 06 E0           MVI     B,$E0               ; All the way down the screen
01D3: 21 02 24        LXI     H,$2402             ; Screen coordinates (3rd byte from upper left)
01D6: C3 CC 14        JMP     $14CC               ; Draw line down left side

; AddDelta
; HL points to descriptor: DX DY XX YY except DX is already loaded in C
; Why the "already loaded" part? Why not just load it here?
;
01D9: 23              INX     H                   ; We loaded delta-x already ... skip over it
01DA: 46              MOV     B,M                 ; Get delta-y
01DB: 23              INX     H                   ; Skip over it
01DC: 79              MOV     A,C                 ; Add delta-x ...
01DD: 86              ADD     M                   ; ... to x
01DE: 77              MOV     M,A                 ; Store new x
01DF: 23              INX     H                   ; Skip to y
01E0: 78              MOV     A,B                 ; Add delta-y ...
01E1: 86              ADD     M                   ; ... to y
01E2: 77              MOV     M,A                 ; Store new y
01E3: C9              RET                         ; Done

; CopyRAMMirror
; Block copy ROM mirror to initialize RAM
01E4: 06 C0           MVI     B,$C0               ; Number of bytes
01E6: 11 00 1B        LXI     D,$1B00             ; RAM mirror in ROM
01E9: 21 00 20        LXI     H,$2000             ; Start of RAM
01EC: C3 32 1A        JMP     BlockCopy           ; Copy [DE]->[HL] and return



; DrawShieldPl1
01EF: 21 42 21        LXI     H,$2142             ; Player 1 shield buffer (remember between games in multi-player)
01F2: C3 F8 01        JMP     $01F8               ; Common draw point
;
; DrawShieldPl2
01F5: 21 42 22        LXI     H,$2242             ; Player 2 shield buffer (remember between games in multi-player)
;
01F8: 0E 04           MVI     C,$04               ; Going to draw 4 shields
01FA: 11 20 1D        LXI     D,$1D20             ; Shield pixel pattern
01FD: D5              PUSH    D                   ; Hold the start for the next shield
01FE: 06 2C           MVI     B,$2C               ; 44 bytes to copy
0200: CD 32 1A        CALL    BlockCopy           ; Block copy DE to HL (B bytes)
0203: D1              POP     D                   ; Restore start of shield pattern
0204: 0D              DCR     C                   ; Drawn all shields?
0205: C2 FD 01        JNZ     $01FD               ; No ... go draw them all
0208: C9              RET                         ; Done

; RememberShields1
0209: 3E 01           MVI     A,$01               ; Not zero means remember
020B: C3 1B 02        JMP     $021B               ; Shuffle-shields player 1

; RememberShields2
020E: 3E 01           MVI     A,$01               ; Not zero means remember
0210: C3 14 02        JMP     $0214               ; Shuffle-shields player 1

; RestoreShields1
0213: AF              XRA     A                   ; Zero means restore
0214: 11 42 22        LXI     D,$2242             ; Player 2 shield buffer (remember between games in multi-player)
0217: C3 1E 02        JMP     CopyShields         ; Shuffle-shields player 2

; RestoreShields2
021A: AF              XRA     A                   ; Zero means restore
021B: 11 42 21        LXI     D,$2142             ; Player 1 shield buffer (remember between games in multi-player)

; CopyShields
; A is 1 for screen-to-buffer, 0 for to buffer-to-screen
; HL is screen coordinates of first shield. There are 23 rows between shields.
; DE is sprite buffer in memory.
021E: 32 81 20        STA     tmp2081             ; Remember copy/restore flag
0221: 01 02 16        LXI     B,$1602             ; 22 rows, 2 bytes/row (for 1 shield pattern)
0224: 21 06 28        LXI     H,$2806             ; Screen coordinates
0227: 3E 04           MVI     A,$04               ; Four shields to move
0229: F5              PUSH    PSW                 ; Hold shield count
022A: C5              PUSH    B                   ; Hold sprite-size
022B: 3A 81 20        LDA     tmp2081             ; Get back copy/restore flag
022E: A7              ANA     A                   ; Not zero ...
022F: C2 42 02        JNZ     $0242               ; ... means remember shidles
0232: CD 69 1A        CALL    RestoreShields      ; Restore player's shields
0235: C1              POP     B                   ; Get back sprite-size
0236: F1              POP     PSW                 ; Get back shield count
0237: 3D              DCR     A                   ; Have we moved all shields?
0238: C8              RZ                          ; Yes ... out
0239: D5              PUSH    D                   ; Hold sprite buffer
023A: 11 E0 02        LXI     D,$02E0             ; Add 2E0 (23 rows) to get to ...
023D: 19              DAD     D                   ; ... next shield on screen
023E: D1              POP     D                   ; restore sprite buffer
023F: C3 29 02        JMP     $0229               ; Go back and do all
;
0242: CD 7C 14        CALL    RememberShields     ; Remember player's shields
0245: C3 35 02        JMP     $0235               ; Continue with next shield


; RunGameObjs
; Process game objects. Each game object has a 16 byte structure. The handler routine for the object
; is at xx03 and xx04 of the structure. The pointer to xx04 is pushed onto the stack before calling
; the handler.
;
; All game objects (except task 0 ... the player) are processed once at the beginning 
; of VBLANK and again at the end of VBLANK. The player is only processed at the end of VBLANK.
;
; The first three bytes of the structure are used for status and timers.
; 
; If the first byte is FF then the end of the game-task list has been reached.
; If the first byte is FE then the object is skipped.
;
; If the first-two bytes are non-zero then they are treated like a two-byte counter
; and decremented as such. The 2nd byte is the LSB (moves the fastest).
;
; If the first-two bytes are zero then the third byte is treated as an additional counter. It
; is decremented as such.
;
; When all three bytes reach zero the task is executed.
;
; ?? I still don't understand why there is the 3rd byte.
; 
0248: 21 10 20        LXI     H,$2010             ; First game object (active player)
024B: 7E              MOV     A,M                 ; Have we reached the ...
024C: FE FF           CPI     $FF                 ; ... end of the object list?
024E: C8              RZ                          ; Yes ... done
024F: FE FE           CPI     $FE                 ; Is object active?
0251: CA 81 02        JZ      $0281               ; No ... skip it
0254: 23              INX     H                   ; xx01
0255: 46              MOV     B,M                 ; First byte to B
0256: 4F              MOV     C,A                 ; Hold 1st byte
0257: B0              ORA     B                   ; OR 1st and 2nd byte
0258: 79              MOV     A,C                 ; Restore 1st byte
0259: C2 77 02        JNZ     $0277               ; If word at xx00,xx02 is non zero then decrement it
;
025C: 23              INX     H                   ; xx02
025D: 7E              MOV     A,M                 ; Get byte counter ?? why not just add to word counter
025E: A7              ANA     A                   ; Is it 0?
025F: C2 88 02        JNZ     $0288               ; No ... decrement byte counter at xx02
0262: 23              INX     H                   ; xx03
0263: 5E              MOV     E,M                 ; Get handler address LSB
0264: 23              INX     H                   ; xx04
0265: 56              MOV     D,M                 ; Get handler address MSB
0266: E5              PUSH    H                   ; Remember pointer to MSB
0267: EB              XCHG                        ; Handler address to HL
0268: E5              PUSH    H                   ; Now to stack (making room for indirect call)
0269: 21 6F 02        LXI     H,$026F             ; Return address to 026F
026C: E3              XTHL                        ; Return address (026F) now on stack. Handler in HL.
026D: D5              PUSH    D                   ; Push pointer to data struct (xx04) for handler to use
026E: E9              PCHL                        ; Run object's code (will return to next line)
026F: E1              POP     H                   ; Restore pointer to xx04
0270: 11 0C 00        LXI     D,$000C             ; Offset to next ...
0273: 19              DAD     D                   ; ... game task (C+4=10)
0274: C3 4B 02        JMP     $024B               ; Do next game task
; 
; Word at xx00 and xx01 is non-zero. Decrement it and move to next task. 
0277: 05              DCR     B                   ; Decrement ...
0278: 04              INR     B                   ; ... two ...
0279: C2 7D 02        JNZ     $027D               ; ... byte ...
027C: 3D              DCR     A                   ; ... value ...
027D: 05              DCR     B                   ; ... at ...
027E: 70              MOV     M,B                 ; ... xx00 ...
027F: 2B              DCX     H                   ; ... and ...
0280: 77              MOV     M,A                 ; ... xx01
;
0281: 11 10 00        LXI     D,$0010             ; Next ...
0284: 19              DAD     D                   ; ... object descriptor
0285: C3 4B 02        JMP     $024B               ; Keep processing game objects
;
; Word at xx00 and xx01 is zero and byte at xx02 is non-zero. Decrement xx02 and 
; move to next task.
0288: 35              DCR     M                   ; Decrement the xx02 counter
0289: 2B              DCX     H                   ; Back up to ...
028A: 2B              DCX     H                   ; ... start of game task
028B: C3 81 02        JMP     $0281               ; Next game task



; GameObj0
; Game object 0: Move/draw the player
;
; This task is only called at the end of the VBLANK. The other tasks are called by 
; both ISRs ... at the beginning and at the end.
;
; The task structure (and initial values) are shown here for reference.
;
;1B10: (2010) 00 
;1B11: (2011) 80     ; Wait 128 interrupts (about 2 secs) before task starts to run        
;1B12: (2012) 00             
;1B13: (2013) 8E 02  ; Location of handler code (028E)
;
;1B15: (2015) FF     ; Blow-up status: FF if NOT blowing up. Else bit 0 is blowing-up-sprite number (toggles back and forth when blowing up)
;1B16: (2016) 05     ; Time till next blow-up sprite change (reloaded to 5)
;1B17: (2017) 0C     ; Number of blow-up changes in blow-up sequence                               
;1B18: (2018) 60 1C  ; Sprite picture (1C60)
;1B1A: (201A) 20 30  ; Sprite location
;1B1C: (201C) 10     ; 16 bytes in sprite
;1B1D: (201D) 01     ; Next index into demo command table
;1B1E: (201E) 00     ; Set to 1 when player enters 1st of 2 hidden-message-display sequences
;
;1B1F: (201F) 00  
;
028E: E1              POP     H                   ; Get player object structure xx04
028F: 23              INX     H                   ; Point to blow-up status
0290: 7E              MOV     A,M                 ; Get player blow-up status
0291: FE FF           CPI     $FF                 ; Player is blowing up?
0293: CA 3B 03        JZ      $033B               ; No ... go do normal movement
; Handle blowing up player
0296: 23              INX     H                   ; Point to blow-up delay count
0297: 35              DCR     M                   ; Decrement the blow-up delay
0298: C0              RNZ                         ; Not time for a new blow-up sprite ... out
0299: 47              MOV     B,A                 ; Hold sprite image number
029A: AF              XRA     A                   
029B: 32 68 20        STA     $2068               
029E: 32 69 20        STA     $2069               
02A1: 3E 30           MVI     A,$30               ; ?? Fleet movement sound start
02A3: 32 6A 20        STA     $206A               
02A6: 78              MOV     A,B                 ; Restore sprite image number (used if we go to 39B)
02A7: 36 05           MVI     M,$05               ; Reload time between blow-up changes
02A9: 23              INX     H                   ; Point to number of blow-up changes
02AA: 35              DCR     M                   ; Count down blow-up changes
02AB: C2 9B 03        JNZ     DrawPlayerDie       ; Still blowing up ... go draw next sprite
; Blow up finished
02AE: 2A 1A 20        LHLD    PlyrSprLocL         ; Player's coordinates
02B1: 06 10           MVI     B,$10               ; 16 Bytes
02B3: CD 24 14        CALL    EraseSimpleSprite   ; Erase simple sprite (the player)
02B6: 21 10 20        LXI     H,$2010             ; Restore player ...
02B9: 11 10 1B        LXI     D,$1B10             ; ... structure ...
02BC: 06 10           MVI     B,$10               ; ... from ...
02BE: CD 32 1A        CALL    BlockCopy           ; ... ROM mirror
02C1: 06 00           MVI     B,$00               ; Turn off ...
02C3: CD DC 19        CALL    SoundBits3Off       ; ... all sounds
02C6: 3A 6D 20        LDA     $206D               
02C9: A7              ANA     A                   
02CA: C0              RNZ                         
02CB: 3A EF 20        LDA     gameMode            ; Are we in ...
02CE: A7              ANA     A                   ; ... game mode?
02CF: C8              RZ                          ; No ... return to splash screens
02D0: 31 00 24        LXI     SP,$2400            ; We aren't going to return ... going
02D3: FB              EI                          
02D4: CD D7 19        CALL    DsableGameTasks     
02D7: CD 2E 09        CALL    $092E               ; Get number of ships for active player
02DA: A7              ANA     A                   ; Any left?
02DB: CA 6D 16        JZ      $166D               ; NO ... ??
02DE: CD E7 18        CALL    $18E7               
02E1: 7E              MOV     A,M                 
02E2: A7              ANA     A                   
02E3: CA 2C 03        JZ      $032C               
02E6: 3A CE 20        LDA     twoPlayers          ; two players
02E9: A7              ANA     A                   
02EA: CA 2C 03        JZ      $032C               
02ED: 3A 67 20        LDA     playerDataMSB       ; player
02F0: F5              PUSH    PSW                 
02F1: 0F              RRC                         
02F2: DA 32 03        JC      $0332               
02F5: CD 0E 02        CALL    RememberShields2    
02F8: CD 78 08        CALL    $0878               
02FB: 73              MOV     M,E                 
02FC: 23              INX     H                   
02FD: 72              MOV     M,D                 
02FE: 2B              DCX     H                   
02FF: 2B              DCX     H                   
0300: 70              MOV     M,B                 
0301: 00              NOP                         
0302: CD E4 01        CALL    CopyRAMMirror       
0305: F1              POP     PSW                 
0306: 0F              RRC                         
0307: 3E 21           MVI     A,$21               
0309: 06 00           MVI     B,$00               
030B: D2 12 03        JNC     $0312               
030E: 06 20           MVI     B,$20               
0310: 3E 22           MVI     A,$22               
0312: 32 67 20        STA     playerDataMSB       ; player
0315: CD B6 0A        CALL    TwoSecDelay         ; Two second delay
0318: AF              XRA     A                   
0319: 32 11 20        STA     $2011               
031C: 78              MOV     A,B                 
031D: D3 05           OUT     $05                 ; Sound
031F: 3C              INR     A                   
0320: 32 98 20        STA     soundPort5          ; sound port 5 hold
0323: CD D6 09        CALL    ClearPlayField      ; Clear center window
0326: CD 7F 1A        CALL    RemoveShip          ; Remove a ship and update indicators
0329: C3 F9 07        JMP     $07F9               

032C: CD 7F 1A        CALL    RemoveShip          ; Remove a ship and update indicators
032F: C3 17 08        JMP     $0817               
0332: CD 09 02        CALL    RememberShields1    
0335: C3 F8 02        JMP     $02F8               

0338: 00 00 00
           
; Player not blowing up ... handle inputs
033B: 21 68 20        LXI     H,$2068             
033E: 36 01           MVI     M,$01               
0340: 23              INX     H                   
0341: 7E              MOV     A,M                 
0342: A7              ANA     A                   
0343: C3 B0 03        JMP     $03B0               

0346: 00              NOP                         
0347: 2B              DCX     H                   
0348: 36 01           MVI     M,$01               
;
034A: 3A 1B 20        LDA     PlyrSprLocM         ; Current player coordinates
034D: 47              MOV     B,A                 ; Hold it
034E: 3A EF 20        LDA     gameMode            ; Are we in ...
0351: A7              ANA     A                   ; ... game mode?
0352: C2 63 03        JNZ     $0363               ; Yes ... use switches as player controls
; 
0355: 3A 1D 20        LDA     ?nextDemo?          ; Get demo command
0358: 0F              RRC                         ; Is it right?
0359: DA 81 03        JC      MovePlayerRight     ; Yes ... do right
035C: 0F              RRC                         ; Is it left?
035D: DA 8E 03        JC      MovePlayerLeft      ; Yes ... do left
0360: C3 6F 03        JMP     $036F               ; Skip over movement (draw player and out)
; Player is in control
0363: CD C0 17        CALL    ReadInputs          ; Read active player controls
0366: 07              RLC                         ; Test for ...
0367: 07              RLC                         ; ... right button
0368: DA 81 03        JC      MovePlayerRight     ; Yes ... handle move right
036B: 07              RLC                         ; Test for left button
036C: DA 8E 03        JC      MovePlayerLeft      ; Yes ... handle move left
; Draw player sprite
036F: 21 18 20        LXI     H,$2018             ; Active player descriptor
0372: CD 3B 1A        CALL    ReadDesc            ; Load 5 byte sprite descriptor in order: EDLHB
0375: CD 47 1A        CALL    ConvToScr           ; Convert HL to screen coordinates
0378: CD 39 14        CALL    DrawSimpSprite      ; Display character
037B: 3E 00           MVI     A,$00               ;
037D: 32 12 20        STA     $2012               ; ?? timing of the game task
0380: C9              RET                         ;

; MovePlayerRight
; Handle player moving right
0381: 78              MOV     A,B                 ; Player coordinate
0382: FE D9           CPI     $D9                 ; At right edge?
0384: CA 6F 03        JZ      $036F               ; Yes ... ignore this
0387: 3C              INR     A                   ; Bump X coordinate
0388: 32 1B 20        STA     PlyrSprLocM         ; New X coordinate
038B: C3 6F 03        JMP     $036F               ; Draw player and out

; MovePlayerLeft
; Handle player moving left
038E: 78              MOV     A,B                 ; Player coordinate
038F: FE 30           CPI     $30                 ; At left edge
0391: CA 6F 03        JZ      $036F               ; Yes ... ignore this
0394: 3D              DCR     A                   ; Bump X coordinate
0395: 32 1B 20        STA     PlyrSprLocM         ; New X coordinate
0398: C3 6F 03        JMP     $036F               ; Draw player and out

; DrawPlayerDie
; Toggle the player's blowing-up sprite between two pictures and draw it
039B: 3C              INR     A                   ; Toggle blowing-up ...
039C: E6 01           ANI     $01                 ; ... player sprite (0,1,0,1)
039E: 32 15 20        STA     playerAlive         ; Hold current state
03A1: 07              RLC                         ; *2
03A2: 07              RLC                         ; *4
03A3: 07              RLC                         ; *8
03A4: 07              RLC                         ; *16
03A5: 21 70 1C        LXI     H,$1C70             ; Base blow-up sprite location
03A8: 85              ADD     L                   ; Offset sprite ...
03A9: 6F              MOV     L,A                 ; ... pointer
03AA: 22 18 20        SHLD    PlyrSprPicL         ; New blow-up sprite picture
03AD: C3 6F 03        JMP     $036F               ; Draw new blow-up sprite and out

03B0: C2 4A 03        JNZ     $034A               ; Move player's ship, draw it, and out
03B3: 23              INX     H                   
03B4: 35              DCR     M                   
03B5: C2 4A 03        JNZ     $034A               ; Move player's ship, draw it, and out
03B8: C3 46 03        JMP     $0346               ; Dec HL, set to 1, and move player's ship, draw it, and out





; GameObj1
; Game object 1: Move/draw the player shot
;
; This task checks the VBLANK before executing. It compares it to the upper bit of the X coordinate.
; If the shot is on the left side of the rotated screen then this task is processed when the
; screen is in VBLANK. If the shot is on the right side of the rotated screen then this task is
; processed when the screen is NOT in VBLANK. I'm not sure why the change. I hardcoded it to be
; in VBLANK and not in VBLANK. There was no visible difference.
;
; The task structure (and initial values) are shown here for reference.
;
;1B20: (2020) 00     ;
;1B21: (2021) 00     ;
;1B22: (2022) 00     ;
;1B23: (2023) BB     ;
;1B24: (2024) 03     ;
;
;1B25: (2025) 00     ; Status: 0 if available
;                              1 if just started (initialize here)
;                              2 if moving normally up the screen
;                              3 if exploding because leaving playfield, hitting shield, or hitting alien shot
;                              ?? 5 if alien explosion is in progress
;                              ?? 4 if alien has exploded (remove from active duty)
;1B26: (2026) 10     ; Sprite blowing up timer
;1B27: (2027) 90 1C  ; Sprite image picture (1C90)
;1B29: (2029) 28 30  ; Screen coordinates (last byte upper bit is the vblank flag)
;1B2B: (202B) 01     ; Size of sprite (Just one byte ....****)
;1B2C: (202C) 04     ; Shot's deltaX. Move 4 pixels at a time. 
;1B2D: (202D) 00     ; 1 if button has been handled but remains down @ 1632 1644 164E 
;1B2E: (202E) FF FF  ;
;
03BB: 11 2A 20        LXI     D,$202A             ; Object's VBLANK flag is upper bit of X coordiante
03BE: CD 06 1A        CALL    CompToVBlank        ; Compare to actual vblank
03C1: E1              POP     H                   ; Pointer to task data
03C2: D0              RNC                         ; Player shot is processed in VBLANK

03C3: 23              INX     H                   ; Point to 2025 ... the shot status
03C4: 7E              MOV     A,M                 ; Get shot status
03C5: A7              ANA     A                   ; Return if ...
03C6: C8              RZ                          ; ... no shot is active
;
03C7: FE 01           CPI     $01                 ; Shot just starting?
03C9: CA FA 03        JZ      InitPlyShot         ; Yes ... go initiate shot
;
03CC: FE 02           CPI     $02                 ; Progressing normally?
03CE: CA 0A 04        JZ      MovePlyShot         ; Yes ... go move it
;
03D1: 23              INX     H                   
03D2: FE 03           CPI     $03                 ; Shot blowing up (not because of alien)?
03D4: C2 2A 04        JNZ     $042A               ; No ... try other options
;
; Shot blowing up because it left the playfield, hit a shield, or hit another bullet
03D7: 35              DCR     M                   ; Decrement the timer
03D8: CA 36 04        JZ      $0436               ; If done then
03DB: 7E              MOV     A,M                 ; Get timer value
03DC: FE 0F           CPI     $0F                 ; Starts at 10 ... first decrement brings us here
03DE: C0              RNZ                         ; Not the first time ... explosion has been drawn
; Draw explosion first pass through timer loop
03DF: E5              PUSH    H                   ; Hold pointer to data
03E0: CD 30 04        CALL    $0430               ; Read shot descriptor
03E3: CD 52 14        CALL    EraseShifted        ; Erase the sprite
03E6: E1              POP     H                   ; 2026 (timer flag)
03E7: 23              INX     H                   ; 2027 point to sprite LSB
03E8: 34              INR     M                   ; Change 1C90 to 1C91
03E9: 23              INX     H                   ; 2028
03EA: 23              INX     H                   ; 2029
03EB: 35              DCR     M                   ; Drop X coordinate ...
03EC: 35              DCR     M                   ; ... by 2
03ED: 23              INX     H                   ; 202A
03EE: 35              DCR     M                   ; Drop Y ...
03EF: 35              DCR     M                   ; ... coordinate ...
03F0: 35              DCR     M                   ; ... by ...
03F1: 23              INX     H                   ; ... 3
03F2: 36 08           MVI     M,$08               ; 202B 8 bytes in size of sprite
03F4: CD 30 04        CALL    $0430               ; Read player shot structure
03F7: C3 00 14        JMP     DrawShiftedSprite   ; Draw sprite and out
;
; InitPlyShot
03FA: 3C              INR     A                   ; Type is now ...
03FB: 77              MOV     M,A                 ; ... 2 (in progress)
03FC: 3A 1B 20        LDA     PlyrSprLocM         ; Players Y coordinate
03FF: C6 08           ADI     $08                 ; To center of player
0401: 32 2A 20        STA     $202A               ; Shot's Y coordinate
0404: CD 30 04        CALL    $0430               ; Read 5 byte structure
0407: C3 00 14        JMP     DrawShiftedSprite   ; Draw sprite and out
;
; MovePlyShot
040A: CD 30 04        CALL    $0430               ; Read the shot structure
040D: D5              PUSH    D                   ; Hold pointer to sprite image
040E: E5              PUSH    H                   ; Hold sprite coordinates
040F: C5              PUSH    B                   ; Hold sprite size (in B)
0410: CD 52 14        CALL    EraseShifted        ; Erase the sprite from the screen
0413: C1              POP     B                   ; Restore size
0414: E1              POP     H                   ; Restore coords
0415: D1              POP     D                   ; Restore pointer to sprite image
0416: 3A 2C 20        LDA     $202C               ; DeltaX for shot
0419: 85              ADD     L                   ; Move the shot ...
041A: 6F              MOV     L,A                 ; ... up the screen
041B: 32 29 20        STA     ?PlyrShotY?         ; Store shot's new X coordinate
041E: CD 91 14        CALL    DrawSprCollision    ; Draw sprite with collision detection
0421: 3A 61 20        LDA     collision           ; Test for ...
0424: A7              ANA     A                   ; ... collision
0425: C8              RZ                          ; No collision ... out
;
; Collision with alien detected
0426: 32 02 20        STA     alienIsExploding    ; Set to not-0 indicating ...
0429: C9              RET                         ; ... an alien is blowing up

042A: FE 05           CPI     $05                 ; Alien explosion in progress?
042C: C8              RZ                          ; Yes ... nothing to do
042D: C3 36 04        JMP     $0436               ; Anything else erases the shot and removes it from duty

0430: 21 27 20        LXI     H,$2027             ; Read 5 byte sprite structure for ...
0433: C3 3B 1A        JMP     ReadDesc            ; ... player shot

0436: CD 30 04        CALL    $0430               ; Read the shot structure
0439: CD 52 14        CALL    EraseShifted        ; Erase the player's shot
043C: 21 25 20        LXI     H,$2025             ; Reinit ...
043F: 11 25 1B        LXI     D,$1B25             ; ... shot structure ...
0442: 06 07           MVI     B,$07               ; ... from ...
0444: CD 32 1A        CALL    BlockCopy           ; ... ROM mirror
0447: 2A 8D 20        LHLD    sauScoreLSB         ; Get pointer to saucer-score table
044A: 2C              INR     L                   ; Every shot explosion advances it one
044B: 7D              MOV     A,L                 ; Have we passed ...
044C: FE 63           CPI     $63                 ; ... the end at 1D63
044E: DA 53 04        JC      $0453               ; No .... keep it
0451: 2E 54           MVI     L,$54               ; Wrap back around to 1D54
0453: 22 8D 20        SHLD    sauScoreLSB         ; New score pointer
0456: 2A 8F 20        LHLD    shotCount           ; Increments with every shot ...
0459: 2C              INR     L                   ; ... but only LSB %% ...
045A: 22 8F 20        SHLD    shotCount           ; ... used for saucer direction
;
045D: 3A 84 20        LDA     $2084               
0460: A7              ANA     A                   
0461: C0              RNZ                         
;
; Setup saucer direction for next trip
0462: 7E              MOV     A,M                 ; Shot counter
0463: E6 01           ANI     $01                 ; Lowest bit set?
0465: 01 29 02        LXI     B,$0229             ; Y delta of 2 starting at Y=29
0468: C2 6E 04        JNZ     $046E               ; Yes ... use 2/29
046B: 01 E0 FE        LXI     B,$FEE0             ; No ... Y delta of -2 starting at Y=E0
046E: 21 8A 20        LXI     H,$208A             ; Saucer descriptor
0471: 71              MOV     M,C                 ; Store Y coordinate
0472: 23              INX     H                   ; Point to ...
0473: 23              INX     H                   ; ... delta Y
0474: 70              MOV     M,B                 ; Store delta Y
0475: C9              RET                         ; Done


; GameObj2
; Game object 2: Missile alien shot
;
;1B30:  (2030) 00     ;
;1B31:  (2031) 00     ;
;1B32:  (2032) 02     ;
;1B33:  (2033) 76     ;
;1B34:  (2034) 04     ;
;
;1B35:  (2035) 00  
;1B36:  (2036) 00  
;1B37:  (2037) 00  
;1B38:  (2038) 00  
;1B39:  (2039) 00  
;1B3A:  (203A) 04  
;1B3B:  (203B) EE  
;1B3C:  (203C) 1C  
;1B3D:  (203D) 00  
;1B3E:  (203E) 00  
;1B3F:  (203F) 03  

; ?? TODO Look for (HL) and (DE) and comment what the location is.

0476: E1              POP     H                   ; Game object data
0477: 3A 32 1B        LDA     $1B32               ; Restore delay from ...
047A: 32 32 20        STA     $2032               ; ... ROM mirror (value 2)
047D: 2A 38 20        LHLD    $2038               
0480: 7D              MOV     A,L                 
0481: B4              ORA     H                   
0482: C2 8A 04        JNZ     $048A               
0485: 2B              DCX     H                   
0486: 22 38 20        SHLD    $2038               
0489: C9              RET                         

048A: 11 35 20        LXI     D,$2035             
048D: 3E F9           MVI     A,$F9               

048F: CD 50 05        CALL    $0550               
0492: 3A 46 20        LDA     $2046               
0495: 32 70 20        STA     $2070               
0498: 3A 56 20        LDA     $2056               
049B: 32 71 20        STA     $2071               
049E: CD 63 05        CALL    $0563               
04A1: 3A 78 20        LDA     $2078               
04A4: A7              ANA     A                   
04A5: 21 35 20        LXI     H,$2035             
04A8: C2 5B 05        JNZ     $055B               
;
04AB: 11 30 1B        LXI     D,$1B30             ; Reload ...
04AE: 21 30 20        LXI     H,$2030             ; ... object ...
04B1: 06 10           MVI     B,$10               ; ... structure ...
04B3: C3 32 1A        JMP     BlockCopy           ; ... from ROM mirror and out




; Game object 3: ?? Saucer
04B6: E1              POP     H                   
04B7: 3A 6E 20        LDA     $206E               
04BA: A7              ANA     A                   
04BB: C0              RNZ                         
04BC: 3A 80 20        LDA     $2080               
04BF: FE 01           CPI     $01                 
04C1: C0              RNZ                         
04C2: 11 45 20        LXI     D,$2045             
04C5: 3E ED           MVI     A,$ED               
04C7: CD 50 05        CALL    $0550               
04CA: 3A 36 20        LDA     $2036               
04CD: 32 70 20        STA     $2070               
04D0: 3A 56 20        LDA     $2056               
04D3: 32 71 20        STA     $2071               
04D6: CD 63 05        CALL    $0563               
04D9: 3A 76 20        LDA     $2076               
04DC: FE 10           CPI     $10                 
04DE: DA E7 04        JC      $04E7               
04E1: 3A 48 1B        LDA     $1B48               
04E4: 32 76 20        STA     $2076               
04E7: 3A 78 20        LDA     $2078               
04EA: A7              ANA     A                   
04EB: 21 45 20        LXI     H,$2045             
04EE: C2 5B 05        JNZ     $055B               
04F1: 11 40 1B        LXI     D,$1B40             
04F4: 21 40 20        LXI     H,$2040             
04F7: 06 10           MVI     B,$10               
04F9: CD 32 1A        CALL    BlockCopy           
04FC: 3A 82 20        LDA     numAliens           ; Number of aliens on screen
04FF: 3D              DCR     A                   
0500: C2 08 05        JNZ     $0508               
0503: 3E 01           MVI     A,$01               
0505: 32 6E 20        STA     $206E               
0508: 2A 76 20        LHLD    $2076               
050B: C3 7E 06        JMP     $067E               

; Game task in squiggly shot when splash shooting "C"
050E: E1              POP     H                   
050F: 11 55 20        LXI     D,$2055             
0512: 3E DB           MVI     A,$DB               
0514: CD 50 05        CALL    $0550               
0517: 3A 46 20        LDA     $2046               
051A: 32 70 20        STA     $2070               
051D: 3A 36 20        LDA     $2036               
0520: 32 71 20        STA     $2071               
0523: CD 63 05        CALL    $0563               
0526: 3A 76 20        LDA     $2076               
0529: FE 15           CPI     $15                 

052B: DA 34 05        JC      $0534               ; If patched out only the far right column will drop a squiggly

052E: 3A 58 1B        LDA     $1B58               
0531: 32 76 20        STA     $2076               
0534: 3A 78 20        LDA     $2078               
0537: A7              ANA     A                   
0538: 21 55 20        LXI     H,$2055             
053B: C2 5B 05        JNZ     $055B               

; Shot explosion is over. Remove the shot.
053E: 11 50 1B        LXI     D,$1B50             ; Original RAM mirror for task descriptor
0541: 21 50 20        LXI     H,$2050             ; Task descriptor for squiggly
0544: 06 10           MVI     B,$10               ; 16 bytes
0546: CD 32 1A        CALL    BlockCopy           ; Replace task descriptor with done
0549: 2A 76 20        LHLD    $2076               
054C: 22 58 20        SHLD    $2058               
054F: C9              RET                         


0550: 32 7F 20        STA     $207F               
0553: 21 73 20        LXI     H,$2073             
0556: 06 0B           MVI     B,$0B               ; 11 bytes
0558: C3 32 1A        JMP     BlockCopy           ; Block copy and out

055B: 11 73 20        LXI     D,$2073             
055E: 06 0B           MVI     B,$0B               ; 11 bytes
0560: C3 32 1A        JMP     BlockCopy           ; Block copy and out

0563: 21 73 20        LXI     H,$2073             
0566: 7E              MOV     A,M                 
0567: E6 80           ANI     $80                 
0569: C2 C1 05        JNZ     $05C1               
056C: 3A C1 20        LDA     $20C1               ; ISR splash task
056F: FE 04           CPI     $04                 ; Shooting the "C" ?
0571: 3A 69 20        LDA     $2069               
0574: CA B7 05        JZ      $05B7               ; We are shooting the "C" ... go ???
0577: A7              ANA     A                   
0578: C8              RZ                          
0579: 23              INX     H                   
057A: 36 00           MVI     M,$00               
057C: 3A 70 20        LDA     $2070               
057F: A7              ANA     A                   
0580: CA 89 05        JZ      $0589               
0583: 47              MOV     B,A                 
0584: 3A CF 20        LDA     $20CF               
0587: B8              CMP     B                   
0588: D0              RNC                         
0589: 3A 71 20        LDA     $2071               
058C: A7              ANA     A                   
058D: CA 96 05        JZ      $0596               
0590: 47              MOV     B,A                 
0591: 3A CF 20        LDA     $20CF               
0594: B8              CMP     B                   
0595: D0              RNC                         
0596: 23              INX     H                   
0597: 7E              MOV     A,M                 
0598: A7              ANA     A                   
0599: CA 1B 06        JZ      $061B               
059C: 2A 76 20        LHLD    $2076               
059F: 4E              MOV     C,M                 
05A0: 23              INX     H                   
05A1: 00              NOP                         
05A2: 22 76 20        SHLD    $2076               
05A5: CD 2F 06        CALL    $062F               
05A8: D0              RNC                         
05A9: CD 7A 01        CALL    GetAlienCoords      
05AC: 79              MOV     A,C                 
05AD: C6 07           ADI     $07                 
05AF: 67              MOV     H,A                 
05B0: 7D              MOV     A,L                 
05B1: D6 0A           SUI     $0A                 
05B3: 6F              MOV     L,A                 
05B4: 22 7B 20        SHLD    $207B               
;
05B7: 21 73 20        LXI     H,$2073             
05BA: 7E              MOV     A,M                 
05BB: F6 80           ORI     $80                 
05BD: 77              MOV     M,A                 
05BE: 23              INX     H                   
05BF: 34              INR     M                   
05C0: C9              RET                         


05C1: 11 7C 20        LXI     D,$207C             
05C4: CD 06 1A        CALL    CompToVBlank        ; Compare to vblank
05C7: D0              RNC                         

05C8: 23              INX     H                   
05C9: 7E              MOV     A,M                 
05CA: E6 01           ANI     $01                 
05CC: C2 44 06        JNZ     $0644               
05CF: 23              INX     H                   
05D0: 34              INR     M                   
05D1: CD 75 06        CALL    $0675               
05D4: 3A 79 20        LDA     $2079               
05D7: C6 03           ADI     $03                 
05D9: 21 7F 20        LXI     H,$207F             
05DC: BE              CMP     M                   
05DD: DA E2 05        JC      $05E2               
05E0: D6 0C           SUI     $0C                 
05E2: 32 79 20        STA     $2079               
05E5: 3A 7B 20        LDA     $207B               
05E8: 47              MOV     B,A                 
05E9: 3A 7E 20        LDA     aShotSpeed          
05EC: 80              ADD     B                   
05ED: 32 7B 20        STA     $207B               
05F0: CD 6C 06        CALL    $066C               
05F3: 3A 7B 20        LDA     $207B               
05F6: FE 15           CPI     $15                 
05F8: DA 12 06        JC      $0612               
05FB: 3A 61 20        LDA     collision           
05FE: A7              ANA     A                   
05FF: C8              RZ                          
0600: 3A 7B 20        LDA     $207B               
0603: FE 1E           CPI     $1E                 
0605: DA 12 06        JC      $0612               
0608: FE 27           CPI     $27                 
060A: 00              NOP                         
060B: D2 12 06        JNC     $0612               
060E: 97              SUB     A                   
060F: 32 15 20        STA     playerAlive         
0612: 3A 73 20        LDA     $2073               
0615: F6 01           ORI     $01                 
0617: 32 73 20        STA     $2073               
061A: C9              RET                         

061B: 3A 1B 20        LDA     PlyrSprLocM         
061E: C6 08           ADI     $08                 
0620: 67              MOV     H,A                 
0621: CD 6F 15        CALL    $156F               
0624: 79              MOV     A,C                 
0625: FE 0C           CPI     $0C                 
0627: DA A5 05        JC      $05A5               
062A: 0E 0B           MVI     C,$0B               
062C: C3 A5 05        JMP     $05A5               

062F: 0D              DCR     C                   
0630: 3A 67 20        LDA     playerDataMSB       
0633: 67              MOV     H,A                 
0634: 69              MOV     L,C                 
0635: 16 05           MVI     D,$05               
0637: 7E              MOV     A,M                 
0638: A7              ANA     A                   
0639: 37              STC                         
063A: C0              RNZ                         

063B: 7D              MOV     A,L                 
063C: C6 0B           ADI     $0B                 
063E: 6F              MOV     L,A                 
063F: 15              DCR     D                   
0640: C2 37 06        JNZ     $0637               
0643: C9              RET                         

0644: 21 78 20        LXI     H,$2078             ;
0647: 35              DCR     M                   ;
0648: 7E              MOV     A,M                 
0649: FE 03           CPI     $03                 
064B: C2 67 06        JNZ     $0667               
064E: CD 75 06        CALL    $0675               
0651: 21 DC 1C        LXI     H,$1CDC             
0654: 22 79 20        SHLD    $2079               
0657: 21 7C 20        LXI     H,$207C             
065A: 35              DCR     M                   
065B: 35              DCR     M                   
065C: 2B              DCX     H                   
065D: 35              DCR     M                   
065E: 35              DCR     M                   
065F: 3E 06           MVI     A,$06               
0661: 32 7D 20        STA     $207D               
0664: C3 6C 06        JMP     $066C               
;        
0667: A7              ANA     A                   
0668: C0              RNZ                         
0669: C3 75 06        JMP     $0675               
;
066C: 21 79 20        LXI     H,$2079             
066F: CD 3B 1A        CALL    ReadDesc            ; Read 5 byte structure
0672: C3 91 14        JMP     DrawSprCollision    ; Draw saucer?? with collision detection and out
;
0675: 21 79 20        LXI     H,$2079             
0678: CD 3B 1A        CALL    ReadDesc            ; Read 5 byte structure
067B: C3 52 14        JMP     EraseShifted        ; Erase the saucer?? and out
;
067E: 22 48 20        SHLD    $2048               
0681: C9              RET                         

                 
; Game task 4: Move saucer
0682: E1              POP     H                   
0683: 3A 80 20        LDA     $2080               
0686: FE 02           CPI     $02                 ; Set to 2 by the splash extra "C"
0688: C0              RNZ                         
0689: 21 83 20        LXI     H,$2083             
068C: 7E              MOV     A,M                 
068D: A7              ANA     A                   
068E: CA 0F 05        JZ      $050F               
0691: 3A 56 20        LDA     $2056               
0694: A7              ANA     A                   
0695: C2 0F 05        JNZ     $050F               
0698: 23              INX     H                   
0699: 7E              MOV     A,M                 
069A: A7              ANA     A                   
069B: C2 AB 06        JNZ     $06AB               
069E: 3A 82 20        LDA     numAliens           ; Number of aliens remaining
06A1: FE 08           CPI     $08                 ; Less than ...
06A3: DA 0F 05        JC      $050F               ; ... 8 ... no saucer
06A6: 36 01           MVI     M,$01               
06A8: CD 3C 07        CALL    $073C               ; Draw the flying saucer
06AB: 11 8A 20        LXI     D,$208A             ; Y coordinate ?? Again with vblank and this?
06AE: CD 06 1A        CALL    CompToVBlank        ; Compare to vblank
06B1: D0              RNC                         ; Not the right ISR for moving saucer

06B2: 21 85 20        LXI     H,$2085             
06B5: 7E              MOV     A,M                 
06B6: A7              ANA     A                   
06B7: C2 D6 06        JNZ     $06D6               
06BA: 21 8A 20        LXI     H,$208A             ; Saucer's structure
06BD: 7E              MOV     A,M                 ; Get saucer's Y coordinate
06BE: 23              INX     H                   ; Bump to ...
06BF: 23              INX     H                   ; ... delta Y
06C0: 86              ADD     M                   ; Move saucer
06C1: 32 8A 20        STA     mysPriPicM          ; New coordinate
06C4: CD 3C 07        CALL    $073C               ; Draw the flying saucer
06C7: 21 8A 20        LXI     H,$208A             ; Saucer's structure
06CA: 7E              MOV     A,M                 ; Y coordinate
06CB: FE 28           CPI     $28                 ; Too low? End of screen?
06CD: DA F9 06        JC      $06F9               ; Yes ... remove from play
06D0: FE E1           CPI     $E1                 ; Too hight? End of screen?
06D2: D2 F9 06        JNC     $06F9               ; Yes ... remove from play
06D5: C9              RET                         ; Done

06D6: 06 FE           MVI     B,$FE               ; Turn off ...
06D8: CD DC 19        CALL    SoundBits3Off       ; ... flying saucer sound
06DB: 23              INX     H                   
06DC: 35              DCR     M                   
06DD: 7E              MOV     A,M                 
06DE: FE 1F           CPI     $1F                 
06E0: CA 4B 07        JZ      $074B               ; Draw saucer explosion and make sound

06E3: FE 18           CPI     $18                 
06E5: CA 0C 07        JZ      $070C               ; Saucer hit ... show and add to score
06E8: A7              ANA     A                   
06E9: C0              RNZ                         
06EA: 06 EF           MVI     B,$EF               
06EC: 21 98 20        LXI     H,$2098             
06EF: 7E              MOV     A,M                 
06F0: A0              ANA     B                   
06F1: 77              MOV     M,A                 
06F2: E6 20           ANI     $20                 ; All off but
06F4: D3 05           OUT     $05                 ; Sound
06F6: 00              NOP                         ; %% Why
06F7: 00              NOP                         ; %%
06F8: 00              NOP                         ; %%
;
06F9: CD 42 07        CALL    $0742               ; Covert pixel pos from descriptor to HL screen and shift
06FC: CD CB 14        CALL    ClearSmallSprite    ; Clear a one byte sprite at HL
06FF: 21 83 20        LXI     H,$2083             ; RAM ?
0702: 06 0A           MVI     B,$0A               ; 10 bytes
0704: CD 5F 07        CALL    $075F               ; Re-initialize some RAM

0707: 06 FE           MVI     B,$FE               ; Turn off UFO ...
0709: C3 DC 19        JMP     SoundBits3Off       ; ... sound and off



070C: 3E 01           MVI     A,$01               ; Flag the score ...
070E: 32 F1 20        STA     adjustScore         ; ... needs updating
0711: 2A 8D 20        LHLD    sauScoreLSB         ; Saucer score table
0714: 46              MOV     B,M                 ; Get score for this saucer
0715: 0E 04           MVI     C,$04               ; There are only 4 possibilities
0717: 21 50 1D        LXI     H,$1D50             ; Possible scores table
071A: 11 4C 1D        LXI     D,$1D4C             ; Print strings for each score
071D: 1A              LDAX    D                   ; Find ...
071E: B8              CMP     B                   ; ... the ...
071F: CA 28 07        JZ      $0728               ; ... print ...
0722: 23              INX     H                   ; ... string ...
0723: 13              INX     D                   ; ... for ...
0724: 0D              DCR     C                   ; ... the ...
0725: C2 1D 07        JNZ     $071D               ; ... score
0728: 7E              MOV     A,M                 ; Get LSB of message (MSB is 2088 which is 1D)
0729: 32 87 20        STA     mysPriLocL          ; Message's LSB (_50=1D94 100=1D97 150=1D9A 300=1D9D)
072C: 26 00           MVI     H,$00               ; MSB = 0 ...
072E: 68              MOV     L,B                 ; HL = B
072F: 29              DAD     H                   ; *2
0730: 29              DAD     H                   ; *4
0731: 29              DAD     H                   ; *8
0732: 29              DAD     H                   ; *16
0733: 22 F2 20        SHLD    scoreDeltaLSB       ; Add score for hitting saucer (015 becomes 150 in BCD).
0736: CD 42 07        CALL    $0742               ; Get the flying saucer score descriptor
0739: C3 F1 08        JMP     $08F1               ; Print the three-byte score and out

073C: CD 42 07        CALL    $0742               ; Draw the ...
073F: C3 39 14        JMP     DrawSimpSprite      ; ... flying saucer

0742: 21 87 20        LXI     H,$2087             ; Read flying saucer ...
0745: CD 3B 1A        CALL    ReadDesc            ; ... structure
0748: C3 47 1A        JMP     ConvToScr           ; Convert pixel number to screen and shift and out
;
074B: 06 10           MVI     B,$10               ; Saucer hit sound bit
074D: 21 98 20        LXI     H,$2098             ; Current state of sounds
0750: 7E              MOV     A,M                 ; OR ...
0751: B0              ORA     B                   ; ... in ...
0752: 77              MOV     M,A                 ; ... saucer-hit sound
0753: CD 70 17        CALL    $1770               ; Turn off fleet sound and start saucer-hit
0756: 21 7C 1D        LXI     H,$1D7C             ; Sprite for saucer blowing up
0759: 22 87 20        SHLD    mysPriLocL          ; Store it in structure
075C: C3 3C 07        JMP     $073C               ; Draw the flying saucer
;
075F: 11 83 1B        LXI     D,$1B83             ; Data for ?
0762: C3 32 1A        JMP     BlockCopy           ; Block copy [HL] to [DE]

; WaitForStart
; Wait for player 1 start button press
0765: 3E 01           MVI     A,$01               ; Tell ISR that we ...
0767: 32 93 20        STA     waitStartLoop       ; ... have started to wait
076A: 31 00 24        LXI     SP,$2400            ; Reset stack
076D: FB              EI                          ; Enable interrupts
076E: CD 79 19        CALL    $1979               ; Suspend game tasks
0771: CD D6 09        CALL    ClearPlayField      ; Clear center window
0774: 21 13 30        LXI     H,$3013             ; Screen coordinates
0777: 11 F3 1F        LXI     D,$1FF3             ; "PRESS"
077A: 0E 04           MVI     C,$04               ; Message length
077C: CD F3 08        CALL    PrintMessage        ; Print it
077F: 3A EB 20        LDA     numCoins            ; Number of credits
0782: 3D              DCR     A                   ; Set flags
0783: 21 10 28        LXI     H,$2810             ; Screen coordinates
0786: 0E 14           MVI     C,$14               ; Message length
0788: C2 57 08        JNZ     $0857               ; Take 1 or 2 player start
078B: 11 CF 1A        LXI     D,$1ACF             ; "ONLY 1PLAYER BUTTON "
078E: CD F3 08        CALL    PrintMessage        ; Print message
0791: DB 01           IN      $01                 ; Read player controls
0793: E6 04           ANI     $04                 ; 1Player start button?
0795: CA 7F 07        JZ      $077F               ; No ... wait for button or credit

;=============================================================
; NewGame
; START NEW GAME
;
; 1 Player start
0798: 06 99           MVI     B,$99               ; Essentially a -1 for DAA
079A: AF              XRA     A                   ; Clear two player flag
;
; 2 player start sequence enters here with a=1 and B=98 (-2)
079B: 32 CE 20        STA     twoPlayers          ; Set flag for 1 or 2 players
079E: 3A EB 20        LDA     numCoins            ; Number of credits
07A1: 80              ADD     B                   ; Take away credits
07A2: 27              DAA                         ; Convert back to DAA
07A3: 32 EB 20        STA     numCoins            ; New credit count
07A6: CD 47 19        CALL    DrawNumCredits      ; Display number of credits
07A9: 21 00 00        LXI     H,$0000             
07AC: 22 F8 20        SHLD    P1ScorL             
07AF: 22 FC 20        SHLD    P2ScorL             
07B2: CD 25 19        CALL    $1925               
07B5: CD 2B 19        CALL    $192B               
07B8: CD D7 19        CALL    DsableGameTasks     
07BB: 21 01 01        LXI     H,$0101             
07BE: 7C              MOV     A,H                 
07BF: 32 EF 20        STA     gameMode            ; 20EF=1 ... game mode
07C2: 22 E7 20        SHLD    $20E7               
07C5: 22 E5 20        SHLD    $20E5               
07C8: CD 56 19        CALL    DrawStatus          ; Print scores and credits
07CB: CD EF 01        CALL    DrawShieldPl1       ; ?? Draw shields
07CE: CD F5 01        CALL    DrawShieldPl2       
07D1: CD D1 08        CALL    GetShipsPerCred     ; Get number of ships from DIP settings
07D4: 32 FF 21        STA     $21FF               ; Player-1 ships
07D7: 32 FF 22        STA     $22FF               ; Player-2 ships
07DA: CD D7 00        CALL    $00D7               
07DD: AF              XRA     A                   
07DE: 32 FE 21        STA     $21FE               
07E1: 32 FE 22        STA     $22FE               
07E4: CD C0 01        CALL    InitAliens          ; Initialize 55 aliens for player 1
07E7: CD 04 19        CALL    $1904               
07EA: 21 78 38        LXI     H,$3878             
07ED: 22 FC 21        SHLD    $21FC               
07F0: 22 FC 22        SHLD    $22FC               
07F3: CD E4 01        CALL    CopyRAMMirror       
07F6: CD 7F 1A        CALL    RemoveShip          ; Initialize ship hold indicator
;
07F9: CD 8D 08        CALL    $088D               
07FC: CD D6 09        CALL    ClearPlayField      
07FF: 00              NOP                         
0800: AF              XRA     A                   
0801: 32 C1 20        STA     $20C1               
0804: CD CF 01        CALL    DrawLeftLine        
0807: 3A 67 20        LDA     playerDataMSB       
080A: 0F              RRC                         
080B: DA 72 08        JC      $0872               
080E: CD 13 02        CALL    RestoreShields1     
0811: CD CF 01        CALL    DrawLeftLine        
0814: CD B1 00        CALL    $00B1               
0817: CD D1 19        CALL    EnableGameTasks     ; Enable game tasks in ISR
081A: 06 20           MVI     B,$20               ; Enable ...
081C: CD FA 18        CALL    SoundBits3On        ; ... sound amplifier
;
; GAME LOOP
;
081F: CD 18 16        CALL    PlrFireOrDemo       ; Initiate player shot if button pressed
0822: CD 0A 19        CALL    $190A               ; ??? Collision detection for shot ???
0825: CD F3 15        CALL    CountAliens         ; Count aliens (count to 2082)
0828: CD 88 09        CALL    AdjustScore         ; Adjust score (and print) if there is an adjustment
082B: 3A 82 20        LDA     numAliens           ; Number of live aliens
082E: A7              ANA     A                   ; All aliens gone?
082F: CA EF 09        JZ      $09EF               ; Yes ... end of turn
0832: CD 0E 17        CALL    $170E               ; ???
0835: CD 35 09        CALL    $0935               ; Check (and handle) extra ship award
0838: CD D8 08        CALL    SpeedShots          ; ???
083B: CD 2C 17        CALL    ShotSound           ; Shot sound on or off with 2025
083E: CD 59 0A        CALL    $0A59               ; Check if player is hit
0841: CA 49 08        JZ      $0849               ; No hit ... jump handler
0844: 06 04           MVI     B,$04               ; Player hit sound
0846: CD FA 18        CALL    SoundBits3On        ; Make explosion sound
0849: CD 75 17        CALL    FleetDelayExShip    ; Extra-ship sound timer, set fleet-delay, play fleet movement sound
084C: D3 06           OUT     $06                 ; Feed the watchdog
084E: CD 04 18        CALL    $1804               ; ???
0851: C3 1F 08        JMP     $081F               ; Continue game loop

0854: 00 00 00                      

;=============================================================
; Test for 1 or 2 player start button press
0857: 11 BA 1A        LXI     D,$1ABA             ; "1 OR 2PLAYERS BUTTON"
085A: CD F3 08        CALL    PrintMessage        ; Print message
085D: 06 98           MVI     B,$98               ; -2 (take away 2 credits)
085F: DB 01           IN      $01                 ; Read player controls
0861: 0F              RRC                         ; Test ...
0862: 0F              RRC                         ; ... bit 2
0863: DA 6D 08        JC      $086D               ; 2 player button pressed ... do it
0866: 0F              RRC                         ; Test bit 3
0867: DA 98 07        JC      NewGame             ; One player start ... do it
086A: C3 7F 07        JMP     $077F               ; Keep waiting on credit or button
; 2 PLAYER START
086D: 3E 01           MVI     A,$01               ; Flag 2 player game
086F: C3 9B 07        JMP     $079B               ; Continue normal startup

;=============================================================
0872: CD 1A 02        CALL    RestoreShields2     
0875: C3 14 08        JMP     $0814               
0878: 3A 08 20        LDA     refAlienDY          
087B: 47              MOV     B,A                 
087C: 2A 09 20        LHLD    refAlienXX          
087F: EB              XCHG                        
0880: C3 86 08        JMP     $0886               
;            
0883: 00 00 00                                    ; %% ?? What the heck?
;
0886: 3A 67 20        LDA     playerDataMSB       ; Player data MSB (21 or 22)
0889: 67              MOV     H,A                 ; To H
088A: 2E FC           MVI     L,$FC               ; ??
088C: C9              RET                         ; Done

088D: 21 11 2B        LXI     H,$2B11             
0890: 11 70 1B        LXI     D,$1B70             
0893: 0E 0E           MVI     C,$0E               
0895: CD F3 08        CALL    PrintMessage        
0898: 3A 67 20        LDA     playerDataMSB       
089B: 0F              RRC                         
089C: 3E 1C           MVI     A,$1C               
089E: 21 11 37        LXI     H,$3711             
08A1: D4 FF 08        CNC     DrawChar            
08A4: 3E B0           MVI     A,$B0               
08A6: 32 C0 20        STA     isrDelay            
08A9: 3A C0 20        LDA     isrDelay            
08AC: A7              ANA     A                   
08AD: C8              RZ                          

08AE: E6 04           ANI     $04                 
08B0: C2 BC 08        JNZ     $08BC               
08B3: CD CA 09        CALL    $09CA               
08B6: CD 31 19        CALL    DrawScore           
08B9: C3 A9 08        JMP     $08A9               
08BC: 06 20           MVI     B,$20               
08BE: 21 1C 27        LXI     H,$271C             
08C1: 3A 67 20        LDA     playerDataMSB       
08C4: 0F              RRC                         
08C5: DA CB 08        JC      $08CB               
08C8: 21 1C 39        LXI     H,$391C             
08CB: CD CB 14        CALL    ClearSmallSprite    ; Clear a one byte sprite at HL
08CE: C3 A9 08        JMP     $08A9               


; GetShipsPerCred
; Get number of ships from DIP settings
08D1: DB 02           IN      $02                 ; DIP settings
08D3: E6 03           ANI     $03                 ; Get number of ships
08D5: C6 03           ADI     $03                 ; From 3-6
08D7: C9              RET                         ; Out

; SpeedShots
; With less than 9 aliens on the screen the alien shots get a tad bit faster. Probably
; because the advancing rack can catch them.
;
08D8: 3A 82 20        LDA     numAliens           ; Number of aliens on screen
08DB: FE 09           CPI     $09                 ; More than 8?
08DD: D0              RNC                         ; Yes ... leave shot speed alone
08DE: 3E FB           MVI     A,$FB               ; Normally FF (-1) ... now FB (-4)
08E0: 32 7E 20        STA     aShotSpeed          ; Speed up alien shots
08E3: C9              RET                         ; Done

08E4: 3A CE 20        LDA     twoPlayers          
08E7: A7              ANA     A                   
08E8: C0              RNZ                         
08E9: 21 1C 39        LXI     H,$391C             
08EC: 06 20           MVI     B,$20               ; 32 rows
08EE: C3 CB 14        JMP     ClearSmallSprite    ; Clear a one byte sprite at HL

08F1: 0E 03           MVI     C,$03               ; Length of saucer-score message ... fall into print

; PrintMessage
; Print a message on the screen
; HL = coordinates
; DE = message buffer
; C = length
08F3: 1A              LDAX    D                   ; Get character
08F4: D5              PUSH    D                   ; Preserve
08F5: CD FF 08        CALL    DrawChar            ; Print character
08F8: D1              POP     D                   ; Restore
08F9: 13              INX     D                   ; Next character
08FA: 0D              DCR     C                   ; All done?
08FB: C2 F3 08        JNZ     PrintMessage        ; Print all of message
08FE: C9              RET                         ; Out

;=============================================================
; DrawChar
; Get pointer to 8 byte sprite number in A and
; draw sprite on screen at HL
08FF: 11 00 1E        LXI     D,$1E00             ; Character set
0902: E5              PUSH    H                   ; Preserve
0903: 26 00           MVI     H,$00               ; MSB=0
0905: 6F              MOV     L,A                 ; Character number to L
0906: 29              DAD     H                   ; HL = HL *2
0907: 29              DAD     H                   ; *4
0908: 29              DAD     H                   ; *8 (8 bytes each)
0909: 19              DAD     D                   ; Get pointer to sprite
090A: EB              XCHG                        ; Now into DE
090B: E1              POP     H                   ; Restore HL
090C: 06 08           MVI     B,$08               ; 8 bytes each
090E: D3 06           OUT     $06                 ; Feed watchdog
0910: C3 39 14        JMP     DrawSimpSprite      ; To screen

;=============================================================
0913: 3A 09 20        LDA     refAlienXX          
0916: FE 78           CPI     $78                 
0918: D0              RNC                         
0919: 2A 91 20        LHLD    $2091               
091C: 7D              MOV     A,L                 
091D: B4              ORA     H                   
091E: C2 29 09        JNZ     $0929               
0921: 21 00 06        LXI     H,$0600             
0924: 3E 01           MVI     A,$01               
0926: 32 83 20        STA     $2083               
0929: 2B              DCX     H                   
092A: 22 91 20        SHLD    $2091               
092D: C9              RET                         

;=============================================================
; Get number of ships for acive player
092E: CD 11 16        CALL    GetPlayerDataPtr    ; HL points to player data
0931: 2E FF           MVI     L,$FF               ; Last byte = numbe of ships
0933: 7E              MOV     A,M                 ; Get number of ships
0934: C9              RET                         ; Done

;=============================================================
; Award extra ship if score has reached ceiling
0935: CD 10 19        CALL    $1910               ; Get descriptor of sorts
0938: 2B              DCX     H                   ; Back up ...
0939: 2B              DCX     H                   ; ... two bytes
093A: 7E              MOV     A,M                 ; Has extra ship ...
093B: A7              ANA     A                   ; already been awarded?
093C: C8              RZ                          ; Yes ... ignore
093D: 06 15           MVI     B,$15               ; Default 1500
093F: DB 02           IN      $02                 ; Read DIP settings
0941: E6 08           ANI     $08                 ; Extra ship at 1000 or 1500
0943: CA 48 09        JZ      $0948               ; 0=1500
0946: 06 10           MVI     B,$10               ; Awarded at 1000
0948: CD CA 09        CALL    $09CA               ; Get score descriptor for active player
094B: 23              INX     H                   ; MSB of score ...
094C: 7E              MOV     A,M                 ; ... to accumulator
094D: B8              CMP     B                   ; Time for an extra ship?
094E: D8              RC                          ; No ... out
094F: CD 2E 09        CALL    $092E               ; Get pointer to number of ships
0952: 34              INR     M                   ; Bump number of ships
0953: 7E              MOV     A,M                 ; Get the new total
0954: F5              PUSH    PSW                 ; Hang onto it for a bit
0955: 21 01 25        LXI     H,$2501             ; Screen coords for ship hold
0958: 24              INR     H                   ; Bump to ...
0959: 24              INR     H                   ; ... next
095A: 3D              DCR     A                   ; ... spot
095B: C2 58 09        JNZ     $0958               ; Find spot for new ship
095E: 06 10           MVI     B,$10               ; 16 byte sprite
0960: 11 60 1C        LXI     D,$1C60             ; Player sprite
0963: CD 39 14        CALL    DrawSimpSprite      ; Draw the sprite
0966: F1              POP     PSW                 ; Restore the count
0967: 3C              INR     A                   ; +1
0968: CD 8B 1A        CALL    $1A8B               ; Print the number of ships
096B: CD 10 19        CALL    $1910               ; Get descriptor for active player of some sort
096E: 2B              DCX     H                   ; Back up ...
096F: 2B              DCX     H                   ; ... two bytes
0970: 36 00           MVI     M,$00               ; Flag extra ship has been awarded
0972: 3E FF           MVI     A,$FF               ; Set timer ...
0974: 32 99 20        STA     extraHold           ; ... for extra-ship sound
0977: 06 10           MVI     B,$10               ; Make sound ...
0979: C3 FA 18        JMP     SoundBits3On        ; ... for extra man

097C: 21 A0 1D        LXI     H,$1DA0             
097F: FE 02           CPI     $02                 
0981: D8              RC                          
0982: 23              INX     H                   
0983: FE 04           CPI     $04                 
0985: D8              RC                          
0986: 23              INX     H                   
0987: C9              RET                         

; AdjustScore
; Adjust the score for the active player. 20F1 is 1 if there is a new value to add.
; The adjustment is in 20F2,20F3. Then print the score.
0988: CD CA 09        CALL    $09CA               ; Get score structure for active player
098B: 3A F1 20        LDA     adjustScore         ; Does the score ...
098E: A7              ANA     A                   ; ... need increasing?
098F: C8              RZ                          ; No ... done
0990: AF              XRA     A                   ; Mark score ...
0991: 32 F1 20        STA     adjustScore         ; ... as adjusted
0994: E5              PUSH    H                   ; Hold the pointer to the structure
0995: 2A F2 20        LHLD    scoreDeltaLSB       ; Get requested adjustment
0998: EB              XCHG                        ; Adjustment to DE
0999: E1              POP     H                   ; Get back pointer to structure
099A: 7E              MOV     A,M                 ; Add adjustment ...
099B: 83              ADD     E                   ; ... first byte
099C: 27              DAA                         ; Adjust it for BCD
099D: 77              MOV     M,A                 ; Store new LSB
099E: 5F              MOV     E,A                 ; Add adjustment ...
099F: 23              INX     H                   ; ... to ...
09A0: 7E              MOV     A,M                 ; ... second ...
09A1: 8A              ADC     D                   ; ... byte
09A2: 27              DAA                         ; Adjust for BCD (cary gets dropped)
09A3: 77              MOV     M,A                 ; Store second byte
09A4: 57              MOV     D,A                 ; Second byte to D (first byte still in E)
09A5: 23              INX     H                   ; Load ...
09A6: 7E              MOV     A,M                 ; ... the ...
09A7: 23              INX     H                   ; ... screen ...
09A8: 66              MOV     H,M                 ; ... coordinates ...
09A9: 6F              MOV     L,A                 ; ... to HL
09AA: C3 AD 09        JMP     Print4Digits        ; %% Usually a good idea, but wasted here

;=============================================================
; Print4Digits
; Print 4 digits in DE
09AD: 7A              MOV     A,D                 ; Get first 2 digits of BCD or hex
09AE: CD B2 09        CALL    DrawHexByte         ; Print them
09B1: 7B              MOV     A,E                 ; Get second 2 digits of BCD or hex (fall into print)

;=============================================================
; DrawHexByte
; Display 2 digits in A to screen at HL
09B2: D5              PUSH    D                   ; Preserve
09B3: F5              PUSH    PSW                 ; Save for later
09B4: 0F              RRC                         ; Get ...
09B5: 0F              RRC                         ; ...
09B6: 0F              RRC                         ; ...
09B7: 0F              RRC                         ; ... left digit
09B8: E6 0F           ANI     $0F                 ; Mask out lower digit's bits
09BA: CD C5 09        CALL    $09C5               ; To screen at HL
09BD: F1              POP     PSW                 ; Restore digit
09BE: E6 0F           ANI     $0F                 ; Mask out upper digit
09C0: CD C5 09        CALL    $09C5               ; To screen
09C3: D1              POP     D                   ; Restore
09C4: C9              RET                         ; Done
;
09C5: C6 1A           ADI     $1A                 ; Bump to number characters
09C7: C3 FF 08        JMP     DrawChar            ; Continue ...

;=============================================================
; Get score descriptor for active player
09CA: 3A 67 20        LDA     playerDataMSB       ; Get active player
09CD: 0F              RRC                         ; Test for player
09CE: 21 F8 20        LXI     H,$20F8             ; Player 1 score descriptor
09D1: D8              RC                          ; Keep it if player 1 is active
09D2: 21 FC 20        LXI     H,$20FC             ; Else get player 2 descriptor
09D5: C9              RET                         ; Out

;=============================================================
; ClearPlayField
; Clear center window of screen
09D6: 21 02 24        LXI     H,$2402             ; Thrid from left, top of screen
09D9: 36 00           MVI     M,$00               ; Clear screen byte
09DB: 23              INX     H                   ; Next in row
09DC: 7D              MOV     A,L                 ; Get X ...
09DD: E6 1F           ANI     $1F                 ; ... coordinate
09DF: FE 1C           CPI     $1C                 ; Edge minus a buffer?
09E1: DA E8 09        JC      $09E8               ; No ... keep going
09E4: 11 06 00        LXI     D,$0006             ; Else ... bump to
09E7: 19              DAD     D                   ; ... next edge + buffer
09E8: 7C              MOV     A,H                 ; Get Y coordinate
09E9: FE 40           CPI     $40                 ; Reached bottom?
09EB: DA D9 09        JC      $09D9               ; No ... keep going
09EE: C9              RET                         ; Done

09EF: CD 3C 0A        CALL    $0A3C               
09F2: AF              XRA     A                   ; Suspend ...
09F3: 32 E9 20        STA     suspendPlay         ; ... ISR game tasks
09F6: CD D6 09        CALL    ClearPlayField      ; Clear playfield
09F9: 3A 67 20        LDA     playerDataMSB       ; Hold current player number ...
09FC: F5              PUSH    PSW                 ; ... on stack
09FD: CD E4 01        CALL    CopyRAMMirror       ; Block copy RAM mirror from ROM
0A00: F1              POP     PSW                 ; Restore ...
0A01: 32 67 20        STA     playerDataMSB       ; ... current player number
0A04: 3A 67 20        LDA     playerDataMSB       ; %% ?? Why load this again? Nobody jumps to 0A04?
0A07: 67              MOV     H,A                 
0A08: E5              PUSH    H                   
0A09: 2E FE           MVI     L,$FE               
0A0B: 7E              MOV     A,M                 
0A0C: E6 07           ANI     $07                 
0A0E: 3C              INR     A                   
0A0F: 77              MOV     M,A                 
0A10: 21 A2 1D        LXI     H,$1DA2             
0A13: 23              INX     H                   
0A14: 3D              DCR     A                   
0A15: C2 13 0A        JNZ     $0A13               
0A18: 7E              MOV     A,M                 
0A19: E1              POP     H                   
0A1A: 2E FC           MVI     L,$FC               
0A1C: 77              MOV     M,A                 
0A1D: 23              INX     H                   
0A1E: 36 38           MVI     M,$38               
0A20: 7C              MOV     A,H                 
0A21: 0F              RRC                         
0A22: DA 33 0A        JC      $0A33               
0A25: 3E 21           MVI     A,$21               ; Start fleet with ...
0A27: 32 98 20        STA     soundPort5          ; ... first sound
0A2A: CD F5 01        CALL    DrawShieldPl2       
0A2D: CD 04 19        CALL    $1904               
0A30: C3 04 08        JMP     $0804               
0A33: CD EF 01        CALL    DrawShieldPl1       
0A36: CD C0 01        CALL    InitAliens          
0A39: C3 04 08        JMP     $0804               
0A3C: CD 59 0A        CALL    $0A59               
0A3F: C2 52 0A        JNZ     $0A52               

; ?? This code is hit between players in a multi-player game

0A42: 3E 30           MVI     A,$30               
0A44: 32 C0 20        STA     isrDelay            
0A47: 3A C0 20        LDA     isrDelay            
0A4A: A7              ANA     A                   
0A4B: C8              RZ                          

0A4C: CD 59 0A        CALL    $0A59               
0A4F: CA 47 0A        JZ      $0A47               
0A52: CD 59 0A        CALL    $0A59               
0A55: C2 52 0A        JNZ     $0A52               
0A58: C9              RET                         

;=============================================================
; Check to see if player is hit
0A59: 3A 15 20        LDA     playerAlive         ; Active player hit flag
0A5C: FE FF           CPI     $FF                 ; All FFs means player is OK
0A5E: C9              RET                         ; Out

0A5F: 3A EF 20        LDA     gameMode            ; Are we in ...
0A62: A7              ANA     A                   ; ... game mode?
0A63: CA 7C 0A        JZ      $0A7C               ; No ... skip ??
0A66: 48              MOV     C,B                 ; Hold B
0A67: 06 08           MVI     B,$08               ; Alien hit sound
0A69: CD FA 18        CALL    SoundBits3On        ; Enable sound
0A6C: 41              MOV     B,C                 ; Restore B
0A6D: 78              MOV     A,B                 ; Into A
0A6E: CD 7C 09        CALL    $097C               
0A71: 7E              MOV     A,M                 
0A72: 21 F3 20        LXI     H,$20F3             
0A75: 36 00           MVI     M,$00               
0A77: 2B              DCX     H                   
0A78: 77              MOV     M,A                 
0A79: 2B              DCX     H                   
0A7A: 36 01           MVI     M,$01               
0A7C: 21 62 20        LXI     H,$2062             ; Return exploding-alien descriptor
0A7F: C9              RET                         ; Out

; Animate
; Start the ISR moving the sprite. Return when done.
0A80: 3E 02           MVI     A,$02               ; Start simple linear ...
0A82: 32 C1 20        STA     $20C1               ; ... sprite animation (splash)
0A85: D3 06           OUT     $06                 ; Feed watchdog
0A87: 3A CB 20        LDA     $20CB               ; Has the ...
0A8A: A7              ANA     A                   ; ... sprite reached target?
0A8B: CA 85 0A        JZ      $0A85               ; No ... wait
0A8E: AF              XRA     A                   ; Stop ...
0A8F: 32 C1 20        STA     $20C1               ; ... ISR animation
0A92: C9              RET                         ; Done

;=============================================================
; PrintMessageDel
; Print message from DE to screen at HL (length in B) with a
; delay between letters.
0A93: D5              PUSH    D                   ; Preserve
0A94: 1A              LDAX    D                   ; Get character
0A95: CD FF 08        CALL    DrawChar            ; Draw character on screen
0A98: D1              POP     D                   ; Preserve
0A99: 3E 07           MVI     A,$07               ; Delay between letters
0A9B: 32 C0 20        STA     isrDelay            ; Set counter
0A9E: 3A C0 20        LDA     isrDelay            ; Get counter
0AA1: 3D              DCR     A                   ; Is it 1?
0AA2: C2 9E 0A        JNZ     $0A9E               ; No ... wait on it
0AA5: 13              INX     D                   ; Next in message
0AA6: 0D              DCR     C                   ; All done?
0AA7: C2 93 0A        JNZ     PrintMessageDel     ; No ... do all
0AAA: C9              RET                         ; Out

0AAB: 21 50 20        LXI     H,$2050             
0AAE: C3 4B 02        JMP     $024B               

;=============================================================
; OneSecDelay
; Delay 64 interrupts
0AB1: 3E 40           MVI     A,$40               ; Delay of 64 (tad over 1 sec)
0AB3: C3 D7 0A        JMP     WaitOnDelay         ; Do delay

; TwoSecDelay
; Delay 128 interrupts
0AB6: 3E 80           MVI     A,$80               ; Delay of 80 (tad over 2 sec)
0AB8: C3 D7 0A        JMP     WaitOnDelay         ; Do delay

0ABB: E1              POP     H                   
0ABC: C3 72 00        JMP     $0072               

;=============================================================
; ISRSplTasks
; Different types of splash tasks managed by ISR in splash screens. The ISR
; calls this if in splash-mode. These may have been bit flags to allow all 3 
; at the same time.
0ABF: 3A C1 20        LDA     $20C1               
0AC2: 0F              RRC                         
0AC3: DA BB 0A        JC      $0ABB               ; 1: ?? Demo control?
0AC6: 0F              RRC                         
0AC7: DA 68 18        JC      SplashSprite        ; 2: Sprite moving in line from point A to point B in splash
0ACA: 0F              RRC                         
0ACB: DA AB 0A        JC      $0AAB               ; 4: Shot moving from alien to extra "C" in splash
0ACE: C9              RET                         

; Message to center of screen.
; Only used in one place for "SPACE  INVADERS"
0ACF: 21 14 2B        LXI     H,$2B14             ; Near center of screen
0AD2: 0E 0F           MVI     C,$0F               ; 15 bytes in message
0AD4: C3 93 0A        JMP     PrintMessageDel     ; Print and out

;=============================================================
; WaitOnDelay
; Wait on ISR counter to reach 0
0AD7: 32 C0 20        STA     isrDelay            ; Delay counter
0ADA: 3A C0 20        LDA     isrDelay            ; Get current delay
0ADD: A7              ANA     A                   ; Zero yet?
0ADE: C2 DA 0A        JNZ     $0ADA               ; No ... wait on it
0AE1: C9              RET                         ; Out

; IniSplashAni
; Init the splash-animation block
0AE2: 21 C2 20        LXI     H,$20C2             ; The splash-animation descriptor
0AE5: 06 0C           MVI     B,$0C               ; C bytes
0AE7: C3 32 1A        JMP     BlockCopy           ; Block copy DE to descriptor

;=============================================================
; After initialization ... splash screens
0AEA: AF              XRA     A                   ; Make a 0
0AEB: D3 03           OUT     $03                 ; Turn off sound
0AED: D3 05           OUT     $05                 ; Turn off sound
0AEF: CD 82 19        CALL    $1982               
0AF2: FB              EI                          ; Enable interrupts (using them for delays)
0AF3: CD B1 0A        CALL    OneSecDelay         ; One second delay
0AF6: 3A EC 20        LDA     splashAnimate       ; Splash screen type
0AF9: A7              ANA     A                   ; Set flags based on type
0AFA: 21 17 30        LXI     H,$3017             ; Screen coordinates (middle near top)
0AFD: 0E 04           MVI     C,$04               ; 4 characters in "PLAY"
0AFF: C2 E8 0B        JNZ     $0BE8               ; Not 0 ... do "normal" PLAY
0B02: 11 FA 1C        LXI     D,$1CFA             ; The "PLAy" with an upside down 'Y'
0B05: CD 93 0A        CALL    PrintMessageDel     ; Print the "PLAy"
0B08: 11 AF 1D        LXI     D,$1DAF             ; "SPACE  INVADERS" message
0B0B: CD CF 0A        CALL    $0ACF               ; Print to middle-ish of screen
0B0E: CD B1 0A        CALL    OneSecDelay         ; One second delay
0B11: CD 15 18        CALL    DrawAdvTable        ; Draw "SCORE ADVANCE TABLE" with print delay
0B14: CD B6 0A        CALL    TwoSecDelay         ; Two second delay
0B17: 3A EC 20        LDA     splashAnimate       ; Do splash ...
0B1A: A7              ANA     A                   ; ... animations?
0B1B: C2 4A 0B        JNZ     $0B4A               ; Not 0 ... no animations
;
; Animate small alien replacing upside-down Y with correct Y
0B1E: 11 95 1A        LXI     D,$1A95             ; Animate sprite from Y=FE to Y=9E step -1
0B21: CD E2 0A        CALL    IniSplashAni        ; Copy to splash-animate structure
0B24: CD 80 0A        CALL    Animate             ; Wait for ISR to move sprite (small alien)
0B27: 11 B0 1B        LXI     D,$1BB0             ; Animate sprite from Y=98 to Y=FF step 1
0B2A: CD E2 0A        CALL    IniSplashAni        ; Copy to splash-animate structure
0B2D: CD 80 0A        CALL    Animate             ; Wait for ISR to move sprite (alien pulling upside down Y)
0B30: CD B1 0A        CALL    OneSecDelay         ; One second delay
0B33: 11 C9 1F        LXI     D,$1FC9             ; Animate sprite from Y=FF to Y=97 step 1
0B36: CD E2 0A        CALL    IniSplashAni        ; Copy to splash-animate structure
0B39: CD 80 0A        CALL    Animate             ; Wait for ISR to move sprite (alien pushing Y)
0B3C: CD B1 0A        CALL    OneSecDelay         ; One second delay
0B3F: 21 B7 33        LXI     H,$33B7             ; Where the splash alien ends up
0B42: 06 0A           MVI     B,$0A               ; 10 rows
0B44: CD CB 14        CALL    ClearSmallSprite    ; Clear a one byte sprite at HL
0B47: CD B6 0A        CALL    TwoSecDelay         ; Two second delay
;
; Play demo
0B4A: CD D6 09        CALL    ClearPlayField      ; Clear playfield
0B4D: 3A FF 21        LDA     $21FF               ; Number of ships for player-1
0B50: A7              ANA     A                   ; If non zero ...
0B51: C2 5D 0B        JNZ     $0B5D               ; ... keep it (counts down between demos)
0B54: CD D1 08        CALL    GetShipsPerCred     ; Get number of ships from DIP settings
0B57: 32 FF 21        STA     $21FF               ; Reset number of ships for player-1
0B5A: CD 7F 1A        CALL    RemoveShip          ; Remove a ship from stash and update indicators
;
0B5D: CD E4 01        CALL    CopyRAMMirror       ; Block copy ROM mirror to initialize RAM
0B60: CD C0 01        CALL    InitAliens          ; Initialize all player 1 aliens
0B63: CD EF 01        CALL    DrawShieldPl1       ; ?? Draw shields
0B66: CD 1A 02        CALL    RestoreShields2     
0B69: 3E 01           MVI     A,$01               
0B6B: 32 C1 20        STA     $20C1               
0B6E: CD CF 01        CALL    DrawLeftLine        ; Draw playfield line
;
0B71: CD 18 16        CALL    PlrFireOrDemo       ; In demo ... process demo movement and always fire
0B74: CD F1 0B        CALL    $0BF1               ; ?? and Display hidden message if sequence is right
0B77: D3 06           OUT     $06                 ; Feed watchdog
0B79: CD 59 0A        CALL    $0A59               ; Has demo player been hit?
0B7C: CA 71 0B        JZ      $0B71               ; No ... continue game
0B7F: AF              XRA     A                   ; Remove player shot ...
0B80: 32 25 20        STA     PlyrShotStat        ; ... from activity
0B83: CD 59 0A        CALL    $0A59               ; Wait for demo player ...
0B86: C2 83 0B        JNZ     $0B83               ; ... to stop exploding
;
; Credit information
0B89: AF              XRA     A                   ; Turn off ...
0B8A: 32 C1 20        STA     $20C1               ; ... splash animation
0B8D: CD B1 0A        CALL    OneSecDelay         ; One second delay
0B90: CD 88 19        CALL    $1988               ; This jumps straight to clear-play-field ?? why?
0B93: 0E 0C           MVI     C,$0C               ; Message size
0B95: 21 11 2C        LXI     H,$2C11             ; Screen coordinates
0B98: 11 90 1F        LXI     D,$1F90             ; "INSERT  COIN"
0B9B: CD F3 08        CALL    PrintMessage        ; Print message
0B9E: 3A EC 20        LDA     splashAnimate       ; Do splash ...
0BA1: FE 00           CPI     $00                 ; ... animations?
0BA3: C2 AE 0B        JNZ     $0BAE               ; Not 0 ... not on this screen
0BA6: 21 11 33        LXI     H,$3311             ; Screen coordinates
0BA9: 3E 02           MVI     A,$02               ; Character "C"
0BAB: CD FF 08        CALL    DrawChar            ; Put an extra "C" for "CCOIN" on the screen
0BAE: 01 9C 1F        LXI     B,$1F9C             ; "<1 OR 2 PLAYERS>  "
0BB1: CD 56 18        CALL    ReadPriStruct       ; Load the screen,pointer
0BB4: CD 4C 18        CALL    $184C               ; Print the message
0BB7: DB 02           IN      $02                 ; Display coin info (bit 7) ...
0BB9: 07              RLC                         ; ... on demo screen?
0BBA: DA C3 0B        JC      $0BC3               ; 1 means no ... skip it
0BBD: 01 A0 1F        LXI     B,$1FA0             ; "*1 PLAYER  1 COIN "
0BC0: CD 3A 18        CALL    $183A               ; Load the descriptor
0BC3: CD B6 0A        CALL    TwoSecDelay         ; Print TWO descriptors worth ?? adhoc calling here like everywhere
0BC6: 3A EC 20        LDA     splashAnimate       ; Doing splash ...
0BC9: FE 00           CPI     $00                 ; ... animation?
0BCB: C2 DA 0B        JNZ     $0BDA               ; Not 0 ... not on this screen
0BCE: 11 D5 1F        LXI     D,$1FD5             ; Animation for small alien to line up with extra "C"
0BD1: CD E2 0A        CALL    IniSplashAni        ; Copy the animation block
0BD4: CD 80 0A        CALL    Animate             ; Wait for the animation to complete
0BD7: CD 9E 18        CALL    $189E               ; Animate alien shot to extra "C"
0BDA: 21 EC 20        LXI     H,$20EC             ; Toggle ...
0BDD: 7E              MOV     A,M                 ; ... the ...
0BDE: 3C              INR     A                   ; ... splash screen ...
0BDF: E6 01           ANI     $01                 ; ... animation for ...
0BE1: 77              MOV     M,A                 ; ... next time
0BE2: CD D6 09        CALL    ClearPlayField      ; Clear play field
0BE5: C3 DF 18        JMP     $18DF               ; Keep splashing

0BE8: 11 AB 1D        LXI     D,$1DAB             ;"PLAY" with normal 'Y'
0BEB: CD 93 0A        CALL    PrintMessageDel     ; Print it
0BEE: C3 0B 0B        JMP     $0B0B               ; Continue with splash (HL will be pointing to next message)

0BF1: CD 0A 19        CALL    $190A               ; ?? Check player hit and aliens turning
0BF4: C3 9A 19        JMP     CheckHiddenMes      ; Check for hidden-message display sequence

; MessageCorp
; "TAITO COP"
0BF7: 13 00 08 13 0E 26 02 0E 0F

0C00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0C20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0C40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0C60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0C80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0CA0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0CC0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0CE0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0D00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0D20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0D40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0D60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0D80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0DA0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0DC0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0DE0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0E00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0E20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0E40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0E60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0E80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0EA0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0EC0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0EE0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0F00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0F20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0F40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0F60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0F80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0FA0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0FC0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0FE0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

1000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
10A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
10C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
10E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

1100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
11A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
11C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
11E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

1200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
12A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
12C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
12E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

1300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1360: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
13A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
13C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
13E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

; DrawShiftedSprite
; The only differences between this and EraseSimpleSprite is two CPL instructions in the latter and
; the use of AND instead of OR. NOP takes the same amount of time/space as CPL. So the two NOPs
; here make these two parallel routines the same size and speed.
;
1400: 00              NOP                         ; Time/size pad to match CPL in EraseShiftedSprite
1401: CD 74 14        CALL    CnvtPixNumber       ; Convert pixel number to coord and shift
1404: 00              NOP                         ; Time/size pad to match CPL in EraseShiftedSprite
1405: C5              PUSH    B                   ; Hold count
1406: E5              PUSH    H                   ; Hold start coordinate
1407: 1A              LDAX    D                   ; Get the picture bits
1408: D3 04           OUT     $04                 ; Store in shift register
140A: DB 03           IN      $03                 ; Read the shifted pixels
140C: B6              ORA     M                   ; OR them onto the screen
140D: 77              MOV     M,A                 ; Store them back to screen
140E: 23              INX     H                   ; Next colummn on screen
140F: 13              INX     D                   ; Next in picture
1410: AF              XRA     A                   ; Shift over ...
1411: D3 04           OUT     $04                 ; ... to next byte in register (shift in 0)
1413: DB 03           IN      $03                 ; Read the shifted pixels
1415: B6              ORA     M                   ; OR them onto the screen
1416: 77              MOV     M,A                 ; Store them back to screen
1417: E1              POP     H                   ; Restore starting coordinate
1418: 01 20 00        LXI     B,$0020             ; Add 32 ...
141B: 09              DAD     B                   ; ... to coordinate (move to next row)
141C: C1              POP     B                   ; Restore count
141D: 05              DCR     B                   ; All done?
141E: C2 05 14        JNZ     $1405               ; No ... go do all rows
1421: C9              RET                         ; Done

1422: 00 00                         

; EraseSimpleSprite
; Clear a sprite from the screen (standard pixel number descriptor)  
; ?? Two bytes cleared here. The draw only sets one.
1424: CD 74 14        CALL    CnvtPixNumber       ; Convert pixel number in HL
1427: C5              PUSH    B                   ; Hold
1428: E5              PUSH    H                   ; Hold
1429: AF              XRA     A                   ; 0
142A: 77              MOV     M,A                 ; Clear screen byte
142B: 23              INX     H                   ; Next byte
142C: 77              MOV     M,A                 ; Clear byte
142D: 23              INX     H                   ; ?? Why do this ?
142E: E1              POP     H                   ; Restore screen coordinate
142F: 01 20 00        LXI     B,$0020             ; Add 1 row ...
1432: 09              DAD     B                   ; ... to screen coordinate
1433: C1              POP     B                   ; Restore counter
1434: 05              DCR     B                   ; All rows done?
1435: C2 27 14        JNZ     $1427               ; Do all rows
1438: C9              RET                         ; out

; DrawSimpSprite
; Display character to screen
; HL = screen coordinates
; DE = character data
; B = number of rows
1439: C5              PUSH    B                   ; Preserve counter
143A: 1A              LDAX    D                   ; From character set ...
143B: 77              MOV     M,A                 ; ... to screen
143C: 13              INX     D                   ; Next in character set
143D: 01 20 00        LXI     B,$0020             ; Next row ...
1440: 09              DAD     B                   ; ... on screen
1441: C1              POP     B                   ; Restore counter
1442: 05              DCR     B                   ; Decrement counter
1443: C2 39 14        JNZ     DrawSimpSprite      ; Do all
1446: C9              RET                         ; Out

1447: 00 00 00 00 00 00 00 00 00 00 00
                        
; EraseShifted
; Erases a shifted sprite from screen (like for player's explosion)
1452: CD 74 14        CALL    CnvtPixNumber       ; Convert pixel number in HL to coorinates with shift
1455: C5              PUSH    B                   ; Hold BC
1456: E5              PUSH    H                   ; Hold coordinate
1457: 1A              LDAX    D                   ; Get picture value
1458: D3 04           OUT     $04                 ; Value into shift register
145A: DB 03           IN      $03                 ; Read shifted sprite picture
145C: 2F              CMA                         ; Reverse it (erasing bits)
145D: A6              ANA     M                   ; Erase the bits from the screen
145E: 77              MOV     M,A                 ; Store the erased pattern back
145F: 23              INX     H                   ; Next column on screen
1460: 13              INX     D                   ; Next in image
1461: AF              XRA     A                   ; Shift register over ...
1462: D3 04           OUT     $04                 ; ... 8 bits (shift in 0)
1464: DB 03           IN      $03                 ; Read 2nd byte of image
1466: 2F              CMA                         ; Reverse it (erasing bits)
1467: A6              ANA     M                   ; Erase the bits from the screen
1468: 77              MOV     M,A                 ; Store the erased pattern back
1469: E1              POP     H                   ; Restore starting coordinate
146A: 01 20 00        LXI     B,$0020             ; Add 32 ...
146D: 09              DAD     B                   ; ... to next row
146E: C1              POP     B                   ; Restore BC (count)
146F: 05              DCR     B                   ; All rows done?
1470: C2 55 14        JNZ     $1455               ; No ... erase all
1473: C9              RET                         ; Done

; CnvtPixNumber
; Convert pixel number in HL to screen coordinate and shift amount.
; HL gets screen coordinate.
; Hardware shift-register gets amount.
; ?? Never called?
1474: 7D              MOV     A,L                 ; Get X coordinate
1475: E6 07           ANI     $07                 ; Shift by pixel position
1477: D3 02           OUT     $02                 ; Write shift amount to hardware
1479: C3 47 1A        JMP     ConvToScr           ; HL = HL/8 + 2000 (screen coordinate)

; RememberShields
; In a multi-player game the player's shields are block-copied to and from RAM between turns.
; HL = screen pointer
; DE = memory buffer
; B = number of rows
; C = number of columns
147C: C5              PUSH    B                   ; Hold counter
147D: E5              PUSH    H                   ; Hold start
147E: 7E              MOV     A,M                 ; From sprite ... (should be DE)
147F: 12              STAX    D                   ; ... to screen ... (should be HL)
1480: 13              INX     D                   ; Next in sprite
1481: 23              INX     H                   ; Next on screen
1482: 0D              DCR     C                   ; All columns done?
1483: C2 7E 14        JNZ     $147E               ; No ... do multi columns
1486: E1              POP     H                   ; Restore screen start
1487: 01 20 00        LXI     B,$0020             ; Add 32 ...
148A: 09              DAD     B                   ; ... to get to next row
148B: C1              POP     B                   ; Pop the counters
148C: 05              DCR     B                   ; All rows done?
148D: C2 7C 14        JNZ     RememberShields     ; No ... do multi rows
1490: C9              RET                         ; Done

; DrawSprCollision
1491: CD 74 14        CALL    CnvtPixNumber       ; Convert pixel number to coord and shift
1494: AF              XRA     A                   ; Clear the ...
1495: 32 61 20        STA     collision           ; ... collision-detection flag
1498: C5              PUSH    B                   ; Hold count
1499: E5              PUSH    H                   ; Hold screen
149A: 1A              LDAX    D                   ; Get byte
149B: D3 04           OUT     $04                 ; Write first byte to shift register
149D: DB 03           IN      $03                 ; Read shifted pattern
149F: F5              PUSH    PSW                 ; Hold the pattern
14A0: A6              ANA     M                   ; Any bits from pixel collide with bits on screen?
14A1: CA A9 14        JZ      $14A9               ; No ... leave flag alone
14A4: 3E 01           MVI     A,$01               ; Yes ... set ...
14A6: 32 61 20        STA     collision           ; ... collision flag
14A9: F1              POP     PSW                 ; Restore the pixel pattern
14AA: B6              ORA     M                   ; OR it onto the screen
14AB: 77              MOV     M,A                 ; Store new screen value
14AC: 23              INX     H                   ; Next byte on screen
14AD: 13              INX     D                   ; Next in pixel pattern
14AE: AF              XRA     A                   ; Write zero ...
14AF: D3 04           OUT     $04                 ; ... to shift register
14B1: DB 03           IN      $03                 ; Read 2nd half of shifted sprite
14B3: F5              PUSH    PSW                 ; Hold pattern
14B4: A6              ANA     M                   ; Any bits from pixel collide with bits on screen?
14B5: CA BD 14        JZ      $14BD               ; No ... leave flag alone
14B8: 3E 01           MVI     A,$01               ; Yes ... set ...
14BA: 32 61 20        STA     collision           ; ... collision flag
14BD: F1              POP     PSW                 ; Restore the pixel pattern
14BE: B6              ORA     M                   ; OR it onto the screen
14BF: 77              MOV     M,A                 ; Store new screen pattern
14C0: E1              POP     H                   ; Starting screen coordinate
14C1: 01 20 00        LXI     B,$0020             ; Add 32 ...
14C4: 09              DAD     B                   ; ... to get to next row
14C5: C1              POP     B                   ; Restore count
14C6: 05              DCR     B                   ; All done?
14C7: C2 98 14        JNZ     $1498               ; No ... do all rows
14CA: C9              RET                         ; Done

;=============================================================
; ClearSmallSprite
; Clear a one byte sprite at HL. B=number of rows.
14CB: AF              XRA     A                   ; 0
14CC: C5              PUSH    B                   ; Preserve BC
14CD: 77              MOV     M,A                 ; Clear screen byte
14CE: 01 20 00        LXI     B,$0020             ; Bump HL ...
14D1: 09              DAD     B                   ; ... one screen row
14D2: C1              POP     B                   ; Restore
14D3: 05              DCR     B                   ; All done?
14D4: C2 CC 14        JNZ     $14CC               ; No ... clear all
14D7: C9              RET                         

;=============================================================
;
14D8: 3A 25 20        LDA     PlyrShotStat        ; Player shot flag
14DB: FE 05           CPI     $05                 ; Alien explosion in progress?
14DD: C8              RZ                          ; Yes ... ignore this function
14DE: FE 02           CPI     $02                 
14E0: C0              RNZ                         
14E1: 3A 29 20        LDA     ?PlyrShotY?         ; Get X coordinate of player shot
14E4: FE D8           CPI     $D8                 ; Compare to 216 (40 from right)
14E6: 47              MOV     B,A                 ; Hold value for later
14E7: D2 30 15        JNC     $1530               ; X is within 40 from right initiate miss-explosion (shot flag 3)
14EA: 3A 02 20        LDA     alienIsExploding    ; Is an alien ...
14ED: A7              ANA     A                   ; ... blowing up?
14EE: C8              RZ                          ; No ... out
;
14EF: 78              MOV     A,B                 ; Get original X coordinate back to A
14F0: FE CE           CPI     $CE                 ; Compare to 206 (50 from right)
14F2: D2 79 15        JNC     $1579               ; X is within 50 from right? Yes ... saucer must be hit
14F5: C6 06           ADI     $06                 
14F7: 47              MOV     B,A                 
14F8: 3A 09 20        LDA     refAlienXX          
14FB: FE 90           CPI     $90                 
14FD: D2 04 15        JNC     $1504               
1500: B8              CMP     B                   
1501: D2 30 15        JNC     $1530               ; Hit something else (not an alien) do miss explosion
; Player shot has hit an alien
1504: 68              MOV     L,B                 
1505: CD 62 15        CALL    $1562               
1508: 3A 2A 20        LDA     $202A               
150B: 67              MOV     H,A                 
150C: CD 6F 15        CALL    $156F               ; Get alien's coordinate
150F: 22 64 20        SHLD    ?expAlienLoc?       ; Put it in the exploding-alien descriptor
1512: 3E 05           MVI     A,$05               ; Flag alien explosion ...
1514: 32 25 20        STA     PlyrShotStat        ; ... in progress
1517: CD 81 15        CALL    $1581               ; Get descriptor for alien
151A: 7E              MOV     A,M                 ; Is alien ...
151B: A7              ANA     A                   ; ... alive
151C: CA 30 15        JZ      $1530               ; No ... skip
151F: 36 00           MVI     M,$00               ; Make alien invader dead
1521: CD 5F 0A        CALL    $0A5F               ; ??? Makes alien explosion sound and other things ???
1524: CD 3B 1A        CALL    ReadDesc            ; Load 5 byte sprite descriptor
1527: CD D3 15        CALL    DrawSprite          ; Draw explosion sprite on screen
152A: 3E 10           MVI     A,$10               ; Initiate alien-explosion
152C: 32 03 20        STA     expAlienTimer       ; ... timer to 16
152F: C9              RET                         ; Out
;
; Player shot leaving playfield, hitting shield, or hitting an alien shot
1530: 3E 03           MVI     A,$03               
1532: 32 25 20        STA     PlyrShotStat        
1535: C3 4A 15        JMP     $154A               
;
; AExplodeTime
; Time down the alien explosion. Remove when done.
1538: 21 03 20        LXI     H,$2003             ; Decrement alien explosion ...
153B: 35              DCR     M                   ; ... timer
153C: C0              RNZ                         ; Not done  ... out
153D: 2A 64 20        LHLD    ?expAlienLoc?       ; Pixel pointer for exploding alien
1540: 06 10           MVI     B,$10               ; 16 row pixel
1542: CD 24 14        CALL    EraseSimpleSprite   ; Clear the explosion sprite from the screen
1545: 3E 04           MVI     A,$04               ; 4 means that ...
1547: 32 25 20        STA     PlyrShotStat        ; ... alien has exploded (remove from active duty)
;
154A: AF              XRA     A                   ; Turn off ...
154B: 32 02 20        STA     alienIsExploding    ; ... alien-is-blowing-up flag
154E: 06 F7           MVI     B,$F7               ; Turn off ...
1550: C3 DC 19        JMP     SoundBits3Off       ; ... alien exploding sound

1553: 00                          
    
1554: 0E 00           MVI     C,$00               
1556: BC              CMP     H                   
1557: D4 90 15        CNC     $1590               
155A: BC              CMP     H                   
155B: D0              RNC                         
155C: C6 10           ADI     $10                 
155E: 0C              INR     C                   
155F: C3 5A 15        JMP     $155A               

1562: 3A 09 20        LDA     refAlienXX          
1565: 65              MOV     H,L                 
1566: CD 54 15        CALL    $1554               
1569: 41              MOV     B,C                 
156A: 05              DCR     B                   
156B: DE 10           SBI     $10                 
156D: 6F              MOV     L,A                 
156E: C9              RET                         

156F: 3A 0A 20        LDA     refAlienYY          
1572: CD 54 15        CALL    $1554               
1575: DE 10           SBI     $10                 
1577: 67              MOV     H,A                 
1578: C9              RET                         

1579: 3E 01           MVI     A,$01               ; Mark flying ...
157B: 32 85 20        STA     $2085               ; ... saucer has been hit
157E: C3 45 15        JMP     $1545               ; Remove player shot

;=============================================================
; Get pointer into 11 byte descriptor. A = structure number,
; C = byte number (1 based).
; A*11+C-1 -> L
; ActivePlayer -> H
1581: 78              MOV     A,B                 ; Hold original
1582: 07              RLC                         ; *2
1583: 07              RLC                         ; *4
1584: 07              RLC                         ; *8
1585: 80              ADD     B                   ; *9
1586: 80              ADD     B                   ; *10
1587: 80              ADD     B                   ; *11
1588: 81              ADD     C                   ; Add offset into descriptor
1589: 3D              DCR     A                   ; -1
158A: 6F              MOV     L,A                 ; Set LSB of HL
158B: 3A 67 20        LDA     playerDataMSB       ; Set ...
158E: 67              MOV     H,A                 ; ... MSB of HL with active player indicator
158F: C9              RET                         

1590: 0C              INR     C                   ; ++C
1591: C6 10           ADI     $10                 ; Add 16 to A
1593: FA 90 15        JM      $1590               ; Keep going if result is negative
1596: C9              RET                         ; Out

1597: 3A 0D 20        LDA     $200D               
159A: A7              ANA     A                   
159B: C2 B7 15        JNZ     $15B7               
159E: 21 A4 3E        LXI     H,$3EA4             
15A1: CD C5 15        CALL    $15C5               
15A4: D0              RNC                         
15A5: 06 FE           MVI     B,$FE               
15A7: 3E 01           MVI     A,$01               
15A9: 32 0D 20        STA     $200D               
15AC: 78              MOV     A,B                 
15AD: 32 08 20        STA     refAlienDY          
15B0: 3A 0E 20        LDA     $200E               
15B3: 32 07 20        STA     refAlienDX          
15B6: C9              RET                         
;
15B7: 21 24 25        LXI     H,$2524             
15BA: CD C5 15        CALL    $15C5               
15BD: D0              RNC                         
15BE: CD F1 18        CALL    $18F1               
15C1: AF              XRA     A                   
15C2: C3 A9 15        JMP     $15A9               
;
15C5: 06 17           MVI     B,$17               
15C7: 7E              MOV     A,M                 
15C8: A7              ANA     A                   
15C9: C2 6B 16        JNZ     $166B               
15CC: 23              INX     H                   
15CD: 05              DCR     B                   
15CE: C2 C7 15        JNZ     $15C7               
15D1: C9              RET                         

15D2: 00              NOP                         
    
;=============================================================
; DrawSprite
; Draw sprite at [DE] to screen at pixel position in HL
; The hardware shift register is used in converting pixel positions
; to screen coordinates.
15D3: CD 74 14        CALL    CnvtPixNumber       ; Convert pixel number to screen/shift
15D6: E5              PUSH    H                   ; Preserve screen coordinate
15D7: C5              PUSH    B                   ; Hold for a second
15D8: E5              PUSH    H                   ; Hold for a second
15D9: 1A              LDAX    D                   ; From sprite data
15DA: D3 04           OUT     $04                 ; Write data to shift register
15DC: DB 03           IN      $03                 ; Read back shifted amount
15DE: 77              MOV     M,A                 ; Shifted sprite to screen
15DF: 23              INX     H                   ; Adjacent cell
15E0: 13              INX     D                   ; Next in sprite data
15E1: AF              XRA     A                   ; 0
15E2: D3 04           OUT     $04                 ; Write 0 to shift register
15E4: DB 03           IN      $03                 ; Read back remainder of previous
15E6: 77              MOV     M,A                 ; Write remainder to adjacent
15E7: E1              POP     H                   ; Old screen coordinate
15E8: 01 20 00        LXI     B,$0020             ; Offset screen ...
15EB: 09              DAD     B                   ; ... to next row
15EC: C1              POP     B                   ; Restore count
15ED: 05              DCR     B                   ; All done?
15EE: C2 D7 15        JNZ     $15D7               ; No ... do all
15F1: E1              POP     H                   ; Restore HL
15F2: C9              RET                         ; Done

; CountAliens
; Count number of aliens remaining in active game and return count 2082 holds the current count.
; If only 1, 206b gets a flag of 1 ?? nobody seems to check this
15F3: CD 11 16        CALL    GetPlayerDataPtr    ; Get active player descriptor
15F6: 01 00 37        LXI     B,$3700             ; B=55 aliens to check?
15F9: 7E              MOV     A,M                 ; Get byte
15FA: A7              ANA     A                   ; Is it a zero?
15FB: CA FF 15        JZ      $15FF               ; Yes ... don't count it
15FE: 0C              INR     C                   ; Count the live aliens
15FF: 23              INX     H                   ; Next alien
1600: 05              DCR     B                   ; Count ...
1601: C2 F9 15        JNZ     $15F9               ; ... all alien indicators
1604: 79              MOV     A,C                 ; Get the count
1605: 32 82 20        STA     numAliens           ; Hold it
1608: FE 01           CPI     $01                 ; Just one?
160A: C0              RNZ                         ; No keep going
160B: 21 6B 20        LXI     H,$206B             ; Set flag if ...
160E: 36 01           MVI     M,$01               ; ... only one alien left
1610: C9              RET                         ; Out

; GetPlayerDataPtr
; Set HL with 2100 if player 1 is active or 2200 if player 2 is active
;
1611: 2E 00           MVI     L,$00               ; Byte boundary
1613: 3A 67 20        LDA     playerDataMSB       ; Active player number
1616: 67              MOV     H,A                 ; Set HL to data
1617: C9              RET                         ; Done

;=============================================================
; PlrFireOrDemo
; Initiate player fire if button is pressed.
; Demo commands are parsed here if in demo mode
1618: 3A 15 20        LDA     playerAlive         ; Is there an active player?
161B: FE FF           CPI     $FF                 ; FF = alive
161D: C0              RNZ                         ; Player has been shot - no firing
161E: 21 10 20        LXI     H,$2010             
1621: 7E              MOV     A,M                 
1622: 23              INX     H                   
1623: 46              MOV     B,M                 
1624: B0              ORA     B                   
1625: C0              RNZ                         
1626: 3A 25 20        LDA     PlyrShotStat        ; Does the player have ...
1629: A7              ANA     A                   ; ... a shot on the screen?
162A: C0              RNZ                         ; Yes ... ignore
162B: 3A EF 20        LDA     gameMode            ; Are we in ...
162E: A7              ANA     A                   ; ... game mode?
162F: CA 52 16        JZ      $1652               ; No ... in demo mode ... constant firing in demo
1632: 3A 2D 20        LDA     fireBounce          ; Is fire button ...
1635: A7              ANA     A                   ; ... being held down?
1636: C2 48 16        JNZ     $1648               ; Yes ... wait for bounce
1639: CD C0 17        CALL    ReadInputs          ; Read active player controls
163C: E6 10           ANI     $10                 ; Fire-button pressed?
163E: C8              RZ                          ; No ... out
163F: 3E 01           MVI     A,$01               ; Flag
1641: 32 25 20        STA     PlyrShotStat        ; Flag shot active
1644: 32 2D 20        STA     fireBounce          ; Flag that fire button is down
1647: C9              RET                         ; Out
1648: CD C0 17        CALL    ReadInputs          ; Read active player controls
164B: E6 10           ANI     $10                 ; Fire-button pressed?
164D: C0              RNZ                         ; Yes ... ignore
164E: 32 2D 20        STA     fireBounce          ; Else ... clear flag
1651: C9              RET                         ; Out
; Handle demo (constant fire, parse demo commands)
1652: 21 25 20        LXI     H,$2025             ; Demo fires ...
1655: 36 01           MVI     M,$01               ; ... constantly
1657: 2A ED 20        LHLD    ?demoPtr?           ; Demo command bufer
165A: 23              INX     H                   ; Next position
165B: 7D              MOV     A,L                 ; Command buffer ...
165C: FE 7E           CPI     $7E                 ; ... wraps around
165E: DA 63 16        JC      $1663               ; ... Buffer from 1F74 to 1F7E
1661: 2E 74           MVI     L,$74               ; ... overflow
1663: 22 ED 20        SHLD    ?demoPtr?           ; Next demo command
1666: 7E              MOV     A,M                 ; Get next command
1667: 32 1D 20        STA     ?nextDemo?          ; Set command for movement
166A: C9              RET                         ; Done

166B: 37              STC                         
166C: C9              RET                         

166D: AF              XRA     A                   
166E: CD 8B 1A        CALL    $1A8B               
1671: CD 10 19        CALL    $1910               
1674: 36 00           MVI     M,$00               
1676: CD CA 09        CALL    $09CA               
1679: 23              INX     H                   
167A: 11 F5 20        LXI     D,$20F5             
167D: 1A              LDAX    D                   
167E: BE              CMP     M                   
167F: 1B              DCX     D                   
1680: 2B              DCX     H                   
1681: 1A              LDAX    D                   
1682: CA 8B 16        JZ      $168B               
1685: D2 98 16        JNC     $1698               
1688: C3 8F 16        JMP     $168F               
168B: BE              CMP     M                   
168C: D2 98 16        JNC     $1698               
168F: 7E              MOV     A,M                 
1690: 12              STAX    D                   
1691: 13              INX     D                   
1692: 23              INX     H                   
1693: 7E              MOV     A,M                 
1694: 12              STAX    D                   
1695: CD 50 19        CALL    PrintHiScore        
1698: 3A CE 20        LDA     twoPlayers          ; Number of players
169B: A7              ANA     A                   ; Is this a single player game?
169C: CA C9 16        JZ      $16C9               ; Yes ... short message
169F: 21 03 28        LXI     H,$2803             ; Screen coordinates
16A2: 11 A6 1A        LXI     D,$1AA6             ; "GAME OVER PLAYER< >"
16A5: 0E 14           MVI     C,$14               ; 20 characters
16A7: CD 93 0A        CALL    PrintMessageDel     ; Print message
16AA: 25              DCR     H                   ; Back up ...
16AB: 25              DCR     H                   ; ... to player indicator
16AC: 06 1B           MVI     B,$1B               ; "1"
16AE: 3A 67 20        LDA     playerDataMSB       ; Player number
16B1: 0F              RRC                         ; Is this player 1?
16B2: DA B7 16        JC      $16B7               ; Yes ... keep the digit
16B5: 06 1C           MVI     B,$1C               ; Else ... set digit 2
16B7: 78              MOV     A,B                 ; To A
16B8: CD FF 08        CALL    DrawChar            ; Print player number
16BB: CD B1 0A        CALL    OneSecDelay         ; Short delay
16BE: CD E7 18        CALL    $18E7               
16C1: 7E              MOV     A,M                 
16C2: A7              ANA     A                   
16C3: CA C9 16        JZ      $16C9               
16C6: C3 ED 02        JMP     $02ED               
;
16C9: 21 18 2D        LXI     H,$2D18             ; Screen coordinates
16CC: 11 A6 1A        LXI     D,$1AA6             ; "GAME OVER PLAYER< >"
16CF: 0E 0A           MVI     C,$0A               ; Just the "GAME OVER" part
16D1: CD 93 0A        CALL    PrintMessageDel     ; Print message
16D4: CD B6 0A        CALL    TwoSecDelay         ; Long delay
16D7: CD D6 09        CALL    ClearPlayField      ; Clear center window
16DA: AF              XRA     A                   ; Now in ...
16DB: 32 EF 20        STA     gameMode            ; ... demo mode
16DE: D3 05           OUT     $05                 ; All sound off
16E0: CD D1 19        CALL    EnableGameTasks     ; Enable ISR game tasks
16E3: C3 89 0B        JMP     $0B89               

16E6: 31 00 24        LXI     SP,$2400            ; Reset stack
16E9: FB              EI                          ; Enable interrupts
16EA: AF              XRA     A                   ; Flag ...
16EB: 32 15 20        STA     playerAlive         ; ... player is shot
16EE: CD D8 14        CALL    $14D8               
16F1: 06 04           MVI     B,$04               ; Player hit ...
16F3: CD FA 18        CALL    SoundBits3On        ; ... sound
16F6: CD 59 0A        CALL    $0A59               ; Has flag been set?
16F9: C2 EE 16        JNZ     $16EE               ; No ... wait for the flag
16FC: CD D7 19        CALL    DsableGameTasks     
16FF: 21 01 27        LXI     H,$2701             
1702: CD FA 19        CALL    $19FA               
1705: AF              XRA     A                   
1706: CD 8B 1A        CALL    $1A8B               
1709: 06 FB           MVI     B,$FB               
170B: C3 6B 19        JMP     $196B               
170E: CD CA 09        CALL    $09CA               
1711: 23              INX     H                   
1712: 7E              MOV     A,M                 
1713: 11 B8 1C        LXI     D,$1CB8             
1716: 21 A1 1A        LXI     H,$1AA1             ;
1719: 0E 04           MVI     C,$04               
171B: 47              MOV     B,A                 
171C: 1A              LDAX    D                   
171D: B8              CMP     B                   
171E: D2 27 17        JNC     $1727               
1721: 23              INX     H                   
1722: 13              INX     D                   
1723: 0D              DCR     C                   
1724: C2 1C 17        JNZ     $171C               
1727: 7E              MOV     A,M                 
1728: 32 CF 20        STA     $20CF               
172B: C9              RET                         

;=============================================================
; Shot sound on or off depending on 2025
; ShotSound
172C: 3A 25 20        LDA     PlyrShotStat        ; Player shot flag
172F: FE 00           CPI     $00                 ; Active shot?
1731: C2 39 17        JNZ     $1739               ; Yes ... go
1734: 06 FD           MVI     B,$FD               ; Sound mask
1736: C3 DC 19        JMP     SoundBits3Off       ; Mask off sound
;
1739: 06 02           MVI     B,$02               ; Sound bit
173B: C3 FA 18        JMP     SoundBits3On        ; OR on sound

173E: 00 00                        

; TimeFleetSound
; This called from the ISR times down the fleet and sets the flag at 2095 if 
; the fleet needs a change in sound handling (new delay, new sound)
1740: 21 9B 20        LXI     H,$209B             ; Pointer to hold time for fleet
1743: 35              DCR     M                   ; Decrement hold time
1744: CC 6D 17        CZ      $176D               ; If 0 turn fleet movement sound off
1747: 3A 68 20        LDA     $2068               
174A: A7              ANA     A                   
174B: CA 6D 17        JZ      $176D               ; Fleet movement sound off and out
;
174E: 21 96 20        LXI     H,$2096             ; Current time on fleet sound
1751: 35              DCR     M                   ; Count down
1752: C0              RNZ                         ; Not time to change sound ... out
1753: 21 98 20        LXI     H,$2098             ; Current sound port 3 value
1756: 7E              MOV     A,M                 ; Get value
1757: D3 05           OUT     $05                 ; Set sounds
1759: 3A 82 20        LDA     numAliens           ; Number of aliens on active screen
175C: A7              ANA     A                   ; Is it zero?
175D: CA 6D 17        JZ      $176D               ; Yes ... turn off fleet movement sound and out
1760: 2B              DCX     H                   ; (2097) Point to fleet timer reload
1761: 7E              MOV     A,M                 ; Get fleet delay value
1762: 2B              DCX     H                   ; (2096) Point to fleet timer
1763: 77              MOV     M,A                 ; Reload the timer
1764: 2B              DCX     H                   ; Point to change-sound
1765: 36 01           MVI     M,$01               ; (2095) time to change sound
1767: 3E 04           MVI     A,$04               ; Set hold ...
1769: 32 9B 20        STA     $209B               ; ... time for fleet sound
176C: C9              RET                         ; Done

176D: 3A 98 20        LDA     soundPort5          ; Current sound port 3 value
1770: E6 30           ANI     $30                 ; Mask off fleet movement sounds
1772: D3 05           OUT     $05                 ; Set sounds
1774: C9              RET                         ; Out

;=============================================================
; FleetDelayExShip
; This game-loop routine handles two sound functions. The routine does:
; 1) Time out the extra-ship awarded sound and turn it off when done
; 2) Load the fleet sound delay based on number of remaining aliens
; 3) Make the changing fleet sound
;
; The 2095 flag is set by the ISR and cleared here. The ISR does the timing and sets 2095 when it
; is time to make a new fleet sound.
;
; ?? Fix the text of the wiki page talking about the speed up because of 
; the CPU getting free.
;
1775: 3A 95 20        LDA     $2095               ; Time for new ...
1778: A7              ANA     A                   ; ... fleet movement sound?
1779: CA AA 17        JZ      $17AA               ; No ... skip to extra-man timing
177C: 21 11 1A        LXI     H,$1A11             ; Number of aliens list coupled ...
177F: 11 21 1A        LXI     D,$1A21             ; ... with delay list
1782: 3A 82 20        LDA     numAliens           ; Get the number of aliens on the screen
1785: BE              CMP     M                   ; Compare it to the first list value
1786: D2 8E 17        JNC     $178E               ; Number of live aliens is higher than value ... use the delay
1789: 23              INX     H                   ; Move to ...
178A: 13              INX     D                   ; ... next list value
178B: C3 85 17        JMP     $1785               ; Find the right delay
178E: 1A              LDAX    D                   ; Get the delay from the second list
178F: 32 97 20        STA     $2097               ; Store the new alien sound delay
1792: 21 98 20        LXI     H,$2098             ; Get current state ...
1795: 7E              MOV     A,M                 ; ... of sound port
1796: E6 30           ANI     $30                 ; Mask off all fleet movement sounds
1798: 47              MOV     B,A                 ; Hold the value
1799: 7E              MOV     A,M                 ; Get current state
179A: E6 0F           ANI     $0F                 ; This time ONLY the fleet movement sounds
179C: 07              RLC                         ; Shift next to next sound
179D: FE 10           CPI     $10                 ; Overflow?
179F: C2 A4 17        JNZ     $17A4               ; No ... keep it
17A2: 3E 01           MVI     A,$01               ; Reset back to first sound
17A4: B0              ORA     B                   ; Add fleet sounds to current sound value
17A5: 77              MOV     M,A                 ; Store new sound value
17A6: AF              XRA     A                   ; Restart ...
17A7: 32 95 20        STA     $2095               ; ... waiting on fleet time
;
17AA: 21 99 20        LXI     H,$2099             ; Sound timer for award extra ship
17AD: 35              DCR     M                   ; Time expired?
17AE: C0              RNZ                         ; No ... leave sound playing
17AF: 06 EF           MVI     B,$EF               ; Turn off bit set with #$10 (award extra ship)
17B1: C3 DC 19        JMP     SoundBits3Off       ; Stop sound and out

;=============================================================
; SndOffExtPly
17B4: 06 EF           MVI     B,$EF               ; Mask off sound bit 4 (Extended play)
17B6: 21 98 20        LXI     H,$2098             ; Current sound content
17B9: 7E              MOV     A,M                 ; Get current sound bits
17BA: A0              ANA     B                   ; Turn off extended play
17BB: 77              MOV     M,A                 ; Remember settings
17BC: D3 05           OUT     $05                 ; Turn off extended play
17BE: C9              RET                         ; Out

17BF: 00

;=============================================================
; ReadInputs
; Read control inputs for active player
17C0: 3A 67 20        LDA     playerDataMSB       ; Get active player
17C3: 0F              RRC                         ; Test player
17C4: D2 CA 17        JNC     $17CA               ; Player 2 ... read port 2
17C7: DB 01           IN      $01                 ; Player 1 ... read port 1
17C9: C9              RET                         ; Out
17CA: DB 02           IN      $02                 ; Get controls for player 2
17CC: C9              RET                         ; Out

;=============================================================
; Check and handle TILT
; CheckHandleTilt
17CD: DB 02           IN      $02                 ; Read input port
17CF: E6 04           ANI     $04                 ; Tilt?
17D1: C8              RZ                          ; No tilt ... return
17D2: 3A 9A 20        LDA     tilt                ; Already in TILT handle?
17D5: A7              ANA     A                   ; 1 = yes
17D6: C0              RNZ                         ; Yes ... ignore it now
17D7: 31 00 24        LXI     SP,$2400            ; Reset stack
17DA: 06 04           MVI     B,$04               ; Do this 4 times
17DC: CD D6 09        CALL    ClearPlayField      ; Clear center window
17DF: 05              DCR     B                   ; All done?
17E0: C2 DC 17        JNZ     $17DC               ; No ... do again
17E3: 3E 01           MVI     A,$01               ; Flag ...
17E5: 32 9A 20        STA     tilt                ; ... handling TILT
17E8: CD D7 19        CALL    DsableGameTasks     
17EB: FB              EI                          ; Re-enable interrupts
17EC: 11 BC 1C        LXI     D,$1CBC             ; Message "TILT"
17EF: 21 16 30        LXI     H,$3016             ; Center of screen
17F2: 0E 04           MVI     C,$04               ; Four letters
17F4: CD 93 0A        CALL    PrintMessageDel     ; Print "TILT"
17F7: CD B1 0A        CALL    OneSecDelay         ; Short delay
17FA: AF              XRA     A                   ; Zero
17FB: 32 9A 20        STA     tilt                ; TILT handle over
17FE: 32 93 20        STA     waitStartLoop       
1801: C3 C9 16        JMP     $16C9               ; Handle game over for player

; Called from game loop
1804: 21 84 20        LXI     H,$2084             
1807: 7E              MOV     A,M                 
1808: A7              ANA     A                   
1809: CA 07 07        JZ      $0707               ; UFO sound off
180C: 23              INX     H                   
180D: 7E              MOV     A,M                 
180E: A7              ANA     A                   
180F: C0              RNZ                         
1810: 06 01           MVI     B,$01               ; UFO sound
1812: C3 FA 18        JMP     SoundBits3On        ; Start UFO sound
  
; DrawAdvTable
; Draw "SCORE ADVANCE TABLE"
1815: 21 10 28        LXI     H,$2810             ; 0x410 is 1040 rotCol=32, rotRow=16
1818: 11 A3 1C        LXI     D,$1CA3             ; "*SCORE ADVANCE TABLE*"
181B: 0E 15           MVI     C,$15               ; 21 bytes in message
181D: CD F3 08        CALL    PrintMessage        ; Print message
1820: 3E 0A           MVI     A,$0A               ; 10 bytes in every "=xx POINTS" string
1822: 32 6C 20        STA     temp206C            ; Hold the count
1825: 01 BE 1D        LXI     B,$1DBE             ; Coordinate/sprite for drawing table
1828: CD 56 18        CALL    ReadPriStruct       ; Get HL=coordinate, DE=image
182B: DA 37 18        JC      $1837               ; Move on if done
182E: CD 44 18        CALL    $1844               ; Draw 16-byte sprite
1831: C3 28 18        JMP     $1828               ; Do all in table
;
1834: CD B1 0A        CALL    OneSecDelay         ; One second delay
1837: 01 CF 1D        LXI     B,$1DCF             ; Coordinate/message for drawing table
183A: CD 56 18        CALL    ReadPriStruct       ; Get HL=coordinate, DE=message
183D: D8              RC                          ; Out if done
183E: CD 4C 18        CALL    $184C               ; Print message
1841: C3 3A 18        JMP     $183A               ; Do all in table
;
1844: C5              PUSH    B                   ; Hold BC
1845: 06 10           MVI     B,$10               ; 16 bytes
1847: CD 39 14        CALL    DrawSimpSprite      ; Draw simple
184A: C1              POP     B                   ; Restore BC
184B: C9              RET                         ; Out
;
184C: C5              PUSH    B                   ; Hold BC
184D: 3A 6C 20        LDA     temp206C            ; Count of 10 ...
1850: 4F              MOV     C,A                 ; ... to C
1851: CD 93 0A        CALL    PrintMessageDel     ; Print the message with delay between letters
1854: C1              POP     B                   ; Restore BC
1855: C9              RET                         ; Out

; ReadPriStruct
; Read a 4-byte print-structure pointed to by BC
; HL=Screen coordiante, DE=pointer to message
; If the first byte is FF then return with C=1.
1856: 0A              LDAX    B                   ; Get the screen LSB
1857: FE FF           CPI     $FF                 ; Valid?
1859: 37              STC                         ; If not C will be 1
185A: C8              RZ                          ; Return if 255
185B: 6F              MOV     L,A                 ; Screen LSB to L
185C: 03              INX     B                   ; Next
185D: 0A              LDAX    B                   ; Read screen MSB
185E: 67              MOV     H,A                 ; Screen MSB to H
185F: 03              INX     B                   ; Next
1860: 0A              LDAX    B                   ; Read message LSB
1861: 5F              MOV     E,A                 ; Message LSB to E
1862: 03              INX     B                   ; Next
1863: 0A              LDAX    B                   ; Read message MSB
1864: 57              MOV     D,A                 ; Message MSB to D
1865: 03              INX     B                   ; Next (for next print)
1866: A7              ANA     A                   ; Clear C
1867: C9              RET                         ; Done

; SplashSprite
; Moves a sprite up or down in splash mode. Interrupt moves the sprite. When it reaches
; Y value in 20CA the flag at 20CB is raised. The image flips between two pictures every
; 4 movements.      

; 20C2 ... image form. Increments every time. Switches between two image forms every 4 counts (with bit 2)
; 20C3 ... delta-x
; 20C4 ... delta-y
;
; 20C5 ... x
; 20C6 ... y
; 20C7 ... image to draw (1st byte)
; 20C8 ... image to draw (2nd byte)
;
; 20C9 ... never used
;
; 20CA ... target X coordinate
; 20CB ... turned to 1 when reached target y coordinate
; 20CC,D ... basic image


1868: 21 C2 20        LXI     H,$20C2             ; Descriptor
186B: 34              INR     M                   ; Change image
186C: 23              INX     H                   ; Point to delta-x
186D: 4E              MOV     C,M                 ; Get delta-x
186E: CD D9 01        CALL    AddDelta            ; Add delta-X and delta-Y to X and Y
1871: 47              MOV     B,A                 ; Current y coordinate
1872: 3A CA 20        LDA     $20CA               ; Has sprite reached ...
1875: B8              CMP     B                   ; ... target coordinate?
1876: CA 98 18        JZ      $1898               ; Yes ... flag and out
1879: 3A C2 20        LDA     $20C2               ; Image number
187C: E6 04           ANI     $04                 ; Watching bit 3 for flip delay
187E: 2A CC 20        LHLD    $20CC               ; Image
1881: C2 88 18        JNZ     $1888               ; Did bit 3 go to 0? No ... keep current image
1884: 11 30 00        LXI     D,$0030             ; 16*3 ...
1887: 19              DAD     D                   ; ...  use other image form
1888: 22 C7 20        SHLD    $20C7               ; Image to descriptor structure
188B: 21 C5 20        LXI     H,$20C5             ; X,Y,Image descriptor
188E: CD 3B 1A        CALL    ReadDesc            ; Read sprite descriptor
1891: EB              XCHG                        ; Image to DE, position to HL
1892: C3 D3 15        JMP     DrawSprite          ; Draw the sprite

1895: 00 00 00                          

1898: 3E 01           MVI     A,$01               ; Flag that sprite ...
189A: 32 CB 20        STA     $20CB               ; ... reached location
189D: C9              RET                         ; Out

; ?? animate alien shot to extra "C" in splash
189E: 21 50 20        LXI     H,$2050             
18A1: 11 C0 1B        LXI     D,$1BC0             
18A4: 06 10           MVI     B,$10               ; Block copy ...
18A6: CD 32 1A        CALL    BlockCopy           ; ... 16 bytes
18A9: 3E 02           MVI     A,$02               
18AB: 32 80 20        STA     $2080               
18AE: 3E FF           MVI     A,$FF               ; Shot direction (-1)
18B0: 32 7E 20        STA     aShotSpeed          
18B3: 3E 04           MVI     A,$04               ; Animate ...
18B5: 32 C1 20        STA     $20C1               ; ... shot
18B8: 3A 55 20        LDA     $2055               ; Has shot ...
18BB: E6 01           ANI     $01                 ; ... collided?
18BD: CA B8 18        JZ      $18B8               ; No ... keep waiting
18C0: 3A 55 20        LDA     $2055               ; Wait ...
18C3: E6 01           ANI     $01                 ; ... for explosion ...
18C5: C2 C0 18        JNZ     $18C0               ; ... to finish
18C8: 21 11 33        LXI     H,$3311             ; Here is where the extra C is
18CB: 3E 26           MVI     A,$26               ; Space character
18CD: 00              NOP                         ; ?
18CE: CD FF 08        CALL    DrawChar            ; Draw character
18D1: C3 B6 0A        JMP     TwoSecDelay         ; Two second delay and out

;=============================================================
; Initializiation comes here
;
18D4: 31 00 24        LXI     SP,$2400            ; Set stack pointer just below screen
18D7: 06 00           MVI     B,$00               ; Count 256 bytes
18D9: CD E6 01        CALL    $01E6               ; Copy ROM to RAM
18DC: CD 56 19        CALL    DrawStatus          ; Print scores and credits
;
18DF: 3E 08           MVI     A,$08               
18E1: 32 CF 20        STA     $20CF               
18E4: C3 EA 0A        JMP     $0AEA               ; Top of splash screen loop

;=============================================================
; ??? See 1910
18E7: 3A 67 20        LDA     playerDataMSB       ; Player indicator
18EA: 21 E7 20        LXI     H,$20E7             ; Strange descriptor
18ED: 0F              RRC                         
18EE: D0              RNC                         
18EF: 23              INX     H                   
18F0: C9              RET                         

18F1: 06 02           MVI     B,$02               
18F3: 3A 82 20        LDA     numAliens           
18F6: 3D              DCR     A                   
18F7: C0              RNZ                         
18F8: 04              INR     B                   
18F9: C9              RET                         

;=============================================================
; SoundBits3On
; Add in bit for sound
18FA: 3A 94 20        LDA     soundPort3          ; Current value of sound port
18FD: B0              ORA     B                   ; Add in new sounds
18FE: 32 94 20        STA     soundPort3          ; New value of sound port
1901: D3 03           OUT     $03                 ; Write new value to sound hardware
1903: C9              RET                         

1904: 21 00 22        LXI     H,$2200             ; Player 2 data area
1907: C3 C3 01        JMP     $01C3               ; Initialize player 2 aliens

;=============================================================
; Called from main game loop 

190A: CD D8 14        CALL    $14D8               ; ?? Collision detection for player's shot
190D: C3 97 15        JMP     $1597               ; ?? Detects ships on edge of screen. Change to ret and they never turn

;=============================================================
; ??? See 18E7
1910: 21 E7 20        LXI     H,$20E7             
1913: 3A 67 20        LDA     playerDataMSB       ; Player 1 or 2
1916: 0F              RRC                         ; Test
1917: D8              RC                          ; Return if player 1
1918: 23              INX     H                   ; Bump to next ???
1919: C9              RET                         ; Return

;=============================================================
; DrawScoreHead
; Print score header " SCORE<1> HI-SCORE SCORE<2> "
191A: 0E 1C           MVI     C,$1C               ; 28 bytes in message
191C: 21 1E 24        LXI     H,$241E             ; Screen coordinates
191F: 11 E4 1A        LXI     D,$1AE4             ; Score header message
1922: C3 F3 08        JMP     PrintMessage        ; Print score header

1925: 21 F8 20        LXI     H,$20F8             ; Player 1 score descriptor
1928: C3 31 19        JMP     DrawScore           ; Print score

192B: 21 FC 20        LXI     H,$20FC             ; Player 2 score descriptor
192E: C3 31 19        JMP     DrawScore           ; Print score

;=============================================================
; DrawScore
; Print score.
; HL = descriptor
1931: 5E              MOV     E,M                 ; Get score LSB
1932: 23              INX     H                   ; Next
1933: 56              MOV     D,M                 ; Get score MSB
1934: 23              INX     H                   ; Next
1935: 7E              MOV     A,M                 ; Get coordinate LSB
1936: 23              INX     H                   ; Next
1937: 66              MOV     H,M                 ; Get coordiante MSB
1938: 6F              MOV     L,A                 ; Set LSB
1939: C3 AD 09        JMP     Print4Digits        ; Print 4 digits in DE

;=============================================================
; Print message "CREDIT "
193C: 0E 07           MVI     C,$07               ; 7 bytes in message
193E: 21 01 35        LXI     H,$3501             ; Screen coordinates
1941: 11 A9 1F        LXI     D,$1FA9             ; Message = "CREDIT "
1944: C3 F3 08        JMP     PrintMessage        ; Print message

;=============================================================
; DrawNumCredits
; Display number of credits on screen
1947: 3A EB 20        LDA     numCoins            ; Number of credits
194A: 21 01 3C        LXI     H,$3C01             ; Screen coordinates
194D: C3 B2 09        JMP     DrawHexByte         ; Character to screen

;=============================================================
; PrintHiScore
1950: 21 F4 20        LXI     H,$20F4             ; Hi Score descriptor
1953: C3 31 19        JMP     DrawScore           ; Print Hi-Score

;=============================================================
; DrawStatus
; Print scores (with header) and credits (with label)
1956: CD 5C 1A        CALL    Clear2Rows          ; Clear 2 rows on the screen
1959: CD 1A 19        CALL    DrawScoreHead       ; Print score header
195C: CD 25 19        CALL    $1925               ; Print player 1 score
195F: CD 2B 19        CALL    $192B               ; Print player 2 score
1962: CD 50 19        CALL    PrintHiScore        ; Print hi score
1965: CD 3C 19        CALL    $193C               ; Print credit lable
1968: C3 47 19        JMP     DrawNumCredits      ; Number of credits

;=============================================================
196B: CD DC 19        CALL    SoundBits3Off       
196E: C3 71 16        JMP     $1671               

1971: 3E 01           MVI     A,$01               
1973: 32 6D 20        STA     $206D               
1976: C3 E6 16        JMP     $16E6               

1979: CD D7 19        CALL    DsableGameTasks     ;
197C: CD 47 19        CALL    DrawNumCredits      ; Display number of credits on screen
197F: C3 3C 19        JMP     $193C               ; Print message "CREDIT"

1982: 32 C1 20        STA     $20C1               
1985: C9              RET                         

1986: 8B              ADC     E                   
1987: 19              DAD     D                   
1988: C3 D6 09        JMP     ClearPlayField      

;=============================================================
; Print "*TAITO CORPORATION*"
198B: 21 03 28        LXI     H,$2803             ; Screen coordinates
198E: 11 BE 19        LXI     D,$19BE             ; Message "*TAITO CORPORATION*"
1991: 0E 13           MVI     C,$13               ; Messgae length
1993: C3 F3 08        JMP     PrintMessage        ; Print message

1996: 00 00 00 00
                         
; CheckHiddenMes
; There is a hidden message "TAITO COP" (with no "R") in the game. It can only be 
; displayed in the demonstration game during the splash screens. You must enter
; 2 seqences of buttons. Timing is not critical. As long as you eventually get all
; the buttons up/down in the correct pattern then the game will register the
; sequence.
;
; 1st: 2start(down) 1start(up)   1fire(down) 1left(down) 1right(down)
; 2nd: 2start(up)   1start(down) 1fire(down) 1left(down) 1right(up)
;
; Unfortunately MAME does not deliver the simultaneous button presses correctly. You can see the message in
; MAME by changing 19A6 to 02 and 19B1 to 02. Then the 2start(down) is the only sequence. 
;
199A: 3A 1E 20        LDA     hidMessSeq          ; Has the 1st "hidden-message" sequence ...
199D: A7              ANA     A                   ; ... been registered?
199E: C2 AC 19        JNZ     $19AC               ; Yes ... go look for the 2nd sequence
19A1: DB 01           IN      $01                 ; Get player inputs
19A3: E6 76           ANI     $76                 ; 0111_0110 Keep 2Pstart, 1Pstart, 1Pshot, 1Pleft, 1Pright
19A5: D6 72           SUI     $72                 ; 0111_0010 1st sequence: 2Pstart, 1Pshot, 1Pleft, 1Pright
19A7: C0              RNZ                         ; Not first sequence ... out
19A8: 3C              INR     A                   ; Flag that 1st sequence ...
19A9: 32 1E 20        STA     hidMessSeq          ; ... has been entered
19AC: DB 01           IN      $01                 ; Check inputs for 2nd sequence
19AE: E6 76           ANI     $76                 ; 0111_0110 Keep 2Pstart, 1Pstart, 1Pshot, 1Pleft, 1Pright
19B0: FE 34           CPI     $34                 ; 0011_0100 2nd sequence: 1Pstart, 1Pshot, 1Pleft
19B2: C0              RNZ                         ; If not second sequence ignore
19B3: 21 1B 2E        LXI     H,$2E1B             ; Screen coordinates
19B6: 11 F7 0B        LXI     D,$0BF7             ; Message = "TAITO COP" (no R)
19B9: 0E 09           MVI     C,$09               ; Message length
19BB: C3 F3 08        JMP     PrintMessage        ; Print message and out

; MessageTaito
; "*TAITO CORPORATION*"
19BE: 28 13 00 08 13 0E 26 02 0E 11 0F 0E 11      
19CB: 00 13 08 0E 0D 28

;=============================================================
; EnableGameTasks
; Enable ISR game tasks 
19D1: 3E 01           MVI     A,$01               ; Set ISR ...
19D3: 32 E9 20        STA     suspendPlay         ; ... game tasks enabled
19D6: C9              RET                         ; Done

;=============================================================
; DsableGameTasks
; Disable ISR game tasks
; Clear 20E9 flag
19D7: AF              XRA     A                   ; Clear ISR game tasks flag
19D8: C3 D3 19        JMP     $19D3               ; Save a byte (the RET)
19DB: 00                                          ; %% Here is the byte saved. I wonder if this was an optimizer pass.
; 

;=============================================================
; SoundBits3Off
; Turn off bit in sound port
19DC: 3A 94 20        LDA     soundPort3          ; Current sound effects value
19DF: A0              ANA     B                   ; Mask bits off
19E0: 32 94 20        STA     soundPort3          ; Store new hold value
19E3: D3 03           OUT     $03                 ; Change sounds
19E5: C9              RET                         ; Done

;=============================================================
; DrawNumShips
; Show ships remaining in hold for the player
19E6: 21 01 27        LXI     H,$2701             ; Screen coordinates
19E9: CA FA 19        JZ      $19FA               ; None in reserve ... skip display
; Draw line of ships
19EC: 11 60 1C        LXI     D,$1C60             ; Player sprite
19EF: 06 10           MVI     B,$10               ; 16 rows
19F1: 4F              MOV     C,A                 ; Hold count
19F2: CD 39 14        CALL    DrawSimpSprite      ; Display 1byte sprite to screen
19F5: 79              MOV     A,C                 ; Restore remaining
19F6: 3D              DCR     A                   ; All done?
19F7: C2 EC 19        JNZ     $19EC               ; No ... keep going
; Clear remainder of line
19FA: 06 10           MVI     B,$10               ; 16 rows
19FC: CD CB 14        CALL    ClearSmallSprite    ; Clear 1byte sprite at HL
19FF: 7C              MOV     A,H                 ; Get Y coordinate
1A00: FE 35           CPI     $35                 ; At edge?
1A02: C2 FA 19        JNZ     $19FA               ; No ... do all
1A05: C9              RET                         ; Out

;=============================================================
; Compare upper bit at [DE] with vblank vlag.
; CF=0 if they are different. CF=1 if they are the same.
; CompToVBlank
1A06: 21 72 20        LXI     H,$2072             ; Get the ...
1A09: 46              MOV     B,M                 ; ... vblank status
1A0A: 1A              LDAX    D                   ; Get the task structure flag
1A0B: E6 80           ANI     $80                 ; Only upper bits count
1A0D: A8              XRA     B                   ; XOR them together
1A0E: C0              RNZ                         ; Not the same (CF cleared)
1A0F: 37              STC                         ; Set the CF if the same
1A10: C9              RET                         ; Done

; Alien delay lists. First list is the number of aliens. The second list is the corresponding delay.
; This delay is only for the rate of change in the fleet's sound.
; The check takes the first num-aliens-value that is lower or the same as the actual num-aliens on screen.
;
; The game starts with 55 aliens. The aliens are move/drawn one per interrupt which means it
; takes 55 interrupts. The first delay value is 52 ... which is almost in sync with the number
; of aliens. It is a tad faster and you can observe the sound and steps getting out of sync.
;
1A11: 32 2B 24 1C 16 11 0D 0A 08 07 06 05 04 03 02 01
1A21: 34 2E 27 22 1C 18 15 13 10 0E 0D 0C 0B 09 07 05     
1A31: FF   ; Needless terminator? The list value "1" catches everything.

;=============================================================
; BlockCopy
; Copy from [DE] to [HL] (b bytes)
1A32: 1A              LDAX    D                   ; Copy from [DE] to ...
1A33: 77              MOV     M,A                 ; ... [HL]
1A34: 23              INX     H                   ; Next destination
1A35: 13              INX     D                   ; Next source
1A36: 05              DCR     B                   ; Count in B
1A37: C2 32 1A        JNZ     BlockCopy           ; Do all
1A3A: C9              RET                         ; Done

;=============================================================
; ReadDesc
; Load 5 bytes sprite descriptor from [HL]
1A3B: 5E              MOV     E,M                 ; Descriptor ...
1A3C: 23              INX     H                   ; ... sprite ...
1A3D: 56              MOV     D,M                 ; ...
1A3E: 23              INX     H                   ; ... picture
1A3F: 7E              MOV     A,M                 ; Descriptor ...
1A40: 23              INX     H                   ; ... screen ...
1A41: 4E              MOV     C,M                 ; ...
1A42: 23              INX     H                   ; ... location
1A43: 46              MOV     B,M                 ; Number of bytes in sprite
1A44: 61              MOV     H,C                 ; From A,C to ...
1A45: 6F              MOV     L,A                 ; ... H,L
1A46: C9              RET                         ; Done

;=============================================================
; ConvToScr
; The screen is organized as one-bit-per-pixel.
; In: HL contains pixel number (bbbbbbbbbbbbbppp)
; Convert from pixel number to screen coordinates (without shift)
; Shift HL right 3 bits (clearing the top 2 bits)
; and set the third bit from the left.
1A47: C5              PUSH    B                   ; Hold B (will mangle)
1A48: 06 03           MVI     B,$03               ; 3 shifts (divide by 8)
1A4A: 7C              MOV     A,H                 ; H to A
1A4B: 1F              RAR                         ; Shift right (into carry, from doesn't matter)
1A4C: 67              MOV     H,A                 ; Back to H
1A4D: 7D              MOV     A,L                 ; L to A
1A4E: 1F              RAR                         ; Shift right (from/to carry)
1A4F: 6F              MOV     L,A                 ; Back to L
1A50: 05              DCR     B                   ; Do all ...
1A51: C2 4A 1A        JNZ     $1A4A               ; ... 3 shifts
1A54: 7C              MOV     A,H                 ; H to A
1A55: E6 3F           ANI     $3F                 ; Mask off all but screen (less than or equal 3F)
1A57: F6 20           ORI     $20                 ; Offset into RAM
1A59: 67              MOV     H,A                 ; Back to H
1A5A: C1              POP     B                   ; Restore B
1A5B: C9              RET                         ; Done

;=============================================================
; Clear2Rows
; Clear 2 rows on the screen (2 vertical lines when rotated)
1A5C: 21 00 24        LXI     H,$2400             ; Screen coordinate
1A5F: 36 00           MVI     M,$00               ; Clear it
1A61: 23              INX     H                   ; Next byte
1A62: 7C              MOV     A,H                 ; Have we done ...
1A63: FE 40           CPI     $40                 ; ... 2 rows?
1A65: C2 5F 1A        JNZ     $1A5F               ; No ... keep going
1A68: C9              RET                         ; Out

;=============================================================
; RestoreShields
; Logically OR the player's shields back onto the playfield
; DE = sprite
; HL = screen
; C = bytes per row
; B = number of rows
1A69: C5              PUSH    B                   ; Preserve BC
1A6A: E5              PUSH    H                   ; Hold for a bit
1A6B: 1A              LDAX    D                   ; From sprite
1A6C: B6              ORA     M                   ; OR with screen
1A6D: 77              MOV     M,A                 ; Back to screen
1A6E: 13              INX     D                   ; Next sprite
1A6F: 23              INX     H                   ; Next on screen
1A70: 0D              DCR     C                   ; Row done?
1A71: C2 6B 1A        JNZ     $1A6B               ; No ... do entire row
1A74: E1              POP     H                   ; Original start
1A75: 01 20 00        LXI     B,$0020             ; Bump HL by ...
1A78: 09              DAD     B                   ; ... one screen row
1A79: C1              POP     B                   ; Restore
1A7A: 05              DCR     B                   ; Row counter
1A7B: C2 69 1A        JNZ     RestoreShields      ; Do all rows
1A7E: C9              RET                         

;=============================================================
; RemoveShip
; Remove a ship from the players stash and update the
; hold indicators on the screen.
1A7F: CD 2E 09        CALL    $092E               ; Get last byte from player data
1A82: A7              ANA     A                   ; Is it 0?
1A83: C8              RZ                          ; Skip
1A84: F5              PUSH    PSW                 ; Preserve number remaining
1A85: 3D              DCR     A                   ; Remove a ship from the stash
1A86: 77              MOV     M,A                 ; New number of ships
1A87: CD E6 19        CALL    DrawNumShips        ; Draw the line of ships
1A8A: F1              POP     PSW                 ; Restore number
1A8B: 21 01 25        LXI     H,$2501             ; Screen coordinates
1A8E: E6 0F           ANI     $0F                 ; Make sure it is a digit
1A90: C3 C5 09        JMP     $09C5               ; Print number remaining








;==========================================================
; DATA FROM HERE DOWN
1A93: 00 00                                 ;        ? Never accessed ?

; Splash screen animation structure 1
; 00   Image form (increments each draw)
; 00   Delta X
; FF   Delta Y is -1
; B8   X coordinate
; FE   Y starting coordiante
; 1C20 Base image (small alien)
; 10   ?? never used
; 9E   Target Y coordiante
; 00   Reached Y flag
; 1C20 Base iamge (small alien)
1A95: 00 00 FF B8 FE 20 1C 10 9E 00 20 1C   

1AA1: 30 10 0B 08                           
1AA5: 07                                    

; MessageGOver
; GAME OVER PLAYER< >"
1AA6: 06 00 0C 04 26 0E 15 04 11 26 26 0F   
1AB2: 0B 00 18 04 11 24 26 25               

; Message1or2
; "1 OR 2PLAYERS BUTTON"
1ABA: 1B 26 0E 11 26 1C 0F 0B 00 18 04      
1AC5: 11 12 26 01 14 13 13 0E 0D 26

; Message1Only
; "ONLY 1PLAYER BUTTON "
; Note the space on the end ... both alternatives are same length
1ACF: 0E 0D 0B 18 26 1B 0F 0B 00 18 04 11 26 26 
1ADD: 01 14 13 13 0E 0D 26                  

; MessageScore
; " SCORE<1> HI-SCORE SCORE<2>"
1AE4: 26 12 02 0E 11 04 24 1B 25 26 07 08   
1AF0: 3F 12 02 0E 11 04 26 12 02 0E 11 04   
1AFC: 24 1C 25 26                           

;-------------------------- RAM initialization -----------------------------
; Coppied to RAM (2000) 0xc0 bytes as initialization

1B00: 01 00 00 10 00 00 00 00 02 78 38 78 38 00  F8 00                                    



; Active-player game task descriptor

;**SPLASH

; The timing bytes below are 00 80 00 ... the player waits for 128 interrupts (about 2 secs) before he can move
1B10: 00 80 00 8E 02 FF 05 0C  
; Active player descriptor
1B18: 60 1C                                 ; Sprite picture (1C60)
1B1A: 20 30                                 ; Initial pixel location
1B1C: 10                                    ; 16 bytes in sprite
;
1B1D: 01 00 00        


; Player shot game task descriptor          
1B20: 00 00 00 BB 03                                    
1B25: 00                                    ; 00 if available, various others if not
1B26: 10 90 1C 28 30 01 04 00 FF FF     

; Missile alien shot game task
1B30: 00 00 02 76 04 00 00 00 00 00 04 EE 1C 00 00 03    
        
; ??Saucer game task                     
1B40: 00 00 00 B6 04 00 00 01 00 1D 04 E2 1C 00 00 03                                    

; Squiggly alien shot game task
1B50: 00 00 00 82 06 00 00 01 06 1D 04 D0 1C 00 00 03     ; Squiggly shot descriptor ???

; FF marks the end of the tasks
1B60: FF 00                                    




; Exploding alien descriptor
1B62: C0 1C                     ; Sprite picture 1CC0
1B64: 00 00                     ; Screen location (filled in)
1B66: 10                        ; 16 bytes

1B67: 21                                    
1B68: 01 00 30                              
1B6B: 00                                    ; Changes 206C to 18 (used after demo in splash screen ... omg ... yuck)
1B6C: 12                                    
1B6D: 00                                    
1B6E: 00                                    
1B6F: 00                                    
1B70: 0F                                    
1B71: 0B                                    
1B72: 00                                    
1B73: 18 26                                 
1B75: 0F                                    
1B76: 0B                                    
1B77: 00                                    
1B78: 18 04                                 
1B7A: 11 24 1B                              
1B7D: 25                                    
1B7E: FC 00 

1B80: 01                              
1B81: FF                                    
1B82: FF                                    
;
1B83: 00                                    
1B84: 00                                    
1B85: 00                                    
1B86: 20                                    
;
1B87: 64                                    
1B88: 1D                                    
1B89: D0                                    
1B8A: 29                                    
1B8B: 18                                    
;
1B8C: 02                                    
1B8D: 54                                    
1B8E: 1D                                    
1B8F: 00   

                                 
1B90: 08                                    
1B91: 00                                    
1B92: 06 00                                 
1B94: 00                                    
1B95: 01 40 00                              
1B98: 01 00 00                              
1B9B: 10 9E                                 
1B9D: 00                                    
1B9E: 20 1C                                 

; 
; ?? These don't need to be copied over to RAM I believe this to be a mistake. The constant at 01E4 is C0,
; which is the size of this mirror with the added sprite. It should be A0. I believe there was a macro
; to size this area and later the splash screens where put in. Some of the data spilled over into this
; and the macro automatically included it. No harm.

; AlienSprCYA
; Alien sprite type C pulling upside down Y
; ........
; **......
; ..*.....
; ...****.
; ..*.*...
; **..*...
; ...*....
; .*.**...
; *.****..
; ...*.**.
; ..******
; ..******
; ...*.**.
; *.****..
; .*.**...
; ........
1BA0: 00 03 04 78 14 13 08 1A 3D 68 FC FC 68 3D 1A 00                                    

; Splash screen animation structure 2
; 00   Image form (increments each draw)
; 00   Delta X
; 1   Delta Y is 1
; B8   X coordinate
; 98   Y starting coordiante
; 1BA0 Base image (small alien with upside down Y)
; 10   ?? never used
; FF   Target Y coordiante
; 00   Reached Y flag
; 1BA0 Base iamge (small alien with upside down Y)
;
1BB0: 00 00 01 B8 98 A0 1B 10 FF 00 A0 1B 
                                   
1BBC: 00                                    
1BBD: 00                                    
1BBE: 00                                    
1BBF: 00                                    
;--------------------------- End of initialization copy -------------------------


; Shot descriptor for splash shooting the extra "C"
1BC0: 00 10 00 0E 05 00 00 00 00 00 07 D0 1C C8 9B 03      
; 1CD0 is the shot picture some how
                             

; AlienSprCYB
; Alien sprite C pulling upside down Y. Note the difference between this and the first picutre
; above. The Y is closer to the ship. This gives the effect of the Y kind of "sticking" in the
; animation.
; ........
; ........
; **......
; ..*.....
; ...****.
; ..*.*...
; **.*....
; *..**...
; .*.***..
; *.**.**.
; .*.*****
; .*.*****
; *.**.**.
; .*.***..
; *..**...
; ........
;
1BD0: 00 00 03 04 78 14 0B 19 3A 6D FA FA 6D 3A 19  00                                    

1BE0: 00                                    
1BE1: 00                                    
1BE2: 00                                    
1BE3: 00                                    
1BE4: 00                                    
1BE5: 00                                    
1BE6: 00                                    
1BE7: 00                                    
1BE8: 00                                    
1BE9: 01 00 00                              
1BEC: 01                                    
;
1BED: 74 1F                                 ; Pointer to demo commands
;
1BEF: 00                                    
1BF0: 80                                    
1BF1: 00                                    
1BF2: 00                                    
1BF3: 00                                    
1BF4: 00 00 1C 2F                           ; Hi-Score descriptor
1BF8: 00 00 1C 27                           ; Pla

1BFC: 00 00 1C 39                           

; AlienSprA
; Alien sprite type A,B, and C at positions 0
;  ........ ........ ........
;  ........ ........ ........
;  *..***.. ........ ........
;  *..****. ...****. ........
;  .*.****. *.***... *..**...
;  .***.**. .*****.* .*.***..
;  ..**.*** ..**.**. *.**.**.
;  .*.***** ..****.. .*.*****
;  .*.***** ..****.. .*.*****
;  ..**.*** ..****.. *.**.**.
;  .***.**. ..**.**. .*.***..
;  .*.****. .*****.* *..**...
;  *..****. *.***... ........
;  *..***.. ...****. ........
;  ........ ........ ........
;  ........ ........ ........
1C00: 00 00 39 79 7A 6E EC FA FA EC 6E 7A 79 39 00 00 
1C10: 00 00 00 78 1D BE 6C 3C 3C 3C 6C BE 1D 78 00 00 
1C20: 00 00 00 00 19 3A 6D FA FA 6D 3A 19 00 00 00 00 

; AlienSprB
; Alien sprite type A,B, and C at positions 1
;  ........ ........ ........
;  ........ ........ ........
;  ...***.. ........ ........
;  .*.****. .***.... ........
;  *******. ...**... .*.**...
;  *.**.**. .*****.* *.****..
;  ..**.*** *.**.**. ...*.**.
;  .*.***** *.****.. ..******
;  .*.***** ..****.. ..******
;  ..**.*** *.****.. ...*.**.
;  *.**.**. *.**.**. *.****..
;  *******. .*****.* .*.**...
;  .*.****. ...**... ........
;  ...***.. .***.... ........
;  ........ ........ ........
;  ........ ........ ........
1C30: 00 00 38 7A 7F 6D EC FA FA EC 6D 7F 7A 38 00 00 
1C40: 00 00 00 0E 18 BE 6D 3D 3C 3D 6D BE 18 0E 00 00 
1C50: 00 00 00 00 1A 3D 68 FC FC 68 3D 1A 00 00 00 00 

; PlayerSprite
; Player sprite  
;  ........
;  ........
;  ****....
;  *****...
;  *****...
;  *****...
;  *****...
;  *******.
;  ********
;  *******.
;  *****...
;  *****...
;  *****...
;  *****...
;  ****....
;  ........  
1C60: 00 00 0F 1F 1F 1F 1F 7F FF 7F 1F 1F 1F 1F 0F 00 


; PlrBlowupSprites
;  ........
;  ..*.....
;  *.......
;  **..*...
;  **......
;  ***.....
;  **..**.*
;  ****....
;  ****.*..
;  **......
;  ****.*..
;  *..*..*.
;  ..*.....
;  **......
;  ........
;  *.......
;
1C70: 00 04 01 13 03 07 B3 0F 2F 03 2F 49 04 03 00 01 
;
;  ......*.
;  ...*....
;  *.*.....
;  **...*.*
;  .*.*....
;  **......
;  **.**.*.
;  ****....
;  ***..*..
;  ***..*..
;  **.*....
;  **.*..*.
;  ......*.
;  ..*....*
;  *...*...
;  ...*..*.
1C80: 40 08 05 A3 0A 03 5B 0F 27 27 0B 4B 40 84 11 48 

; PlayerShotSpr
1C90: 0F    ;....****      
        
; ShotExploding
; *..**..*
; ..****..
; .******.
; *.****..
; ..****.*
; .*****..
; ..*****.
; *..**..*           
1C91: 99 3C 7E 3D BC 3E 7C 99     
      
; Message10Pts
; Ran out of space ad 1DFE
1C99: 27 1B 1A 26 0F 0E 08 0D 13 12    ; "=10 POINTS"

; MessageAdv
; "*SCORE ADVANCE TABLE*"                                
1CA3: 28 12 02 0E 11 04 26 00                                 
1CAB: 03 15 00 0D 02 04 26 13                                 
1CB3: 00 01 0B 04 28                                    
;
1CB8: 02 10 20 30                           

; MessageTilt
1CBC: 13 08 0B 13   ; "TILT"

; AlienExplode
; Alien exploding sprite
;  ........
;  ...*....
;  *..*..*.
;   .*...*..
;  ..*.*...
;  *......*
;  .*....*.
;  ........
;  .*....*.
;  *......*
;  ..*.*...
;  .*...*..
;  *..*..*.
;  ...*....
;  ........
;  ........
1CC0: 00 08 49 22 14 81 42 00 42 81 14 22 49 08 00 00 
;
1CD0: 44                                    
1CD1: AA                                    
1CD2: 10 88                                 
1CD4: 54                                    
1CD5: 22 10 AA                              
1CD8: 44                                    
1CD9: 22 54 88                              
1CDC: 4A                                    
1CDD: 15                                    
1CDE: BE                                    
1CDF: 3F                                    
1CE0: 5E                                    
1CE1: 25                                    
1CE2: 04                                    
1CE3: FC 04 10                              
1CE6: FC 10 20                              
1CE9: FC 20 80                              
1CEC: FC 80 

1CEE: 00                              
1CEF: FE 00                                 
1CF1: 24                                    
1CF2: FE 12                                 
1CF4: 00                                    
1CF5: FE 00                                 
1CF7: 48                                    
1CF8: FE 90         
               
; MessagePlayUY
1CFA: 0F 0B 00 29    ; "PLAy" with an upside down 'Y' for splash screen
                                
1CFE: 00                                    
1CFF: 00                                    
1D00: 01 07 01                              
1D03: 01 01 04                              
1D06: 0B                                    
1D07: 01 06 03                              
1D0A: 01 01 0B                              
1D0D: 09                                    
1D0E: 02                                    
1D0F: 08                                    
1D10: 02                                    
1D11: 0B                                    
1D12: 04                                    
1D13: 07                                    
1D14: 0A                                    
1D15: 05                                    
1D16: 02                                    
1D17: 05                                    
1D18: 04                                    
1D19: 06 07                                 
1D1B: 08                                    
1D1C: 0A                                    
1D1D: 06 0A                                 
1D1F: 03              

; ShieldImage
; Shield image pattern. 2 x 22 = 44 bytes.
;
;************....
;*************...
;**************..
;***************.
;****************
;..**************
;...*************
;....************
;....************
;....************
;....************
;....************
;....************
;....************
;...*************
;..**************
;****************
;****************
;***************.
;**************..
;*************...
;************....
;             
1D20: FF 0F FF 1F FF 3F FF 7F FF FF FC FF F8 FF F0 FF F0 FF F0 FF F0 FF                                    
1D36: F0 FF F0 FF F0 FF F8 FF FC FF FF FF FF FF FF 7F FF 3F FF 1F FF 0F                                    


1D4C: 05 10 15 30  ; Table of possible saucer scores
1D50: 94 97 9A 9D  ; Table of corresponding string prints for each possible score                                  

; SaucerScrTab
; The 208D points here to the score given when the saucer is shot. It advances 
; every time the player-shot is removed. The table wraps. Thus the one and only
; 300 comes up every 16 shots (after an initial 8). ?? Check this timing ... does shot get removed before saucer score or after?
1D54: 10 05 05 10 15 10 10 05 30 10 10 10 05 15 10 05    
                             

; SpriteSaucer
; ........
; ........
; ........
; ........
; ..*.....
; ..**....
; .****...
; ***.**..
; .*****..
; ..*****.
; ..*.***.
; .******.
; .******.
; ..*.***.
; ..*****.
; .*****..
; ***.**..
; .****...
; ..**....
; ..*.....      
; ........
; ........
; ........
; ........                         
1D64: 00 00 00 00 04 0C 1E 37 3E 7C 74 7E 7E 74 7C 3E 37 1E 0C 04 00 00 00 00


; SpriteSaucerExp
;........
;.*...*..
;........
;*.*..*.*
;......*.
;...*....
;...**..*
;*.****..
;.**.**.*
;..****..
;.**.**..
;*.***...
;....*...
;...*..*.
;.*...**.
;.**.**.*
;*.***...
;...**..*
;...*....
;.*....*.
;....*..*
;...*....
;........
;........
1D7C: 00 22 00 A5 40 08 98 3D B6 3C 36 1D 10 48 62 B6 1D 98 08 42 90 08 00 00  
         
; SaucSoreStr
1D94: 26 1F 1A  ; _50                                   
1D97: 1B 1A 1A  ; 100                                  
1D9A: 1B 1F 1A  ; 150                                  
1D9D: 1D 1A 1A  ; 300                                  

1DA0: 10                                    
1DA1: 20                                    
1DA2: 30                                    
1DA3: 60                                    
1DA4: 50                                    
1DA5: 48                                    
1DA6: 48                                    
1DA7: 48                                    
1DA8: 40                                    
1DA9: 40                                    
1DAA: 40   
                                 
; MessagePlayY
1DAB: 0F 0B 00 18   ; "PLAY" with normal Y

; MessageInvaders
; "SPACE  INVADERS"
1DAF: 12 0F 00 02 04 26 26 08 0D 15 00 03 04 11 12 

; Tables used to draw "SCORE ADVANCE TABLE" information
1DBE: 0E 2C 68 1D           ; Flying Saucer                         
1DC2: 0C 2C 20 1C           ; Alien C, sprite 0                      
1DC6: 0A 2C 40 1C           ; Alien B, sprite 1                         
1DCA: 08 2C 00 1C           ; Alien A, sprite 0                         
1DCE: FF                    ; End of list         
;
1DCF: 0E 2E E0 1D           ; "=? MYSTERY"                          
1DD3: 0C 2E EA 1D           ; "=30 POINTS"                        
1DD7: 0A 2E F4 1D           ; "=20 POINTS"                        
1DDB: 08 2E 99 1C           ; "=10 POINTS"
1DDF: FF                    ; End of list

; MessageMyst
1DE0: 27 38 26 0C 18 12 13 04 11 18   ; "=? MYSTERY"

; Message30Pts
1DEA: 27 1D 1A 26 0F 0E 08 0D 13 12   ; "=30 POINTS"                                 

; Message20Pts
1DF4: 27 1C 1A 26 0F 0E 08 0D 13 12   ; "=20 POINTS"

; Ran out of space here. The "=10" message is up at 1C99. That keeps
; the font table firmly at 1E00.

1DFE: 00 00         


;=============================================================
; Characters
; 8 byte sprites 
; The screen is turned so rotate these pictures counter-clockwise.
; Some of the font characters at the end were never needed. The ROM overwrites these characters with
; data near the end. For instance, 1F90 would be a character but has the "INSERT COIN" message. The "?"
; character is at 1FC0 and is used in messages as is 1FF8 "-".

1E00: 00 1F 24 44 24 1F 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 
1E08: 00 7F 49 49 49 36 00 00  ; *****... *******. .*****.. *******. *******. *******. .*****.. *******. 
1E10: 00 3E 41 41 41 22 00 00  ; ..*..*.. *..*..*. *.....*. *.....*. *..*..*. ...*..*. *.....*. ...*.... 
1E18: 00 7F 41 41 41 3E 00 00  ; ..*...*. *..*..*. *.....*. *.....*. *..*..*. ...*..*. *.....*. ...*.... 
1E20: 00 7F 49 49 49 41 00 00  ; ..*..*.. *..*..*. *.....*. *.....*. *..*..*. ...*..*. *.*...*. ...*.... 
1E28: 00 7F 48 48 48 40 00 00  ; *****... .**.**.. .*...*.. .*****.. *.....*. ......*. ***...*. *******. 
1E30: 00 3E 41 41 45 47 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 
1E38: 00 7F 08 08 08 7F 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 

1E40: 00 00 41 7F 41 00 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 
1E48: 00 02 01 01 01 7E 00 00  ; ........ .*...... *******. *******. *******. *******. .*****.. *******. 
1E50: 00 7F 08 14 22 41 00 00  ; *.....*. *....... ...*.... *....... .....*.. ....*... *.....*. ...*..*. 
1E58: 00 7F 01 01 01 01 00 00  ; *******. *....... ..*.*... *....... ...**... ...*.... *.....*. ...*..*. 
1E60: 00 7F 20 18 20 7F 00 00  ; *.....*. *....... .*...*.. *....... .....*.. ..*..... *.....*. ...*..*. 
1E68: 00 7F 10 08 04 7F 00 00  ; ........ .******. *.....*. *....... *******. *******. .*****.. ....**.. 
1E70: 00 3E 41 41 41 3E 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 
1E78: 00 7F 48 48 48 30 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 

1E80: 00 3E 41 45 42 3D 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 
1E88: 00 7F 48 4C 4A 31 00 00  ; .*****.. *******. .*..**.. ......*. .******. ..*****. *******. **...**. 
1E90: 00 32 49 49 49 26 00 00  ; *.....*. ...*..*. *..*..*. ......*. *....... .*...... .*...... ..*.*... 
1E98: 00 40 40 7F 40 40 00 00  ; *.*...*. ..**..*. *..*..*. *******. *....... *....... ..**.... ...*.... 
1EA0: 00 7E 01 01 01 7E 00 00  ; .*....*. .*.*..*. *..*..*. ......*. *....... .*...... .*...... ..*.*... 
1EA8: 00 7C 02 01 02 7C 00 00  ; *.****.. *...**.. .**..*.. ......*. .******. ..*****. *******. **...**. 
1EB0: 00 7F 02 0C 02 7F 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 
1EB8: 00 63 14 08 14 63 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 

1EC0: 00 60 10 0F 10 60 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 
1EC8: 00 43 45 49 51 61 00 00  ; .....**. **....*. .*****.. ........ **...*.. .*....*. ..**.... .*..***. 
1ED0: 00 3E 45 49 51 3E 00 00  ; ....*... *.*...*. *.*...*. *....*.. *.*...*. *.....*. ..*.*... *...*.*. 
1ED8: 00 00 21 7F 01 00 00 00  ; ****.... *..*..*. *..*..*. *******. *..*..*. *..*..*. ..*..*.. *...*.*. 
1EE0: 00 23 45 49 49 31 00 00  ; ....*... *...*.*. *...*.*. *....... *..*..*. *..**.*. *******. *...*.*. 
1EE8: 00 42 41 49 59 66 00 00  ; .....**. *....**. .*****.. ........ *...**.. .**..**. ..*..... .***..*. 
1EF0: 00 0C 14 24 7F 04 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 
1EF8: 00 72 51 51 51 4E 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 

1F00: 00 1E 29 49 49 46 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 
1F08: 00 40 47 48 50 60 00 00  ; .****... ......*. .**.**.. *...**.. ...*.... ........ ........ ..*.*... 
1F10: 00 36 49 49 49 36 00 00  ; *..*.*.. ***...*. *..*..*. *..*..*. ..*.*... *.....*. ........ ..*.*... 
1F18: 00 31 49 49 4A 3C 00 00  ; *..*..*. ...*..*. *..*..*. *..*..*. .*...*.. .*...*.. ........ ..*.*... 
1F20: 00 08 14 22 41 00 00 00  ; *..*..*. ....*.*. *..*..*. .*.*..*. *.....*. ..*.*... ........ ..*.*... 
1F28: 00 00 41 22 14 08 00 00  ; .**...*. .....**. .**.**.. ..****.. ........ ...*.... ........ ..*.*... 
1F30: 00 00 00 00 00 00 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 
1F38: 00 14 14 14 14 14 00 00  ; ........ ........ ........ ........ ........ ........ ........ ........ 

1F40: 00 22 14 7F 14 22 00 00  ; ........ ........   
1F48: 00 03 04 78 04 03 00 00  ; .*...*.. **......   
                               ; ..*.*... ..*.....   
                               ; *******. ...****.   
                               ; ..*.*... ..*.....   
                               ; .*...*.. **......   
                               ; ........ ........   
                               ; ........ ........   


1F50: 24 1B 26 0E 11 26 1C 26  ; "<1 OR 2 PLAYERS>  "             
1F58: 0F 0B 00 18 04 11 12 25               
1F60: 26 26 

1F62: 28 1B 26 0F 0B 00 18 04  ; "*1 PLAYER  1 COIN "
1F6A: 11 26 26 1B 26 02 0E 08 
1F72: 0D 26                           

; DemoCommands
; (1=Right, 2=Left)
1F74: 01 01 00 00 01 00 02 01 00 02 01 00
        
; AlienSprCA
; Small alien pushing Y back onto screen
; .....**.
; ....*...
; ****....
; ....*...
; .....**.
; ....**..
; ...**...
; .*.**...
; *.****..
; ...*.**.
; ..******
; ..******
; ...*.**.
; *.****..
; .*.**...
; ........                         
1F80: 60 10 0F 10 60 30 18 1A 3D 68 FC FC 68 3D 1A 00               

; MessageCoin
1F90: 08 0D 12 04 11 13 26 26 02 0E 08 0D   ; "INSERT  COIN"         
                          
;
1F9C: 0D 2A 50 1F                 ; "<1 OR 2 PLAYERS>  " to screen at 2A0D ?? translate all coords to X,Y
1FA0: 0A 2A 62 1F                 ; "*1 PLAYER  1 COIN " to screen at 2A0A
1FA4: 07 2A E1 1F                 ; "*2 PLAYERS 2 COINS" to screen at 2A07
1FA8: FF                          ; Terminates "table print"         

; MessageCredit
1FA9: 02 11 04 03 08 13 26       ; "CREDIT " (with space on the end)           

; AlienSprCB
; ........
; .....**.
; ....*...
; ****....
; ....*...
; .....**.
; ...***..
; *..**...
; .*.***..
; *.**.**.
; .*.*****
; .*.*****
; *.**.**.
; .*.***..
; *..**...
; ........
1FB0: 00 60 10 0F 10 60 38 19 3A 6D FA FA 6D 3A 19 00               

1FC0: 00 20 40 4D 50 20 00 00               ; "?"

1FC8: 00 

; Splash screen animation structure 3
; 00   Image form (increments each draw)
; 00   Delta X
; FF   Delta Y is -1
; B8   X coordinate
; FF   Y starting coordiante
; 1F80 Base image (small alien with Y)
; 10   ?? never used
; 97   Target Y coordiante
; 00   Reached Y flag
; 1F80 Base iamge (small alien with Y)
;
1FC9: 00 00 FF B8 FF 80 1F 10 97 00 80 1F 

; Splash screen animation structure 4
; 00   Image form (increments each draw)
; 00   Delta X
; 01   Delta Y is 1
; D0   X coordinate
; 22   Y starting coordiante
; 1C20 Base image (small alien)
; 10   ?? never used
; 94   Target Y coordiante
; 00   Reached Y flag
; 1C20 Base iamge (small alien)
;
1FD5: 00 00 01 D0 22 20 1C 10 94 00 20 1C 

1FE1: 28 1C 26 0F 0B 00 18 04    ; "*2 PLAYERS 2 COINS"
1FE9: 11 12 26 1C 26 02 0E 08 
1FF1: 0D 12                              

; MessagePush
1FF3: 0F 14 12 07 26             ; "PUSH " (with space on the end)                                 

1FF8: 00 08 08 08 08 08 00 00               ; 3F:"-"