;  "ICBM Attack"
;       For Bally Arcade / Astrocade Game System
;       Released in 1982 by Spectre Systems
;       Designed and Programmed by Brett Bilbrey
;       Sound by Marion Nelepa 
;
;  This cartridge was released into the public domain in 2001 
;  by Brett Bilbrey, Mike Toth and Marian Nalepa (Spectre Systems).
;
;  "ICBM Attack" requires a special analog hand controller to 
;  play - it can not be played without it.
;
;  Disassembly begun November 18, 2011 by Adam Trionfo
;
;
;  Version History:
;    .03 (July 29, 2013) - Added a version history.
;                        - Most areas have been identified as code or
;                          graphics.  If it's code, then it's been
;                          disassembled.  If it's graphics, then it
;                          has been commented.  
;    .02 (Jan. 10, 2012) - Second crack at disassembly. 
;                          Found and commented some of the graphics data.
;    .01 (Nov. 18, 2011) - First attempt at disassembly of code.
;                        - Not too much done... just sorta messing around.  
;
;  This program can be assembled using ZMAC.  Make sure that HVGLIB.H
;  is in the same directory and then type:
;      zmac -i -m -o icbm.bin -x icbm.lst icbm.asm
;
;  This source code assembles EXACTLY, byte for byte, into the "ICBM
;  Attack" cart cartridge; there are no differences.   

SMLFNT    EQU     $020D           ; FNTSML: FoNT descriptor for SMaLl font           

;  Vector Block of Enemy Ship
SHIPVECT  EQU  $4F3F              ; Vector Block of Enemy Ship
SHIPSTAT  EQU  SHIPVECT+VBSTAT    ; $4F40 Vector Status
SHIPTIMB  EQU  SHIPVECT+VBTIMB    ; $4F41 Vector Time Base
SHIPDXL   EQU  SHIPVECT+VBDXL     ; $4F42 Vector Delta X Lo
SHIPDXH   EQU  SHIPVECT+VBDXH     ; $4F43 Vector Delta X Hi
SHIPXPOS  EQU  SHIPVECT+VBXH      ; $4F45 Vector X Position
SHIPXCHK  EQU  SHIPVECT+VBXCHK    ; $4F46 Vector X Checks
SHIPDYL   EQU  SHIPVECT+VBDYL     ; $4F47 Vector Delta Y Lo
SHIPDYH   EQU  SHIPVECT+VBDYH     ; $4F48 Vector Delta Y Hi
SHIPYPOS  EQU  SHIPVECT+VBYH      ; $4F4A Vector Y Position
SHIPYCHK  EQU  SHIPVECT+VBYCHK    ; $4F4B Vector Y Checks

;  Unknown  EQU      $4F4C        ; Waiting to figure-out what...     
;  Unknown  EQU      $4F62        ; ... these areas of RAM are for
;  Unknown  EQU      $4F78
;  Unknown  EQU      $4F8E


          INCLUDE "HVGLIB.H"    ; Home Video Game Library
        
          ORG     FIRSTC

          JP      L2003         ; Jump to beginning of program 
        
L2003:    SYSSUK  COLSET        ;  UPI COLors SET
          DW      L297A         ;  Color Table -- All colors are black
        
          LD      E,$00
          LD      BC,$0FFF
          LD      HL,$4000
L200F:    LD      (HL),E
          CPI     
          JP      PE,L200F
          LD      A,$FF
          LD      ($4FEC),A
          LD      SP,$4FB8
          SYSTEM  EMUSIC        ;  UPI End playing MUSIC
        
          LD      A,$17
          OUT     (HORCB),A     ; Port $09, write HORizontal Color Boundary        
          LD      A,$BE
          OUT     (VERBL),A     ; Port $0A, write VERtical Blanking Line

;  Draw the "I" in "ICBM Attack" on Title Screen        
          SYSSUK  RECTAN        ; UPI paint a RECTANgle
          DB      30            ; X Coordinate
          DB      5             ; Y Coordinate
          DB      3             ; Width of Rectangle
          DB      15            ; Height of Rectangle
          DB      $FF           ;  ... Color = 255
        
;  Fill-in a square for "M" in "ICBM Attack" on Title Screen
          SYSSUK  RECTAN        ; UPI paint a RECTANgle
          DB      60            ; X Coordinate
          DB      5             ; Y Coordinate
          DB      15            ; Width of Rectangle
          DB      15            ; Height of Rectangle
          DB      $FF           ;  ... Color = 255
        
;  Blank-out a rectangle in middle of the the "M" Square 
;  in "ICBM Attack" on Title Screen
          SYSSUK  RECTAN        ; UPI paint a RECTANgle
          DB      63            ; X Coordinate
          DB      8             ; Y Coordinate
          DB      9             ; Width of Rectangle
          DB      12            ; Height of Rectangle
          DB      $00           ;  ... Color = 0
        

;  Draw top of the first "T" in "ICBM Attack" on Title Screen
          SYSSUK  RECTAN        ; UPI paint a RECTANgle
          DB      96            ; X Coordinate
          DB      5             ; Y Coordinate
          DB      9             ; Width of Rectangle
          DB      3             ; Height of Rectangle
          DB      $FF           ;  ... Color = 255
        
;  Draw middle leg of "M" in "ICBM Attack" on Title Screen
          SYSSUK  RECTAN        ; UPI paint a RECTANgle
          DB      66            ; X Coordinate
          DB      11            ; Y Coordinate
          DB      3             ; Width of Rectangle
          DB      9             ; Height of Rectangle
          DB      $FF           ;  ... Color = 255
        
;  Draw top of the second "T" in "ICBM Attack" on Title Screen
          SYSSUK  RECTAN        ; UPI paint a RECTANgle
          DB      108           ; X Coordinate
          DB      5             ; Y Coordinate
          DB      9             ; Width of Rectangle
          DB      3             ; Height of Rectangle
          DB      $FF           ;  ... Color = 255

;  Draw Title Screen ??
          LD      BC,L2B74      ; Title Screen X,Y Coordinates and Pattern Addresses
L2054:    LD      A,(BC)
          LD      E,A           ; X Coordinate for WRITP ??
          INC     BC
          LD      A,(BC)
          LD      D,A           ; Y Coordinate for WRITP ??
          INC     BC
          LD      A,(BC)
          LD      L,A           ; Low Order Byte of Pattern Address for WRITP ?? 
          INC     BC
          LD      A,(BC)
          LD      H,A           ; High Order Byte of Pattern Address for WRITP ??
          INC     BC
          XOR     A
          OR      E
          JR      Z,L206A
          LD      A,$20         ; Magic Register for WRITP
          SYSTEM  WRITP         ; UPI WRITe with Pattern size LOOKUP
        
          JR      L2054
L206A:    LD      A,$04
          LD      ($4FC0),A
          SYSSUK  STRDIS        ;  UPI STRing DISplay
          DB      $19           ;  ... X = 25
          DB      $50           ;  ... Y = 80
          DB      $0C           ;  ... Options = 12
          DW      L2CC6         ;  ... String "SPECTRE SYSTEMS"
        
          SYSSUK  STRDIS        ;  UPI STRing DISplay
          DB      $2B           ;  ... X = 43
          DB      $47           ;  ... Y = 71
          DB      $04           ;  ... Options = 4
          DW      L2CD6         ;  ... String "1982"
        
          LD      A,$08
          OUT     (INMOD),A     ; Port $0E,  write INterrupt MODe

;  Set-up Interrupt Vector for $4F28, which will hold $2ADE
          IM      2
          LD      HL,L2ADE      ; Interrupts will jump here (in ROM)        
          LD      ($4F28),HL      
          LD      HL,$4F28      ; Interrupt Vector (in RAM)
          LD      A,H
          LD      I,A           ; High byte of Interrupt Vector ($4F)
          LD      A,L
          OUT     (INFBK),A     ; Port $D, write INterrupt FeedBacK ($28)
        
          EI      
L2093:    JP      L2093         ; Jump Forever
        
        
L2096:    DI      
          XOR     A
          LD      ($4FC0),A
          SYSSUK  COLSET        ;  UPI COLors SET
          DW      L2972         ;  ... Table Address = 10610
          
          LD      A,$29
          OUT     (HORCB),A     ; Port, $09, write HORizontal Color Boundary
l20a3:    SYSTEM  ACTINT        ;  UPI ACTivate sub timer INTerrupts
        
          LD      DE,L2A2C
          EI      
          SYSSUK  GETPAR        ;  UPI GET game PARameter from user
          DW      L2A52         ;  ... Prompt Address = 10834
          DB      $01           ;  ... Digits = 1
          DW      $4FF3         ;  ... Parameter Address = 20467
          
          DI      
          LD      A,($4FF3)
          AND     A
          JR      Z,L20A3
          CP      $05
          JP      P,L20A3
          LD      B,A
          LD      HL,$4FBD
L20C0:    LD      (HL),$3F
          INC     HL
          INC     HL
          INC     HL
          INC     HL
          INC     HL
          DJNZ    L20C0
          LD      HL,$4000
          LD      BC,$0FB9
          LD      E,$00
L20D1:    LD      (HL),E
          CPI     
          JP      PE,L20D1
          LD      SP,$4F1B
          CALL    L282B
          SYSSUK  SETOUT        ;  UPI SET some OUTput ports
          DB      $B8           ;  ... VERBL*2 = 184
          DB      $6C           ;  ... HORCB/4 = 108
          DB      $08           ;  ... INMOD = 8
        
          LD      A,$9B
          OUT     (INLIN),A     ; Port $0F, write INterrupt LINe
          DI      
          LD      A,$08
          OUT     (INMOD),A     ; Port $0E, write INterrupt MODe
          IM      2
          LD      HL,L247D
          LD      ($4F28),HL
          LD      HL,$4F28
          LD      A,H
          LD      I,A
          LD      A,L
          OUT     ($0D),A
L20FC:    LD      A,($4F23)
          SRA     A
          SRA     A
          INC     A
          LD      ($4F20),A
          LD      A,($4F23)
          AND     $07
          SYSSUK  INDEXW        ;  UPI INDEX Word by A
          DW      L2982         ;  ... Base Address = 10626
        
          PUSH    DE
          LD      A,($4F23)
          INC     A
          LD      ($4F23),A
          POP     HL
          SYSTEM  COLSET        ;  UPI COLors SET
          
          LD      BC,$0100
          LD      HL,$4FBA
          LD      ($4F2F),HL
L2124:    LD      HL,($4F2F)
          LD      DE,$0003
          ADD     HL,DE
          LD      A,(HL)
          AND     A
          JR      NZ,L213A
          INC     C
          LD      A,$04
          CP      C
          JP      Z,L288E
          PUSH    BC
          JP      L222B

L213A:    PUSH    BC
          SYSSUK  STRDIS        ;  UPI STRing DISplay
          DB      32            ;  ... X = 32
          DB      32            ;  ... Y = 32
          DB      $04           ;  ... Options = 4
          DW      L2AD2         ;  ... String "PLAYER   UP"

          CALL    L2859
          CALL    L28C3
          POP     BC
          PUSH    BC
          LD      A,$30         ; ASCII Character to Display
          OR      B
          LD      C,$04         ; Stand option byte
          LD      DE,$2059      ; Standard coordinates to begin at
          SYSTEM  CHRDIS        ; UPI CHaRacter DISplay

L2154:    IN      A,($11)
          AND     A
          JR      Z,L2154
          LD      HL,$4000
          LD      BC,$0E5F
          LD      E,$00
L2161:    LD      (HL),E
          CPI     
          JP      PE,L2161


L2167:    CALL    L2859
          CALL    L28C3
          CALL    L282B
          LD      DE,($4F2B)    ; Y,X Coordinate
          LD      HL,L2916      ; Pattern Address (Missile Cursor)
          LD      A,$20         ; Magic Register          
          SYSTEM  WRITR         ; UPI WRITe RELATIVE
        
          EI      
          LD      A,$01
          LD      ($4F22),A
          LD      A,$7F
          LD      ($4FD5),A
          XOR     A
          LD      ($4FDD),A
          LD      ($4F26),A
          CALL    L27AD
          SYSSUK  RANGED        ;  UPI RANGED random number
          DB      $05           ;  ... Cutoff = 5
        
          ADD     A,$0A
          LD      ($4F24),A
          LD      IY,($4F2F)
          LD      A,(IY+$02)
          LD      ($4F21),A
          PUSH    IY
          CALL    L2240
          POP     IY
          DI      
          LD      B,$06
          LD      A,(IY+$03)
          AND     A
          JR      Z,L21CE
L21B2:    BIT     0,A
          JP      Z,L21BD
          LD      HL,L2A20
          CALL    L28B8
L21BD:    RRA     
          DJNZ    L21B2
          LD      A,($4F23)
          AND     $3F
          LD      B,A
L21C6:    LD      HL,L2A20
          CALL    L28B8
          DJNZ    L21C6
L21CE:    XOR     A
          LD      HL,$4F33
          ADD     A,(HL)
          INC     HL
          ADD     A,(HL)
          INC     HL
          ADD     A,(HL)
          AND     A
          JR      Z,L21E3
          LD      B,A
L21DB:    LD      HL,L2A29
          CALL    L28B8
          DJNZ    L21DB
L21E3:    LD      A,($4F21)
          LD      B,A
          LD      A,(IY+$02)
          SUB     B
          JR      Z,L21F0
          INC     (IY+$04)
L21F0:    LD      A,(IY+$03)
          CP      $3F
          JR      Z,L221B
L21F7:    LD      A,(IY+$04)
          AND     A
          JR      Z,L221B
          SYSSUK  RANGED        ;  UPI RANGED random number
          DB      $06           ;  ... Cutoff = 6
          INC     A
          LD      B,A
          LD      C,A
          LD      A,(IY+$03)
L2206:    RLCA    
          DJNZ    L2206
          BIT     6,A
          JR      NZ,L21F7
          SET     6,A
          LD      B,C
L2210:    RRCA    
          DJNZ    L2210
          LD      (IY+$03),A
          DEC     (IY+$04)
          JR      L21F0

L221B:    SYSTEM  EMUSIC        ;  UPI End playing MUSIC
          ;
          LD      HL,$4000
          LD      BC,$0E5F
          LD      E,$00
L2225:    LD      (HL),E
          CPI     
          JP      PE,L2225
L222B:    LD      DE,$0005
          LD      HL,($4F2F)
          ADD     HL,DE
          LD      ($4F2F),HL
          POP     BC
          INC     B
          LD      A,$05
          CP      B
          JP      Z,L20FC
          JP      L2124
L2240:    LD      A,($4F26)
          AND     A
          JR      Z,L2260
          LD      DE,$4FA4
          PUSH    DE
          POP     IY
          LD      A,(IY+$01)
          AND     A
          JR      NZ,L2260
          LD      A,$04
          LD      ($4F22),A
          LD      A,$7F
          LD      ($4FD7),A
          XOR     A
          LD      ($4F26),A
L2260:    LD      A,($4FDD)
          AND     $04
          RET     NZ
          LD      A,($4F27)
          AND     A
          JR      Z,L2283
          LD      A,($4F2A)
          INC     A
          CP      $F0
          JR      NZ,L2276
          LD      A,$80
L2276:    LD      ($4F2A),A
          OUT     (TONEA),A       ; Write TONe A oscillator
          INC     A
          OUT     (TONEB),A       ; Write TONe B oscillator
          INC     A
          OUT     (TONEC),A       ; Write TONe C oscillator
          JR      L228A
L2283:    XOR     A
          OUT     (TONEA),A       ; Write TONe A oscillator
          OUT     (TONEB),A       ; Write TONe B oscillator
          OUT     (TONEC),A       ; Write TONe C oscillator
L228A:    LD      A,($4F1D)
          AND     A
          JP      Z,L236B
          LD      D,A
          LD      HL,$4F33
          LD      BC,($4F1C)
          LD      B,$03
L229B:    BIT     2,D
          JP      Z,L2354
          BIT     2,C
          JP      Z,L22C8
          PUSH    DE
          PUSH    BC
          PUSH    HL
          XOR     A
l22a9:    SYSSUK  INDEXW        ; UPI INDEX Word by A
          DW      L29B5         ; Base Address of Table
          ;
          PUSH    DE
          POP     IY
          INC     (IY+$11)
          DEC     (IY+$11)
          JR      NZ,L22C0
          INC     (IY+$01)
          DEC     (IY+$01)
          JR      Z,L22ED
L22C0:    INC     A
          CP      $04
          JR      NZ,L22A9
          POP     HL
          POP     BC
          POP     DE
L22C8:    LD      A,$AA
          OUT     (VOLAB),A       ; Write VOLumes of tones A & B
          LD      A,$0A
          OUT     (VOLC),A        ; Write VOLume of tone C
          LD      A,$B0
          OUT     (TONEA),A       ; Write TONe A oscillator
          INC     A
          OUT     (TONEB),A       ; Write TONe B oscillator
          INC     A
          OUT     (TONEC),A       ; Write TONe C oscillator
          HALT    


L22DB:  DB      $3E
        DB      $22
        DB      $D3
        DB      $16
        DB      $3E
        DB      $02
        DB      $D3
        DB      $15
        DB      $AF
        DB      $D3
        DB      $11
        DB      $D3
        DB      $12
        DB      $D3
        DB      $13
        DB      $C3
        DB      $54
        DB      $23

L22ED:    POP     HL
          POP     BC
          DEC     (HL)
          JP      NZ,L22F5
          RES     2,C
L22F5:    PUSH    HL
          PUSH    BC
          LD      DE,($4F2D)
          LD      (IY+$0D),E
          LD      (IY+$0E),D
          PUSH    DE
          DI      
          CALL    L27F0
          EI      
          LD      A,B
          CP      $03
          JR      NZ,L2311
          LD      HL,$5811
          JR      L231D
L2311:    CP      $02
          JR      NZ,L231A
          LD      HL,$588E
          JR      L231D
L231A:    LD      HL,$5850
L231D:    POP     DE
          PUSH    DE
          PUSH    HL
          CALL    L280E
          LD      (IY+$03),E
          LD      (IY+$04),D
          LD      (IY+$08),L
          LD      (IY+$09),H
          POP     HL
          POP     DE
          LD      (IY+$05),$00
          LD      (IY+$06),L
          LD      (IY+$0A),$00
          LD      (IY+$0B),H
          LD      (IY+$12),D
          LD      (IY+$01),$80
          LD      HL,L2911
          DI      
          PUSH    IY
          POP     IX            ; Vector Address 
          SYSTEM  VWRITR        ;  UPI Vector WRITe Relative
          ;
          EI      
          POP     BC
          POP     HL
          POP     DE
L2354:    INC     HL
          RLC     C
          RRC     D
          DEC     B
          JP      NZ,L229B
          XOR     A
          LD      ($4F1D),A
          RRC     C
          RRC     C
          RRC     C
          LD      A,C
          LD      ($4F1C),A
L236B:    LD      A,($4FDD)
          AND     $02
          JP      Z,L2410
          LD      A,($4F40)
          AND     A
          JP      Z,L2410
          LD      A,($4F45)
          CP      $11
          JP      M,L2410
          CP      $8F
          JP      P,L2410
          XOR     A
          LD      ($4FDD),A
          LD      A,($4FA5)
          AND     A
          JR      Z,L2399
          LD      A,$20
          LD      ($4FD6),A
          JP      L2410

L2399:    LD      A,($4F24)
          AND     A
          JP      P,L23A8
          LD      A,$FF
          LD      ($4F24),A
          JP      L2240
L23A8:    DEC     A
          LD      ($4F24),A
          LD      IY,$4FA4
          SYSSUK  RANGED        ;  UPI RANGED random number
          DB      $09           ;  ... Cutoff = 9
          ;
          INC     A
          LD      (IY+$0F),A
          CP      $07
          JP      M,L23C3
          SUB     $06
          LD      HL,$292E
          JR      L23C6
L23C3:    LD      HL,$2922
L23C6:    LD      BC,$0000
          SLA     A
          LD      C,A
          ADD     HL,BC
          LD      D,(HL)
          INC     HL
          LD      E,(HL)
          LD      A,($4F45)
          LD      L,A
          LD      A,($4F4A)
          LD      H,A
          LD      (IY+$0D),E
          LD      (IY+$0E),D
          INC     E
          INC     E
          INC     E
          INC     E
          PUSH    HL
          CALL    L280E
          LD      (IY+$03),E
          LD      (IY+$04),D
          LD      (IY+$08),L
          LD      (IY+$09),H
          POP     HL
          LD      (IY+$05),$00
          LD      (IY+$06),L
          LD      (IY+$0A),$00
          LD      (IY+$0B),H
          LD      (IY+$01),$80
          LD      HL,L2911
          DI      
          PUSH    IY
          POP     IX            ; Vector Address
          SYSTEM  VWRITR        ;  UPI Vector WRITe Relative
          ;
          EI      
L2410:    LD      A,($4FDD)
          AND     $01
          JP      Z,L2240
          XOR     A
          LD      ($4FDD),A
          LD      A,$02
          LD      ($4F22),A
          SYSSUK  RANGED        ;  UPI RANGED random number
          DB      $7F                     ;  ... Cutoff = 127
          ;
          OR      $20
          LD      ($4FD6),A
          LD      A,$01
          LD      ($4F27),A
          LD      IY,SHIPVECT
          SYSSUK  RANGED        ;  UPI RANGED random number
          DB      $FF           ;  ... Cutoff = 255
          ;
          SET     6,A
          LD      (IY+$03),A
          LD      (IY+$04),$00
          SYSSUK  RANGED        ;  UPI RANGED random number
          DB      $FF           ;  ... Cutoff = 255
          ;
          AND     A
          JP      M,L2449
          LD      A,$06
          JR      L2459
L2449:    LD      D,$FF
          LD      A,(IY+$03)
          CPL     
          LD      E,A
          INC     DE
          LD      (IY+$03),E
          LD      (IY+$04),D
          LD      A,$9A
L2459:    LD      (IY+$06),A
          SYSSUK  RANGED        ;  UPI RANGED random number
          DB      $28           ;  ... Cutoff = 40
          ;
          ADD     A,$20
          LD      (IY+$0B),A
          SYSSUK  RANGED        ;  UPI RANGED random number
          DB      $90           ;  ... Cutoff = 144
          ;
          LD      (IY+$08),A
          XOR     A
          LD      (IY+$09),A
          LD      (IY+$01),$80
          DI      
          SYSSUK  VWRITR        ; UPI Vector WRITe Relative
          DW      SHIPVECT      ; Vector Block of Enemy Ship
          DW      L28ED         ; Pattern Address of Enemy Ship
          ;
          EI      
          JP      L2240
L247D:    DI      
          EXX     
          EX      AF,AF'
          PUSH    IY
          LD      DE,($4F2B)
          LD      HL,L2916      ; Pattern Address (Missile Cursor)
          LD      A,$20
          SYSTEM  WRITR         ;  UPI WRITE RELATIVE
          ;
          LD      IY,SHIPVECT
          LD      A,(IY+$01)
          AND     A
          JP      Z,L2555
          LD      A,($4F20)
          LD      (IY+$02),A
          SYSSUK  VWRITR        ;  UPI Vector WRITe Relative
          DW      SHIPVECT      ;  ... Vector Block = 20287
          DW      L28ED         ; Pattern Address of Enemy Ship
          ;
          SET     6,D
          LD      HL,$4F36
          EX      DE,HL
          LD      B,$03
L24AC:    PUSH    BC
          LD      BC,$0003
          LDIR    
          LD      BC,$0025
          ADD     HL,BC
          POP     BC
          DJNZ    L24AC
          AND     $03
          JR      Z,L24CA
L24BD:    LD      B,$09
          LD      HL,$4F3E
L24C2:    RL      (HL)
          DEC     HL
          DJNZ    L24C2
          DEC     A
          JR      NZ,L24BD
L24CA:    LD      B,$09
          LD      HL,$4F36
          LD      DE,$2936
L24D2:    PUSH    BC
          LD      A,(DE)
          AND     (HL)
          JR      Z,L24E7
          LD      B,$04
L24D9:    PUSH    AF
          AND     $C0
          CP      $C0
          JR      Z,L2535
          POP     AF
          SLA     A
          SLA     A
          DJNZ    L24D9
L24E7:    INC     DE
          INC     HL
          POP     BC
          DJNZ    L24D2
          SYSSUK  VECT          ;  UPI VECTor move coordinate pair
          DW      SHIPVECT      ;  ... Vector Block = 20287
          DW      L290B         ;  ... Limit Table = 10507
          ;
          BIT     3,(IY+$07)
          JR      Z,L252A
L24F8:    XOR     A
          OUT     (TONEA),A       ; Write TONe A oscillator
          LD      ($4F27),A
          LD      A,($4F24)
          AND     A
          JP      P,L250C
          LD      A,$01
          LD      ($4F26),A
          JR      L251D
L250C:    LD      A,$01
          LD      ($4F22),A
          XOR     A
          LD      ($4FDD),A
          SYSSUK  RANGED        ;  UPI RANGED random number
          DB      $7F           ;  ... Cutoff = 127
          ;
          OR      $20
          LD      ($4FD5),A
L251D:    RES     3,(IY+$07)
          LD      (IY+$01),$00
          CALL    L28C3
          JR      L2533
l252a:    SYSSUK  VWRITR        ;  UPI Vector WRITe Relative
          DW      SHIPVECT      ;  ... Vector Block = 20287
          DW      L28ED         ; Pattern Address of Enemy Ship
          ;
          XOR     A
          OUT     (TONEA),A     ; Write TONe A oscillator  
L2533:    JR      L2555
L2535:    POP     AF
          POP     BC
          SYSSUK  RANGED        ;  UPI RANGED random number
          DB      $03           ;  ... Cutoff = 3
          ;
          INC     A
          LD      B,A
          LD      A,($4F24)
          SUB     B
          LD      ($4F24),A
L2543:    PUSH    BC
          LD      HL,$2A26
          CALL    L28B8
          POP     BC
          DJNZ    L2543
          LD      HL,$2A23
          CALL    L28B8
          JR      L24F8
L2555:    IN      A,($1C)
          SRL     A
          ADD     A,$11
          LD      E,A
          IN      A,($1D)
          SRL     A
          SRL     A
          ADD     A,$12
          LD      D,A
          LD      HL,L2916      ; Pattern Address (Missile Cursor)
          LD      ($4F2B),DE
          LD      A,$20
          SYSTEM  WRITR         ;  UPI WRITe RELATIVE
          ;
          LD      HL,($4F1E)
          LD      B,$03
          IN      A,($10)
L2577:    BIT     2,L
          JR      NZ,L2583
          BIT     2,A
          JR      Z,L2589
          SET     2,L
          SET     2,H
L2583:    BIT     2,A
          JR      NZ,L2589
          RES     2,L
L2589:    RRC     L
          RRC     H
          RRC     A
          DJNZ    L2577
          RLC     L
          RLC     L
          RLC     L
          RLC     H
          RLC     H
          RLC     H
          LD      A,H
          LD      ($4F1F),A
          LD      A,L
          LD      ($4F1E),A
          LD      A,($4F1D)
          AND     A
          JR      NZ,L25B9
          LD      A,H
          LD      ($4F1D),A
          XOR     A
          LD      ($4F1F),A
          LD      HL,($4F2B)
          LD      ($4F2D),HL
L25B9:    LD      HL,L25C5
          LD      ($4F28),HL
          EXX     
          POP     IY
          EX      AF,AF'
          EI      
          RET     

L25C5:  DI      
        EXX     
        EX      AF,AF'
        PUSH    IY
        XOR     A
L25CB:  SYSSUK  INDEXW                  ; UPI INDEX Word by A
        DW      L29B5                   ; Base Address of Table
        
        PUSH    DE
        POP     IY
        PUSH    AF
        LD      A,(IY+$11)
        AND     A
        JR      Z,L2630
        INC     (IY+$11)
        LD      E,(IY+$0F)
        LD      D,(IY+$10)
        CP      $05
        JR      NZ,L25F3
        LD      HL,$29BD
        LD      A,$23
        OUT     ($15),A
        LD      A,$30
        OUT     ($17),A
        JR      L262C
L25F3:  CP      $14
        JR      NZ,L2600
        LD      HL,$29C5
        LD      A,$40
        OUT     ($17),A
        JR      L262C
L2600:  CP      $28
        JR      NZ,L260D
        LD      HL,$29D9
        LD      A,$50
        OUT     ($17),A
        JR      L262C
L260D:  CP      $30
        JR      NZ,L2630
        LD      (IY+$11),$00
        PUSH    DE
        LD      A,$20
        LD      HL,$29BD
        SYSTEM  WRITR                   ;  UPI WRITe RELATIVE
        ;
        POP     DE
        PUSH    DE
        LD      HL,$29C5
        SYSTEM  WRITR                   ;  UPI WRITe RELATIVE
        ;
        POP     DE
        LD      HL,$29D9
        LD      A,$03
        OUT     ($15),A
L262C:  LD      A,$20
        SYSTEM  WRITR                   ;  UPI WRITe RELATIVE
l2630:  LD      D,(IY+$01)
        INC     D
        DEC     D
        JR      Z,L2679
        LD      A,($4F20)
        ADD     A,$15
        LD      (IY+$02),A
        LD      HL,L2911                ; Pattern Address
        PUSH    IY
        POP     IX
        SYSTEM  VWRITR                  ;  UPI Vector WRITe Relative
        ;
        LD      DE,$0012
        PUSH    IY
        POP     HL
        ADD     HL,DE
        SYSTEM  VECT                    ;  UPI VECTor move coordinate pair
        ;
        BIT     3,(IY+$0C)
        JR      Z,L2674
        LD      E,(IY+$0D)
        LD      D,(IY+$0E)
        LD      (IY+$0F),E
        LD      (IY+$10),D
        LD      (IY+$11),$01
        CALL    L27F0
        RES     3,(IY+$0C)
        LD      (IY+$01),$00
        JR      L2679
L2674:  LD      HL,L2911
        SYSTEM  VWRITR                  ;  UPI Vector WRITe Relative
L2679:  POP     AF
        INC     A
        CP      $04
        JP      NZ,L25CB
        LD      IY,$4FA4
        BIT     7,(IY+$01)
        JP      Z,L2751
        LD      A,($4F20)
        LD      (IY+$02),A
        LD      HL,L2911
        PUSH    IY
        POP     IX
        SYSTEM  VWRITR                  ;  UPI Vector WRITe Relative
        ;
        LD      HL,$290F
        SYSTEM  VECT                    ;  UPI VECTor move coordinate pair
        ;
        XOR     A
        LD      D,(IX+$0B)
        LD      E,(IX+$06)
        SYSTEM  RELAB1                  ;  UPI RELative to non-magic ABSolute
        ;
        LD      B,A
        LD      A,(DE)
L26AA:  RLA     
        RLA     
        DJNZ    L26AA
        AND     $C0
        CP      $C0
        JR      NZ,L26C7
        LD      HL,$2A26
        CALL    L28B8
        LD      (IY+$01),$00
        PUSH    IX
        CALL    L28C3
        POP     IX
        JR      L2727
L26C7:  BIT     3,(IY+$0C)
        JP      Z,L274C
        RES     3,(IY+$0C)
        LD      (IY+$01),$00
        LD      A,(IY+$0F)
        CP      $07
        JP      M,L26F9
        SUB     $06
        LD      B,A
        LD      C,A
        LD      A,($4F1C)
L26E5:  RLCA    
        DJNZ    L26E5
        RES     3,A
        LD      B,C
L26EB:  RRCA    
        DJNZ    L26EB
        LD      ($4F1C),A
        LD      HL,$4F32
        ADD     HL,BC
        LD      (HL),$00
        JR      L270E
L26F9:  LD      B,A
        LD      C,A
        LD      IY,($4F2F)
        LD      A,(IY+$03)
L2702:  RRCA    
        DJNZ    L2702
        RES     7,A
        LD      B,C
L2708:  RLCA    
        DJNZ    L2708
        LD      (IY+$03),A
L270E:  LD      A,$01
        LD      ($4F25),A
        LD      IY,$4FA4
        LD      E,(IY+$0D)
        LD      D,(IY+$0E)
        LD      ($4F31),DE
        XOR     A                       ; Magic Register for WRITP
        LD      HL,L2940                ; Blank Pattern
        SYSTEM  WRITP                   ; UPI WRITe with Pattern size lookup
L2727:  LD      A,($4F24)
        AND     A
        JR      Z,L273F
        LD      A,($4F22)
        OR      $02
        LD      ($4F22),A
        SYSSUK  RANGED                  ;  UPI RANGED random number
        DB      $7F                     ;  ... Cutoff = 127
        ;
        OR      $20
        LD      ($4FD6),A
        JR      L2751
L273F:  LD      A,($4F40)
        AND     A
        JR      NZ,L2751
        LD      A,$01
        LD      ($4F26),A
        JR      L2751
L274C:  LD      HL,L2911
        SYSTEM  VWRITR                  ;  UPI Vector WRITe Relative
L2751:  LD      A,($4F22)
        LD      C,A
        SYSTEM  DECCTS                  ;  UPI DECrement CT'S under mask
        ;
        LD      A,($4F25)
        AND     A
        JR      Z,L27A1
        INC     A
        LD      ($4F25),A
        LD      DE,($4F31)
        CP      $04
        JR      NZ,L276E
        LD      HL,$2A01
        JR      L279D
L276E:  CP      $08
        JR      NZ,L2777
        LD      HL,$2A08
        JR      L279D
L2777:  CP      $0C
        JR      NZ,L2780
        LD      HL,$2A12
        JR      L279D
L2780:  CP      $14
        JR      NZ,L2789
        LD      HL,$2A01
        JR      L279D
L2789:  CP      $18
        JR      NZ,L2792
        LD      HL,$2A08
        JR      L279D
L2792:  CP      $1C
        JR      NZ,L27A1
        XOR     A
        LD      ($4F25),A
        LD      HL,$2A12
L279D:  LD      A,$20
        SYSTEM  WRITR                   ;  UPI WRITe RELATIVE
L27A1:  LD      HL,$247D
        LD      ($4F28),HL
        EXX     
        POP     IY
        EX      AF,AF'
        EI      
        RET     

L27AD:    LD      BC,$000D      ; 13 Bytes to load 
          LD      HL,L2992      ; Initial Values of Enemy Ship Vector Block  
          LD      DE,SHIPVECT   ; Vector Block of Enemy Ship in RAM  
          LDIR    
          LD      BC,$0016      ; 22 Bytes to load ??
          LD      HL,L299F
          LD      DE,$4F4C
          LDIR    
          LD      BC,$0016      ; 22 Bytes to load ??
          LD      HL,L299F
          LD      DE,$4F62
          LDIR    
          LD      BC,$0016      ; 22 Bytes to load ??
          LD      HL,L299F
          LD      DE,$4F78
          LDIR    
          LD      BC,$0016      ; 22 Bytes to load ??
          LD      HL,L299F
          LD      DE,$4F8E
          LDIR    
          LD      BC,$0016      ; 22 Bytes to load ??
          LD      HL,L299F
          LD      DE,$4FA4
          LDIR    
          RET     

L27F0:    LD      HL,L28E6
          LD      A,$20
          SYSTEM  WRITR         ;  UPI WRITe RELATIVE
          ;
          RET     


L27F8:    BIT     0,C
          JR      Z,L2807
          XOR     A
          PUSH    DE
          PUSH    HL
          EX      DE,HL
          LD      D,(HL)
          INC     HL
          LD      E,(HL)
          POP     HL            ; Pattern
          SYSTEM  WRITP         ;  UPI WRITe with Pattern size lookup
        
          POP     DE
L2807:    INC     DE
          INC     DE
          SRL     C
          DJNZ    L27F8
          RET     


L280E:    LD      A,D
          SUB     H
          JP      M,L2817
          LD      B,$00
          JR      L2819
L2817:    LD      B,$FF
L2819:    LD      C,A
          PUSH    BC
          LD      A,E
          SUB     L
          JP      M,L2824
          LD      B,$00
          JR      L2826
L2824:    LD      B,$FF
L2826:    LD      C,A
          PUSH    BC
          POP     DE
          POP     HL
          RET


L282B:    LD      HL,$2020
          LD      ($4F2B),HL
          LD      HL,$4F33
          LD      (HL),$0A
          INC     HL
          LD      (HL),$0A
          INC     HL
          LD      (HL),$0A
          LD      A,$22
          OUT     (VOLAB),A     ; Port $16, write VOLumes of tones A & B
          LD      A,$02
          OUT     (VOLC),A      ; Port $15, write VOLume of tone C
          LD      A,$31         
          OUT     (TONMO),A     ; Port $10, write TONe Master Oscillator
          XOR     A
          LD      ($4F1D),A
          LD      ($4F1E),A
          LD      ($4F1F),A
          LD      HL,SCREEN     ; Magic SCREEN start
          LD      ($4F2D),HL
          RET     
        
L2859:    LD      A,$07
          LD      ($4F1C),A
          LD      DE,$2930
          LD      BC,($4F1C)
          LD      B,$03
          LD      HL,L2901      ; Player's Missile Base Pattern
          CALL    L27F8
          LD      DE,$2924
          LD      IY,($4F2F)
          LD      C,(IY+$03)
          LD      B,$06
          LD      HL,L28F7      ; Player's City Pattern
          CALL    L27F8
          SYSSUK  RECTAN        ;  UPI paint a RECTANgle
          DB      6             ; X Coordinate
          DB      3             ; Y Coordinate
          DB      148           ; X Size (Width)
          DB      9             ; Y Size (Height)
          DB      10101010B     ; Color Mask
        
          SYSSUK  RECTAN        ;  UPI paint a RECTANgle
          DB      7             ; X Coordinate
          DB      4             ; Y Coordinate
          DB      146           ; X Size (Width)
          DB      7             ; Y Size (Height)
          DB      00000000B     ; Color Mask
        
          RET     


L288E:    LD      HL,$4000
          LD      BC,$0E5F
          LD      E,$00
L2896:    LD      (HL),E
          CPI     
          JP      PE,L2896
          CALL    L2859
          CALL    L28C3
          LD      HL,$4FCE
          LD      BC,$0031
          LD      E,$00
L28AA:    LD      (HL),E
          CPI     
          JP      PE,L28AA
          LD      A,$FF
          LD      ($4FEC),A
          SYSTEM  QUIT          ;  UPI QUIT cassette execution
        
          RET      


L28B8:    PUSH    BC
          LD      DE,($4F2F)
          LD      B,$03
          SYSTEM  BCDADD        ;  UPI BCD ADDition
          ;
          POP     BC
          RET     


L28C3:    LD      BC,$460C      ; Extended Options and Options Byte 
          LD      HL,$4FBA      ; Address of BCD Number
          LD      IX,SMLFNT     ; FoNT descriptor for SMaLl font
          LD      DE,$0515      ; Standard X,Y Coordinate
          XOR     A
L28D1:    SYSTEM  DISNUM        ;  UPI DISplay NUMber
          ;
          INC     HL
          INC     HL
          INC     HL
          INC     HL
          INC     HL
          INC     DE
          INC     DE
          INC     DE
          INC     DE
          INC     DE
          INC     DE
          INC     DE
          INC     DE
          INC     A
          CP      $04
          JR      NZ,L28D1
          RET     


;  Pattern for WRITR
L28E6:    DB      -1,-1         ; X,Y Displacment 
          DB      1,3           ; X,Y Size      
          DB      $44           ; 1 . 1 .
          DB      $10           ; . 1 . .
          DB      $44           ; 1 . 1 .

;  Enemy Ship Pattern
L28ED:    DB      -3,-1         ; X,Y Displacment
          DB      2,3           ; X,Y Size
          DB      $01,$40       ; . . . 1 1 . . .
          DB      $15,$54       ; . 1 1 1 1 1 1 .
          DB      $41,$41       ; 1 . . 1 1 . . 1

;  Player's City Pattern        
L28F7:    DB      2,4           ; X,Y Size
          DB      $0C,$40       ; . . 3 . 1 . . .
          DB      $0C,$70       ; . . 3 . 1 3 . .
          DB      $15,$D4       ; . 1 1 1 3 1 1 .
          DB      $DF,$F7       ; 3 1 3 3 3 3 1 3

;  Player's Missile Base  
L2901:    DB      2,4           ; X,Y Size
          DB      $00,$33       ; . . . . . 1 . 1
          DB      $0C,$0C       ; . . 1 . . . 1 .
          DB      $3F,$0C       ; . 1 1 1 . . 1 .
          DB      $FF,$FF       ; 1 1 1 1 1 1 1 1

;  Limit Table for VECT Routine
L290B:    DB      5             ; X Lower Limit ??
          DB      155           ; X Upper Limit ??
          DB      15            ; Y Lower Limit ??
          DB      70            ; Y Upper Limit ??
        
        DB      $05
        DB      $58

;  Enemy Missile ??
L2911:  DB      0,0          ; X,Y Displacment
        DB      1,1          ; X,Y Size
        DB      $80          ; 2 . . .

;  Pattern Address (Missile Cursor)
L2916:  DB      -2,-2        ; X,Y Displacment
        DB      2,5          ; X,Y Size
        DB      $08,$00      ; . . 2 . . . . .
        DB      $08,$00      ; . . 2 . . . . . 
        DB      $A2,$80      ; 2 2 . 2 2 . . .
        DB      $08,$00      ; . . 2 . . . . .
        DB      $08,$00      ; . . 2 . . . . .
        
L2924:  DB      $58
        DB      $1A
        DB      $58
        DB      $2C
        DB      $58
        DB      $3E
        DB      $58
        DB      $5A
        DB      $58
        DB      $6C
        DB      $58
        DB      $7E

L2930:  DB      $58
        DB      $0C
        DB      $58
        DB      $8C
        DB      $58
        DB      $4C
        DB      $03
        DB      $C0
        DB      $00
        DB      $3F
        DB      $FC
        DB      $00
        DB      $C3
        DB      $C3
        DB      $00
        DB      $00

;  Blank Pattern
L2940:  DB      2,4        ; X,Y Size
        DB      $00,$00    ; . . . . . . . .
        DB      $00,$00    ; . . . . . . . .
        DB      $00,$00    ; . . . . . . . .
        DB      $00,$00    ; . . . . . . . .

L294A:  DB      $FA
        DB      $AB
        DB      $63
        DB      $00

L294E:  DB      $00
        DB      $50
        DB      $74
        DB      $06

L2952:  DB      $5B
        DB      $B3
        DB      $82
        DB      $00

L2956:  DB      $73
        DB      $F0
        DB      $B9
        DB      $07

L295A:  DB      $B3
        DB      $7A
        DB      $FA
        DB      $00

L295E:  DB      $FA
        DB      $63
        DB      $AB
        DB      $06

L2962:  DB      $A5
        DB      $FA
        DB      $63
        DB      $00

L2966:  DB      $3B
        DB      $9B
        DB      $EB
        DB      $07

;  Color Table
;  -----------
L296A:  DB      $73           ; COL3L - Light Brown 
        DB      $AB           ; COL2L - Light Green 
        DB      $52           ; COL1L - Red  
        DB      $00           ; COL3L - Black 
        DB      $D4           ; COL3R - Light Blue 
        DB      $74           ; COL2R - Light Brown/Orange-ish
        DB      $07           ; COL1R - White
        DB      $00           ; COL0R - Black

;  Color Table
;  -----------
;  How these colors are used in the game:
;  Black  - Background 
;  Blue   - Missile Base, City, Blast Radius, Score 
;  Green  - Enemy Bomb, Player Missile, Nuclear Blast
;           Missile Cursor, Nuclear Blast 
;  Orange - City, Enemy Ship
L2972:    DB      $FA           ; COL3L - Blue
          DB      $FA           ; COL2L - Blue
          DB      $00           ; COL1L - Black
          DB      $6B           ; COL0L - Orange
          DB      $FA           ; COL3R - Blue
          DB      $FA           ; COL2R - Blue
          DB      $00           ; COL1R - Black
          DB      $6B           ; COL0R - Orange

;  Color Table (Alt)
L297A:    DB      $00           ; COL3L - Black
          DB      $00           ; COL2L - Black
          DB      $00           ; COL1L - Black
          DB      $00           ; COL0L - Black
          DB      $00           ; COL3R - Black
          DB      $00           ; COL2R - Black
          DB      $00           ; COL1R - Black
          DB      $00           ; COL0R - Black
        
;  Table for INDEXW
;  There APPEARS to be eight entries in this table... but that's a guess
;  base on the data that follows, which seem to be addresses ??
L2982:  DW      L294A
        DW      L294E
        DW      L2952
        DW      L2956
        DW      L295A
        DW      L295E
        DW      L2962
        DW      L2966

;  Initial Values for Vector Block of Enemy Ship (SHIPVECT) 
L2992:  DB      $20             ; Vector Block, Magic Register 
        DB      $00             ; Vector Block, STATus byte  
        DB      $01             ; Vector Block, TIMe Base   
        DB      $00             ; Vector Block, Delta for X Low  
        DB      $00             ; Vector Block, Delta for X Hi  
        DB      $00             ; Vector Block, X coord Low  
        DB      $00             ; Vector Block, X coord Hi  
        DB      $01             ; Vector Block, X CHecK flags  
        DB      $00             ; Vector Block, Delta for Y Low 
        DB      $00             ; Vector Block, Delta for Y Hi  
        DB      $00             ; Vector Block, Y coord Low
        DB      $00             ; Vector Block, Y coord Hi  
        DB      $03             ; Vector Block, Y CHecK flags  

;  22 Bytes of Initial values for... something ??
;  These 22 values are loaded into RAM using a LDIR loop. 
L299F:  DB      $20
        DB      $00
        DB      $00
        DB      $00
        DB      $00
        DB      $00
        DB      $00
        DB      $00
        DB      $00
        DB      $00
        DB      $00
        DB      $00
        DB      $01
        DB      $00
        DB      $00
        DB      $00
        DB      $00
        DB      $00
        DB      $05
        DB      $9B
        DB      $00
        DB      $65

;  Four RAM Addresses... not sure what these are yet.
L29B5:  DW      $4F4C     
        DW      $4F62
        DW      $4F78
        DW      $4F8E

;  Blast Radius Pattern (Smallest Explosion)    
        DB      -1,-1        ; X,Y Displacment
        DB      1,4          ; X,Y Size
        DB      $3C          ; . 3 3 .
        DB      $FF          ; 3 3 3 3
        DB      $FF          ; 3 3 3 3
        DB      $3C          ; . 3 3 .

;  Blast Radius Pattern (Middle-Sized Explosion)
        DB      -3,-3        ; X,Y Displacment
        DB      2,8          ; X,Y Size
        DB      $0F,$F0      ; . . 3 3 3 3 . .
        DB      $30,$0C      ; . 3 . . . . 3 .
        DB      $C0,$03      ; 3 . . . . . . 3
        DB      $C0,$03      ; 3 . . . . . . 3
        DB      $C0,$03      ; 3 . . . . . . 3
        DB      $C0,$03      ; 3 . . . . . . 3
        DB      $30,$0C      ; . 3 . . . . 3 .
        DB      $0F,$F0      ; . . 3 3 3 3 . .

;  Blast Radius Pattern (Largest Explosion)
        DB      -5,-5        ; X,Y Displacment
        DB      3,12         ; X,Y Size
        DB      $03,$FF,$C0  ; . . . 3 3 3 3 3 3 . . .
        DB      $0C,$00,$30  ; . . 3 . . . . . . 3 . .
        DB      $30,$00,$0C  ; . 3 . . . . . . . . 3 .
        DB      $C0,$00,$03  ; 3 . . . . . . . . . . 3
        DB      $C0,$00,$03  ; 3 . . . . . . . . . . 3
        DB      $C0,$00,$03  ; 3 . . . . . . . . . . 3
        DB      $C0,$00,$03  ; 3 . . . . . . . . . . 3
        DB      $C0,$00,$03  ; 3 . . . . . . . . . . 3
        DB      $C0,$00,$03  ; 3 . . . . . . . . . . 3
        DB      $30,$00,$0C  ; . 3 . . . . . . . . 3 .
        DB      $0C,$00,$30  ; . . 3 . . . . . . 3 . .
        DB      $03,$FF,$C0  ; . . . 3 3 3 3 3 3 . . .

;  These are the nuclear explosions, but I can't find the "Screen Write"
;  for these patterns.  Must be in a table someplace... but where??
;  Bottom of Nuclear Explosion
        DB      3,1          ; X,Y Displacment
        DB      1,3          ; X,Y Size
        DB      $A0          ; 2 2 . .
        DB      $A0          ; 2 2 . . 
        DB      $A0          ; 2 2 . .

;  Top of Nuclear Explosion (1 of 2)
        DB      1,-2        ; X,Y Displacment
        DB      2,3         ; X,Y Size
        DB      $0A,$00     ; . . 2 2 . . . .
        DB      $2A,$80     ; . 2 2 2 2 . . .
        DB      $AA,$A0     ; 2 2 2 2 2 2 . .

;  Top of Nuclear Explosion (2 of 2)
        DB      0,-3        ; X,Y Displacment
        DB      2,5         ; X,Y Size
        DB      $0A,$A0     ; . . 2 2 2 2 . .
        DB      $28,$28     ; . 2 2 . . 2 2 .
        DB      $A0,$0A     ; 2 2 . . . . 2 2
        DB      $80,$02     ; 2 . . . . . . 2
        DB      $20,$08     ; . 2 . . . . 2 .

L2A20:  DB      $00
        DB      $01
        DB      $00
        DB      $10
        DB      $00
        DB      $00
        DB      $05
        DB      $00
        DB      $00
L2A29:  DB      $01
        DB      $00
        DB      $00

;  Strings
L2A2C:    DB      "SPECTRE SYSTEMS       "
          DB      "ICBM ATTACK    ",$00
L2A52:    DB      "THE NUMBER    "
          DB      "OF PLAYERS"
          DB      "                        "   ; 24 Spaces
          DB      "                        "   ; 24 Spaces
          DB      "                      "     ; 22 Spaces
          DB      "DESIGNED BY         "
          DB      "BRETT BILBREY",$00
L2AD2:    DB      "PLAYER   UP",$00

;  Interrupt
L2ADE:    LD      A,($4FC0)
          ADD     A,$08
          LD      ($4FC0),A
          LD      B,$26
L2AE8:    ADD     A,$08
          OUT     (COL3R),A     ; Port $03,  write COLor 3 Right
          OUT     (COL3L),A     ; Port $07,  write COLor 3 Left
          OUT     (COL3R),A     ; Port $03,  write COLor 3 Right
          OUT     (COL3L),A     ; Port $07,  write COLor 3 Left
          OUT     (COL3R),A     ; Port $03,  write COLor 3 Right
          OUT     (COL3L),A     ; Port $07,  write COLor 3 Left
          OUT     (COL3R),A     ; Port $03,  write COLor 3 Right
          OUT     (COL3L),A     ; Port $07,  write COLor 3 Left
          DJNZ    L2AE8
          LD      A,$FA
          OUT     (COL3L),A     ; Port $07,  write COLor 3 Left
          LD      A,$A9         
          OUT     (COL2L),A     ; Port $06, write COLor 2 Left
          LD      A,$63
          OUT     (COL1L),A     ; Port $05, write COLor 1 Left
          LD      A,$02
          SYSTEM  RANGED        ; UPI RANGED random number
        
          INC     A
          LD      C,A
          XOR     A
          SYSTEM  RANGED        ; UPI RANGED random number
        
          OUT     (C),A
          LD      HL,L2B1F
          LD      ($4F28),HL    ; Load new location into interrupt vector 
          LD      A,$66
          OUT     (INLIN),A     ; Port $0F, write INterrupt LINe
          EI      
          RET
        
        
L2B1F:    SYSSUK  COLSET        ; UPI COLors SET
          DW      L296A         ; ... Table Address = 10602
          LD      A,$9C
          OUT     (INLIN),A     ; Write INterrupt LINe
          LD      HL,L2B2F
          LD      ($4F28),HL
          EI      
          RET     
        
        
L2B2F:    LD      A,($4FC0)
          LD      B,$28
L2B34:    SUB     $08
          OUT     (COL3R),A     ; Port $03,  write COLor 3 Right
          OUT     (COL3L),A     ; Port $07,  write COLor 3 Left
          OUT     (COL3R),A     ; Port $03,  write COLor 3 Right
          OUT     (COL3L),A     ; Port $07,  write COLor 3 Left
          DJNZ    L2B34
          LD      A,$00
          OUT     (INLIN),A     ; Port $0F, write INterrupt LINe
          OUT     (COL3R),A     ; Port $03,  write COLor 3 Right
          OUT     (COL3L),A     ; Port $07,  write COLor 3 Left
          LD      HL,L2ADE
          LD      ($4F28),HL
          IN      A,(SW0)       ; Port $10, read SWitch bank 0 for player 1 hand control
          AND     A
          JP      NZ,L2096
          IN      A,(SW1)       ; Port $11, read SWitch bank 1 for player 2 hand control
          AND     A             
          JP      NZ,L2096
          IN      A,(KEY0)      ; Port $14, KEYboard column 0 (right side)
          AND     A
          JP      NZ,L2096
          IN      A,(KEY1)      ; Port $15, KEYboard column 1 (center right)
          AND     A
          JP      NZ,L2096
          IN      A,(KEY2)      ; Port $16, KEYboard column 2 (center left)
          AND     A
          JP      NZ,L2096
          IN      A,(KEY3)      ; Port $17, KEYboard column 3 (left side)
          AND     A
          JP      NZ,L2096
          EI      
          RET
        
        
;  WRITP X,Y Coordinates and Pattern Addresses
L2B74:  DB      36,5    ; X,Y Pattern Coordinate 
        DW      L2BF1   ; Pattern Address ("C" in "ICBM Attack" on Title Screen)

L2B78:  DB      48,5    ; X,Y Pattern Coordinate
        DW      L2C20   ; Pattern Address ("B" in "ICBM Attack" on Title Screen)

        DB      72,5    ; X,Y Pattern Coordinate
        DW      L2C4F   ; Pattern Address (Top-Right Indent of 'M' in ICBM Attack)   

        DB      84,5    ; X,Y Pattern Coordinate
        DW      L2C54   ; Pattern Address ("A" in "ICBM Attack" on Title Screen)

        DB      97,11   ; X,Y Pattern Coordinate
        DW      L2C83   ; Pattern Address (Bottom of 'T' in ICBM Attack on Title Screen)

        DB      109,11  ; X,Y Pattern Coordinate
        DW      L2C83   ; Pattern Address (Bottom of 'T' in ICBM Attack on Title Screen) 

        DB      120,5   ; X,Y Pattern Coordinate
        DW      L2C54   ; Pattern Address ("A" in "ICBM Attack" on Title Screen)

        DB      132,5   ; X,Y Pattern Coordinate
        DW      L2BF1   ; Pattern Address ("C" in "ICBM Attack" on Title Screen)

        DB      144,5   ; X,Y Pattern Coordinate
        DW      L2C97   ; Pattern Address ("K" in "ICBM Attack" on Title Screen)

        DB      3,54    ; X,Y Pattern Coordinate
        DW      L2CDB   ; Pattern Address (City, Right-Most Part of Building)

        DB      11,45   ; X,Y Pattern Coordinate
        DW      L2CE9   ; Pattern Address (City, Building)

        DB      19,47   ; X,Y Pattern Coordinate
        DW      L2D0B   ; Pattern Address (City Building)

        DB      23,34   ; X,Y Pattern Coordinate
        DW      L2D1F   ; Pattern Address

        DB      27,31   ; X,Y Pattern Coordinate
        DW      L2D40   ; Pattern Address

        DB      31,39   ; X,Y Pattern Coordinate
        DW      L2D64   ; Pattern Address

        DB      35,44   ; X,Y Pattern Coordinate
        DW      L2D81   ; Pattern Address
        
        DB      43,47   ; X,Y Pattern Coordinate
        DW      L2DAF   ; Pattern Address
        
        DB      51,50   ; X,Y Pattern Coordinate
        DW      L2DD5   ; Pattern Address
        
        DB      59,52   ; X,Y Pattern Coordinate
        DW      L2DF1   ; Pattern Address

        DB      67,54   ; X,Y Pattern Coordinate
        DW      L2E09   ; Pattern Address

        DB      75,55   ; X,Y Pattern Coordinate
        DW      L2E1B   ; Pattern Address
        
        DB      83,57   ; X,Y Pattern Coordinate
        DW      L2E27   ; Pattern Address

        DB      112,67  ; X,Y Pattern Coordinate
        DW      L2E2D   ; Pattern Address
        
        DB      116,64  ; X,Y Pattern Coordinate
        DW      L2E31   ; Pattern Address

        DB      120,59  ; X,Y Pattern Coordinate
        DW      L2E39   ; Pattern Address

        DB      128,57  ; X,Y Pattern Coordinate
        DW      L2E53   ; Pattern Address

        DB      136,65  ; X,Y Pattern Coordinate
        DW      L2E73   ; Pattern Address

        DB      144,67  ; X,Y Pattern Coordinate
        DW      L2E81   ; Pattern Address

        DB      92,67   ; X,Y Pattern Coordinate
        DW      L2E87   ; Pattern Address

        DB      32,71   ; X,Y Pattern Coordinate
        DW      L2E91   ; Pattern Address

        DB      101,33  ; X,Y Pattern Coordinate
        DW      L2EA1   ; Pattern Address

        DB      $00

;  Pattern ('C' in ICBM Attack on Title Screen)
L2BF1:    DB      3,15         ; X,Y Size      
          DB      $00,$3F,$C0  ; . . . . . 3 3 3 3 . . .
          DB      $03,$FF,$C0  ; . . . 3 3 3 3 3 3 . . .
          DB      $0F,$FF,$C0  ; . . 3 3 3 3 3 3 3 . . .
          DB      $3F,$C0,$00  ; . 3 3 3 3 . . . . . . .
          DB      $3F,$00,$00  ; . 3 3 3 . . . . . . . .
          DB      $FC,$00,$00  ; 3 3 3 . . . . . . . . .
          DB      $FC,$00,$00  ; 3 3 3 . . . . . . . . .
          DB      $FC,$00,$00  ; 3 3 3 . . . . . . . . .
          DB      $FC,$00,$00  ; 3 3 3 . . . . . . . . .
          DB      $FC,$00,$00  ; 3 3 3 . . . . . . . . .
          DB      $3F,$00,$00  ; . 3 3 3 . . . . . . . .
          DB      $3F,$C0,$00  ; . 3 3 3 3 . . . . . . .
          DB      $0F,$FF,$C0  ; . . 3 3 3 3 3 3 3 . . .
          DB      $03,$FF,$C0  ; . . . 3 3 3 3 3 3 . . .
          DB      $00,$3F,$C0  ; . . . . . 3 3 3 3 . . .
        
;  Pattern ('B' in ICBM Attack on Title Screen) 
L2C20:    DB      3,15         ; X,Y Size
          DB      $FF,$F0,$00  ; 3 3 3 3 3 3 . . . . . .
          DB      $FF,$FC,$00  ; 3 3 3 3 3 3 3 . . . . .
          DB      $FF,$FF,$00  ; 3 3 3 3 3 3 3 3 . . . .
          DB      $00,$3F,$C0  ; . . . . . 3 3 3 3 . . .
          DB      $00,$0F,$C0  ; . . . . . . 3 3 3 . . .
          DB      $00,$3F,$C0  ; . . . . . 3 3 3 3 . . .
          DB      $FF,$FF,$00  ; 3 3 3 3 3 3 3 3 . . . .
          DB      $FF,$FC,$00  ; 3 3 3 3 3 3 3 . . . . .
          DB      $FF,$FF,$00  ; 3 3 3 3 3 3 3 3 . . . .
          DB      $00,$3F,$C0  ; . . . . . 3 3 3 3 . . .
          DB      $00,$0F,$C0  ; . . . . . . 3 3 3 . . .
          DB      $00,$3F,$C0  ; . . . . . 3 3 3 3 . . .
          DB      $FF,$FF,$00  ; 3 3 3 3 3 3 3 3 . . . .
          DB      $FF,$FC,$00  ; 3 3 3 3 3 3 3 . . . . .
          DB      $FF,$F0,$00  ; 3 3 3 3 3 3 . . . . . .

;  Pattern (Top-Right Indent of 'M' in ICBM Attack on Title Screen)        
L2C4F:    DB      1,3          ; X,Y Size
          DB      $FC          ; 3 3 3 .
          DB      $3C          ; . 3 3 .
          DB      $0C          ; . . 3 .

;  Pattern ('A' in ICBM Attack on Title Screen)
L2C54:    DB      3,15         ; X,Y Size
          DB      $03,$F0,$00  ; . . . 3 3 3 . . . . . .
          DB      $03,$F0,$00  ; . . . 3 3 3 . . . . . .
          DB      $03,$F0,$00  ; . . . 3 3 3 . . . . . .
          DB      $00,$FC,$00  ; . . . . 3 3 3 . . . . .
          DB      $00,$FC,$00  ; . . . . 3 3 3 . . . . .
          DB      $00,$FC,$00  ; . . . . 3 3 3 . . . . .
          DB      $3F,$3F,$00  ; . 3 3 3 . 3 3 3 . . . .
          DB      $3F,$3F,$00  ; . 3 3 3 . 3 3 3 . . . .
          DB      $3F,$3F,$00  ; . 3 3 3 . 3 3 3 . . . .
          DB      $FC,$0F,$C0  ; 3 3 3 . . . 3 3 3 . . .
          DB      $FC,$0F,$C0  ; 3 3 3 . . . 3 3 3 . . .
          DB      $FC,$0F,$C0  ; 3 3 3 . . . 3 3 3 . . .
          DB      $FF,$FF,$C0  ; 3 3 3 3 3 3 3 3 3 . . .
          DB      $FF,$FF,$C0  ; 3 3 3 3 3 3 3 3 3 . . .
          DB      $FF,$FF,$C0  ; 3 3 3 3 3 3 3 3 3 . . .

;  Pattern (Bottom of 'T' in ICBM Attack on Title Screen)
L2C83:    DB      2,9          ; X,Y Size
          DB      $FC,$00      ; 3 3 3 . . . . . 
          DB      $FC,$00      ; 3 3 3 . . . . .
          DB      $FC,$00      ; 3 3 3 . . . . .
          DB      $FC,$00      ; 3 3 3 . . . . .
          DB      $FC,$00      ; 3 3 3 . . . . .
          DB      $3F,$00      ; . 3 3 3 . . . .
          DB      $3F,$FF      ; . 3 3 3 3 3 3 3
          DB      $0F,$FF      ; . . 3 3 3 3 3 3
          DB      $00,$FF      ; . . . . 3 3 3 3

;  Pattern ('K' in ICBM Attack on Title Screen) 
L2C97:    DB      3,15         ; X,Y Size
          DB      $00,$0F,$C0  ; . . . . . . 3 3 3 . . .
          DB      $00,$3F,$00  ; . . . . . 3 3 3 . . . .
          DB      $00,$FC,$00  ; . . . . 3 3 3 . . . . .
          DB      $03,$F0,$00  ; . . . 3 3 3 . . . . . .
          DB      $0F,$C0,$00  ; . . 3 3 3 . . . . . . .
          DB      $3F,$00,$00  ; . 3 3 3 . . . . . . . .
          DB      $FC,$00,$00  ; 3 3 3 . . . . . . . . .
          DB      $F0,$00,$00  ; 3 3 . . . . . . . . . .
          DB      $FC,$00,$00  ; 3 3 3 . . . . . . . . .
          DB      $3F,$00,$00  ; . 3 3 3 . . . . . . . .
          DB      $0F,$C0,$00  ; . . 3 3 3 . . . . . . .
          DB      $03,$F0,$00  ; . . . 3 3 3 . . . . . .
          DB      $00,$FC,$00  ; . . . . 3 3 3 . . . . .
          DB      $00,$3F,$00  ; . . . . . 3 3 3 . . . .
          DB      $00,$0F,$C0  ; . . . . . . 3 3 3 . . .
        
L2CC6:    DB      "SPECTRE SYSTEMS",$00      
L2CD6:    DB      "1982",$00

;  Title Screen Pattern - City (X,Y Pattern Coordinate - 3,54)
;  Right-Most Part of Building on Title Screen
L2CDB:    DB      2,6          ; X,Y Size
          DB      $05,$55      ; . . 1 1 1 1 1 1 
          DB      $04,$44      ; . . 1 . 1 . 1 .      
          DB      $04,$44      ; . . 1 . 1 . 1 .
          DB      $55,$55      ; 1 1 1 1 1 1 1 1
          DB      $00,$A0      ; . . . . 2 2 . .
          DB      $00,$0A      ; . . . . . . 2 2

;  Title Screen Pattern - City (X,Y Pattern Coordinate - 11,45)
L2CE9:    DB      2,16         ; X,Y Size
          DB      $15,$15      ; . 1 1 1 . 1 1 1
          DB      $11,$11      ; . 1 . 1 . 1 . 1
          DB      $55,$55      ; 1 1 1 1 1 1 1 1
          DB      $44,$44      ; 1 . 1 . 1 . 1 .
          DB      $7F,$FF      ; 1 3 3 3 3 3 3 3
          DB      $70,$30      ; 1 3 . . . 3 . .
          DB      $7F,$FF      ; 1 3 3 3 3 3 3 3
          DB      $70,$30      ; 1 3 . . . 3 . .
          DB      $7F,$FF      ; 1 3 3 3 3 3 3 3
          DB      $70,$30      ; 1 3 . . . 3 . .
          DB      $7F,$FF      ; 1 3 3 3 3 3 3 3
          DB      $70,$30      ; 1 3 . . . 3 . .
          DB      $55,$55      ; 1 1 1 1 1 1 1 1
          DB      $00,$00      ; . . . . . . . .
          DB      $AA,$A0      ; 2 2 2 2 2 2 . .
          DB      $00,$2A      ; . . . . . 2 2 2
        
;  Title Screen Pattern - City (X,Y Pattern Coordinate - 19,47)
L2D0B:    DB      1,18         ; X,Y Size
          DB      $40          ; 1 . . .
          DB      $40          ; 1 . . .
          DB      $F0          ; 3 3 . .
          DB      $35          ; . 3 1 1
          DB      $F6          ; 3 3 1 2
          DB      $36          ; . 3 1 2
          DB      $F5          ; 3 3 1 1
          DB      $36          ; . 3 1 2
          DB      $F6          ; 3 3 1 2
          DB      $35          ; . 3 1 1
          DB      $54          ; 1 1 1 .
          DB      $00          ; . . . .
          DB      $00          ; . . . .
          DB      $80          ; 2 . . .
          DB      $A8          ; 2 2 2 .
          DB      $0A          ; . . 2 2
          DB      $AA          ; 2 2 2 2
          DB      $2A          ; . 2 2 2

;  Title Screen Pattern - City (X,Y Pattern Coordinate - 23,34)
L2D1F:    DB      1,31         ; X,Y Size
          DB      $03          ; . . . 3 
          DB      $03          ; . . . 3
          DB      $03          ; . . . 3
          DB      $55          ; 1 1 1 1  
          DB      $44          ; 1 . 1 .  
          DB      $55          ; 1 1 1 1
          DB      $44          ; 1 . 1 .
          DB      $55          ; 1 1 1 1
          DB      $44          ; 1 . 1 .
          DB      $55          ; 1 1 1 1
          DB      $44          ; 1 . 1 .
          DB      $55          ; 1 1 1 1
          DB      $44          ; 1 . 1 .
          DB      $55          ; 1 1 1 1
          DB      $44          ; 1 . 1 .
          DB      $55          ; 1 1 1 1
          DB      $55          ; 1 1 1 1
          DB      $9A          ; 2 1 2 2    
          DB      $9A          ; 2 1 2 2
          DB      $55          ; 1 1 1 1
          DB      $9A          ; 2 1 2 2
          DB      $9A          ; 2 1 2 2
          DB      $55          ; 1 1 1 1
          DB      $00          ; . . . . 
          DB      $00          ; . . . .
          DB      $0A          ; . . 2 2 
          DB      $00          ; . . . .
          DB      $00          ; . . . .
          DB      $00          ; . . . .
          DB      $80          ; 2 . . .    
          DB      $AA          ; 2 2 2 2    

;  Title Screen Pattern - City (X,Y Pattern Coordinate - 27,31)
L2D40:    DB      $01,34          ; X,Y Size
          DB      $CC             ; 3 . 3 .    
          DB      $CC             ; 3 . 3 .    
          DB      $CC             ; 3 . 3 .    
          DB      $FF             ; 3 3 3 3    
          DB      $AB             ; 2 2 2 3    
          DB      $AB             ; 2 2 2 3
          DB      $6B             ; 1 2 2 3
          DB      $7F             ; 1 3 3 3    
          DB      $6B             ; 1 2 2 3
          DB      $6B             ; 1 2 2 3
          DB      $6B             ; 1 2 2 3
          DB      $7F             ; 1 3 3 3    
          DB      $6B             ; 1 2 2 3
          DB      $6B             ; 1 2 2 3
          DB      $6B             ; 1 2 2 3
          DB      $7F             ; 1 3 3 3    
          DB      $6B             ; 1 2 2 3
          DB      $6B             ; 1 2 2 3
          DB      $6B             ; 1 2 2 3
          DB      $55             ; 1 1 1 1    
          DB      $69             ; 1 2 2 1    
          DB      $69             ; 1 2 2 1
          DB      $55             ; 1 1 1 1    
          DB      $69             ; 1 2 2 1
          DB      $69             ; 1 2 2 1
          DB      $55             ; 1 1 1 1    
          DB      $01             ; . . . 1    
          DB      $00             ; . . . .
          DB      $80             ; 2 . . .
          DB      $2A             ; . 2 2 2    
          DB      $00             ; . . . .
          DB      $00             ; . . . .
          DB      $00             ; . . . .
          DB      $AA             ; 2 2 2 2

;  Title Screen Pattern - City (X,Y Pattern Coordinate - 31,39)
L2D64:    DB      1,27            ; X,Y Size
          DB      $20             ; . 2 . .
          DB      $88             ; 2 . 2 .
          DB      $02             ; . . . 2
          DB      $22             ; . 2 . 2
          DB      $02             ; . . . 2
          DB      $22             ; . 2 . 2
          DB      $02             ; . . . 2
          DB      $22             ; . 2 . 2
          DB      $55             ; 1 1 1 1
          DB      $04             ; . . 1 .
          DB      $55             ; 1 1 1 1
          DB      $04             ; . . 1 .
          DB      $55             ; 1 1 1 1
          DB      $DD             ; 3 1 3 1
          DB      $55             ; 1 1 1 1
          DB      $DD             ; 3 1 3 1
          DB      $55             ; 1 1 1 1
          DB      $DD             ; 3 1 3 1
          DB      $55             ; 1 1 1 1
          DB      $00             ; . . . .
          DB      $00             ; . . . .
          DB      $AA             ; 2 2 2 2
          DB      $02             ; . . . 2
          DB      $00             ; . . . .
          DB      $00             ; . . . .
          DB      $80             ; 2 . . .
          DB      $AA             ; 2 2 2 2
 
;  Title Screen Pattern - City (X,Y Pattern Coordinate - 35,44)
L2D81:    DB      2,22            ; X,Y Size
          DB      $03,$FC         ; . . . 3 3 3 3 .
          DB      $03,$AC         ; . . . 3 2 2 3 .
          DB      $03,$AC         ; . . . 3 2 2 3 .
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $10,$41         ; . 1 . . 1 . . 1
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $10,$41         ; . 1 . . 1 . . 1
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $DD,$DD         ; 3 1 3 1 3 1 3 1
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $DD,$DD         ; 3 1 3 1 3 1 3 1
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $DD,$DD         ; 3 1 3 1 3 1 3 1
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $00,$00         ; . . . . . . . .
          DB      $00,$00         ; . . . . . . . .
          DB      $AA,$AA         ; 2 2 2 2 2 2 2 2
          DB      $AA,$80         ; 2 2 2 2 2 . . .
          DB      $00,$00         ; . . . . . . . .
          DB      $00,$00         ; . . . . . . . .
          DB      $02,$AA         ; . . . 2 2 2 2 2
          DB      $AA,$00         ; 2 2 2 2 . . . .
        
;  Title Screen Pattern - City (X,Y Pattern Coordinate - 43,47)
L2DAF:    DB      2,18            ; X,Y Size
          DB      $08,$00         ; . . 2 . . . . .
          DB      $08,$2A         ; . . 2 . . 2 2 2
          DB      $08,$22         ; . . 2 . . 2 . 2
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $7F,$FF         ; 1 3 3 3 3 3 3 3
          DB      $73,$33         ; 1 3 . 3 . 3 . 3
          DB      $73,$33         ; 1 3 . 3 . 3 . 3
          DB      $73,$33         ; 1 3 . 3 . 3 . 3
          DB      $73,$33         ; 1 3 . 3 . 3 . 3
          DB      $73,$33         ; 1 3 . 3 . 3 . 3
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $00,$00         ; . . . . . . . .
          DB      $00,$00         ; . . . . . . . .
          DB      $A0,$00         ; 2 2 . . . . . .
          DB      $00,$00         ; . . . . . . . .
          DB      $00,$AA         ; . . . . 2 2 2 2
          DB      $2A,$80         ; . 2 2 2 2 . . .
          DB      $A8,$00         ; 2 2 2 . . . . .

;  Title Screen Pattern - City (X,Y Pattern Coordinate - 51,50)
L2DD5:    DB      2,13            ; X,Y Size
          DB      $55,$42         ; 1 1 1 1 1 . . 2
          DB      $FF,$42         ; 3 3 3 3 1 . . 2
          DB      $33,$4A         ; . 3 . 3 1 . 2 2
          DB      $33,$4A         ; . 3 . 3 1 . 2 2
          DB      $33,$55         ; . 3 . 3 1 1 1 1
          DB      $33,$41         ; . 3 . 3 1 . . 1
          DB      $33,$41         ; . 3 . 3 1 . . 1
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $00,$00         ; . . . . . . . .
          DB      $0A,$AA         ; . . 2 2 2 2 2 2
          DB      $00,$00         ; . . . . . . . .
          DB      $00,$2A         ; . . . . . 2 2 2
          DB      $AA,$AA         ; 2 2 2 2 2 2 2 2

;  Title Screen Pattern - City (X,Y Pattern Coordinate - 59,52)        
L2DF1:    DB      2,11            ; X,Y Size
          DB      $83,$F0         ; 2 . . 3 3 3 . .
          DB      $83,$F0         ; 2 . . 3 3 3 . .
          DB      $55,$D5         ; 1 1 1 1 3 1 1 1
          DB      $41,$D0         ; 1 . . 1 3 1 . .
          DB      $41,$D0         ; 1 . . 1 3 1 . .
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $00,$00         ; . . . . . . . .
          DB      $AA,$A8         ; 2 2 2 2 2 2 2 .
          DB      $00,$00         ; . . . . . . . .
          DB      $AA,$AA         ; 2 2 2 2 2 2 2 2
          DB      $AA,$00         ; 2 2 2 2 . . . .

;  Title Screen Pattern - City (X,Y Pattern Coordinate - 67,54)
L2E09:    DB      2,8             ; X,Y Size
          DB      $55,$00         ; 1 1 1 1 . . . .
          DB      $41,$00         ; 1 . . 1 . . . .
          DB      $41,$A9         ; 1 . . 1 2 2 2 1
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $00,$00         ; . . . . . . . .
          DB      $00,$0A         ; . . . . . . 2 2
          DB      $0A,$AA         ; . . 2 2 2 2 2 2
          DB      $AA,$00         ; 2 2 2 2 . . . .

;  Title Screen Pattern - City (X,Y Pattern Coordinate - 75,55)
L2E1B:    DB      2,5             ; X,Y Size
          DB      $3C,$00         ; . 3 3 . . . . .
          DB      $3C,$00         ; . 3 3 . . . . .
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $02,$AA         ; . . . 2 2 2 2 2
          DB      $AA,$A0         ; 2 2 2 2 2 2 . .

;  Title Screen Pattern - City (X,Y Pattern Coordinate - 83,57)
L2E27:    DB      2,2             ; X,Y Size
          DB      $55,$55         ; 1 1 1 1 1 1 1 1
          DB      $A0,$00         ; 2 2 . . . . . .

;  Title Screen Pattern - Player Base (X,Y Pattern Coordinate - 112,67)
L2E2D:    DB      1,2             ; X,Y Size
          DB      $0A             ; . . 2 2
          DB      $AA             ; 2 2 2 2

;  Title Screen Pattern - Player Base (X,Y Pattern Coordinate - 116,64)
L2E31:    DB      1,6             ; X,Y Size
          DB      $2A             ; . 2 2 2
          DB      $22             ; . 2 . 2
          DB      $82             ; 2 . . 2
          DB      $00             ; . . . .
          DB      $80             ; 2 . . .
          DB      $2A             ; . 2 2 2

;  Title Screen Pattern - Player Base (X,Y Pattern Coordinate - 120,59)       
L2E39:    DB      2,12            ; X,Y Size
          DB      $40,$00         ; 1 . . . . . . .
          DB      $10,$00         ; . 1 . . . . . .
          DB      $07,$00         ; . . 1 3 . . . .
          DB      $0F,$C0         ; . . 3 3 3 . . .
          DB      $2A,$05         ; . 2 2 2 . . 1 1
          DB      $24,$04         ; . 2 1 . . . 1 .
          DB      $05,$55         ; . . 1 1 1 1 1 1
          DB      $55,$00         ; 1 1 1 1 . . . .
          DB      $08,$00         ; . . 2 . . . . .
          DB      $A0,$0A         ; 2 2 . . . . 2 2
          DB      $2A,$A8         ; . 2 2 2 2 2 2 .
          DB      $00,$02         ; . . . . . . . 2

L2E53:  DB      2,15              ; X,Y Size
        DB      $00,$04           ; . . . . . . 1 .
        DB      $03,$04           ; . . . 3 . . 1 .
        DB      $00,$D4           ; . . . . 3 1 1 .
        DB      $00,$50           ; . . . . 1 1 . .
        DB      $05,$50           ; . . 1 1 1 1 . .
        DB      $00,$10           ; . . . . . 1 . .
        DB      $55,$54           ; 1 1 1 1 1 1 1 .
        DB      $00,$04           ; . . . . . . 1 .
        DB      $40,$0A           ; 1 . . . . . 2 2
        DB      $AA,$A0           ; 2 2 2 2 2 2 . .
        DB      $80,$08           ; 2 . . . . . 2 .
        DB      $82,$02           ; 2 . . 2 . . . 2
        DB      $02,$00           ; . . . 2 . . . .
        DB      $80,$AA           ; 2 . . . 2 2 2 2
        DB      $2A,$80           ; . 2 2 2 2 . . .

L2E73:  DB      2,6               ; X,Y Size
        DB      $80,$00           ; 2 . . . . . . .
        DB      $2A,$80           ; . 2 2 2 2 . . .
        DB      $00,$AA           ; . . . . 2 2 2 2
        DB      $00,$0A           ; . . . . . . 2 2
        DB      $8A,$80           ; 2 . 2 2 2 . . .
        DB      $80,$00           ; 2 . . . . . . .

L2E81:  DB      2,2               ; X,Y Size
        DB      $80,$00           ; 2 . . . . . . .
        DB      $AA,$AA           ; 2 2 2 2 2 2 2 2

L2E87:  DB      4,2               ; X,Y Size
        DB      $00,$0A,$00,$AA   ; . . . . . . 2 2 . . . . 2 2 2 2
        DB      $A8,$00,$AA,$80   ; 2 2 2 . . . . . 2 2 2 2 2 . . .

;  Title Screen Pattern - Copyright Symbol (X,Y Pattern Coordinate - 32,71)
L2E91:  DB      2,7               ; X,Y Size
        DB      $0F,$C0           ; . . 3 3 3 . . .
        DB      $30,$30           ; . 3 . . . 3 . .
        DB      $CF,$CC           ; 3 . 3 3 3 . 3 .
        DB      $CC,$0C           ; 3 . 3 . . . 3 .
        DB      $CF,$CC           ; 3 . 3 3 3 . 3 .
        DB      $30,$30           ; . 3 . . . 3 . .
        DB      $0F,$C0           ; . . 3 3 3 . . .

;  Title Screen Pattern - Explosion (X,Y Pattern Coordinate - 101,33)
L2EA1:  DB      3,12              ; X,Y Size
        DB      $01,$08,$00       ; . . . 1 . . 2 . . . . .
        DB      $20,$05,$42       ; . 2 . . . . 1 1 1 . . 2
        DB      $02,$0C,$04       ; . . . 2 . . 3 . . . 1 .
        DB      $0C,$3B,$C4       ; . . 3 . . 3 2 3 3 . 1 .
        DB      $40,$BC,$90       ; 1 . . . 2 3 3 . 2 1 . .
        DB      $4B,$C3,$01       ; 1 . 2 3 3 . . 3 . . . 1
        DB      $00,$C3,$20       ; . . . . 3 . . 3 . 2 . .
        DB      $02,$FC,$C2       ; . . . 2 3 3 3 . 3 . . 2
        DB      $84,$E0,$C0       ; 2 . 1 . 3 2 . . 3 . . .
        DB      $14,$00,$91       ; . 1 1 . . . . . 2 1 . 1
        DB      $02,$50,$00       ; . . . 2 1 1 . . . . . .
        DB      $00,$08,$04       ; . . . . . . 2 . . . 1 .
        
;  Empty Space on ROM?
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF

; For some reason one byte in this area isn't empty on the ROM     
          DB      $04

; Okay, back to more empty space on the ROM
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
          DB      $FF
        
;  End of "ICBM Attack"
