;  "The Incredible Wizard"
;  For Bally Arcade/Astrocade
;
;                THE INCREDIBLE WIZARD #2017
;
;    Created by Tom McHugh, Scot Norris, and Julie Malan.
;     With creative consultation and in conjunction with
;                   Action Graphics, Inc.
;                Produced by Astrocade, Inc.
;
;          Licensed from Bally/Midway Mfg. Co. and 
;   based on the original (c) "Wizard of Wor" game done by
;           Dave Nutting Associates (A Bally Co.)
;  Cassette documentation by Scot Norris and Dave Armstrong
;          Copyright Action Graphics, Inc. 2/22/82
;
; 
;  Disassembly Started November 2, 2011 by AJT
;
;  This program can be assembled using ZMAC.  Make sure that HVGLIB.H
;  is in the same directory and then type:
;      zmac -i -m -o wizwor.bin -x wizwor.lst wizwor.asm
;
;
;  Version History:
;
;    .05 (Apr. 22, 2016) - Found Sprite Draw Routines
;      (Lance F. Squire) - DRWSP DRaW SPrite
;                        - DRWFL DRaW FLopped sprite
;    .04 (July 26, 2013) - Found and commented most graphics data
;                        - Began looking at music/sound data
;                        - Added "Incredible Wizard" manual after
;                          source for reference.
;    .03 (Sept. 8, 2012) - Continued finding code.
;    .02 (Nov. 16, 2011) - Second Preliminary version.  First
;                          version added to BallyAlley.com.
;    .01 (Nov. 10, 2011) - First Distributed version.
;                          Distributed ONLY via email.


        INCLUDE "HVGLIB.H"      ; Home Video Game Library

SCRTCH  EQU     $4E38           ; First byte of Scratchpad on Line $91
                                ; This leaves 11 lines available for scratchpad
                                ; or 40 bytes per line x 11 = 440 + 16 = 456 Bytes

LIVES1  EQU     $4F36           ; Number of Lives for Player 1
LIVES2  EQU     $4F37           ; Number of Lives for Player 2           
GAMDIF  EQU     $4F3C           ; Game Difficulty Level
COUNT1  EQU     $4FD5           ; Countdown Timer for Player 1 to Exit Safe Area
COUNT2  EQU     $4FD6           ; Countdown Timer for Player 2 to Exit Safe Area
NUMPLA  EQU     $4FF3           ; Number of Players                                
 

        ORG     FIRSTC

        DB      'U'             ; Sentinal for Menu Start

;  First Menu Item node
        DW      MENUST          ; ... Next Menu Node
        DW      L2084           ; ... Choice 1 Text is "THE WIZARD"
        DW      L2019           ; ... Start of "The Incredible Wizard" 

;  Reset Vector Jumps - Used with RST Instruction
        JP      L3216           ; Reset VECTor #1 /  8 / $08
        JP      L322D           ; Reset VECTor #2 / 16 / $10
        JP      L33E8           ; Reset VECTor #3 / 24 / $18
        JP      L2883           ; Reset VECTor #4 / 32 / $20
        JP      L3234           ; Reset VECTor #5 / 40 / $28
        JP      L323A           ; Reset VECTor #6 / 48 / $30

;  Start of "The Incredible Wizard" Program 
        
;  Initialize Scratch RAM $4F00-$4FAF to zero.  $4F00 is the first byte
;  of line 96 (of 0-101) to the 16'th byte of line 100. 
L2019:  SYSSUK  FILL            ;  UPI FILL memory with data
        DW      $4F00           ;  ... Memory Address = 20224
        DW      $00B0           ;  ... Byte Count = 176
        DB      $00             ;  ... Data = 0

;  Game Difficulty Level Menu

;  Display Game Difficulty Level Menu
;  The menu looks like this:
;
;      THE WIZARD
;    1 - EASY
;    2 - MEDIUM
;    3 - HARD
;
        SYSSUK  MENU            ;  UPI display a MENU
        DW      L2084           ;  ... Title Address "THE WIZARD"
        DW      L2065           ;  ... Menu Linked List

;  Game difficulty level selection is in A.    

L2026:  LD      A,$80           ;  Setup for "EASY" Game Difficulty Level 
        JR      L202C
L202A:  LD      A,$40           ;  Setup for "HARD" Game Difficulty Level
L202C:  LD      ($4F3C),A       ;  

;  Get the Number of Players
;  Number of players must be 1 or 2.  The player's input is checked
;  to make sure that it is valid.  If it isn't 1 or 2, then the
;  player will be asked again until valid input is given.

L202F:  SYSSUK  GETPAR          ;  UPI GET game PARameter from 
        DW      L2077           ;  ... Prompt Address "# OF PLAYERS"
        DB      $01             ;  ... Digits = 1
        DW      $4FF3           ;  ... Parameter Address of Number of Players  

        LD      A,($4FF3)       ; Load A with Number of Players   
        DEC     A                
        CP      $02
        JP      NC,L202F        ; Number of players <> 2, then get again 
        
;  Screen and Interrupt Initialization

;  Vertical Blank
;  First byte of Scratchpad starts on line 91 (of 0-101)
;  This leaves 11 lines available for scratchpad, or:
;     40 bytes per line x 11 = 440 + 16 = 456 Bytes
;  First scratchpad byte available is $4E38 
        
        SYSSUK  SETOUT          ;  UPI SET some OUTput ports
        DB      $B6             ;  ... VERBL*2 = 182
        DB      $2C             ;  ... HORCB/4 = 44
        DB      $08             ;  ... INMOD = 8

        SYSSUK  COLSET          ;  UPI COLors SET
        DW      L208F           ;  ... Table Address = $208F

        DI      

;  Set-up Interrupt Vector for $2094
        LD      A,$94
        OUT     (INFBK),A       ; Port $D, write INterrupt FeedBacK
        LD      A,$20
        LD      I,A             ; High byte of Interrupt Vector

        JP      L22A1

;  Game Difficulty Level Text
L2054:  DB      "EASY",$00
L2059:  DB      "MEDIUM",$00
L2060:  DB      "HARD",$00
        
;  Game Difficulty Level Linked List  
L2065:  DW      L206B           ; Link to Choice 2
        DW      L2054           ; Address of Choice 1 Menu Text, "EASY"
        DW      L2026           ; Jump here if Choice 1 is selected

L206B   DW      L2071           ; Link to Choice 3
        DW      L2059           ; Address of Choice 2 Menu Text, "MEDIUM"
        DW      L202F           ; Jump here if Choice 2 is selected

L2071:  DW      $0000           ; Last Link in Linked List
        DW      L2060           ; Address of Choice 3 Menu Text, "HARD"
        DW      L202A           ; Jump here if Choice 3 is selected

;  Text      
L2077:  DB      "# OF PLAYERS",$00
L2084:  DB      "THE WIZARD",$00

;  Color Table
L208F:  DB      $63             ; color 3 Left = Red 
        DB      $7D             ; color 2 Left = Yellow 
        DB      $F4             ; color 1 Left = Blue 
        DB      $00             ; color 0 Left = Black 
        
        DB      $00

;  Screen INTerrupt VECtor
L2094:  DW      L2096           

;  Interrupt Routine        
L2096:  PUSH    AF
        PUSH    BC
        PUSH    DE
        PUSH    HL
        PUSH    IX
        PUSH    IY
        EX      AF,AF'
        PUSH    AF
        EXX     
        PUSH    BC
        PUSH    DE
        PUSH    HL
        CALL    L20B7
        POP     HL
        POP     DE
        POP     BC
        EXX     
        POP     AF
        EX      AF,AF'
        POP     IY
        POP     IX
        POP     HL
        POP     DE
        POP     BC
        POP     AF
        EI      
        RET   


L20B7:  LD      A,($4F26)
        RLA     
        JR      NC,L2106
        LD      A,($4FEB)
        RRA     
        JR      C,L20E5
        LD      IX,$4E38
        CALL    L211A
        LD      IX,$4E6C
        CALL    L2120
        LD      IX,$4E8B
        CALL    L2120
        LD      IX,$4EAA
        CALL    L2120
        CALL    L2134
        JP      L2106
L20E5:  LD      HL,$4F3C
        SET     3,(HL)
        LD      IX,$4E52
        CALL    L211A
        LD      IX,$4EC9
        CALL    L2120
        LD      IX,$4EE8
        CALL    L2120
        LD      IX,$4F07
        CALL    L2120
L2106:  CALL    STIMER         
        CALL    L3ED5
        LD      HL,$4F31
        LD      A,(HL)
        AND     A
        RET     Z

        DEC     (HL)
        RET     NZ

        LD      HL,$4FDE
        SET     5,(HL)
        RET     


L211A:  CALL    L2160
        JP      L2123
L2120:  CALL    L21B6
L2123:  CALL    L35C3
        BIT     6,(IX+$00)
        RET     Z

        LD      A,(IX+$03)
        AND     A
        RET     Z

        DEC     (IX+$03)
        RET     
        

L2134:  LD      HL,$4E86
        CALL    L2155
        LD      HL,$4EA5
        CALL    L2155
        LD      HL,$4EC4
        CALL    L2155
        LD      HL,$4EE3
        CALL    L2155
        LD      HL,$4F02
        CALL    L2155
        LD      HL,$4F21
L2155:  LD      B,$03
L2157:  LD      A,(HL)
        AND     A
        JR      Z,L215C
        DEC     (HL)
L215C:  INC     HL
        DJNZ    L2157
        RET


L2160:  CALL    L21F9
        RET     Z

        LD      B,$0B
        CALL    L2208
        LD      L,(IX+$16)
        LD      E,(IX+$17)
        BIT     2,(IX+$07)
        LD      IY,$4E38
        JR      Z,L217D
        LD      IY,$4E52
L217D:  CALL    L21D9
        CALL    L2196
        LD      IY,$4E6C
        LD      B,$06
L2189:  PUSH    BC
        CALL    L21D9
        LD      BC,$001F
        ADD     IY,BC
        POP     BC
        DJNZ    L2189
        RET     


L2196:  BIT     7,(IY+$15)
        RET     Z

        LD      A,(IX+$16)
        SUB     (IY+$16)
        ADD     A,$04
        CP      $09
        RET     NC

        LD      A,(IX+$17)
        SUB     (IY+$17)
        ADD     A,$04
        CP      $09
        RET     NC

        SET     5,(IY+$15)
        RET     

L21B6:  CALL    L21F9
        RET     Z

        LD      A,($4F2E)
        CP      $02
        LD      B,$0D
        JR      NZ,L21C5
        LD      B,$0B
L21C5:  CALL    L2208
        LD      L,(IX+$16)
        LD      E,(IX+$17)
        LD      IY,$4E38
        CALL    L21D9
        LD      IY,$4E52
L21D9:  LD      A,(IY+$00)
        AND     $C9
        CP      $80
        RET     NZ

        LD      A,(IY+$08)
        SUB     L
        ADD     A,$17
        CP      H
        RET     NC

        LD      A,(IY+$09)
        SUB     E
        ADD     A,$09
        CP      D
        RET     NC

        PUSH    HL
        PUSH    DE
        CALL    L3263
        POP     DE
        POP     HL
        RET     


L21F9:  PUSH    IX
        POP     HL
        LD      BC,$0015
        ADD     HL,BC
        PUSH    HL
        CALL    L2212
        POP     HL
        BIT     6,(HL)
        RET     


L2208:  BIT     1,(HL)
        LD      (HL),$00
L220C:  LD      H,B
        LD      D,$08
        RET     NZ

        EX      DE,HL
        RET      


L2212:  BIT     7,(HL)
        RET     Z

        LD      C,(HL)
        LD      A,C
        AND     $0C
        OUT     (XPAND),A       ; eXPANDer pixel definition port
        BIT     5,(HL)
        JR      NZ,L2260
        PUSH    HL
        CALL    L2262
        POP     HL
        PUSH    HL
        INC     HL
        LD      E,(HL)
        INC     HL
        LD      D,(HL)
        BIT     4,C
        LD      A,$04
        JR      Z,L2230
        RRCA    
L2230:  BIT     0,C
        JR      NZ,L2236
        NEG     
L2236:  BIT     1,C
        JR      Z,L223E
        ADD     A,E
        LD      E,A
        JR      L2240
L223E:  ADD     A,D
        LD      D,A
L2240:  LD      (HL),D
        DEC     HL
        LD      (HL),E
        INC     HL
        LD      A,E
        AND     $03
        LD      B,A
        CALL    L3201
        LD      A,B
        RRCA    
        RRCA    
        OR      D
        LD      D,A
        INC     HL
        LD      (HL),E
        INC     HL
        LD      (HL),D
        IN      A,($08)
        CALL    L226B
        POP     HL
        IN      A,($08)
        AND     A
        RET     Z

        SET     6,(HL)
L2260:  RES     7,(HL)
L2262:  INC     HL
        INC     HL
        INC     HL
        LD      E,(HL)
        INC     HL
        LD      D,(HL)
        LD      A,D
        OR      E
        RET     Z

L226B:  LD      A,D
        RLCA    
        RLCA    
        AND     $03
        OR      $28
        OUT     (MAGIC),A       ; write MAGIC register
        EX      DE,HL
        LD      A,H
        AND     $0F
        LD      H,A
        BIT     4,C
        JR      NZ,L228B
        BIT     1,C
        JR      NZ,L2285
        LD      B,$04
        JR      L2291
L2285:  LD      (HL),$FF
        INC     HL
        LD      (HL),$00
        RET     

L228B:  BIT     1,C
        JR      NZ,L229B
        LD      B,$06
L2291:  LD      DE,$0028
        LD      A,$88
L2296:  LD      (HL),A
        ADD     HL,DE
        DJNZ    L2296
        RET     

L229B:  LD      (HL),$FC
        INC     HL
        LD      (HL),$FC
        RET


L22A1:  SYSTEM  INTPC           ;  UPI INTerPret with Context create
;
        DO      RCALL           ;  UPI Real CALL asm language subroutine
        DW      L3D32           ;  ... Real Address = 15666 (Initialize? LFS 08/23/2016)
;
;  Check if there are two players.  If there are, initialize Number of Lives 
;  for player 2 to 7 lives. 
        DO      RCALL           ;  UPI Real CALL asm language subroutine
        DW      L22DA           ;  ... Real Address = 8922
;
;  Initialize Number of Lives for player 1 to 7 lives 
        DO      SETB            ;  UPI SET Byte
        DB      $07             ;  ... Data = 7
        DW      LIVES1          ;  Number of Lives for Player 1
;
        DO      RCALL           ;  UPI Real CALL asm language subroutine
        DW      L23A9           ;  ... Real Address = 9129
;
        DONT    XINTC           ;  UPI eXit INTerpreter with Context
;
        LD      HL,$4F3C
        RES     3,(HL)
        CALL    L3079

        SYSSUK  SENTRY          ;  UPI SENse TRansition
        DW      L22D6           ;  ... Keymask Address = 8918
;
        SYSSUK  DOIT            ;  UPI DOIT table, branch to translation handler
        DW      L2308           ;  ... Table Address = 8968
;
        SYSSUK  SENTRY          ;  UPI SENse TRansition
        DW      L22D6           ;  ... Keymask Address = 8918
;
        SYSSUK  DOIT            ;  UPI DOIT table, branch to translation handler
        DW      L2308           ;  ... Table Address = 8968
;
L22C9:  EI      
        LD      A,($4F3C)
        BIT     3,A
        JR      NZ,$22B1
        CALL    L2AF5
        JR      L22C9

;  Keypad Mask Table
L22D6:  DB      $00
        DB      $00
        DB      $00
        DB      $00

;  If there are two players, then initialize Number of Lives 
;  for player 2 to 7 lives. 
L22DA:  LD      A,($4FF3)       ; Number of Players
        DEC     A               ;                
        RET     Z               ; If only only player, then RET, else... 
        LD      A,$07           ;   ... Set Number of Players to 7 
        LD      (LIVES2),A      ;   ... Load Number of Lives for Player 1
        RET     

;  SENTRY RETURN Code SCT6 Handler
;  Counter-Timer 6 has counted down
L22E5:  LD      A,$01
        LD      ($4FDB),A
        CALL    L2F8A
        CALL    L2B30
        CALL    L33F4
        LD      HL,LIVES1
        LD      A,(HL)
        INC     HL
        OR      (HL)
        RET     NZ

        LD      A,($4E38)
        LD      HL,$4E52
        OR      (HL)
        RET     M

        LD      HL,$4FDE
        SET     4,(HL)
        RET     


;  DOIT table
L2308:  DB      $55             ; RCALL - $15 (SJ0), Joy 1 for player 1 changed
        DW      L2386           ; Handler Address

        DB      $57             ; RCALL - $17 (SJ1), Joy 2 for player 2 changed  
        DW      L238B           ; Handler Address

        DB      $54             ; RCALL - $14 (ST0), Trigger 1 for player 1 changed
        DW      L32CB           ; Handler Address

        DB      $56             ; RCALL - $16 (ST1), Trigger 2 for player 2 changed
        DW      L32D1           ; Handler Address

        DB      $51             ; RCALL - $11 (SSEC), SEConds timer has counted down 
        DW      L2342           ; Handler Address

        DB      $41             ; RCALL - $01 (SCT0), Counter-Timer 0 has counted down 
        DW      L2370           ; Handler Address

        DB      $42             ; RCALL - $02 (SCT1), Counter-Timer 1 has counted down
        DW      L237B           ; Handler Address

        DB      $43             ; RCALL - $03 (SCT2), Counter-Timer 2 has counted down
        DW      L337D           ; Handler Address

        DB      $44             ; RCALL - $04 (SCT3), Counter-Timer 3 has counted down
        DW      L34A1           ; Handler Address

        DB      $45             ; RCALL - $05 (SCT4), Counter-Timer 4 has counted down
        DW      L2409           ; Handler Address

        DB      $46             ; RCALL - $06 (SCT5), Counter-Timer 5 has counted down
        DW      L23C0           ; Handler Address

        DB      $47             ; RCALL - $07 (SCT6), Counter-Timer 6 has counted down
        DW      L22E5           ; Handler Address

        DB      $48             ; RCALL - $08 (SCT7), Counter-Timer 7 has counted down
        DW      L239A           ; Handler Address

        DB      $89             ; MCALL - $09 (SF0), Sentry, Flag bit 0 has changed
        DW      L245C           ; Handler Address

        DB      $4A             ; RCALL - $0A (SF1), Sentry, Flag bit 1 has changed
        DW      L324C           ; Handler Address

        DB      $4B             ; RCALL - $0B (SF2), Sentry, Flag bit 2 has changed
        DW      L3241           ; Handler Address

        DB      $4C             ; RCALL - $0C (SF3), Sentry, Flag bit 3 has changed
        DW      L23B2           ; Handler Address

        DB      $4D             ; RCALL - $0D (SF4), Sentry, Flag bit 4 has changed
        DW      L23D9           ; Handler Address

        DB      $4E             ; RCALL - $0E (SF5), Sentry, Flag bit 5 has changed
        DW      L3475           ; Handler Address

        DB      $C0             ; End of DOIT Table


;  SENTRY RETURN Code SSEC Handler
;  SEConds timer has counted down
L2342:  LD      A,($4F26)
        BIT     3,A
        JR      Z,L234D
        SYSSUK  DECCTS           ;  UPI DECrement CT'S under 
        DB      $FC              ;  ... Counters = 252
;
        RET     


L234D:  SYSSUK  DECCTS           ;  UPI DECrement CT'S under 
        DB      $FF              ;  ... Counters = 255
;
        LD      A,(COUNT1)
        AND     A
        CALL    NZ,L2366
        LD      A,(COUNT2)
        AND     A
        RET     Z

        DI      

; Display Countdown Timer for Player 2 to Exit Safe Area
        SYSSUK  DISNUM           ;  UPI DISplay NUMber
        DB      $7C              ;  ... X = 124
        DB      $4A              ;  ... Y = 74
        DB      $04              ;  ... Options = 4
        DB      $01              ;  ... Extended = 1
        DW      COUNT2           ;  ... Countdown Timer for Player 2
;                                       to Exit Safe Area
;
        RET     


; Display Countdown Timer for Player 1 to Exit Safe Area  
L2366:  DI      
        SYSSUK  DISNUM           ;  UPI DISplay NUMber
        DB      $1E              ;  ... X = 30
        DB      $4A              ;  ... Y = 74
        DB      $08              ;  ... Options = 8
        DB      $01              ;  ... Extended = 1
        DW      COUNT1           ;  ... Countdown Timer for Player 1
;                                       to Exit Safe Area
;
        RET     


;  SENTRY RETURN Code SCT0 Handler
;  Counter-Timer 0 has counted down
L2370:  LD      HL,$4E38
        BIT     0,(HL)
        JP      Z,L3005
        SET     1,(HL)
        RET     

;  SENTRY RETURN Code SCT1 Handler
;  Counter-Timer 1 has counted down
L237B:  LD      HL,$4E52
        BIT     0,(HL)
        JP      Z,L2FFA
        SET     1,(HL)
        RET      


;  SENTRY RETURN Code SJ0 Handler
;                Code SJ1 Handler              
;  Joystick 1 for player 1 has changed and/or
;  Joystick 2 for player 2 has changed
L2386:  LD      HL,$4E39        ; Joystick 1 handler
        JR      L238E
L238B:  LD      HL,$4E53        ; Joystick 2 handler
L238E:  LD      A,(HL)
        AND     $F0
        OR      B
        LD      (HL),A
        DEC     HL
        BIT     0,(HL)
        RET     Z

        SET     1,(HL)
        RET

;  SENTRY RETURN Code SCT7 Handler
;  Counter-Timer 7 has counted down
L239A:  LD      HL,$4E4D
        LD      A,($4E67)
        OR      (HL)
        JR      Z,L23A9
        LD      A,$01
        LD      ($4FDC),A
        RET     


L23A9:  CALL    L23F8
        LD      A,$01
        LD      ($4FDE),A
        RET     


;  SENTRY RETURN Code SF3 Handler
;  Sentry, Flag bit 3 has changed
L23B2:  CALL    L23D0           ; Display "ESCAPED" Message
        LD      HL,$4F26
        SET     3,(HL)
        LD      A,$02
        LD      ($4FDA),A
        RET     


;  SENTRY RETURN Code SCT5 Handler
;  Counter-Timer 5 has counted down
L23C0:  CALL    L23D0           ; Display "ESCAPED" Message
        CALL    L34B8          
        RES     3,(HL)
L23C8:  LD      HL,$4FDE
        SET     1,(HL)
        SET     2,(HL)
        RET     


; Display "ESCAPED" centered near bottom of screen 
L23D0:  DI      
        SYSSUK  STRDIS           ;  UPI STRing DISplay
        DB      $1B              ;  ... X = 27
        DB      $4A              ;  ... Y = 74
        DB      $6C              ;  ... Options: 2x, XOR Write, Red on Black
        DW      L23F0            ;  ... String Address of "ESCAPED"
        ;
        RET     


;  SENTRY RETURN Code SF4 Handler
;  Sentry, Flag bit 4 has changed
;
;  Display "GAME OVER" then perform System Reset via the On-Board
;  ROM's QUIT function.  This resets the machine and displays the main
;  menu again. 
L23D9:  DI      
        SYSSUK  STRDIS                  ;  UPI STRing DISplay
        DB      $30                     ;  ... X = 48
        DB      $18                     ;  ... Y = 24
        DB      $48                     ;  ... Options = 72
        DW      L23FF                   ;  ... String "GAME OVER"
        ;
        EI      
        SYSSUK  SETB                    ;  UPI SET Byte
        DB      $80                     ;  ... Data = 128
        DW      $4F40                   ;  ... Memory Address = 20288
        ;
        SYSSUK  PAWS                    ;  UPI PAUSE
        DB      $01                     ;  ... Interrupts = 1
        ;
        CALL    L23F8
        DI      
        SYSTEM  QUIT                    ;  UPI QUIT cassette execution


L23F0:  DB      "ESCAPED",$00

L23F8:  LD      A,($4F42)
        RLA     
        JR      NC,L23F8
        RET     
        
L23FF:  DB      "GAME" 
        DB      $06             ; Six spaces      
        DB      "OVER",$00  


;  SENTRY RETURN Code SCT4 Handler
;  Counter-Timer 4 has counted down
L2409:  DI      
        LD      HL,$4F26
        LD      A,(HL)
        XOR     $01
        LD      (HL),A
        RRA     
        LD      C,$0C
        JR      C,L242A
        LD      A,($4F2E)
        AND     A
        LD      A,$02
        JR      NZ,L2420
        LD      A,$0A
L2420:  LD      ($4FD9),A
        LD      HL,$4F42
        SET     4,(HL)
        LD      C,$00            ; ... Options: 1x, Standard Write, Black on Black
L242A:  LD      A,$5F            ; ... ASCII Character to Display (Left Arrow) 
        LD      DE,$1A04         ; ... X,Y Coordinates
        SYSTEM  CHRDIS           ;  UPI CHaRacter DISplay
        
        LD      A,$61            ; ... ASCII Character to Display (Right Arrow)
        LD      DE,$1A94         ; ... X,Y Coordinates
        SYSTEM  CHRDIS           ;  UPI CHaRacter DISplay
        
        LD      A,$04
        OUT     (XPAND),A        ; eXPANDer pixel definition port
        LD      A,$28
        OUT     (MAGIC),A        ; write MAGIC register
        LD      DE,$0028
        LD      A,$22
        LD      HL,$03C3
        CALL    L244F



        RLCA    
        LD      HL,$03E4
L244F:  CALL    L2455
        CALL    L2455
L2455:  ADD     HL,DE
        LD      (HL),A
        ADD     HL,DE
        LD      (HL),A
        ADD     HL,DE
        ADD     HL,DE
        RET     


;  SENTRY RETURN Code SF0 Handler
;  Flag bit 0 has changed

;  I'm not sure if the MCALL and the RCALL are disassembled correctly
;  as I had to do a lot of this part by hand.
L245C:  DO      MCALL           ; UPI Call Interprter Subroutine
        DW      L24C3           ; Address of routine to call
        ;
        DO      RCALL           ; UPI Real CALL asm language subroutine
        DW      L2E15           ; Address of routine to call
        ;
        DO      SETB            ;  UPI SET Byte
        DB      $01             ;  ... Data = 1
        DW      $4F40           ;  ... Memory Address = 20288
        ;
        DO      STRDIS          ;  UPI STRing DISplay
        DB      $2B             ;  ... X = 43
        DB      $0B             ;  ... Y = 11
        DB      $94             ;  ... Options = 148
        DW      L2510           ;  ... String Address of "GET"
        ;
        DO      STRDIS          ;  UPI STRing DISplay
        DB      $0A             ;  ... X = 10
        DB      $36             ;  ... Y = 54
        DB      $98             ;  ... Options = 152
        DW      L2514           ;  ... String Address of "READY"
        ;
        DONT    XINTC           ;  UPI eXit INTerpreter with Context

        LD      C,$60
        CALL    L2E8B
        SYSSUK  MCALL            ;  UPI Macro CALL interpreter subroutine
        DW      L24C3            ;  ... Macro Address = 9411
        ;
        SYSSUK  SETB             ;  UPI SET Byte
        DB      $02              ;  ... Data = 2
        DW      $4F40            ;  ... Memory Address = 20288
        ;
        SYSSUK  STRDIS           ;  UPI STRing DISplay
        DB      $20              ;  ... X = 32
        DB      $18              ;  ... Y = 24
        DB      $D4              ;  ... Options = 212
        DW      L251A            ;  ... String Address of "GO"
        ;
        LD      C,$34
        CALL    L2E8B
        SYSTEM  INTPC            ;  UPI INTerPret with Context create
        ;
        DO      MCALL            ;  UPI Macro CALL interpreter subroutine
        DW      L24C3            ;  ... Macro Address = 9411
        ;
        DO      RCALL            ;  UPI Real CALL asm language subroutine
        DW      L251D            ;  ... Real Address = 9501
        ;
        DO      RCALL            ;  UPI Real CALL asm language subroutine
        DW      L2757            ;  ... Real Address = 10071
        ;
        DO      RCALL            ;  UPI Real CALL asm language subroutine
        DW      L2EFE            ;  ... Real Address = 12030
        ;
        DO      RCALL            ;  UPI Real CALL asm language subroutine
        DW      L29E1            ;  ... Real Address = 10721
        ;
        DO      SETB             ;  UPI SET Byte
        DB      $0F              ;  ... Data = 15
        DW      $4FD7            ;  ... Memory Address = 20439
        ;
        DO      SETB             ;  UPI SET Byte
        DB      $02              ;  ... Data = 2
        DW      $4FDB            ;  ... Memory Address = 20443
        ;
        DO      RCALL            ;  UPI Real CALL asm language subroutine
        DW      L24F9            ;  ... Real Address = 9465
        ;
        DO      RCALL            ;  UPI Real CALL asm language subroutine
        DW      L24E0            ;  ... Real Address = 9440
        ;
        DO      RCALL            ;  UPI Real CALL asm language subroutine
        DW      L24ED            ;  ... Real Address = 9453
        ;
        DO      CHRDIS           ;  UPI CHaRacter DISplay
        DB      $20              ;  ... X = 32
        DB      $54              ;  ... Y = 84
        DB      $08              ;  ... Options = 8
        DB      $30              ;  ... Character = 48
        ;
        DO      SETB             ;  UPI SET Byte
        DB      $01              ;  ... Data = 1
        DW      $4FD9            ;  ... Memory Address = 20441
        ;
        DO      SETB             ;  UPI SET Byte
        DB      $01              ;  ... Data = 1
        DW      $4F27            ;  ... Memory Address = 20263
        ;
        DO      RCALL            ;  UPI Real CALL asm language subroutine
        DW      L24CD            ;  ... Real Address = 9421
        ;
        DO      RCALL            ;  UPI Real CALL asm language subroutine
        DW      L23C8            ;  ... Real Address = 9160
        ;
        DONT    MRET             ;  UPI Macro RETurn from interpreter subroutine


L24C3:  DO      FILL             ;  UPI FILL memory with data
        DW      NORMEM           ;  ... Memory Address = 16384
        DW      $0F32            ;  ... Byte Count = 3890
        DB      $00              ;  ... Data = 0
        ;
        DO      RCALL            ;  UPI Real CALL asm language subroutine
        DW      L3D32            ;  ... Real Address = 15666
        ;
        DONT    MRET             ;  UPI Macro RETurn from interpreter subroutine


L24CD:  LD      HL,$4F3C
        LD      A,(HL)
        RES     0,(HL)
        RES     1,(HL)
        RRCA    
        RRCA    
        RRCA    
        AND     $60
        OR      $80
        LD      ($4F26),A
        RET     


L24E0:  LD      IX,FNTSML
        SYSSUK  DISNUM                  ;  UPI DISplay NUMber
        DB      $6E                     ;  ... X = 110
        DB      $4E                     ;  ... Y = 78
        DB      $0C                     ;  ... Options = 12
        DB      $C2                     ;  ... Extended = 194
        DW      $4f33                   ;  ... Number Address = 20275
        ;
        RET     


L24ED:  LD      A,($4FF3)
        DEC     A
        RET     Z

        SYSSUK  CHRDIS                  ;  UPI CHaRacter DISplay
        DB      $98                     ;  ... X = 152
        DB      $54                     ;  ... Y = 84
        DB      $04                     ;  ... Options = 4
        DB      $30                     ;  ... Character = 48
        ;
        RET     


L24F9:  LD      A,($4F3C)
        BIT     6,A
        JR      NZ,L2507
        LD      A,($4F32)
        CP      $07
        JR      C,L2509
L2507:  LD      A,$06
L2509:  SUB     $07
        CPL     
        LD      ($4F2C),A
        RET     


L2510:  DB      "GET",$00 
L2514:  DB      "READY",$00
L251A:  DB      "GO",$00


L251D:  LD      A,($4F32)
        LD      C,A
        CP      $09
        JR      C,L253C
        AND     $03
        JR      NZ,L252C
        INC     A
        JR      $254E
L252C:  SYSSUK  RANGED           ;  UPI RANGED random number
        DB      $09              ;  ... Cutoff = 9
        ;
        CALL    L2562
        JR      NZ,L252C
        LD      A,(HL)
        OR      D
        LD      (HL),A
        LD      A,E
        ADD     A,$0F
        JR      L254E
L253C:  AND     $03
        JR      Z,L254E
L2540:  SYSSUK  RANGED           ;  UPI RANGED random number
        DB      $0D              ;  ... Cutoff = 13
        ;
        CALL    L2562
        JR      NZ,L2540
        LD      A,(HL)
        OR      D
        LD      (HL),A
        LD      A,E
        ADD     A,$02            ;  Displacement
L254E:  SYSSUK  INDEXW           ;  UPI INDEX Word by A
        DW      L2577            ;  ... Base Address = 9591
        ;
        EX      DE,HL           
        LD      ($4F28),HL
        LD      A,C
        AND     $07
        SUB     $07
        RET     NZ
        
        LD      H,A
        LD      L,A
        LD      ($4F34),HL
        RET     


L2562:  LD      E,A
        LD      HL,$4F34
        INC     A
        CP      $09
        JR      C,L256E
        SUB     $08
        INC     HL
L256E:  LD      B,A
        XOR     A
        SCF     
L2571:  RLA     
        DJNZ    L2571
        LD      D,A
        AND     (HL)
        RET     

;  Base Address of Table for INDEXW
;
;  I'm not sure how many tables are in this table, or what the entries
;  represent, but following the code using the debugger, I know that
;  the addresses run through AT LEAST entry $0D  

L2577:  DW      $25A7           ; Entry $00
        DW      $26A3           ; Entry $01
        DW      $25B9           ; Entry $02
        DW      $25CB           ; Entry $03
        DW      $25DD           ; Entry $04
        DW      $25EF           ; Entry $05
        DW      $2601           ; Entry $06
        DW      $2613           ; Entry $07
        DW      $2625           ; Entry $08
        DW      $2637           ; Entry $09
        DW      $2649           ; Entry $0A
        DW      $265B           ; Entry $0B
        DW      $266D           ; Entry $0C
        DW      $267F           ; Entry $0D

        DB      $91
        DB      $26
        DB      $B5
        DB      $26
        DB      $C7
        DB      $26
        DB      $D9
        DB      $26
        DB      $EB
        DB      $26
        DB      $FD
        DB      $26
        DB      $0F
        DB      $27
        DB      $21
        DB      $27
        DB      $33
        DB      $27
        DB      $45
        DB      $27

L25A7:  DB      $AC
        DB      $EE
        DB      $CE
        DB      $BC
        DB      $5B
        DB      $EF
        DB      $BC
        DB      $EF
        DB      $FF
        DB      $B6
        DB      $9F
        DB      $DD
        DB      $3B
        DB      $EF
        DB      $EC
        DB      $95
        DB      $95
        DB      $9C
        DB      $AC
        DB      $EE
        DB      $CE
        DB      $3A
        DB      $D7
        DB      $AD
        DB      $97
        DB      $AF
        DB      $FC
        DB      $AD
        DB      $73
        DB      $9E
        DB      $BC
        DB      $7B
        DB      $ED
        DB      $9C
        DB      $D5
        DB      $9C
        DB      $AC
        DB      $6A
        DB      $CE
        DB      $BC
        DB      $D7
        DB      $AD
        DB      $9E
        DB      $EF
        DB      $FE
        DB      $A5
        DB      $33
        DB      $33
        DB      $BC
        DB      $F7
        DB      $9F
        DB      $9C
        DB      $59
        DB      $CD
        DB      $AC
        DB      $6A
        DB      $CE
        DB      $3A
        DB      $DF
        DB      $CF
        DB      $97
        DB      $AF
        DB      $63
        DB      $AD
        DB      $73
        DB      $33
        DB      $BC
        DB      $F5
        DB      $BF
        DB      $9C
        DB      $DC
        DB      $51
        DB      $AC
        DB      $C6
        DB      $AE
        DB      $3A
        DB      $CD
        DB      $73
        DB      $97
        DB      $AE
        DB      $DF
        DB      $A7
        DB      $3B
        DB      $CD
        DB      $3B
        DB      $FF
        DB      $CE
        DB      $9D
        DB      $59
        DB      $CD
        DB      $AC
        DB      $6A
        DB      $CE
        DB      $BC
        DB      $DF
        DB      $63
        DB      $9E
        DB      $C7
        DB      $BF
        DB      $AD
        DB      $6B
        DB      $53
        DB      $BC
        DB      $7B
        DB      $ED
        DB      $9C
        DB      $D5
        DB      $9C
        DB      $A6
        DB      $AC
        DB      $EC
        DB      $3B
        DB      $5A
        DB      $FC
        DB      $9F
        DB      $E7
        DB      $BC
        DB      $A7
        DB      $33
        DB      $BE
        DB      $33
        DB      $BF
        DB      $53
        DB      $9D
        DB      $59
        DB      $CD
        DB      $AE
        DB      $EE
        DB      $EE
        DB      $33
        DB      $33
        DB      $33
        DB      $9F
        DB      $79
        DB      $73
        DB      $A7
        DB      $9E
        DB      $FF
        DB      $3B
        DB      $6B
        DB      $53
        DB      $95
        DB      $9D
        DB      $CD
        DB      $AC
        DB      $CE
        DB      $EC
        DB      $BC
        DB      $E5
        DB      $BC
        DB      $9E
        DB      $7A
        DB      $DE
        DB      $A5
        DB      $B7
        DB      $AF
        DB      $3A
        DB      $5B
        DB      $73
        DB      $9D
        DB      $C5
        DB      $9D
        DB      $AC
        DB      $6A
        DB      $CE
        DB      $BC
        DB      $FF
        DB      $EF
        DB      $9E
        DB      $53
        DB      $33
        DB      $A5
        DB      $A7
        DB      $BF
        DB      $BC
        DB      $5B
        DB      $73
        DB      $9C
        DB      $C5
        DB      $9D
        DB      $AC
        DB      $6A
        DB      $EC
        DB      $BC
        DB      $73
        DB      $9E
        DB      $96
        DB      $BF
        DB      $ED
        DB      $AD
        DB      $53
        DB      $BC
        DB      $BC
        DB      $EF
        DB      $FC
        DB      $9C
        DB      $D5
        DB      $9C
        DB      $A6
        DB      $AC
        DB      $EC
        DB      $3B
        DB      $FC
        DB      $FC
        DB      $97
        DB      $B6
        DB      $9E
        DB      $A7
        DB      $97
        DB      $AD
        DB      $3B
        DB      $EF
        DB      $DE
        DB      $9D
        DB      $59
        DB      $CD
        DB      $AC
        DB      $6A
        DB      $CE
        DB      $3A
        DB      $FD
        DB      $CF
        DB      $B5
        DB      $BC
        DB      $63
        DB      $BC
        DB      $7A
        DB      $DF
        DB      $3A
        DB      $DF
        DB      $63
        DB      $9D
        DB      $C5
        DB      $9D
        DB      $A6
        DB      $AC
        DB      $EC
        DB      $39
        DB      $7A
        DB      $DE
        DB      $9C
        DB      $79
        DB      $63
        DB      $AE
        DB      $DC
        DB      $73
        DB      $3B
        DB      $EE
        DB      $FD
        DB      $95
        DB      $95
        DB      $9C
        DB      $AE
        DB      $EE
        DB      $EE
        DB      $BF
        DB      $FF
        DB      $FF
        DB      $BF
        DB      $FF
        DB      $FF
        DB      $BF
        DB      $FF
        DB      $FF
        DB      $BF
        DB      $FF
        DB      $FF
        DB      $9D
        DB      $DD
        DB      $DD
        DB      $AE
        DB      $CE
        DB      $EE
        DB      $B7
        DB      $AD
        DB      $53
        DB      $B5
        DB      $3A
        DB      $EF
        DB      $BE
        DB      $D5
        DB      $BF
        DB      $B7
        DB      $AE
        DB      $FF
        DB      $9D
        DB      $DD
        DB      $DD
        DB      $AE
        DB      $EE
        DB      $CE
        DB      $BF
        DB      $F5
        DB      $AF
        DB      $BF
        DB      $DE
        DB      $FF
        DB      $B5
        DB      $AF
        DB      $53
        DB      $BE
        DB      $F5
        DB      $AF
        DB      $9D
        DB      $DC
        DB      $DD
        DB      $AE
        DB      $EE
        DB      $EE
        DB      $3B
        DB      $73
        DB      $BF
        DB      $33
        DB      $B7
        DB      $33
        DB      $B7
        DB      $3B
        DB      $73
        DB      $BF
        DB      $73
        DB      $BF
        DB      $9D
        DB      $DD
        DB      $DD
        DB      $AE
        DB      $EE
        DB      $EE
        DB      $39
        DB      $F5
        DB      $BF
        DB      $B6
        DB      $BE
        DB      $73
        DB      $BD
        DB      $79
        DB      $73
        DB      $3A
        DB      $F6
        DB      $BF
        DB      $9D
        DB      $DD
        DB      $DD
        DB      $AE
        DB      $EE
        DB      $CE
        DB      $39
        DB      $F5
        DB      $AF
        DB      $BE
        DB      $DE
        DB      $FF
        DB      $BF
        DB      $6B
        DB      $DF
        DB      $BF
        DB      $F5
        DB      $AF
        DB      $9D
        DB      $DC
        DB      $DD
        DB      $AE
        DB      $EE
        DB      $CE
        DB      $B5
        DB      $9F
        DB      $63
        DB      $B6
        DB      $A5
        DB      $9F
        DB      $39
        DB      $F6
        DB      $AF
        DB      $B6
        DB      $BF
        DB      $FF
        DB      $9D
        DB      $DD
        DB      $DD
        DB      $AC
        DB      $EE
        DB      $EE
        DB      $B6
        DB      $9F
        DB      $53
        DB      $BF
        DB      $E7
        DB      $AF
        DB      $BF
        DB      $5B
        DB      $DF
        DB      $B5
        DB      $AF
        DB      $63
        DB      $9C
        DB      $DD
        DB      $DD
        DB      $AC
        DB      $EE
        DB      $CE
        DB      $B6
        DB      $9F
        DB      $ED
        DB      $BF
        DB      $ED
        DB      $FE
        DB      $BF
        DB      $F6
        DB      $9F
        DB      $B7
        DB      $BF
        DB      $63
        DB      $9D
        DB      $DD
        DB      $DD
        DB      $AC
        DB      $EE
        DB      $EC
        DB      $BE
        DB      $D7
        DB      $BC
        DB      $3B
        DB      $ED
        DB      $FE
        DB      $3B
        DB      $DE
        DB      $FD
        DB      $BD
        DB      $E7
        DB      $BC
        DB      $9C
        DB      $DD
        DB      $DC

L2757:  DI      
        LD      A,$10
        OUT     (MAGIC),A       ; write MAGIC register
        LD      HL,$0003
        EXX     
        LD      D,$00
L2762:  LD      E,$00
L2764:  PUSH    DE
        CALL    L27B8      
        CALL    L27EE      
        CALL    L2801      
        CALL    L280C      
        CALL    L281E
        EXX     
        INC     HL
        INC     HL
        INC     HL
        EXX     
        POP     DE
        LD      A,E
        ADD     A,$0C
        LD      E,A
        CP      $79
        JR      C,L2764
        EXX     
        LD      DE,$01BF
        ADD     HL,DE
        EXX     
        LD      A,D
        ADD     A,$0C
        LD      D,A
        CP      $3D
        JR      C,L2762
        SYSTEM  INTPC           ;  UPI INTerPret with Context create
        ;
        DO      RECTAN          ;  UPI paint a RECTANgle
        DB      $0E             ;  ... X = 14
        DB      $48             ;  ... Y = 72
        DB      $0C             ;  ... Width = 12
        DB      $0C             ;  ... Height = 12
        DB      $FF             ;  ... Color = 255
        ;
        DO      RECTAN          ;  UPI paint a RECTANgle
        DB      $0F             ;  ... X = 15
        DB      $48             ;  ... Y = 72
        DB      $0A             ;  ... Width = 10
        DB      $0B             ;  ... Height = 11
        DB      $00             ;  ... Color = 0
        ;
        DO      RECTAN          ;  UPI paint a RECTANgle
        DB      $86             ;  ... X = 134
        DB      $48             ;  ... Y = 72
        DB      $0C             ;  ... Width = 12
        DB      $0C             ;  ... Height = 12
        DB      $FF             ;  ... Color = 255
        ;
        DO      RECTAN          ;  UPI paint a RECTANgle
        DB      $87             ;  ... X = 135
        DB      $48             ;  ... Y = 72
        DB      $0A             ;  ... Width = 10
        DB      $0B             ;  ... Height = 11
        DB      $00             ;  ... Color = 0
        ;
        DO      RECTAN          ;  UPI paint a RECTANgle
        DB      $36             ;  ... X = 54
        DB      $47             ;  ... Y = 71
        DB      $32             ;  ... Width = 50
        DB      $14             ;  ... Height = 20
        DB      $55             ;  ... Color = 85
        ;
        DO      RECTAN          ;  UPI paint a RECTANgle
        DB      $37             ;  ... X = 55
        DB      $48             ;  ... Y = 72
        DB      $30             ;  ... Width = 48
        DB      $12             ;  ... Height = 18
        DB      $00             ;  ... Color = 0
        ;
        DONT    XINTC           ;  UPI eXit INTerpreter with Context
        ;
        RET


L27B8:  LD      A,D
        RST     $08             ;  User ReStarT #1 of 6
        LD      A,C
        ADD     A,C
        ADD     A,C
        LD      D,A
        LD      A,E
        RST     $08             ;  User ReStarT #1 of 6
        LD      A,C
        LD      C,$00
        CP      $06
        JR      C,L27CB
        INC     C
        SUB     $0B
        CPL     
L27CB:  SRL     A
        JR      C,L27D1
        SET     1,C
L27D1:  ADD     A,D
        LD      E,A
        LD      D,$00
        LD      HL,($4F28)
        ADD     HL,DE
        LD      A,(HL)
        BIT     1,C
        JR      Z,L27E2
        RRCA    
        RRCA    
        RRCA    
        RRCA    
L27E2:  BIT     0,C
        LD      C,A
        RET     Z

        AND     $0C
        RET     PE
        
        LD      A,C
        XOR     $0C
        LD      C,A
        RET     


L27EE:  BIT     0,C
        RET     NZ

        EXX     
        PUSH    HL
L27F3:  LD      (HL),$0F  ; Data for $4003 (Top-left corner of red line of area ??)
        INC     HL
        LD      (HL),$FF
        INC     HL
        LD      (HL),$FF
        INC     HL
        LD      (HL),$F0
L27FE:  POP     HL
        EXX     
        RET     


L2801:  BIT     1,C
        RET     NZ

        EXX     
        PUSH    HL
        LD      DE,$01B8
        ADD     HL,DE
        JR      L27F3
L280C:  BIT     2,C
        RET     NZ

        EXX     
        PUSH    HL
        LD      A,$0C
L2813:  LD      B,$0C
        LD      DE,$0028
L2818:  LD      (HL),A
        ADD     HL,DE
        DJNZ    L2818
        JR      L27FE
L281E:  BIT     3,C
        RET     NZ

        EXX     
        PUSH    HL
        INC     HL
        INC     HL
        INC     HL
        LD      A,$30
        JR      L2813
L282A:  LD      (IX+$01),B
        BIT     0,(IX+$00)
        RET     NZ

        EXX     
        LD      A,C
        AND     A
        RET     Z

        EXX     
L2837:  LD      A,(IX+$07)
L283A:  ADD     A,$40
        CP      $C0
        JR      NC,L283A
        AND     $FC
        OR      C
        LD      (IX+$07),A
L2846:  LD      A,(IX+$07)
L2849:  RES     5,(IX+$00)
L284D:  RST     $30              ;  User ReStarT #6 of 6
        LD      BC,$000A
        JP      L295A
L2854:  BIT     7,(IX+$0A)
        RET     NZ

        BIT     5,(IX+$00)
        RET     Z

        JR      L2846
L2860:  LD      A,(IX+$00)
        AND     $C0
        CP      $80
        RET     NZ

        BIT     7,(IX+$0A)
        RET     NZ

        CALL    L2A5A
        LD      C,$00
        EXX     
        LD      A,(IX+$01)
        AND     $0F
        LD      B,A
        LD      (IX+$01),A
        RST     $20              ;  User ReStarT #4 of 6
        JR      NZ,L282A
        RST     $20              ;  User ReStarT #4 of 6
        JR      NZ,L282A
        RET      


; Reset VECTor #4 / 32 / $20
L2883:  CALL    L288A
        LD      A,B
        AND     $F0
        RET     
 

L288A:  RST     $30             ;  User restart #6 of 6
        BIT     4,(IX+$00)
        JR      Z,L28FF
        RES     4,(IX+$00)
        LD      A,D
        RST     $08             ;  User restart #1 of 6
        RET     NZ
        
        BIT     2,B
        JR      Z,$28AF
        LD      A,$0B
        ADD     A,E
        LD      E,A
        CALL    L2EF2
        RET     NZ
        
        LD      C,$02
        SET     6,B
        CALL    L293D
        SBC     HL,DE
        JR      $28BE
        BIT     3,B
        RET     Z
        
        CALL    L2EE8
        RET     NZ
        
        LD      C,$03
        SET     7,B
        CALL    L293D
        ADD     HL,DE
        LD      A,H
        CP      $F0
        JR      C,$28C7
        LD      A,$78
        JR      $28CC
        CP      $79
        JR      C,$28F2
        XOR     A
        EX      AF,AF'
        CALL    L2409
        EX      AF,AF'
        LD      H,A
        LD      L,$00
        BIT     2,(IX+$00)
        JR      Z,$28F2
        LD      D,A
        LD      A,($4F2E)
        DEC     A
        LD      A,D
        JR      NZ,$28F2
        LD      HL,$4F42
        SET     5,(HL)
L28E7:  CALL    L34D1
        LD      HL,$4FDE
        SET     3,(HL)
        JP      L3445
        CP      (IX+$04)
        CALL    NZ,L2956
        LD      (IX+$03),L
        LD      (IX+$04),H
        RET     


;  JR to here.  Follow code.
L28FF:  SET     4,(IX+$00)
        LD      A,E
        RST     $08                     ;  USER RESTART #1 OF 6
        RET     NZ

        BIT     0,B
        JR      Z,L291D
        LD      A,$0B
        ADD     A,D
        LD      D,A
        CALL    L2ED6
        RET     NZ

        LD      C,$00
        SET     4,B
        CALL    L2945
        SBC     HL,DE
        JR      L292C
L291D:  BIT     1,B
        RET     Z

        CALL    L2EDE
        RET     NZ

        LD      C,$01
        SET     5,B
        CALL    L2945
        ADD     HL,DE
L292C:  LD      A,H
        CP      $3D
        RET     NC

        CP      (IX+$06)
        CALL    NZ,L2956
        LD      (IX+$05),L
        LD      (IX+$06),H
        RET     


L293D:  LD      E,(IX+$03)
        LD      D,(IX+$04)
        JR      L294B
L2945:  LD      E,(IX+$05)
        LD      D,(IX+$06)
L294B:  LD      L,(IX+$02)
        LD      H,$00
        ADD     HL,HL
        ADD     HL,HL
        ADD     HL,HL
        ADD     HL,HL
        EX      DE,HL
        RET     


L2956:  EXX     
        INC     C
        EXX     
        RET     


L295A:  PUSH    IX
        POP     HL
        ADD     HL,BC
        PUSH    HL
        BIT     4,(HL)
        JR      NZ,L2966
        LD      C,$05
        ADD     HL,BC
L2966:  INC     HL
        PUSH    AF
        INC     D
        INC     D
        LD      A,E
        ADD     A,$10
        LD      E,A
        POP     AF
        PUSH    HL
        BIT     2,(IX+$00)
        LD      HL,$3646
        JR      NZ,L297C
        LD      HL,$3696
L297C:  BIT     6,(IX+$00)
        JR      Z,L2985
        LD      HL,$363E
L2985:  PUSH    AF
        PUSH    AF
        RLCA    
        RLCA    
        AND     $03
        LD      C,A
        POP     AF
        AND     $1E
        RLA     
        OR      C
        LD      C,A
        POP     AF
        ADD     HL,BC
        ADD     HL,BC
        EX      (SP),HL
        INC     A
        BIT     1,A
        LD      C,$00
        JR      Z,L29BE
        BIT     0,A
        PUSH    AF
        JR      NZ,L29B7
        BIT     2,(IX+$00)
        JR      Z,L29AF
        DEC     A
        AND     $1C
        CP      $0C
        JR      Z,L29BD
L29AF:  LD      A,$07
        LD      C,$80
        ADD     A,D
        LD      D,A
        JR      L29BD
L29B7:  LD      C,$40
        LD      A,$07
        ADD     A,E
        LD      E,A
L29BD:  POP     AF
L29BE:  INC     A
        AND     $03
        LD      A,E
        JR      NZ,L29C5
        CPL     
L29C5:  AND     $03
        OR      C
        OR      $20
        LD      (HL),A
        CALL    L3201
        INC     HL
        LD      (HL),E
        INC     HL
        LD      (HL),D
        EX      (SP),HL
        LD      E,(HL)
        INC     HL
        LD      D,(HL)
        POP     HL
        INC     HL
        LD      (HL),E
        INC     HL
        LD      (HL),D
        POP     HL
        SET     5,(HL)
        SET     7,(HL)
        RET


L29E1:  LD      A,($4F32)
        CP      $09
        JR      C,L29EA
        LD      A,$08
L29EA:  SYSSUK  INDEXB           ;  UPI INDEX Byte by A
        DW      L2A51            ;  ... Base Address = 10833
        ;
        LD      C,A
        LD      B,$06
L29F1:  PUSH    BC
        LD      A,B
        RST     $18              ;  User ReStarT #3 of 6
        CALL    L29FB
        POP     BC
        DJNZ    L29F1
        RET     


L29FB:  SYSSUK  INDEXW           ;  UPI INDEX Word by A
        DW      $2A44            ;  ... Base Address = 10820
        ;
        RRA     
        JR      C,L2A06
        SET     3,(IX+$0A)
L2A06:  SYSSUK  RANGED           ;  UPI RANGED random number
        DB      $03              ;  ... Cutoff = 3
        ;
        CALL    L2A3C
        LD      E,A
        INC     HL
        SYSSUK  RANGED           ;  UPI RANGED random number
        DB      $02              ;  ... Cutoff = 2
        ;
        CALL    L2A3C
        LD      D,A
        INC     C
        LD      A,C
        CP      $10
        JR      C,L2A1D
        AND     $F0
L2A1D:  LD      C,A
        XOR     A
L2A1F:  LD      B,$A4
L2A21:  PUSH    IX
        POP     HL
        PUSH    HL
        INC     HL
        LD      (HL),$00
        INC     HL
        LD      (HL),C
        LD      C,$00
        INC     HL
        LD      (HL),C
        INC     HL
        LD      (HL),E
        INC     HL
        LD      (HL),C
        INC     HL
        LD      (HL),D
        INC     HL
        LD      (HL),A
        INC     HL
        LD      (HL),$A0
        POP     HL
        LD      (HL),B
        RET     


L2A3C:  LD      B,A
        INC     B
        LD      A,$F4
L2A40:  ADD     A,$0C
        DJNZ    L2A40
        ADD     A,(HL)
        RET     
 

        DB      $0C
        DB      $00
        DB      $30
        DB      $00
        DB      $54
        DB      $00
        DB      $0C
        DB      $18
        DB      $30
        DB      $18
        DB      $54

;  Table for INDEXB
L2A51:  DB      $18
        DB      $00
        DB      $01
        DB      $02
        DB      $03
        DB      $04
        DB      $05
        DB      $06
        DB      $07


L2A5A:  BIT     3,(IX+$0A)
        LD      HL,$4E38
        LD      DE,$4E52
        JR      Z,L2A67
        EX      DE,HL
L2A67:  LD      A,(IX+$01)
        AND     $F0
        JR      Z,L2A88
        LD      A,(IX+$1A)
        AND     A
        RET     NZ

        LD      A,($4F2E)
        DEC     A
        JR      Z,L2AA6
        LD      A,(HL)
        AND     $C1
        CP      $80
        JR      Z,L2ABE
        EX      DE,HL
        LD      A,(HL)
        AND     $C1
        CP      $80
        JR      Z,L2ABE
L2A88:  LD      A,(IX+$06)
        CP      $18
        LD      C,$02
        JR      C,L2A93
        LD      C,$01
L2A93:  LD      A,R
        BIT     4,A
        LD      B,$01
        JR      Z,L2A9C
        LD      B,C
L2A9C:  BIT     2,A
        LD      A,$04
        JR      Z,L2AA4
        LD      A,$08
L2AA4:  JR      L2AD8
L2AA6:  LD      A,(IX+$06)
        CP      $0C
        LD      B,$02
        JR      C,L2AB1
        LD      B,$01
L2AB1:  LD      A,($4F26)
        BIT     2,A
        LD      A,$04
        JR      NZ,L2AD8
        LD      A,$08
        JR      L2AD8
L2ABE:  LD      BC,$0004
        ADD     HL,BC
        LD      A,(HL)
        SUB     (IX+$04)
        LD      B,$08
        JR      NC,L2ACC
        LD      B,$04
L2ACC:  INC     HL
        INC     HL
        LD      A,(HL)
        SUB     (IX+$06)
        LD      A,$02
        JR      NC,L2AD8
        LD      A,$01
L2AD8:  OR      B
        LD      (IX+$01),A
        LD      B,$7F
        LD      A,(IX+$02)
        RRA     
        RRA     
        RRA     
        RRA     
        AND     $0F
        JR      Z,L2AEE
L2AE9:  SRL     B
        RRA     
        JR      NC,L2AE9
L2AEE:  LD      A,R
        AND     B
        LD      (IX+$1A),A
        RET


L2AF5   LD      A,($4F27)
        AND     A
        RET     Z

        PUSH    IY
        LD      HL,$4F2B
        CALL    L2B55
        CALL    L2C4C
        CALL    L2B69
        CALL    L2860
        CALL    L2B9E
        CALL    L2854
        LD      IY,$4E38
        CALL    L2C68
        CALL    L3015
        CALL    L2D76
        LD      IY,$4E52
        CALL    L2C68
        CALL    L3015
        CALL    L2D76
        POP     IY
        JP      L31AC


L2B30:  CALL    L2B38
        BIT     0,(IX+$0A)
        RET     NZ

L2B38:  LD      HL,$4F2A
        CALL    L2B55
        RES     0,(IX+$0A)
        PUSH    IY
        LD      IY,$4E38
        CALL    L2C6C
        LD      IY,$4E52
        CALL    L2C6C
        POP     IY
        RET     
        
        
L2B55:  INC     (HL)
        LD      A,(HL)
        CP      $06
        JR      C,L2B5D
        LD      (HL),$00
L2B5D:  LD      B,A
        RST     $18              ;  User ReStarT #3 of 6
        BIT     7,(IX+$00)
        RET     NZ

        LD      A,(HL)
        AND     A
        JR      NZ,L2B55
        RET     

L2B69:  BIT     3,(IX+$00)
        RET     Z

        SET     5,(IX+$15)
        LD      A,$06
        CALL    L2B8E
        LD      A,($4F2E)
        AND     A
        LD      HL,$4F42
        JR      Z,L2B8B
        DEC     A
        JR      Z,L2B88
        DEC     HL
        DEC     HL
        SET     3,(HL)
        RET     


L2B88:  SET     0,(HL)
        RET

L2B8B:  SET     1,(HL)
        RET     


L2B8E:  SET     6,(IX+$00)
        RES     3,(IX+$00)
        LD      (IX+$03),$01
        LD      (IX+$05),A
        RET     


L2B9E:  BIT     6,(IX+$00)
        RET     Z

        BIT     7,(IX+$0A)
        RET     NZ

        LD      A,(IX+$03)
        AND     A
        RET     NZ

        LD      (IX+$03),$04
        DEC     (IX+$05)
        JR      Z,L2BC3
        LD      A,(IX+$07)
        ADD     A,$40
        LD      (IX+$07),A
        AND     $C0
        JP      L2849


L2BC3:  BIT     2,(IX+$00)
        CALL    L34D1
        RET     Z

        LD      A,(IX+$07)
        AND     $1C
        CP      $08
        RET     NC

        AND     A
        JR      NZ,L2BDB
        LD      HL,$4F2C
        DEC     (HL)
        RET     P

L2BDB:  LD      HL,$4F41
        BIT     2,A
        JR      Z,L2BE6
        SET     3,(HL)
        JR      L2BE8
L2BE6:  SET     4,(HL)
L2BE8:  LD      C,(IX+$02)
        LD      A,(IX+$07)
        ADD     A,$04
L2BF0:  AND     $3C
        EX      AF,AF'
L2BF3:  LD      A,$07
        CALL    L2C41
        ADD     A,$18
        LD      E,A
        LD      A,($4E3C)
        SUB     E
        ADD     A,$12
        CP      $24
        JR      C,L2BF3
        LD      A,($4E56)
        SUB     E
        ADD     A,$12
        CP      $24
        JR      C,L2BF3
        LD      A,($4F2E)
        DEC     A
        JR      NZ,L2C1F
        LD      A,E
        CP      $3D
        JR      C,L2C1F
        LD      HL,$4F26
        SET     2,(HL)
L2C1F:  LD      A,$06
        CALL    L2C41
        LD      D,A
        LD      A,($4E3E)
        SUB     D
        ADD     A,$06
        CP      $0C
        JR      C,L2C1F
        LD      A,($4E58)
        SUB     D
        ADD     A,$06
        CP      $0C
        JR      C,L2C1F
        EX      AF,AF'
        LD      (IX+$1B),$2D
        JP      L2A1F
L2C41:  SYSTEM  RANGED           ;  UPI RANGED random number
        ;
        INC     A
        LD      B,A
        LD      A,$F4
L2C47:  ADD     A,$0C
        DJNZ    L2C47
        RET     


L2C4C:  RST     $30                     ;  User ReStarT #6 of 6
        LD      HL,COUNT1
        LD      A,E
        CP      $3C
        JR      C,L2C56
        INC     HL
L2C56:  LD      A,(HL)
        AND     A
        JR      NZ,L2C5F
        RES     2,(IX+$0A)
        RET     


L2C5F:  SET     2,(IX+$0A)
L2C63:  RES     0,(IX+$00)
        RET     


L2C68:  LD      B,$81
        JR      L2C6E
L2C6C:  LD      B,$80
L2C6E:  BIT     2,(IX+$0A)
        RET     NZ

        LD      A,(IX+$00)
        AND     $C1
        CP      B
        RET     NZ

        LD      A,(IY+$00)
        AND     $C1
        CP      $80
        RET     NZ

        RST     $28              ;  User ReStarT #5 of 6
        LD      A,D
        SUB     H
        ADD     A,$0B
        CP      $16
        JR      NC,L2C9F
        CALL    L2D24
        JR      Z,L2CBC
        CALL    L2D11
        JR      Z,L2CBC
        CALL    L2D18
        JR      Z,L2CBC
        CALL    L2D1B
        JR      Z,L2CBC
L2C9F:  RST     $28              ;  User ReStarT #5 of 6
        LD      A,E
        SUB     L
        ADD     A,$0B
        CP      $16
        JR      NC,L2CED
        CALL    L2D4F
        JR      Z,L2CBC
        CALL    L2D3C
        JR      Z,L2CBC
        CALL    L2D43
        JR      Z,L2CBC
        CALL    L2D46
        JR      NZ,L2CED
L2CBC:  LD      A,R
        RRA     
        JR      NC,L2CCA
        LD      A,(IX+$01)
        AND     $0F
        LD      (IX+$01),A
        RET     


L2CCA:  LD      (IX+$1B),$1E
        SET     1,(IX+$0A)
        BIT     0,(IX+$00)
        RET     Z

        CALL    L2C63
        LD      A,(IX+$07)
        AND     $1C
        RET     Z

        LD      HL,$4F41
        SUB     $04
        JR      NZ,L2CEA
        SET     4,(HL)
        RET     


L2CEA:  SET     3,(HL)
        RET     

L2CED:  RES     1,(IX+$00)
        RES     1,(IX+$0A)
        LD      A,(IX+$1B)
        AND     A
        RET     NZ

        LD      A,($4F32)
        DEC     A
        RET     Z

        LD      A,(IX+$07)
        AND     $1C
        RET     Z

        CP      $0C
        RET     NC

        SET     0,(IX+$00)
        SET     7,(IX+$0A)
        RET     


L2D11:  RST     $28              ;  User ReStarT #5 of 6
        LD      A,H
        ADD     A,$07
        LD      H,A
        JR      L2D24
L2D18:  RST     $28              ;  User ReStarT #5 of 6
        JR      $2D20
L2D1B:  RST     $28              ;  User ReStarT #5 of 6
        LD      A,H
        ADD     A,$07
        LD      H,A
        LD      A,D
        ADD     A,$07
        LD      D,A
L2D24:  LD      A,D
        LD      B,H
        CALL    L2D6C
        RET     NZ

        LD      A,E
        CP      L
        JR      C,L2D2F
L2D2E:  EX      DE,HL
L2D2F:  LD      A,L
        LD      B,E
        RST     $10              ;  User ReStarT #2 of 6
        RET     Z

        LD      B,A
        CALL    L2EE8
        LD      DE,$0003
        JR      $2D65
L2D3C:  RST     $28              ;  User ReStarT #5 of 6
        LD      A,L
        ADD     A,$07
        LD      L,A
        JR      L2D4F
L2D43:  RST     $28              ;  User ReStarT #5 of 6
        JR      $2D4B
L2D46:  RST     $28              ;  User ReStarT #5 of 6
        LD      A,L
        ADD     A,$07
        LD      L,A
        LD      A,E
        ADD     A,$07
        LD      E,A
L2D4F:  LD      A,E
        LD      B,L
        CALL    L2D6C
        RET     NZ

        LD      A,D
        CP      H
        JR      C,L2D5A
L2D59:  EX      DE,HL
L2D5A:  LD      A,H
        LD      B,D
        RST     $10              ;  User ReStarT #2 of 6
        RET     Z

        LD      B,A
        CALL    L2EDE
        LD      DE,$01E0
        LD      A,(HL)
        AND     C
        RET     NZ

        ADD     HL,DE
        DJNZ    $2D65
        RET     


L2D6C:  SET     0,(IX+$0A)
        PUSH    DE
        PUSH    HL
        RST     $10                     ;  USER RESTART #2 OF 6
        POP     HL
        POP     DE
        RET     

L2D76:  LD      A,($4F3C)
        RLA     
        RET     C

        LD      A,(IX+$00)
        AND     $C1
        CP      $80
        RET     NZ

        BIT     1,(IX+$0A)
        RET     Z

        LD      A,(IX+$02)
        CP      $20
        RET     NC

        BIT     7,(IX+$15)
        RET     NZ

        LD      A,(IX+$1C)
        AND     A
        RET     NZ

        LD      A,(IY+$00)
        AND     $C1
        CP      $80
        RET     NZ

        RST     $28                     ;  USER RESTART #5 OF 6
        LD      A,(IX+$07)
        AND     $03
        JR      Z,L2DD6
        DEC     A
        JR      Z,L2DE4
        DEC     A
        JR      Z,L2DBC
        LD      A,D
        CP      H
        RET     NZ

        LD      A,E
        CP      L
        RET     NC

        CALL    L2D2F
        RET     NZ

        LD      A,$18
        JR      L2DC8
L2DBC:  LD      A,D
        CP      H
        RET     NZ

        LD      A,E
        CP      L
        RET     C

        CALL    L2D2E
        RET     NZ

        LD      A,$0B
L2DC8:  ADD     A,(IX+$04)
        AND     $FE
        LD      E,A
        LD      A,(IX+$06)
        ADD     A,$06
        LD      D,A
        JR      L2DFC
L2DD6:  LD      A,E
        CP      L
        RET     NZ

        LD      A,D
        CP      H
        RET     C

        CALL    L2D59
        RET     NZ

        LD      A,$FD
        JR      L2DF0
L2DE4:  LD      A,E
        CP      L
        RET     NZ

        LD      A,D
        CP      H
        RET     NC

        CALL    L2D5A
        RET     NZ

        LD      A,$0A
L2DF0:  ADD     A,(IX+$06)
        AND     $FE
        LD      D,A
        LD      A,(IX+$04)
        ADD     A,$14
        LD      E,A
L2DFC:  BIT     1,(IX+$00)
        JR      NZ,L2E0B
        SET     1,(IX+$00)
        LD      (IX+$1C),$0F
        RET     

L2E0B:  LD      HL,$4F42
        SET     3,(HL)
        LD      H,$90
        JP      L3304


L2E15:  LD      B,$00
        LD      HL,$4F33
        LD      A,(HL)
        INC     A
        DAA     
        LD      (HL),A
        DEC     HL
        INC     (HL)
        LD      A,(HL)
        CP      $08
        JR      NZ,L2E26
        INC     (HL)
L2E26:  AND     $03
        CALL    Z,L2E5F
        LD      A,($4F3C)
        AND     $03
        JR      Z,L2E52
        CALL    L2E7A
        SYSSUK  STRDIS           ;  UPI STRing DISplay
        DB      $2C              ;  ... X = 44
        DB      $30              ;  ... Y = 48
        DB      $04              ;  ... Options = 4
        DW      L2EAD            ;  ... String Address =of "ALL SCORES"
        ;
        SYSSUK  STRDIS           ;  UPI STRing DISplay
        DB      $26              ;  ... X = 38
        DB      $40              ;  ... Y = 64
        DB      $48              ;  ... Options = 72
        DW      L2EB8            ;  ... String Address of "DOUBLE"
        ;
        LD      A,($4F3C)
        AND     $03
        JP      PO,L2E52
        SYSSUK  STRDIS           ;  UPI STRing DISplay
        DB      $0E              ;  ... X = 14
        DB      $40              ;  ... Y = 64
        DB      $48              ;  ... Options = 72
        DW      L2EBF            ;  ... String Address of "QUADRUPLE"
        ;
L2E52:  LD      A,B
        AND     A
        RET     Z

        LD      C,$78
        CALL    L2E8B
        SYSSUK  MCALL            ;  UPI Macro CALL interpreter subroutine
        DW      L24C3            ;  ... Macro Address = 9411
        ;
        RET     


L2E5F:  LD      HL,LIVES1
        INC     (HL)
        CALL    L2F2E
        LD      A,($4FF3)
        DEC     A
        JR      Z,L2E73
        LD      HL,LIVES2
        INC     (HL)
        CALL    L2F33
L2E73:  SYSSUK  STRDIS           ;  UPI STRing DISplay
        DB      $24              ;  ... X = 36
        DB      $20              ;  ... Y = 32
        DB      $0C              ;  ... Options = 12
        DW      L2EC9            ;  ... String Address of "EXTRA PLAYER"
        ;
L2E7A:  LD      A,B
        INC     B
        AND     A
        RET     NZ
        
        LD      HL,$4F40
        SET     2,(HL)
        SYSSUK  STRDIS           ;  UPI STRing DISplay
        DB      $2E              ;  ... X = 46
        DB      $00              ;  ... Y = 0
        DB      $48              ;  ... Options = 72
        DW      L2EA7            ;  ... String Address of "BONUS"
        ;
        RET


L2E8B:  SYSSUK  PAWS            ;  UPI PAUSE
        DB      $02             ;  ... Interrupts = 2
        ;
        LD      HL,LIVES1
        LD      A,(HL)
        AND     A
        JR      Z,L2E98
        IN      A,($10)
        LD      B,A
L2E98:  INC     HL
        LD      A,(HL)
        AND     A
        JR      Z,L2E9F
        IN      A,($11)
L2E9F:  OR      B
        BIT     4,A
        RET     NZ
        
        DEC     C
        JR      NZ,L2E8B
        RET     


L2EA7:  DB      "BONUS",$00
L2EAD:  DB      "ALL SCORES",$00
L2EB8:  DB      "DOUBLE",$00
L2EBF:  DB      "QUADRUPLE",$00
L2EC9:  DB      "EXTRA PLAYER",$00

L2ED6:  CALL    L31F9
        LD      HL,$4000
        JR      L2EE4
L2EDE:  CALL    L31F9
        LD      HL,$41B8
L2EE4:  LD      C,$01
        JR      L2EFA
L2EE8:  CALL    L31F9
        LD      HL,$402B
        LD      C,$10
        JR      L2EFA
L2EF2:  CALL    L31F9
        LD      HL,$4028
        LD      C,$04
L2EFA:  ADD     HL,DE
        LD      A,(HL)
        AND     C
        RET     


L2EFE:   LD      A,(LIVES1)
         AND     A
         JR      Z,L2F11
         CP      $08
         JR      C,L2F0A
         LD      A,$07
L2F0A:   LD      B,A
         LD      HL,$2F3A
         CALL    L2F20  
L2F11:   LD      A,(LIVES2)
         AND     A
         RET     Z

         CP      $08
         JR      C,L2F1C
         LD      A,$07
L2F1C:   LD      B,A
         LD      HL,$2F5D
L2F20:   PUSH    BC
         PUSH    HL
         CALL    L35F4
         POP     HL
         LD      BC,$0005
         ADD     HL,BC
         POP     BC 
         DJNZ    L2F20
         RET     


;  After the Worluk is killed, the program jumps here. 
L2F2E:  LD      HL,$2F80
        JR      $2F36
L2F33:  LD      HL,$2F85
        DI      
        JP      L35F4


        DB      $20
        DB      $94
        DB      $0B
        DB      $D6
        DB      $36
        DB      $20
        DB      $91
        DB      $0B
        DB      $D6
        DB      $36
        DB      $20
        DB      $B1
        DB      $09
        DB      $D6
        DB      $36
        DB      $20
        DB      $D1
        DB      $07
        DB      $D6
        DB      $36
        DB      $20
        DB      $F1
        DB      $05
        DB      $D6
        DB      $36
        DB      $20
        DB      $81
        DB      $02
        DB      $D6
        DB      $36
        DB      $20
        DB      $51
        DB      $00
        DB      $D6
        DB      $36
        DB      $60
        DB      $B3
        DB      $0B
        DB      $E6
        DB      $36
        DB      $60
        DB      $B6
        DB      $0B
        DB      $E6
        DB      $36
        DB      $60
        DB      $D6
        DB      $09
        DB      $E6
        DB      $36
        DB      $60
        DB      $F6
        DB      $07
        DB      $E6
        DB      $36
        DB      $60
        DB      $16
        DB      $06
        DB      $E6
        DB      $36
        DB      $60
        DB      $A6
        DB      $02
        DB      $E6
        DB      $36
        DB      $60
        DB      $76
        DB      $00
        DB      $E6
        DB      $36
        DB      $20
        DB      $DC
        DB      $04
        DB      $D6
        DB      $36
        DB      $60
        DB      $FC
        DB      $04
        DB      $E6
        DB      $36

L2F8A:  LD      A,($4F27)
        AND     A
        RET     Z

        LD      A,($4F26)
        BIT     4,A
        RET     NZ

        LD      IX,$4E38
        LD      D,$07
        LD      HL,$4FE4
        CALL    L2FAA
        LD      IX,$4E52
        LD      D,$02
        LD      HL,$4FE5
L2FAA:  BIT     7,(IX+$00)
        RET     NZ

        BIT     7,(IX+$0A)
        RET     NZ

        LD      (HL),$00
        BIT     0,D
        JR      Z,L2FCE
        LD      A,(LIVES1)
        AND     A
        RET     Z

        LD      E,$00
        LD      B,$04
        CALL    L2FE9
        LD      (COUNT1),A
        XOR     A
L2FCA:  LD      E,$0F
        JR      L2FE0
L2FCE:  LD      A,(LIVES2)
        AND     A
        RET     Z

        LD      E,$78
        LD      B,$08
        CALL    L2FE9
        LD      (COUNT2),A
;  Draw 1x10 line above player's "Safe Area"        
        XOR     A               ; Color Mask to Write Rectangle with
L2FDE:  LD      E,$87           ; X Coordinate for UL Corner 
L2FE0:  LD      D,$47           ; Y Coordinate for UL Corner
        LD      BC,$010A        ; X,Y Size in Pixels (1,10)
        DI      
        SYSTEM  RECTAN          ;  UPI paint a RECTANgle
        ;
        RET     


L2FE9:  RES     2,(IX+$0A)
        LD      A,D
        LD      B,$81
        LD      C,$10
        LD      D,$48
        CALL    L2A21
        LD      A,$0A
        RET     


L2FFA:  LD      A,$FF
        CALL    L2FDE
        LD      C,$08
        LD      E,$7C
        JR      $300E
L3005:  LD      A,$FF
        CALL    L2FCA
;  Place a Black Space in the Countdown Timer area for Player 1, when the
;  Player 1 leaves the Safe Area at the beginning of each turn.  
        LD      C,$04           ; ... Options: 1x, Standard Write, Blue on Black                                       
        LD      E,30            ; ... X Coordinate
        LD      D,74            ; ... Y Coordinate
        LD      A,$20           ; ... ASCII Character to Display (Space)
        SYSTEM  CHRDIS          ;  UPI CHaRacter DISplay
;
        RET     


;  CALL to here.  Disassembled (but didn't follow) code on July 15, 2013
;  Disassembled $3015-$3077  
L3015:  LD      A,(IY+$00)
        AND     $C1
        CP      $80
        RET     NZ

        LD      A,(IX+$00)
        AND     $C9
        CP      $80
        RET     NZ

        LD      A,(IY+$04)
        SUB     (IX+$04)
        LD      C,A
        ADD     A,$06
        CP      $0C
        RET     NC

        LD      A,(IY+$06)
        SUB     (IX+$06)
        LD      B,A
        ADD     A,$06
        CP      $0C
        RET     NC

        RST     $28                     ;  User ReStarT #5 of 6
        BIT     1,(IX+$07)
        JR      NZ,L3074
        LD      A,L
        CP      E
        LD      A,B
l3047:  JR      NZ,L3054
        RLA     
        BIT     0,(IX+$07)
        JR      NZ,L3051
        CCF     
l3051:  JP      NC,L3263
l3054:  BIT     0,(IY+$07)
        LD      A,$08
        JR      Z,L305D
        XOR     A
l305d:  BIT     1,(IY+$07)
        JR      Z,L306A
        ADD     A,L
        RST     $08                     ;  User ReStarT #1 of 6
        LD      (IY+$04),A
        JR      L306F
l306a:  ADD     A,H
        RST     $08                     ;  User ReStarT #1 of 6
        LD      (IY+$06),A
l306f:  SET     5,(IY+$00)
        RET     

l3074:  LD      A,H
        CP      D
        LD      A,C
        JR      L3047

L3079:  LD      IX,$4E38
        CALL    L3084
        LD      IX,$4E52
L3084:  BIT     5,(IX+$00)
        JR      NZ,L308F
        LD      A,($4F27)
        AND     A
        RET     Z

L308F:  BIT     7,(IX+$0A)
        RET     NZ

        CALL    L30C4
        CALL    L312E          
        CALL    L2B9E         
        BIT     3,(IX+$00)
        RET     Z

        LD      A,$10
        CALL    L2B8E       
        LD      A,($4F2E)
        CP      $02
        JR      NZ,L30B3
        LD      HL,$4F26
        SET     4,(HL)
L30B3:  BIT     2,(IX+$07)
        LD      HL,LIVES1
        JR      NZ,L30BD
        INC     HL
L30BD:  DEC     (HL)
        LD      HL,$4F41
        SET     0,(HL)
        RET 
        
        
L30C4:  BIT     1,(IX+$00)
        RET     Z

        LD      A,(IX+$06)
        SUB     $04
        LD      (IX+$06),A
        CP      $44
        PUSH    AF
        CALL    Z,L30E0
        POP     AF
        CP      $3C
        CALL    Z,L30F3
        JP      L2846
L30E0:  LD      HL,$4F41
        SET     6,(HL)
        BIT     2,(IX+$07)
        LD      HL,$2F3A
        JR      NZ,L30F1
        LD      HL,$2F5D
L30F1:  JR      L312A
L30F3:  RES     0,(IX+$00)
        RES     1,(IX+$00)
        BIT     2,(IX+$07)
        LD      HL,COUNT1
        JR      NZ,L3107
        LD      HL,COUNT2
L3107:  LD      (HL),$01
        LD      A,(LIVES1)
        LD      HL,$2F3A
        JR      NZ,L3117
        LD      A,(LIVES2)
        LD      HL,$2F5D
L3117:  DEC     A
        RET     Z

        PUSH    AF
        PUSH    HL
        CALL    L312A
        POP     HL
        POP     AF
        CP      $07
        RET     NC

        LD      B,A
        LD      DE,$0005
L3127:  ADD     HL,DE
        DJNZ    L3127
L312A:  DI      
        JP      L35F4
L312E:  LD      A,(IX+$00)
        AND     $CB
        CP      $80
        RET     NZ

        LD      A,(IX+$01)
        AND     $0F
        LD      B,A
        RST     $20              ;  User ReStarT #4 of 6
        JR      NZ,L318B
        RST     $20              ;  User ReStarT #4 of 6
        JR      NZ,L318B
        BIT     2,(IX+$0A)
        JR      NZ,L3183
        BIT     5,(IX+$00)
        JP      NZ,L2846
        LD      A,B
        AND     A
        RET     PE

        CP      $04
        JR      NC,L316A
        LD      A,(IX+$04)
        ADD     A,$0C
L315B:  SUB     $0C
        RET     Z

        JR      NC,L315B
        CP      $FA
        LD      B,$04
        JR      C,L3168
        LD      B,$08
L3168:  JR      L317C
L316A:  LD      A,(IX+$06)
        ADD     A,$0C
L316F:  SUB     $0C
        RET     Z

        JR      NC,L316F
        CP      $FA
        LD      B,$01
        JR      C,L317C
        LD      B,$02
L317C:  RST     $20              ;  User ReStarT #4 of 6
        JR      NZ,L318E
        RST     $20              ;  User ReStarT #4 of 6
        JR      NZ,L318E
        RET     
        
        
L3183:  LD      A,(IX+$07)
        AND     $03
        LD      C,A
        JR      L3195
L318B:  LD      (IX+$01),B
L318E:  BIT     2,(IX+$0A)
        JP      Z,L2837
L3195:  LD      A,(IX+$07)
        AND     $04
        OR      $08
        LD      B,A
        LD      A,(IX+$0A)
        INC     (IX+$0A)
        RRCA    
        RRCA    
        AND     $C0
        OR      B
        OR      C
        JP      L284D

L31AC:  BIT     7,(IX+$1D)
        JR      Z,L31BF
        LD      H,(IX+$1D)
        LD      L,(IX+$1E)
        XOR     A
        LD      (IX+$1D),A
        RES     7,H
        LD      (HL),A
L31BF:  LD      A,(IX+$00)
        AND     $C0
        CP      $80
        RET     NZ

        LD      HL,$4AFD
        LD      DE,$0078
        LD      A,(IX+$06)
        ADD     A,$05
L31D2:  ADD     HL,DE
        SUB     $0C
        JR      NC,L31D2
        LD      A,(IX+$04)
        ADD     A,$05
L31DC:  INC     HL
        SUB     $0C
        JR      NC,L31DC
        LD      A,(IX+$07)
        AND     $1C
        ADD     A,$04
        CP      $10
        RET     NC

        LD      B,A
        RRCA    

        RRCA    
        OR      B
        LD      (HL),A
        SET     7,H
        LD      (IX+$1D),H
        LD      (IX+$1E),L
        RET


L31F9:  LD      A,D
        RST     $08             ;  USER RESTART #1 OF 6
        LD      D,A
        LD      A,E
        RST     $08             ;  USER RESTART #1 OF 6
        ADD     A,$0E
        LD      E,A
L3201:  PUSH    HL
        SRL     E
        SRL     E
        LD      H,$00
        LD      L,D
        LD      D,H
        ADD     HL,HL
        ADD     HL,HL
        ADD     HL,HL
        PUSH    HL
        ADD     HL,HL
        ADD     HL,HL
        ADD     HL,DE
        POP     DE
        ADD     HL,DE
        EX      DE,HL
        POP     HL
        RET     


;  Reset VECTor #1 /  8 / $08 
L3216:  LD      HL,$3221
        LD      C,$0B
L321B:  DEC     C
        INC     HL
        CP      (HL)
        JR      C,L321B
        LD      A,(HL)
        RET     

        DB      $78
        DB      $6C
        DB      $60
        DB      $54
        DB      $48
        DB      $3C
        DB      $30
        DB      $24
        DB      $18
        DB      $0C
        DB      $00

;  Reset VECTor #2 / 16 / $10
L322D:  RST     $08              ;  User ReStarT #1 of 6
        LD      A,B
        LD      B,C
        RST     $08              ;  User ReStarT #1 of 6
        LD      A,B
        SUB     C
        RET     

; Reset VECTor #5 / 40 / $28
L3234:  LD      L,(IY+$04)
        LD      H,(IY+$06)
L323A:  LD      E,(IX+$04)      ; Reset VECTor #6 / 48 / $30
        LD      D,(IX+$06)
        RET     

; 
;  SENTRY RETURN Code SF2 Handler
;  Sentry, Flag bit 2 has changed
L3241:  LD      HL,$4F39
        LD      BC,$8408
        LD      DE,$5400
        JR      L3255

;  SENTRY RETURN Code SF1 Handler
;  Sentry, Flag bit 1 has changed
L324C:  LD      HL,$4F3B
        LD      BC,$8404
        LD      DE,$5478
L3255:  LD      A,($4F26)
        BIT     3,A
        RET     NZ

        LD      A,(HL)
        DEC     HL
        OR      (HL)
        RET     Z

        DI      
        SYSTEM  DISNUM                  ;  UPI DISplay NUMber
        ;
        RET     


L3263:  SET     3,(IY+$00)
        BIT     2,(IX+$00)
        RET     NZ

        BIT     2,(IY+$00)
        LD      B,$05
        JR      Z,L3295
        LD      A,(IY+$07)
        RRA     
        RRA     
        AND     $07
        LD      B,A
        INC     B
        CP      $03
        JR      C,L3295
        LD      HL,$4F3C
        JR      NZ,L328C
        SET     0,(HL)
        LD      B,$10
        JR      L3295
L328C:  SET     1,(HL)
        LD      B,$20
        LD      HL,$4F2E
        SET     3,(HL)
L3295:  LD      A,($4F26)
        LD      C,A
        BIT     6,C
        LD      A,B
        JR      Z,L32A0
        ADD     A,A
        DAA     
L32A0:  BIT     5,C
        JR      Z,L32A6
        ADD     A,A
        DAA     
L32A6:  BIT     2,(IX+$07)
        LD      DE,$4F38
        LD      B,$00
        JR      NZ,L32B4
        INC     DE
        INC     DE
        INC     B
L32B4:  LD      HL,$4FDE
        DEC     B
        JR      NZ,L32BE
        SET     1,(HL)
        JR      L32C0
L32BE:  SET     2,(HL)
L32C0:  EX      DE,HL
        ADD     A,(HL)
        DAA     
        LD      (HL),A
        INC     HL
        LD      A,$00
        ADC     A,(HL)
        DAA     
        LD      (HL),A
        RET


;  SENTRY RETURN Code ST0 Handler
;                Code ST1 Handler 
;  Trigger 1 for player 1 changed and/or
;  Trigger 2 for player 2 changed
L32CB:  LD      IX,$4E38        ; Trigger 1 for Player 1 Changed
        JR      L32D5
L32D1:  LD      IX,$4E52        ; Trigger 2 for Player 2 Changed
L32D5:  BIT     4,B
        RET     Z

        LD      A,($4F27)
        AND     A
        RET     Z

        LD      A,(IX+$00)
        AND     $C1
        CP      $80
        RET     NZ

        BIT     7,(IX+$15)
        RET     NZ

        CALL    L332C
        RET     NC

        RES     3,(IX+$0A)
        SET     2,(IX+$0A)
        SET     5,(IX+$00)
        INC     (IX+$0A)
        LD      HL,$4F41
        SET     2,(HL)
        LD      H,$80
L3304:  LD      A,(IX+$07)
        AND     $1C
        ADD     A,$04
        CP      $10
        JR      C,L3311
        LD      A,$0C
L3311:  OR      H
        LD      H,A
L3313:  LD      BC,$0015
        LD      A,(IX+$07)
        AND     $03
        OR      H
        PUSH    IX
        POP     HL
        ADD     HL,BC
        PUSH    HL
        INC     HL
        LD      (HL),E
        INC     HL
        LD      (HL),D
        INC     HL
        LD      (HL),B
        INC     HL
        LD      (HL),B
        POP     HL
        LD      (HL),A
        RET     



L332C:  RST     $30             ;  USER RESTART #6 OF 6
        LD      A,(IX+$07)
        BIT     1,A
        RRA     
        JR      Z,L3359
        JR      NC,L3341
        INC     E
        INC     E
        CALL    L2EE8
        RET     NZ

        LD      A,$19
        JR      L334B
L3341:  LD      A,E
        ADD     A,$08
        LD      E,A
        CALL    L2EF2
        RET     NZ

        LD      A,$0E
L334B:  ADD     A,(IX+$04)
        AND     $FC
        LD      E,A
        LD      A,(IX+$06)
        ADD     A,$05
        LD      D,A
        SCF     
        RET


L3359:  JR      NC,L3366
        INC     D
        INC     D
        INC     D
        CALL    L2EDE
        RET     NZ

        LD      A,$0B
        JR      L336F
L3366:  LD      A,D
        ADD     A,$08
        LD      D,A
        CALL    L2ED6
        RET     NZ

        XOR     A
L336F:  ADD     A,(IX+$06)
        AND     $FC
        LD      D,A
        LD      A,(IX+$04)
        ADD     A,$13
        LD      E,A
        SCF     
        RET     


L337D:  LD      A,($4F32)
        LD      A,$04
        LD      HL,$4F3C
        BIT     6,(HL)
        JR      Z,L338B
        LD      A,$02
L338B:  LD      ($4FD7),A
        LD      B,$06
L3390:  PUSH    BC
        RST     $18              ;  User ReStarT #3 of 6
        CALL    L3399
        POP     BC
        DJNZ    L3390
        RET     


L3399:  LD      A,(IX+$00)
        AND     $C0		;? bits 1100 000 (7th and 6th 128 & 64)
        CP      $80		;If bit 7 
        RET     NZ		;is set return

        LD      HL,$4F3C	
        LD      A,(IX+$07)
        RRA     		; Shift bits right
        RRA     		; again
        AND     $07		; Keep last 3 bits
        CP      $03		;Is it 3?
        JR      C,L33B6		;Less than skip down 5 ----------------
        RET     NZ		;Not equal RETurn                     |
				;				      |	
        BIT     7,(HL)		;Is BIT 7 (128) of address(HL) set?   |
        JR      NZ,L33BB	;No, skip down 5 ---------------------+---
        JR      L33BA		;--------------			      |  |
L33B6:  BIT     7,(HL)		;<-+----------+------------------------  |
        JR      NZ,L33BB	;If not set --+--------------------------+
L33BA:  INC     A		;<-------------				 |
L33BB:  SYSSUK  INDEXB          ;  UPI INDEX Byte by A  <-----------------
        DW      L33E3           ;  ... Base Address = 13283
        ;			; AND ...
        LD      A,(IX+$02)	; We through it away and load ths instead...
        ADD     A,A		; A*2 MOD 128
        CP      (HL)
        RET     NC		;RETurn if no Carry (Greater Than or Equal)

        CP      $10		;
        JR      C,L33CB		; Skip next if Less than $10
        AND     $F0		; Loose lower nibble (four bits)
L33CB:  LD      (IX+$02),A	; Put it back.
        CP      $20		; 32
        RET     C		;REturn if Carry (Less than)

        LD      B,$FE		; B = 254
        JR      Z,L33D7		; Skip if A=$20 (32)
        LD      B,$FC		; B = 252
L33D7:  RST     $30             ;  User ReStarT #6 of 6
				; LD E,(IX+$04) LD D,(IX+$06)
        LD      A,E		
        AND     B
        LD      (IX+$04),A
        LD      A,D
        AND     B
        LD      (IX+$06),A
        RET     

;  Base Address of Table for INDEXB
L33E3:  DB      $09
        DB      $11
        DB      $11
        DB      $21
        DB      $41

;  Reset VECTor #3 / 24 / $18
L33E8:  LD      IX,$4E4D
        LD      DE,$001F
        ADD     IX,DE
        DJNZ    $33EF		;Loop till B=0 33EF?
        RET     


L33F4:  LD      A,($4F27)
        AND     A
        RET     Z		;RETurn if Z

        LD      B,$06
L33FB:  PUSH    BC
        RST     $18              ;  User ReStarT #3 of 6
        POP     BC
        BIT     7,(IX+$00)
        RET     NZ		;Return if NZ

        DJNZ    L33FB		;Loop till B=0
        LD      A,($4F26)
        BIT     1,A
        RET     NZ		;RETurn if NZ

        LD      A,($4E38)
        LD      HL,$4E52
        OR      (HL)
        BIT     6,A
        RET     NZ		;RETurn if NZ

        LD      HL,$4F2E
        LD      A,(HL)
        INC     (HL)
        AND     A
        JR      Z,L3459
        DEC     A
        JR      NZ,L344B
        LD      A,($4F32)
        DEC     A
        JR      Z,L344B
        LD      B,$40
        SRL     A
        JR      Z,L3434
        LD      B,$80
        SRL     A
        JR      Z,L3434
        LD      B,$C0
L3434:  SYSSUK  RANGED           ;  UPI RANGED random number
        DB      $00              ;  ... Cutoff = 0
        ;
        CP      B
        JR      NC,L344B
        LD      HL,$0403
        LD      ($4F2F),HL
L3440:  LD      A,$01
        LD      ($4FD8),A


L3445:  LD      HL,$4F26
        SET     1,(HL)
        RET     


L344B:  LD      HL,$4F26
        SET     3,(HL)
        XOR     A
        LD      ($4F27),A
        INC     A
        LD      ($4FDC),A
        RET     


L3459:  LD      HL,$4F41
        SET     1,(HL)
        LD      BC,$0C00
        LD      A,$04
        LD      ($4FD7),A
        LD      A,$0C
        CALL    L2BF0
        CALL    L3440
        LD      A,C
        CP      $3D
        RET     C

        SET     2,(HL)
        RET     


;  SENTRY RETURN Code SF5 Handler
;  Sentry, Flag bit 5 has changed
L3475:  LD      IX,$4E6C		; 
        LD      A,(IX+$00)		; LD A,($4E6C)
        AND     $C0
        CP      $80
        RET     NZ			; RETurn if NZ

        LD      HL,$4F31
        BIT     7,(IX+$15)
        JR      Z,L3491
        LD      (HL),$02
        SET     5,(IX+$15)
        RET     

L3491:  LD      (HL),$14
        CALL    L332C
        RET     NC			; RETurn if NC

        LD      HL,$4F40
        SET     5,(HL)
        LD      H,$8C
        JP      L3313


;  SENTRY RETURN Code SCT3 Handler
;  Counter-Timer 3 has counted down
L34A1:   LD      HL,$4F2E
         LD      A,(HL)
         AND     A
         RET     Z			; RETurn if Zero

         DEC     A
         JR      NZ,L34DA
         LD      A,($4F3C)
         BIT     6,A
         LD      A,$20
         JR      NZ,L34B5
         LD      A,$10
L34B5:   LD      ($4E6E),A
L34B8:   LD      HL,$4F26
         RES     1,(HL)
         RET     


L34BE:  LD      HL,$4F40
        SET     6,(HL)
        JP      L28E7
L34C6:  SET     2,(HL)
        LD      A,$01
        LD      ($4FD8),A
        RES     5,(IX+$0A)
L34D1:  SET     7,(IX+$0A)
        LD      (IX+$00),$00
        RET     
     

L34DA:  LD      IX,$4E6C
        BIT     2,(HL)
        JR      Z,L34C6
        RES     2,(HL)
        BIT     3,(HL)
        JR      NZ,L34B8
        LD      A,($4F26)
        BIT     4,A
        JR      NZ,L34BE
        LD      A,($4F32)
        CP      $05
        LD      A,$03         
        JR      NC,L34F9
        INC     A
L34F9:  LD      ($4FD8),A
        LD      HL,$4E38
        LD      DE,$4E52
        SYSSUK  RANGED           ;  UPI RANGED random number
        DB      $00              ;  ... Cutoff = 0
        ;
        BIT     3,A
        JR      Z,L350A
        EX      DE,HL
L350A:  LD      A,(HL)
        AND     $C1
        CP      $80
        JR      Z,L351C
        EX      DE,HL
        LD      A,(HL)
        AND     $C1
        CP      $80
        LD      DE,$003C
        JR      NZ,L3591
L351C:  PUSH    HL
        POP     IX
        LD      HL,$4F2F
        PUSH    HL
        CALL    L35BC
        LD      C,A
        INC     HL
        CALL    L35BC
        LD      B,A
        EXX     
        LD      A,(IX+$06)
        ADD     A,$06
        RST     $08              ;  User ReStarT #1 of 6
        EX      AF,AF'
        LD      A,(IX+$04)
        ADD     A,$06
        RST     $08              ;  User ReStarT #1 of 6
        EXX     
        LD      E,A
        EX      AF,AF'
        LD      D,A
        POP     HL
L353F:  SYSSUK  RANGED           ;  UPI RANGED random number
        DB      $00              ;  ... Cutoff = 0
        ;
        RRA     
        JR      NC,L356E
        RRA     
        LD      A,(IX+$07)
        AND     $03
        CP      $03
        CALL    Z,L3565
        LD      A,E
        ADD     A,B
        JR      L355D
        AND     $03
        CP      $02
        CALL    Z,L3565
        LD      A,E
        SUB     B
L355D:  CP      $79
        JR      NC,L353F
        LD      E,A
        INC     HL
        JR      L358B
L3565:  SYSSUK  RANGED           ;  UPI RANGED random number
        DB      $00              ;  ... Cutoff = 0
        ;
        AND     $03
        RET     Z		; Return if Zero

        POP     AF
        JR      L353F
L356E:  RRA     
        LD      A,(IX+$07)
        JR      NC,L357F
        AND     $03
        CP      $01
        CALL    Z,L3565
        LD      A,D
        ADD     A,C
        JR      L3586
L357F:  AND     $03
        CALL    Z,L3565
        LD      A,D
        SUB     C
L3586:  CP      $3D
        JR      NC,L353F
        LD      D,A
L358B:  LD      A,(HL)
        CP      $02
        JR      C,L3591
        DEC     (HL)
L3591:  LD      HL,$4F40
        SET     4,(HL)
        LD      HL,$4FDE
        SET     5,(HL)
        LD      A,($4F3C)
        RLA     
        LD      C,$10
        JR      C,L35A5
        LD      C,$20
L35A5:  BIT     2,(IX+$07)
        LD      IX,$4E6C
        RES     3,(IX+$0A)
        JR      NZ,L35B7
        SET     3,(IX+$0A)
L35B7:  LD      A,$10
        JP      L2A1F
L35BC:  LD      B,(HL)
        XOR     A
L35BE:  ADD     A,$0C
        DJNZ    L35BE		;Repeat until B=0
        RET


L35C3:  PUSH    IX		;Transfer IX
        POP     HL		;to HL
        LD      BC,$000A
        ADD     HL,BC
        BIT     7,(HL)
        RET     Z		;RETurn if Zero

        RES     7,(HL)
        PUSH    HL
        BIT     6,(HL)
        RES     6,(HL)
        CALL    NZ,L35EB
        POP     HL
        BIT     5,(HL)		;Is bit 5 set?
        RET     Z		;RETurn if Zero

        LD      A,(IX+$06)
        DEC     HL
        LD      (HL),A
        LD      A,(IX+$04)
        DEC     HL
        LD      (HL),A
        INC     HL
        INC     HL
        LD      A,(HL)
        XOR     $70		; flip bits 5,6,7 (01110000)
        LD      (HL),A
L35EB:  BIT     4,(HL)		; Is bit 4 set?
        LD      DE,$0005
        JR      Z,L35F3		; If not skip next instruction
        ADD     HL,DE
L35F3:  INC     HL
L35F4:  LD      A,(HL)		; Get M-mode from Vblock?
        OUT     (MAGIC),A       ; write MAGIC register
        LD      BC,$FFD6	; BC = -41 or -29h
        BIT     7,A		; Is bit 7 of A set? 128
        JR      NZ,L3608	; If yes Skip down to 3608
        LD      BC,$002A	; BC = 42
        BIT     6,A		; Is bit 6 of A set? 64
        JR      NZ,L3608	; If Yes Skip to 3608
        LD      BC,$0026	; BC = 38
L3608:  INC     HL		; Next value of Vblock? Screen address?
        LD      E,(HL)		; Load DE 
        INC     HL		; with next 2 
        LD      D,(HL)		; values
        PUSH    DE		; put on stack
        INC     HL		; Next value of Vblock? Sprite image?
        LD      E,(HL)		; Load
        INC     HL		; DE
        LD      D,(HL)
        POP     HL		; HL = previous DE. Screen Address?
        BIT     6,A		; Test bit 6 of A
        LD      A,$08		; A=8 No flags altered
        JR      NZ,DRWFL	; If bit set Draw sprite Flopped

;**************************
;* DRAW/ERASE SPRITE Reg? *
;**************************
DRWSP:  EX      AF,AF'		;Exchange A and 'A
        LD      A,(DE)
        INC     DE
        LD      (HL),A
        INC     HL
        LD      A,(DE)
        INC     DE
        LD      (HL),A
        INC     HL
        LD      (HL),$00	;Clear shifter?
        ADD     HL,BC		;adjust draw position
        EX      AF,AF'		;Return a and 'A
        DEC     A
        JR      NZ,DRWSP	;Repeat if not zero
        RET     

;******************************
;* DRAW/ERASE SPRITE Flopped? *
;******************************
DRWFL:  EX      AF,AF'		;Exchange A and 'A
        LD      A,(DE)
        INC     DE
        LD      (HL),A
        DEC     HL
        LD      A,(DE)
        INC     DE
        LD      (HL),A
        DEC     HL
        LD      (HL),$00	;Clear shifter
        ADD     HL,BC		;adjust draw position
        EX      AF,AF'		;Return A and 'A
        DEC     A
        JR      NZ,DRWFL	;Repeat if not zero
        RET     

;  ?? What is this ??
L363A:  DB      $43
        DB      $CD
        DB      $BB
        DB      $86

; Explosions Pattern Table ?? 
        DW      L39C6  ; Explosion 1
        DW      L39D6  ; Explosion 2
        DW      L39E6  ; Explosion 3
        DW      L39F6  ; Explosion 4

; Burwor, Blue , Facing Up (Pattern Table ??)
        DW      L36F6  ; Burwor, Blue , Facing Up (Not Sticking Out Tongue #1)
        DW      L3706  ; Burwor, Blue , Facing Up (Not Sticking Out Tongue #2)
        DW      L3716  ; Burwor, Blue , Facing Up (Sticking Out Tongue)

        DB      $00
        DB      $00

;  Burwor, Blue (Pattern Table ??) 
        DW      L3726  ; Burwor, Blue (Not Sticking Out Tongue #1)
        DW      L3736  ; Burwor, Blue (Not Sticking Out Tongue #2)
        DW      L3746  ; Burwor, Blue (Sticking Out Tongue)

        DB      $00
        DB      $00

; Garwor, Yellow (Facing Up) (Pattern Table ??)
        DW      L3756  ; Garwor, Yellow (Mouth Open and Tail Low, Facing Up)
        DW      L3766  ; Garwor, Yellow (Mouth Open and Tail High, Facing Up)
        DW      L3776  ; Garwor, Yellow (Mouth Open, Facing Up)
        
        DB      $00
        DB      $00

;  Garwor, Yellow (Facing Right) (Pattern Table ??)
        DW      $3786  ; Garwor, Yellow (Mouth Open and Tail Low) 
        DW      $3796  ; Garwor, Yellow (Mouth Open and Tail High)
        DW      $37A6  ; Garwor, Yellow (Mouth Open)
        
        DB      $00
        DB      $00

;  Thorwor, Red, Facing Up (Pattern Table ??)
        DW      L37B6  ;  Thorwor, Red, Facing Up (Mouth Open #1/3 Blue Feet)
        DW      L37C6  ;  Thorwor, Red, Facing Up (Mouth Closed/3 Blue Feet)
        DW      L37D6  ;  Thorwor, Red, Facing Up (Mouth Open/2 Blue Feet)

        DB      $00
        DB      $00

;   (Pattern Table ??)
        DW      L37E6  ;  Thorwor, Red, Facing Right (Mouth Open /3 Blue Feet)
        DW      L37F6  ;  Thorwor, Red, Facing Right (Mouth Closed/3 Blue Feet)
        DW      L3806  ;  Thorwor, Red, Facing Right (Mouth Open /2 Blue Feet)

        DB      $00
        DB      $00
        
;  Worluk, Blue with Yellow Wings (Pattern Table ??)         
        DW      $3816  ; Address of Worluk, "Wings All the Way Up"
        DW      $3826  ; Address of Worluk, "Wings Half-Way Up"
        DW      $3836  ; Address of Worluk, "Wings Down"

        DB      $00
        DB      $00

;  Worluk, Blue with Yellow Wings (Pattern Table ??)         
        DW      $3816  ; Address of Worluk, "Wings All the Way Up"
        DW      $3826  ; Address of Worluk, "Wings Half-Way Up"
  	DW      $3836  ; Address of Worluk, "Wings Down"

        DB      $00
        DB      $00
   
;  The Wizard, Facing Up (Pattern Table) ??
        DW      L3846  ; The Wizard, Facing Up, #1  
        DW      L3856  ; The Wizard, Facing Up, #2
        DW      L3866  ; The Wizard, Facing Up, #3

        DB      $00
        DB      $00

;  The Wizard, Facing Right (Pattern Table) ??
        DW      L3876  ; The Wizard, Facing Right, #1
        DW      L3886  ; The Wizard, Facing Right, #2
        DW      L3896  ; The Wizard, Facing Right, #3

        DB      $00
        DB      $00

;  Player 2, Blue Worrior, Facing Up (Pattern Table) ??
        DW      L38A6  ; Player 2, Blue Worrior, Facing Up #1 (Standing Position)
        DW      L38B6  ; Player 2, Blue Worrior, Facing Up #2
        DW      L38C6  ; Player 2, Blue Worrior, Facing Up #3

        DB      $00
        DB      $00

;  Player 2, Blue Worrior, Facing Right (Pattern Table) ??
        DW      L36E6  ; Player 2, Blue Worrior, Facing Right #1
        DW      L38D6  ; Player 2, Blue Worrior, Facing Right #2
        DW      L38E6  ; Player 2, Blue Worrior, Facing Right #3

        DB      $00
        DB      $00

;  Player 1, Yellow Worrior, Facing Up (Pattern Table) ??
        DW      L38F6  ;  Player 1, Yellow Worrior, Facing Up #1
        DW      L3906  ;  Player 1, Yellow Worrior, Facing Up #2
        DW      L3916  ;  Player 1, Yellow Worrior, Facing Up #3

        DB      $00
        DB      $00

;  Yellow Worrior (Pattern Table ??)
        DW      $36D6  ; Address of "Yellow Worrior (Standing Position)" 
        DW      $3926  ; Address of "Yellow Worrior (Walking 1)"          
        DW      $3936  ; Address of "Yellow Worrior (Walking 2)"               

        DB      $00
        DB      $00
        DB      $00
        DB      $00

;  Blue Worrior, Facing Up, Firing Position (Pattern Table) ??
        DW      L3946  ;  Blue Worrior, Facing Up #1 (Firing Position, Frame 1 and 3)
        DW      L3956  ;  Blue Worrior, Facing Up #2 (Firing Position, Frame 2)
        DW      L3946  ;  Blue Worrior, Facing Up #1 (Firing Position, Frame 1 and 3)

        DB      $00
        DB      $00

;  Blue Worrior, Facing Right, Firing Position (Pattern Table) ??
        DW      L3966  ;  Blue Worrior, Facing Right #1 (Firing Position, Frame #1 and #3)
        DW      L3976  ;  Blue Worrior, Facing Right #1 (Firing Position, Frame #2)
        DW      L3966  ;  Blue Worrior, Facing Right #1 (Firing Position, Frame #1 and #3)

        DB      $00
        DB      $00

;  Yellow Worrior, Facing Up, Firing Position (Pattern Table) ??
        DW      L3986  ;  Yellow Worrior, Facing Up #1 (Firing Position, Frame #1 and #3)
        DW      L3996  ;  Yellow Worrior, Facing Up #1 (Firing Position, Frame #2)
        DW      L3986  ;  Yellow Worrior, Facing Up #1 (Firing Position, Frame #1 and #3)

        DB      $00
        DB      $00

;  Yellow Worrior, Facing Right, Firing Position (Pattern Table) ??
        DW      L39A6  ;  Yellow Worrior, Facing Right #1 (Firing Position, Frame #1 and #3)
        DW      $39B6  ;  Yellow Worrior, Facing Right #2 (Firing Position, Frame #2)
        DW      L39A6  ;  Yellow Worrior, Facing Right #1 (Firing Position, Frame #1 and #3)

;  Player 1, Yellow Worrior, Facing Right #1 (Standing Position)
        DB      $3A,$00           ; . 3 2 2 . . . .
        DB      $21,$00           ; . 2 . 1 . . . .
        DB      $4A,$00           ; 1 . 2 2 . . . .
        DB      $B8,$08           ; 2 3 2 . . . 2 .
        DB      $BF,$FF           ; 2 3 3 3 3 3 3 3
        DB      $28,$08           ; . 2 2 . . . 2 .
        DB      $82,$00           ; 2 . . 2 . . . .
        DB      $50,$50           ; 1 1 . . 1 1 . .

;  Player 2, Blue Worrior, Facing Right #1 (Standing Position)
L36E6:  DB      $35,$00           ; . 3 1 1 . . . . 
        DB      $13,$00           ; . 1 . 3 . . . . 
        DB      $C5,$00           ; 3 . 1 1 . . . . 
        DB      $74,$08           ; 1 3 1 . . . 2 . 
        DB      $7F,$FF           ; 1 3 3 3 3 3 3 3 
        DB      $14,$08           ; . 1 1 . . . 2 . 
        DB      $41,$00           ; 1 . . 1 . . . . 
        DB      $F0,$F0           ; 3 3 . . 3 3 . . 

; Burwor, Blue , Facing Up (Not Sticking Out Tongue #1)       
L36F6:  DB      $00,$03           ; . . . . . . . 3
        DB      $14,$5C           ; . 1 1 . 1 1 3 .
        DB      $14,$10           ; . 1 1 . . 1 . .
        DB      $75,$50           ; 1 3 1 1 1 1 . .
        DB      $75,$50           ; 1 3 1 1 1 1 . .
        DB      $54,$D0           ; 1 1 1 . 3 1 . .
        DB      $43,$17           ; 1 . . 3 . 1 1 3
        DB      $1C,$03           ; . 1 3 . . . . 3

; Burwor, Blue , Facing Up (Not Sticking Out Tongue #2)
L3706:  DB      $00,$03           ; . . . . . . . 3
        DB      $14,$5C           ; . 1 1 . 1 1 3 .
        DB      $14,$10           ; . 1 1 . . 1 . .
        DB      $75,$50           ; 1 3 1 1 1 1 . .
        DB      $75,$50           ; 1 3 1 1 1 1 . .
        DB      $54,$D0           ; 1 1 1 . 3 1 . .
        DB      $43,$5C           ; 1 . . 3 1 1 3 .
        DB      $4C,$03           ; 1 . 3 . . . . 3
        
; Burwor, Blue , Facing Up (Sticking Out Tongue)
L3716:  DB      $0C,$03           ; . . 3 . . . . 3 
        DB      $1D,$17           ; . 1 3 1 . 1 1 3 
        DB      $1D,$10           ; . 1 3 1 . 1 . . 
        DB      $75,$50           ; 1 3 1 1 1 1 . . 
        DB      $45,$50           ; 1 . 1 1 1 1 . . 
        DB      $54,$D0           ; 1 1 1 . 3 1 . . 
        DB      $43,$5C           ; 1 . . 3 1 1 3 . 
        DB      $4C,$03           ; 1 . 3 . . . . 3 

; Burwor, Blue, Facing Right (Not Sticking Out Tongue #1)
L3726:  DB      $15,$40           ; . 1 1 1 1 . . .
        DB      $47,$D4           ; 1 . 1 3 3 1 1 .
        DB      $C5,$54           ; 3 . 1 1 1 1 1 .
        DB      $31,$40           ; . 3 . 1 1 . . .
        DB      $0D,$44           ; . . 3 1 1 . 1 .
        DB      $15,$54           ; . 1 1 1 1 1 1 .
        DB      $10,$0C           ; . 1 . . . . 3 .
        DB      $F0,$03           ; 3 3 . . . . . 3

; Burwor, Blue, Facing Right (Not Sticking Out Tongue #2)
L3736:  DB      $55,$40           ; 1 1 1 1 1 . . . 
        DB      $07,$D4           ; . . 1 3 3 1 1 . 
        DB      $C5,$54           ; 3 . 1 1 1 1 1 . 
        DB      $31,$40           ; . 3 . 1 1 . . . 
        DB      $1D,$44           ; . 1 3 1 1 . 1 . 
        DB      $15,$54           ; . 1 1 1 1 1 1 . 
        DB      $30,$0C           ; . 3 . . . . 3 . 
        DB      $C0,$03           ; 3 . . . . . . 3 

; Burwor, Blue , Facing Right (Sticking Out Tongue)
L3746:  DB      $55,$40           ; 1 1 1 1 1 . . .
        DB      $04,$D4           ; . . 1 . 3 1 1 . 
        DB      $C5,$7F           ; 3 . 1 1 1 3 3 3 
        DB      $31,$54           ; . 3 . 1 1 1 1 . 
        DB      $1D,$40           ; . 1 3 1 1 . . . 
        DB      $15,$54           ; . 1 1 1 1 1 1 . 
        DB      $30,$04           ; . 3 . . . . 1 . 
        DB      $C0,$0F           ; 3 . . . . . 3 3 

; Garwor, Yellow (Mouth Open and Tail Low, Facing Up)
L3756:  DB      $0A,$00           ; . . 2 2 . . . . 
        DB      $26,$20           ; . 2 1 2 . 2 . .
        DB      $A2,$80           ; 2 2 . 2 2 . . .
        DB      $2A,$A3           ; . 2 2 2 2 2 . 3
        DB      $0A,$A8           ; . . 2 2 2 2 2 .
        DB      $02,$A3           ; . . . 2 2 2 . 3
        DB      $30,$A8           ; . 3 . . 2 2 2 .
        DB      $3A,$80           ; . 3 2 2 2 . . .

; Garwor, Yellow (Mouth Open and Tail High, Facing Up)
L3766:  DB      $0A,$00           ; . . 2 2 . . . .
        DB      $26,$20           ; . 2 1 2 . 2 . .
        DB      $A2,$80           ; 2 2 . 2 2 . . .
        DB      $2A,$A3           ; . 2 2 2 2 2 . 3
        DB      $0A,$A8           ; . . 2 2 2 2 2 .
        DB      $02,$A0           ; . . . 2 2 2 . .
        DB      $C0,$A8           ; 3 . . . 2 2 2 .
        DB      $EA,$03           ; 3 2 2 2 . . . 3

; Garwor, Yellow (Mouth Open, Facing Up)
L3776:  DB      $0A,$80           ; . . 2 2 2 . . .
        DB      $22,$80           ; . 2 . 2 2 . . .
        DB      $A6,$80           ; 2 2 1 2 2 . . .
        DB      $2A,$A0           ; . 2 2 2 2 2 . .
        DB      $0A,$A8           ; . . 2 2 2 2 2 .
        DB      $02,$A3           ; . . . 2 2 2 . 3
        DB      $20,$A8           ; . 2 . . 2 2 2 .
        DB      $CA,$80           ; 3 . 2 2 2 . . .

; Garwor, Yellow (Mouth Open and Tail Low) 
        DB      $00,$20           ; . . . . . 2 . . 
        DB      $F0,$A8           ; 3 3 . . 2 2 2 . 
        DB      $82,$86           ; 2 . . 2 2 . 1 2 
        DB      $8A,$AA           ; 2 . 2 2 2 2 2 2 
        DB      $AA,$A0           ; 2 2 2 2 2 2 . . 
        DB      $2A,$88           ; . 2 2 2 2 . 2 . 
        DB      $22,$00           ; . 2 . 2 . . . . 
        DB      $0C,$C0           ; . . 3 . 3 . . . 

; Garwor, Yellow (Mouth Open and Tail High)
        DB      $F0,$20           ; 3 3 . . . 2 . . 
        DB      $80,$A8           ; 2 . . . 2 2 2 . 
        DB      $82,$86           ; 2 . . 2 2 . 1 2 
        DB      $8A,$AA           ; 2 . 2 2 2 2 2 2 
        DB      $2A,$A0           ; . 2 2 2 2 2 . . 
        DB      $2A,$88           ; . 2 2 2 2 . 2 . 
        DB      $22,$00           ; . 2 . 2 . . . . 
        DB      $C0,$C0           ; 3 . . . 3 . . . 

; Garwor, Yellow (Mouth Open)
        DB      $C0,$20           ; 3 . . . . 2 . . 
        DB      $20,$A8           ; . 2 . . 2 2 2 . 
        DB      $82,$92           ; 2 . . 2 2 1 . 2 
        DB      $8A,$AA           ; 2 . 2 2 2 2 2 2 
        DB      $AA,$AA           ; 2 2 2 2 2 2 2 2 
        DB      $2A,$80           ; . 2 2 2 2 . . . 
        DB      $22,$00           ; . 2 . 2 . . . . 
        DB      $0C,$00           ; . . 3 . . . . . 

;  Thorwor, Red, Facing Up (Mouth Open/3 Blue Feet)
L37B6:  DB      $0F,$30           ; . . 3 3 . 3 . .
        DB      $3F,$30           ; . 3 3 3 . 3 . .
        DB      $F7,$31           ; 3 3 1 3 . 3 . 1
        DB      $3F,$FC           ; . 3 3 3 3 3 3 .
        DB      $0F,$F1           ; . . 3 3 3 3 . 1
        DB      $03,$FC           ; . . . 3 3 3 3 .
        DB      $C0,$F1           ; 3 . . . 3 3 . 1
        DB      $3F,$0C           ; . 3 3 3 . . 3 .

;  Thorwor, Red, Facing Up (Mouth Closed/3 Blue Feet)
L37C6:  DB      $0F,$C0           ; . . 3 3 3 . . .
        DB      $3F,$C0           ; . 3 3 3 3 . . .
        DB      $F3,$C0           ; 3 3 . 3 3 . . .
        DB      $3F,$FD           ; . 3 3 3 3 3 3 1
        DB      $0F,$F0           ; . . 3 3 3 3 . .
        DB      $03,$FD           ; . . . 3 3 3 3 1
        DB      $30,$F0           ; . 3 . . 3 3 . .
        DB      $CF,$0D           ; 3 . 3 3 . . 3 1

;  Thorwor, Red, Facing Up (Mouth Open/2 Blue Feet)
L37D6:  DB      $0F,$30           ; . . 3 3 . 3 . .
        DB      $3F,$30           ; . 3 3 3 . 3 . .
        DB      $F7,$30           ; 3 3 1 3 . 3 . .
        DB      $3F,$FC           ; . 3 3 3 3 3 3 .
        DB      $0F,$F1           ; . . 3 3 3 3 . 1
        DB      $C3,$FC           ; 3 . . 3 3 3 3 .
        DB      $30,$F1           ; . 3 . . 3 3 . 1
        DB      $0F,$0C           ; . . 3 3 . . 3 .

;  Thorwor, Red, Facing Right (Mouth Open/3 Blue Feet)
L37E6:  DB      $30,$30           ; . 3 . . . 3 . .
        DB      $C0,$FC           ; 3 . . . 3 3 3 .
        DB      $C3,$DF           ; 3 . . 3 3 1 3 3
        DB      $CF,$FF           ; 3 . 3 3 3 3 3 3
        DB      $3F,$C0           ; . 3 3 3 3 . . .
        DB      $3F,$FF           ; . 3 3 3 3 3 3 3
        DB      $CC,$C0           ; 3 . 3 . 3 . . .
        DB      $11,$10           ; . 1 . 1 . 1 . .

;  Thorwor, Red, Facing Right (Mouth Closed/3 Blue Feet)
L37F6:  DB      $C0,$30           ; 3 . . . . 3 . .  
        DB      $30,$FC           ; . 3 . . 3 3 3 . 
        DB      $C3,$CF           ; 3 . . 3 3 . 3 3 
        DB      $CF,$FF           ; 3 . 3 3 3 3 3 3 
        DB      $3F,$FF           ; . 3 3 3 3 3 3 3 
        DB      $3F,$C0           ; . 3 3 3 3 . . . 
        DB      $CC,$C0           ; 3 . 3 . 3 . . . 
        DB      $44,$40           ; 1 . 1 . 1 . . . 

;  Thorwor, Red, Facing Right (Mouth Open/2 Blue Feet)
L3806:  DB      $0C,$30           ; . . 3 . . 3 . . 
        DB      $30,$FC           ; . 3 . . 3 3 3 . 
        DB      $C3,$DF           ; 3 . . 3 3 1 3 3 
        DB      $CF,$FF           ; 3 . 3 3 3 3 3 3 
        DB      $3F,$C0           ; . 3 3 3 3 . . . 
        DB      $3F,$FF           ; . 3 3 3 3 3 3 3 
        DB      $CC,$C0           ; 3 . 3 . 3 . . . 
        DB      $11,$00           ; . 1 . 1 . . . . 

;  Worluk, Blue with Yellow Wings (Wings All the Way Up)
        DB      $8C,$32           ; 2 . 3 . . 3 . 2 
        DB      $A1,$4A           ; 2 2 . 1 1 . 2 2 
        DB      $A8,$2A           ; 2 2 2 . . 2 2 2 
        DB      $17,$D4           ; . 1 1 3 3 1 1 . 
        DB      $49,$61           ; 1 . 2 1 1 2 . 1 
        DB      $05,$50           ; . . 1 1 1 1 . . 
        DB      $11,$44           ; . 1 . 1 1 . 1 . 
        DB      $C0,$03           ; 3 . . . . . . 3 

;  Worluk, Blue with Yellow Wings (Wings Half-Way Up)
        DB      $0C,$30           ; . . 3 . . 3 . . 
        DB      $81,$42           ; 2 . . 1 1 . . 2 
        DB      $A8,$2A           ; 2 2 2 . . 2 2 2 
        DB      $17,$D4           ; . 1 1 3 3 1 1 . 
        DB      $69,$69           ; 1 2 2 1 1 2 2 1 
        DB      $05,$50           ; . . 1 1 1 1 . . 
        DB      $11,$44           ; . 1 . 1 1 . 1 . 
        DB      $C0,$03           ; 3 . . . . . . 3 

;  Worluk, Blue with Yellow Wings (Wings Down)
        DB      $0C,$30           ; . . 3 . . 3 . . 
        DB      $01,$40           ; . . . 1 1 . . . 
        DB      $08,$20           ; . . 2 . . 2 . . 
        DB      $17,$D4           ; . 1 1 3 3 1 1 . 
        DB      $69,$69           ; 1 2 2 1 1 2 2 1 
        DB      $85,$52           ; 2 . 1 1 1 1 . 2 
        DB      $11,$44           ; . 1 . 1 1 . 1 . 
        DB      $C0,$03           ; 3 . . . . . . 3 

; The Wizard, Facing Up, #1
L3846:  DB      $00,$C1           ; . . . . 3 . . 1
        DB      $01,$05           ; . . . 1 . . 1 1
        DB      $75,$15           ; 1 3 1 1 . 1 1 1
        DB      $55,$55           ; 1 1 1 1 1 1 1 1
        DB      $45,$50           ; 1 . 1 1 1 1 . .
        DB      $01,$00           ; . . . 1 . . . .
        DB      $00,$40           ; . . . . 1 . . .
        DB      $00,$C0           ; . . . . 3 . . .

; The Wizard, Facing Up, #2
L3856:  DB      $00,$C0           ; . . . . 3 . . .
        DB      $00,$41           ; . . . . 1 . . 1
        DB      $01,$05           ; . . . 1 . . 1 1
        DB      $75,$D5           ; 1 3 1 1 3 1 1 1
        DB      $55,$54           ; 1 1 1 1 1 1 1 .
        DB      $45,$50           ; 1 . 1 1 1 1 . .
        DB      $01,$00           ; . . . 1 . . . .
        DB      $00,$00           ; . . . . . . . .

; The Wizard, Facing Up, #3
L3866:  DB      $03,$00           ; . . . 3 . . . .
        DB      $01,$C1           ; . . . 1 3 . . 1
        DB      $01,$45           ; . . . 1 1 . 1 1
        DB      $74,$55           ; 1 3 1 . 1 1 1 1
        DB      $55,$55           ; 1 1 1 1 1 1 1 1
        DB      $45,$50           ; 1 . 1 1 1 1 . .
        DB      $00,$00           ; . . . . . . . .
        DB      $00,$00           ; . . . . . . . .

; The Wizard, Facing Right, #1
L3876:  DB      $01,$50           ; . . . 1 1 1 . .
        DB      $00,$70           ; . . . . 1 3 . .
        DB      $01,$50           ; . . . 1 1 1 . .
        DB      $05,$54           ; . . 1 1 1 1 1 .
        DB      $D1,$43           ; 3 1 . 1 1 . . 3
        DB      $01,$50           ; . . . 1 1 1 . .
        DB      $00,$54           ; . . . . 1 1 1 .
        DB      $00,$55           ; . . . . 1 1 1 1

; The Wizard, Facing Right, #2
L3886:  DB      $05,$40           ; . . 1 1 1 . . .
        DB      $01,$C0           ; . . . 1 3 . . .
        DB      $05,$40           ; . . 1 1 1 . . .
        DB      $15,$50           ; . 1 1 1 1 1 . .
        DB      $05,$C7           ; . . 1 1 3 . 1 3
        DB      $05,$40           ; . . 1 1 1 . . .
        DB      $01,$50           ; . . . 1 1 1 . .
        DB      $00,$54           ; . . . . 1 1 1 .

; The Wizard, Facing Right, #3
L3896:  DB      $05,$40           ; . . 1 1 1 . . .
        DB      $01,$C0           ; . . . 1 3 . . .
        DB      $05,$40           ; . . 1 1 1 . . .
        DB      $05,$17           ; . . 1 1 . 1 1 3
        DB      $05,$5C           ; . . 1 1 1 1 3 .
        DB      $05,$40           ; . . 1 1 1 . . .
        DB      $01,$50           ; . . . 1 1 1 . .
        DB      $01,$54           ; . . . 1 1 1 1 .

;  Player 2, Blue Worrior, Facing Up #1 (Standing Position) 
L38A6:  DB      $00,$C0           ; . . . . 3 . . .
        DB      $02,$E0           ; . . . 2 3 2 . .
        DB      $00,$C3           ; . . . . 3 . . 3
        DB      $00,$C3           ; . . . . 3 . . 3
        DB      $74,$C4           ; 1 3 1 . 3 . 1 .
        DB      $45,$D0           ; 1 . 1 1 3 1 . .
        DB      $D3,$D3           ; 3 1 . 3 3 1 . 3
        DB      $0D,$47           ; . . 3 1 1 . 1 3

;  Player 2, Blue Worrior, Facing Up #2
L38B6:  DB      $00,$C0           ; . . . . 3 . . .
        DB      $02,$E0           ; . . . 2 3 2 . .
        DB      $00,$C0           ; . . . . 3 . . .
        DB      $00,$C0           ; . . . . 3 . . .
        DB      $74,$C3           ; 1 3 1 . 3 . . 3
        DB      $45,$D7           ; 1 . 1 1 3 1 1 3
        DB      $D3,$D3           ; 3 1 . 3 3 1 . 3
        DB      $0D,$47           ; . . 3 1 1 . 1 3

;  Player 2, Blue Worrior, Facing Up #3        
L38C6:  DB      $00,$C0           ; . . . . 3 . . .
        DB      $02,$E0           ; . . . 2 3 2 . .
        DB      $00,$C0           ; . . . . 3 . . .
        DB      $00,$C0           ; . . . . 3 . . .
        DB      $74,$C3           ; 1 3 1 . 3 . . 3
        DB      $45,$D7           ; 1 . 1 1 3 1 1 3
        DB      $D3,$D7           ; 3 1 . 3 3 1 1 3
        DB      $0D,$40           ; . . 3 1 1 . . .

;  Player 2, Blue Worrior, Facing Right #2        
L38D6:  DB      $35,$00           ; . 3 1 1 . . . .
        DB      $13,$00           ; . 1 . 3 . . . .
        DB      $C5,$00           ; 3 . 1 1 . . . .
        DB      $74,$08           ; 1 3 1 . . . 2 .
        DB      $7F,$FF           ; 1 3 3 3 3 3 3 3
        DB      $14,$08           ; . 1 1 . . . 2 .
        DB      $44,$00           ; 1 . 1 . . . . .
        DB      $FF,$00           ; 3 3 3 3 . . . .

;  Player 2, Blue Worrior, Facing Right #3
L38E6:  DB      $35,$00           ; . 3 1 1 . . . .
        DB      $13,$00           ; . 1 . 3 . . . .
        DB      $C5,$00           ; 3 . 1 1 . . . .
        DB      $74,$08           ; 1 3 1 . . . 2 .
        DB      $7F,$FF           ; 1 3 3 3 3 3 3 3
        DB      $14,$08           ; . 1 1 . . . 2 .
        DB      $14,$00           ; . 1 1 . . . . .
        DB      $3F,$00           ; . 3 3 3 . . . .

;  Player 1, Yellow Worrior, Facing Up #1
L38F6:  DB      $00,$C0           ; . . . . 3 . . .
        DB      $02,$E0           ; . . . 2 3 2 . .
        DB      $00,$C1           ; . . . . 3 . . 1
        DB      $00,$C1           ; . . . . 3 . . 1
        DB      $98,$C8           ; 2 1 2 . 3 . 2 .
        DB      $8A,$E0           ; 2 . 2 2 3 2 . .
        DB      $E3,$E1           ; 3 2 . 3 3 2 . 1
        DB      $06,$89           ; . . 1 2 2 . 2 1

;  Player 1, Yellow Worrior, Facing Up #2
L3906:  DB      $00,$C0           ; . . . . 3 . . .
        DB      $02,$E0           ; . . . 2 3 2 . .
        DB      $00,$C0           ; . . . . 3 . . .
        DB      $00,$C0           ; . . . . 3 . . .
        DB      $98,$C1           ; 2 1 2 . 3 . . 1
        DB      $8A,$E9           ; 2 . 2 2 3 2 2 1
        DB      $E3,$E1           ; 3 2 . 3 3 2 . 1
        DB      $06,$89           ; . . 1 2 2 . 2 1

;  Player 1, Yellow Worrior, Facing Up #3
L3916:  DB      $00,$C0           ; . . . . 3 . . .
        DB      $02,$E0           ; . . . 2 3 2 . .
        DB      $00,$C0           ; . . . . 3 . . .
        DB      $00,$C0           ; . . . . 3 . . .
        DB      $98,$C1           ; 2 1 2 . 3 . . 1
        DB      $8A,$E9           ; 2 . 2 2 3 2 2 1
        DB      $E3,$E9           ; 3 2 . 3 3 2 2 1
        DB      $06,$80           ; . . 1 2 2 . . .

;  Player 1, Yellow Worrior, Facing Right # 1 (Walking 1)
        DB      $3A,$00           ; . 3 2 2 . . . . 
        DB      $21,$00           ; . 2 . 1 . . . . 
        DB      $4A,$00           ; 1 . 2 2 . . . . 
        DB      $B8,$08           ; 2 3 2 . . . 2 . 
        DB      $BF,$FF           ; 2 3 3 3 3 3 3 3 
        DB      $28,$08           ; . 2 2 . . . 2 . 
        DB      $88,$00           ; 2 . 2 . . . . . 
        DB      $55,$00           ; 1 1 1 1 . . . . 

;  Player 1, Yellow Worrior, Facing Right # 1 (Walking 2)        
        DB      $3A,$00           ; . 3 2 2 . . . . 
        DB      $21,$00           ; . 2 . 1 . . . . 
        DB      $4A,$00           ; 1 . 2 2 . . . . 
        DB      $B8,$08           ; 2 3 2 . . . 2 . 
        DB      $BF,$FF           ; 2 3 3 3 3 3 3 3 
        DB      $28,$08           ; . 2 2 . . . 2 . 
        DB      $28,$00           ; . 2 2 . . . . . 
        DB      $15,$00           ; . 1 1 1 . . . . 

;  Blue Worrior, Facing Up #1 (Firing Position, Frame #1 and #3)
L3946:  DB      $2E,$C0           ; . 2 3 2 3 . . .
        DB      $8F,$20           ; 2 . 3 3 . 2 . .
        DB      $33,$00           ; . 3 . 3 . . . .
        DB      $03,$0C           ; . . . 3 . . 3 .
        DB      $00,$CC           ; . . . . 3 . 3 .
        DB      $75,$D0           ; 1 3 1 1 3 1 . .
        DB      $47,$D3           ; 1 . 1 3 3 1 . 3
        DB      $D9,$47           ; 3 1 2 1 1 . 1 3

;  Blue Worrior, Facing Up #2 (Firing Position, Frame 2)        
L3956:  DB      $0C,$E0           ; . . 3 . 3 2 . .
        DB      $2F,$B0           ; . 2 3 3 2 3 . .
        DB      $8B,$80           ; 2 . 2 3 2 . . .
        DB      $30,$F0           ; . 3 . . 3 3 . .
        DB      $00,$F0           ; . . . . 3 3 . .
        DB      $75,$D0           ; 1 3 1 1 3 1 . .
        DB      $47,$D3           ; 1 . 1 3 3 1 . 3
        DB      $DA,$47           ; 3 1 2 2 1 . 1 3

;  Blue Worrior, Facing Right #1 (Firing Position, Frame #1 and #3)
L3966:  DB      $54,$38           ; 1 1 1 . . 3 2 .
        DB      $4C,$02           ; 1 . 3 . . . . 2
        DB      $94,$0F           ; 2 1 1 . . . 3 3
        DB      $74,$FE           ; 1 3 1 . 3 3 3 2
        DB      $7F,$0B           ; 1 3 3 3 . . 2 3
        DB      $14,$02           ; . 1 1 . . . . 2
        DB      $43,$C0           ; 1 . . 3 3 . . .
        DB      $F0,$00           ; 3 3 . . . . . .

;  Blue Worrior, Facing Right #2 (Firing Position, Frame #2)
L3976:  DB      $D4,$E0           ; 3 1 1 . 3 2 . .
        DB      $4C,$38           ; 1 . 3 . . 3 2 .
        DB      $94,$23           ; 2 1 1 . . 2 . 3
        DB      $B4,$3C           ; 2 3 1 . . 3 3 .
        DB      $7F,$CB           ; 1 3 3 3 3 . 2 3
        DB      $17,$CE           ; . 1 1 3 3 . 3 2
        DB      $40,$00           ; 1 . . . . . . .
        DB      $F0,$00           ; 3 3 . . . . . .

;  Yellow Worrior, Facing Up #1 (Firing Position, Frame #1 and #3)
L3986:  DB      $2E,$E0           ; . 2 3 2 3 2 . .
        DB      $8F,$80           ; 2 . 3 3 2 . . .
        DB      $03,$80           ; . . . 3 2 . . .
        DB      $03,$04           ; . . . 3 . . 1 .
        DB      $00,$C4           ; . . . . 3 . 1 .
        DB      $9A,$E0           ; 2 1 2 2 3 2 . .
        DB      $8B,$E1           ; 2 . 2 3 3 2 . 1
        DB      $EE,$89           ; 3 2 3 2 2 . 2 1

;  Yellow Worrior, Facing Up #2 (Firing Position, Frame #2)
L3996:  DB      $0C,$E0           ; . . 3 . 3 2 . .
        DB      $2F,$80           ; . 2 3 3 2 . . .
        DB      $8B,$C0           ; 2 . 2 3 3 . . .
        DB      $30,$D0           ; . 3 . . 3 1 . .
        DB      $00,$D0           ; . . . . 3 1 . .
        DB      $9A,$C0           ; 2 1 2 2 3 . . .
        DB      $8B,$E1           ; 2 . 2 3 3 2 . 1
        DB      $E6,$89           ; 3 2 1 2 2 . 2 1

;  Yellow Worrior, Facing Right #1 (Firing Position, Frame #1 and #3)
L39A6:  DB      $E8,$38           ; 3 2 2 . . 3 2 .
        DB      $84,$02           ; 2 . 1 . . . . 2
        DB      $E8,$0F           ; 3 2 2 . . . 3 3
        DB      $B8,$FE           ; 2 3 2 . 3 3 3 2
        DB      $BF,$0B           ; 2 3 3 3 . . 2 3
        DB      $28,$02           ; . 2 2 . . . . 2
        DB      $81,$40           ; 2 . . 1 1 . . .
        DB      $50,$00           ; 1 1 . . . . . .

;  Yellow Worrior, Facing Right #2 (Firing Position, Frame #2)
L39B6:  DB      $E8,$E0           ; 3 2 2 . 3 2 . . 
        DB      $84,$C8           ; 2 . 1 . 3 . 2 . 
        DB      $68,$23           ; 1 2 2 . . 2 . 3 
        DB      $B8,$3C           ; 2 3 2 . . 3 3 . 
        DB      $BF,$CB           ; 2 3 3 3 3 . 2 3 
        DB      $29,$42           ; . 2 2 1 1 . . 2 
        DB      $80,$00           ; 2 . . . . . . . 
        DB      $50,$00           ; 1 1 . . . . . . 

; Explosion 1
L39C6:  DB      $00,$00           ; . . . . . . . . 
        DB      $0E,$00           ; . . 3 2 . . . . 
        DB      $1F,$70           ; . 1 3 3 1 3 . . 
        DB      $3F,$C0           ; . 3 3 3 3 . . . 
        DB      $0F,$D0           ; . . 3 3 3 1 . . 
        DB      $2F,$F0           ; . 2 3 3 3 3 . . 
        DB      $0D,$0C           ; . . 3 1 . . 3 . 
        DB      $00,$00           ; . . . . . . . . 

; Explosion 2
L39D6:  DB      $C8,$0C           ; 3 . 2 . . . 3 . 
        DB      $2E,$20           ; . 2 3 2 . 2 . . 
        DB      $11,$8E           ; . 1 . 1 2 . 3 2 
        DB      $BF,$F8           ; 2 3 3 3 3 3 2 . 
        DB      $0F,$D0           ; . . 3 3 3 1 . . 
        DB      $B7,$F8           ; 2 3 1 3 3 3 2 . 
        DB      $2D,$8C           ; . 2 3 1 2 . 3 . 
        DB      $20,$C2           ; . 2 . . 3 . . 2 

;  Explosion 3
L39E6:  DB      $48,$04           ; 1 . 2 . . . 1 . 
        DB      $36,$20           ; . 3 1 2 . 2 . . 
        DB      $11,$8E           ; . 1 . 1 2 . 3 2 
        DB      $B3,$C4           ; 2 3 . 3 3 . 1 . 
        DB      $07,$30           ; . . 1 3 . 3 . . 
        DB      $73,$D8           ; 1 3 . 3 3 1 2 . 
        DB      $2C,$8C           ; . 2 3 . 2 . 3 . 
        DB      $10,$C2           ; . 1 . . 3 . . 2  

;  Explosion 4
L39F6:  DB      $C4,$0C           ; 3 . 1 . . . 3 .
        DB      $22,$10           ; . 2 . 2 . 1 . .
        DB      $00,$C1           ; . . . . 3 . . 1
        DB      $42,$30           ; 1 . . 2 . 3 . .
        DB      $0C,$42           ; . . 3 . 1 . . 2
        DB      $83,$04           ; 2 . . 3 . . 1 .
        DB      $04,$08           ; . . 1 . . . 2 .
        DB      $30,$43           ; . 3 . . 1 . . 3

;  Still trying to figure-out what this area does.  Using the MESS
;  Debugger I can see that L3A06 is not executed.  I suspect that this
;  area is music data, but as of yet I have not found any CALLs to the
;  On-Board ROM's MUSIC routines.  Of course, this program could
;  just as easily stuff the sound ports ($10-18) without using those
;  MUSIC routines.    
L3A06:  DB      $03
        DB      $10
        DB      $10
        DB      $04
        DB      $F9
        DB      $FF
        DB      $A0
        DB      $10
        DB      $08
        DB      $01
        DB      $02
        DB      $02
        DB      TONEC  ; Music Port = write TONe C oscillator          ==> C
        DB      $29    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator          ==> C
        DB      $34    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator          ==> C
        DB      $3E    ; Data for TONEA ==> A
        DB      VIBRA  ; Music Port = write VIBRA to frequency & range ==> C
        DB      $81    ; Data for VIBRA ==> A
        DB      VOLAB  ; Music Port = write VOLumes of tones A & B     ==> C
        DB      $DD    ; Data for VOLAB ==> A
        DB      VOLC   ; Music Port = write VOLume of tone C           ==> C
        DB      $0E    ; Data for VOLC  ==> A
        DB      $01
        DB      $B4
        DB      $09
        DB      $00
        DB      $10
        DB      $20
        DB      $15
        DB      $1B
        DB      $16
        DB      $AA
        DB      $00
        DB      $03
        DB      $04
        DB      $F9
        DB      $FF
        DB      $20
        DB      $04
        DB      $FE
        DB      $23
        DB      $02
        DB      $01
        DB      $05
        DB      $F9
        DB      $FF
        DB      $02
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $13    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $0D    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $0B    ; Data for TONEA ==> A
        DB      $02
        DB      $22
        DB      $3A
        DB      $04
        DB      $F9
        DB      $FF
        DB      $20
        DB      $02
        DB      $FE
        DB      $23
        DB      $01
        DB      $01
        DB      $05
        DB      $F9
        DB      $FF
        DB      $03
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $0A    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $08    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $06    ; Data for TONEA ==> A
        DB      $02
        DB      $22
        DB      $3A
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $2C    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $14    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $0F    ; Data for TONEA ==> A
        DB      $10
        DB      $10
        DB      $05
        DB      $F9
        DB      $FF
        DB      $02
        DB      $04
        DB      $F9
        DB      $FF
        DB      $A0
        DB      $10
        DB      $04
        DB      $21
        DB      $01
        DB      $01
        DB      $17
        DB      $10
        DB      $04
        DB      $EB
        DB      $FF
        DB      $70
        DB      $10
        DB      $04
        DB      $03
        DB      $01
        DB      $01
        DB      $05
        DB      $EB
        DB      $FF
        DB      $01
        DB      $16
        DB      $88
        DB      $15
        DB      $18
        DB      $00
        DB      $03
        DB      $10
        DB      $18
        DB      $04
        DB      $F9
        DB      $FF
        DB      $18
        DB      $02
        DB      $FE
        DB      $21
        DB      $01
        DB      $01
;  This next byte is read when player fires rifle.
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $27    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $46    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $7E    ; Data for TONEA ==> A
        DB      $05
        DB      $F9
        DB      $FF
        DB      $01
;  This next byte is read when player fires rifle (same as above I guess)
;  Rifle sound getting softer ??
        DB      VOLAB  ; Music Port = write VOLumes of tones A & B     ==> C
        DB      $77    ; Data for VOLAB ==> A
        DB      VOLC   ; Music Port = write VOLume of tone C           ==> C
        DB      $17    ; Data for VOLC  ==> A
        DB      VOLN   ; Music Port = write VOLume of Noise            ==> C    
        DB      $0A    ; Data for VOLN ==> A
        DB      $04
        DB      $EB
        DB      $FF
        DB      $0A
        DB      $02
        DB      $FE
        DB      $03
        DB      $01
        DB      $01
        DB      $05
        DB      $EB
        DB      $FF
        DB      $01
        DB      $00
        DB      $04
        DB      $F9
        DB      $FF
        DB      $80
        DB      $02
        DB      $02
        DB      $23
        DB      $01
        DB      $01
        DB      $05
        DB      $F9
        DB      $FF
        DB      $01
        DB      $00
        DB      $03
        DB      $10
        DB      $06
        DB      $04
        DB      $F9
        DB      $FF
        DB      $72
        DB      $06
        DB      $05
        DB      $21
        DB      $01
        DB      $01
        DB      $17
        DB      $22
        DB      $04
        DB      $EB
        DB      $FF
        DB      $64
        DB      $05
        DB      $03
        DB      $21
        DB      $01
        DB      $01
        DB      $05
        DB      $EB
        DB      $FF
        DB      $04
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $11    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $17    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $1F    ; Data for TONEA ==> A
        DB      $16
        DB      $9A
        DB      $15
        DB      $1A
        DB      $00
        DB      $05
        DB      $F9
        DB      $FF
        DB      $01
        DB      $06
        DB      $F9
        DB      $FF
        DB      $01
        DB      $00
        DB      $03
        DB      $01
        DB      $02
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $2A    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $18    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $06    ; Data for TONEA ==> A
        DB      $10
        DB      $30
        DB      $04
        DB      $F9
        DB      $FF
        DB      $30
        DB      $20
        DB      $FC
        DB      $01
        DB      $01
        DB      $01
        DB      $17
        DB      $00
        DB      $04
        DB      $EB
        DB      $FF
        DB      $20
        DB      $00
        DB      $02
        DB      $21
        DB      $04
        DB      $04
        DB      $05
        DB      $EB
        DB      $FF
        DB      $06
        DB      $16
        DB      $FF
        DB      $15
        DB      $1F
        DB      $00
        DB      $03
        DB      $10
        DB      $20
        DB      $13
        DB      $13
        DB      $12
        DB      $12
        DB      $11
        DB      $10
        DB      $17
        DB      $10
        DB      $16
        DB      $67
        DB      $15
        DB      $17
        DB      $04
        DB      $F9
        DB      $FF
        DB      $18
        DB      $20
        DB      $F8
        DB      $01
        DB      $02
        DB      $02
        DB      $01
        DB      $28
        DB      $03
        DB      $10
        DB      $28
        DB      $17
        DB      $84
        DB      $04
        DB      $EB
        DB      $FF
        DB      $84
        DB      $0A
        DB      $FF
        DB      $03
        DB      $01
        DB      $01
        DB      $16
        DB      $CC
        DB      $15
        DB      $0C
        DB      $14
        DB      $83
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $22    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $1D    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $10    ; Data for TONEA ==> A
        DB      $04
        DB      $F2
        DB      $FF
        DB      $8C
        DB      $83
        DB      $01
        DB      $23
        DB      $08
        DB      $08
        DB      $05
        DB      $F2
        DB      $FF
        DB      $01
        DB      $00
        DB      $15
        DB      $1C
        DB      $01
        DB      $20
        DB      $03
        DB      $10
        DB      $20
        DB      $04
        DB      $F9
        DB      $FF
        DB      $20
        DB      $0C
        DB      $FF
        DB      $03
        DB      $01
        DB      $01
        DB      $16
        DB      $55
        DB      $15
        DB      $06
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $54    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $6A    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $FD    ; Data for TONEA ==> A
        DB      $01
        DB      $14
        DB      $03
        DB      $10
        DB      $30
        DB      $14
        DB      $81
        DB      $16
        DB      $FC
        DB      $15
        DB      $0E
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $2C    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $4F    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $37    ; Data for TONEA ==> A
        DB      $01
        DB      $68
        DB      $03
        DB      $10
        DB      $10
        DB      $14
        DB      $85
        DB      $16
        DB      $87
        DB      $15
        DB      $08
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $46    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $2C    ; Data for VOLAB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $FD    ; Data for TONEA ==> A
        DB      $04
        DB      $F9
        DB      $FF
        DB      $30
        DB      $10
        DB      $02
        DB      $21
        DB      $05
        DB      $05
        DB      $05
        DB      $F9
        DB      $FF
        DB      $04
        DB      $00
        DB      $03

;  Music for "Song" played before a level ??
;  This program does seem to use the Onboard MUSIC routines, instead
;  opting to use its own routines. 
;  Used MESS Debugger to figure this out. 
;  Music "Play" Routine seems to be $3D87.
;  Actual output of data is done at $3D92.
;  Register C holds Output Port
;  Register A holds Data to be output to MUSIC port        
        DB      TONMO  ; Music Port = TONe Master Oscillator          ==> C 
        DB      $30    ; Data for TONMO ==> A
        DB      VOLAB  ; Music Port = write VOLumes of tones A & B    ==> C
        DB      $FE    ; Data for VOLAB ==> A
        DB      VOLC   ; Music Port = write VOLume of tone C          ==> C
        DB      $0F    ; Data for VOLC  ==> A
        DB      VIBRA  ; Music Port = write VIBRAto frequency & range ==> C
        DB      $81    ; Data for VIBRA ==> A
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $3E    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $A8    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $6A    ; Data for TONEA ==> A
        DB      $01    ; Data for write SouND BloCK multi-port (SNDBX) ==> A ?? 
        DB      $42    ; Data for write SouND BloCK multi-port (SNDBX) ==> A ??
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $37    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $85    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $5E    ; Data for TONEA ==> A
        DB      $01
        DB      $16
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $35    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $7E    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $54    ; Data for TONEA ==> A
        DB      $01
        DB      $34
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $3E    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $A8    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $6A    ; Data for TONEA ==> A
        DB      $01
        DB      $34
        DB      $03
        DB      $10
        DB      $30
        DB      VOLAB  ; Music Port = write VOLumes of tones A & B    ==> C
        DB      $EF    ; Data for VOLAB ==> A
        DB      VOLC   ; Music Port = write VOLume of tone C          ==> C
        DB      $0F    ; Data for VOLC  ==> A
        DB      VIBRA  ; Music Port = write VIBRAto frequency & range ==> C
        DB      $81    ; Data for VIBRA ==> A
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $70    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $3E    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $A8    ; Data for TONEA ==> A
        DB      $01
        DB      $60
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $70    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $42    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $A8    ; Data for TONEA ==> A
        DB      $01
        DB      $58
        DB      $02
        DB      $9B
        DB      $3B
        DB      $10
        DB      $14
        DB      $14
        DB      $48
        DB      $04
        DB      $F9
        DB      $FF
        DB      $14
        DB      $08
        DB      $FF
        DB      $23
        DB      $02
        DB      $03
        DB      $15
        DB      $28
        DB      $17
        DB      $20
        DB      $04
        DB      $EB
        DB      $FF
        DB      $54
        DB      $20
        DB      $04
        DB      $03
        DB      $02
        DB      $03
        DB      $05
        DB      $F9
        DB      $FF
        DB      $01
        DB      $16
        DB      $88
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $FD    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $FE    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $FF    ; Data for TONEA ==> A
        DB      $00
        DB      $01
        DB      $06
        DB      $03
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $E0    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $C8    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $B6    ; Data for TONEA ==> A
        DB      $10
        DB      $14
        DB      $14
        DB      $48
        DB      $16
        DB      $88
        DB      $15
        DB      $28
        DB      $17
        DB      $20
        DB      $01
        DB      $20
        DB      $02
        DB      $DF
        DB      $3B
        DB      $04
        DB      $EB
        DB      $FF
        DB      $80
        DB      $00
        DB      $FE
        DB      $01
        DB      $01
        DB      $01
        DB      $17
        DB      $80
        DB      $10
        DB      $40
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $68    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $44    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $21    ; Data for TONEA ==> A
        DB      $15
        DB      $1F
        DB      $16
        DB      $EE
        DB      $01
        DB      $40
        DB      $15
        DB      $2F
        DB      $05
        DB      $F9
        DB      $FF
        DB      $02
        DB      $04
        DB      $F9
        DB      $FF
        DB      $80
        DB      $02
        DB      $FF
        DB      $21
        DB      $01
        DB      $01
        DB      $14
        DB      $80
        DB      $04
        DB      $F2
        DB      $FF
        DB      $BF
        DB      $80
        DB      $01
        DB      $01
        DB      $02
        DB      $02
        DB      $00
        DB      $03
        DB      $10
        DB      $14
        DB      $14
        DB      $88
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $37    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $85    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $8D    ; Data for TONEA ==> A
        DB      $17
        DB      $00
        DB      $16
        DB      $AA
        DB      $15
        DB      $2A
        DB      $01
        DB      $28
        DB      $09
        DB      $14
        DB      $00
        DB      $04
        DB      $F9
        DB      $FF
        DB      $5C
        DB      $14
        DB      $06
        DB      $01
        DB      $04
        DB      $04
        DB      $17
        DB      $28
        DB      $00
        DB      TONEC  ; Music Port = write TONe C oscillator         ==> C
        DB      $A8    ; Data for TONEC ==> A
        DB      TONEB  ; Music Port = write TONe B oscillator         ==> C
        DB      $1A    ; Data for TONEB ==> A
        DB      TONEA  ; Music Port = write TONe A oscillator         ==> C
        DB      $7E    ; Data for TONEA ==> A
        DB      $16
        DB      $DD
        DB      $15
        DB      $2D
        DB      $10
        DB      $1E
        DB      $17
        DB      $18
        DB      $14
        DB      $01
        DB      $05
        DB      $F2
        DB      $FF
        DB      $05
        DB      $04
        DB      $F2
        DB      $FF
        DB      $1C
        DB      $01
        DB      $03
        DB      $23
        DB      $02
        DB      $02
        DB      $00
        DB      $05
        DB      $F2
        DB      $FF
        DB      $01
        DB      $14
        DB      $1C
        DB      $04
        DB      $F2
        DB      $FF
        DB      $1C
        DB      $01
        DB      $FD
        DB      $23
        DB      $07
        DB      $07
        DB      $00
        DB      $03

L3CA3:  PUSH    IY
        POP     HL
        LD      B,A
        ADD     HL,DE
        DEC     (HL)
        JP      NZ,L3D2E
        INC     HL
        LD      A,(HL)
        DEC     HL
        LD      (HL),A
        INC     HL
        INC     HL
        BIT     0,(HL)
        RET     Z

        LD      C,(HL)
        INC     HL
        BIT     2,C
        JR      NZ,L3D1C
        BIT     3,C
        JR      Z,L3CF8
        INC     HL
        INC     HL
        INC     HL
        XOR     A		; Zero A
        CP      (HL)		; ComPare address(HL) to A
        JR      Z,L3CDF		; If Zero goto Next code block
        DEC     (HL)		; Decrment addess
        JR      NZ,L3CDF	; If Not Zero goto Next code block
        RES     0,C
        LD      DE,$0006
        OR      A
        SBC     HL,DE
        LD      (HL),$00
        BIT     5,C
        JR      Z,L3CDB		;Skip LD if Zero
        LD      (IY+$0D),$01
L3CDB:  INC     HL
        INC     HL
        LD      (HL),C
        RET     


L3CDF:  DEC     HL
        DEC     HL
        DEC     HL
        RES     3,C
        BIT     1,C
        JR      NZ,L3CED
        XOR     A		; Zero A
        SUB     (HL)
        LD      (HL),A
        JR      L3CF8
L3CED:  DEC     HL
        LD      (HL),C
        BIT     4,C
        INC     HL
        INC     HL
        JR      Z,L3CF6		;Skip INC if Zero?
        INC     HL
L3CF6:  LD      B,(HL)
        RET     


L3CF8:  LD      A,B
        ADD     A,(HL)
        LD      B,A
        INC     HL
        CP      (HL)
        JR      NC,L3D05
        SET     4,C
        SET     3,C
        JR      L3D16
L3D05:  JR      NZ,L3D0D
        SET     4,C
        SET     3,C
        JR      L3D16
L3D0D:  INC     HL
        CP      (HL)
        JR      C,L3D15
        RES     4,C
        SET     3,C
L3D15:  DEC     HL
L3D16:  DEC     HL
        DEC     HL
        LD      (HL),C
        RET


        DB      $18
        DB      $0F


L3D1C:  INC     HL
        PUSH    HL
        LD      A,(HL)
        INC     HL
        SUB     (HL)
        NEG     
        LD      E,A
        LD      D,$00
        LD      A,R
        POP     HL
        ADD     A,(HL)
        LD      B,A
        JP      L3D31		;Jump to Return?

L3D2E:  INC     HL
        INC     HL
        LD      C,(HL)
L3D31:  RET     


;  Following the code...
;    1)  $4F59 = $3A06  ($3A06 holds $0310)
;    2)  $4F5B = $00
;    3)  COL3L = $63 (Red)
L3D32:  EXX     
        LD      HL,$3A06	; HL=3A06
        LD      ($4F59),HL      ; Set 4F59 to $3A06 
        LD      HL,$4F5B	; HL=4F5B
        LD      (HL),$00        ; 4F5B=0 Why? Zeroed in LDIR command later...

L3D3E:  LD      A,$63           ; $63 is the color red
        OUT     (COL3L),A       ; COLor 3 Left = $63 (Color Red)
        LD      A,$F5           ; F5 is the color Light Blue
        OUT     (COL1L),A       ; COLor 1 Left = $F5 (Light Blue) 
        LD      HL,$4F42
        SET     7,(HL)          ; Set Most Significant Bit of $4F42
        INC     HL              ; Set HL to $4F43
        XOR     A               ; Change A to $00
        LD      (HL),A          ; $4F43 = 0
        OUT     (COL0L),A       ; write COLor 0 Left = $00 (Black)
        INC     A               ; A = $01
        LD      HL,$4F66        ;
        LD      (HL),A          ; $4F66 = $01 Why? about to be 0ed by LDIR...
        LD      HL,($4F59)      ; Value could be 3A06 from L3D32... or something else
				; if entered from L3D3E
        PUSH    HL              ; Save value on stack
        LD      HL,$4F44        ; Start of block
        LD      BC,$0021	; Count
        LD      (HL),$00        ; $4F44 = $00 Zero first entry.
        LD      E,L             ; E = $44
        LD      D,H             ; D = $4F
        INC     DE              ; DE = $4F45 Same block +1
        LDIR                    ; Zero Block
				; LD (DE),(HL) INC DE,HL DEC BC Repeat to BC=0
				; In Effect Copy 4F44-4F65 to 4F45-4F66.
				; Since 4F44 was zeroed it just clears 4F45-4F66.     
        LD      HL,$4F59
        LD      BC,$0818	; Load B Count 08 and C port 18 (Sound Block Transfer)
        OTIR    		; OUT(c),(HL) INC HL DEC B until B=0.
				; Since 4F59-4F61 are now 0 this clears all sound ports to 0
        POP     HL		; Get value from stack
        LD      ($4F59),HL	; put here again. Saved from wipe.
        EXX     
        RET     


L3D74:  EXX     		; EXchange alternate registers before
        JR      L3D3E		; entering the routine above.

L3D77:  LD      E,(HL)		; Use DE to 
        INC     HL		; load HL with
        LD      D,(HL)		; Contents HL is 
        EX      DE,HL		; pointing to.
        XOR     A		; Zero A
        RET     


L3D7D:  LD      A,(HL)
        INC     HL
        EXX     
        LD      C,$10
        LD      HL,$000A
        JR      L3D8F

L3D87:  LD      A,(HL)
        INC     HL
        EXX     
        LD      C,$17
        LD      HL,$0003
L3D8F:  LD      DE,$4F59
        OUT     (C),A          ; Write to MUSIC port(s) ??
        ADD     HL,DE
        LD      (HL),A
        EXX     
        XOR     A		;Zero A
        RET     


L3D99:  LD      A,(HL)
        INC     HL
        EXX     
        LD      C,$16
        LD      HL,$0004
        JR      L3D8F
L3DA3:  LD      A,(HL)
        INC     HL
        EXX     
        LD      C,$15
        LD      HL,$0005
        JR      L3D8F
L3DAD:  LD      A,(HL)
        INC     HL
        EXX     
        LD      C,$14
        LD      HL,$0006
        JR      L3D8F
L3DB7:  LD      A,(HL)
        INC     HL
        EXX     
        LD      C,$11
        LD      HL,$0009
        JR      L3D8F
L3DC1:  LD      A,(HL)
        INC     HL
        EXX     
        LD      C,$12
        LD      HL,$0008
        JR      L3D8F
L3DCB:  LD      A,(HL)
        INC     HL
        EXX     
        LD      C,$13
        LD      HL,$0007
        JR      L3D8F
L3DD5:  LD      (IY+$02),$01
        RET     


L3DDA:  LD      (IY+$02),$00
        LD      A,($4F42)
        SET     7,A
        LD      ($4F42),A
        XOR     A		;Zero A
        RET     


L3DE8:  INC     A
        RET     


L3DEA:  LD      A,(HL)
        INC     HL
        LD      (IY+$0B),A
        INC     A
        RET     


L3DF1:  LD      E,(HL)
        INC     HL
        LD      D,(HL)
        INC     HL
        PUSH    HL
        PUSH    IY
        POP     HL
        ADD     HL,DE
        LD      DE,$0005
        ADD     HL,DE
        LD      A,$06
        POP     DE
L3E01:  EX      DE,HL
        LD      B,(HL)
        INC     HL
        EX      DE,HL
        LD      (HL),B
        DEC     HL
        DEC     A
        JR      NZ,L3E01
        EX      DE,HL
        RET     


L3E0C:  LD      E,(HL)
        INC     HL
        LD      D,(HL)
        INC     HL
        LD      A,(HL)
        INC     HL
        PUSH    HL
        PUSH    IY
        POP     HL
        ADD     HL,DE
        LD      DE,$0006
        ADD     HL,DE
        LD      (HL),A
        POP     HL
        XOR     A
        RET     

;  Seems like a Jump Table to me -- So I treated it as such ??
;  These addresses are loaded into HL from $3F46
L3E1F:  DW      L3DE8
        DW      L3DEA
        DW      L3D77
        DW      L3D74
        DW      L3DF1
        DW      L3E0C
        DW      L3DE8
        DW      L3DE8
        DW      L3DE8
        DW      L3DDA
        DW      L3DD5
        DW      L3DE8
        DW      L3DE8
        DW      L3DE8
        DW      L3DE8
        DW      L3DE8
        DW      L3D7D
        DW      L3DB7
        DW      L3DC1
        DW      L3DCB
        DW      L3DAD
        DW      L3DA3
        DW      L3D99
        DW      L3D87
        
L3E4F:  LD      A,D
        CP      (IY+$02)
        JR      C,L3E63
        EXX     
        CALL    L3D3E
        LD      (IY+$0D),$01
        LD      (IY+$02),D
        LD      ($4F59),HL
L3E63:  LD      HL,$4F42
        RES     7,(HL)
        RET


L3E69:  LD      HL,$4F41
        LD      A,(HL)
        OR      A
        JR      Z,L3E9E
        LD      (HL),$00
        RRA     
        LD      D,$02
        LD      HL,$3B29
        JR      C,L3E4F
        RRA     
        LD      D,$01
        LD      HL,$3A07
        JR      C,L3E4F
        LD      D,$00
        RRA     
        LD      HL,$3A80
        JR      C,L3E4F
        RRA     
        LD      HL,$3A40
        JR      C,L3E4F
        RRA     
        LD      HL,$3A2A
        JR      C,L3E4F
        RRA     
        RRA     
        LD      HL,$3B55
        JR      C,L3E4F
        RRA     
L3E9E:  RET     


L3E9F:  LD      HL,$4F42
        LD      A,(HL)
        CP      $80
        JR      Z,L3ED4
        LD      (HL),$00
        RRA     
        LD      D,$01
        LD      HL,$3C1E
        JP      C,L3E4F
        RRA     
        LD      D,$00
        LD      HL,$3B0F
        JP      C,L3E4F
        RRA     
        RRA     
        LD      HL,$3A56
        JP      C,L3E4F
        RRA     
        LD      HL,$3BDF
        JP      C,L3E4F
        RRA     
        LD      D,$01
        LD      HL,$3C09
        JP      C,L3E4F
        RRA     
L3ED4:  RET


L3ED5:  LD      IY,$4F59
        LD      HL,$3F36
        PUSH    HL
        LD      HL,$4F40
        LD      A,(HL)       
        LD      (HL),$00
        OR      A
        JR      Z,L3F30
        LD      D,$00
        RRA     
        LD      HL,$3B9B
        JP      C,L3E4F
        RRA     
        LD      HL,$3B6D
        JP      C,L3E4F
        RRA     
        LD      HL,$3B7E
        JP      C,L3E4F
        LD      D,$02
        RRA     
        JR      NC,L3F0E
        LD      HL,$3AE7
        CALL    L3E4F
        LD      HL,$4F43
        LD      (HL),$01
        RET


L3F0E:  RRA     
        LD      HL,$3C53
        JP      C,L3E4F
        RRA     
        LD      D,$00
        LD      HL,$3AB8
        JP      C,L3E4F
        RRA     
        LD      D,$02
        LD      HL,$3C74
        JP      C,L3E4F
        RRA     
        LD      D,$03
        LD      HL,$3BC4
        JP      C,L3E4F


L3F30:  CALL    L3E69
        JP      L3E9F
        LD      A,($4F66)
        OR      A
        JR      Z,L3F5F
        LD      HL,($4F59)
L3F3F:  LD      A,(HL)         ; Get music data ??
        INC     HL
        EXX     
        LD      HL,$3F55
        PUSH    HL
        LD      HL,$3E1F
        RLCA    
        LD      E,A
        LD      D,$00
        ADD     HL,DE
        LD      E,(HL)
        INC     HL
        LD      D,(HL)
        PUSH    DE
        EXX     
        XOR     A
        RET


; Next address loaded into HL
L3F55:  DB      $B7
        DB      $28
        DB      $E7
        DB      $22
        DB      $59
        DB      $4F
        DB      $FD
        DB      $36
        DB      $0D
        DB      $00


L3F5F:  XOR     A
        CP      (IY+$0D)
        JR      NZ,L3FB5
        CP      (IY+$0C)
        JR      NZ,L3FB5
        INC     (IY+$0C)
        CP      (IY+$0B)
        JR      Z,L3F7B
        DEC     (IY+$0B)
        JR      NZ,L3F7B
        LD      (IY+$0D),$01
L3F7B:  CP      (IY-$15)
        JR      Z,L3F8D
        LD      A,($4F5C)
        LD      DE,$FFEB
        CALL    L3CA3
        LD      (IY+$03),B
        XOR     A
L3F8D:  CP      (IY-$07)
        JR      Z,L3F9F
        LD      A,($4F63)
        LD      DE,$FFF9
        CALL    L3CA3
        LD      (IY+$0A),B
        XOR     A
L3F9F:  CP      (IY-$0E)
        JR      Z,L3FB1
        LD      A,($4F5F)
        LD      DE,$FFF2
        CALL    L3CA3
        LD      (IY+$06),B
        XOR     A
L3FB1:  XOR     A
        LD      ($4F65),A
L3FB5:  LD      BC,$0818
        LD      HL,$4F5C
        OTIR    
        XOR     A
        LD      HL,$4F43
        CP      (HL)
        JR      Z,L3FE0
        DEC     (HL)
        JR      NZ,L3FD9
        SYSTEM  RANGED          ;  UPI Ranged Random Number
        ;
        LD      B,A
        AND     $0F
        ADD     A,$04
        LD      (HL),A
        LD      A,B
        OR      $03
        BIT     7,A
        JR      NZ,L3FD7
        XOR     A
L3FD7:  OUT     (COL0L),A       ; write COLor 0 Left
L3FD9:  LD      A,(HL)
        AND     $07
        OUT     (COL3L),A       ; write COLor 3 Left
        OUT     (COL1L),A       ; write COLor 1 Left
L3FE0:  RET     

        DB      "(C)ASTROVISION",$00
        DB      "THE WIZARD",$00

        DB      $03
        DB      $12
        DB      $82
        DB      $FF
        DB      $FF

End     ; End of "The Incredible Wizard"

The Incredible Wizard
(Instruction from Astrocade Manual)


Challenge The Incredible Wizard and his creatures in their own environment: 
treacherous dungeons!  Slip through the magic door to the other side of the 
dungeon, but prevent the super monster from escaping through it.  Shoot The 
Incredible Wizard and experience the tremor of the entire dungeon as his magic 
wavers.  Become a Worlord and play Worlord Dungeons-- even go all the way to the 
PIT.  Fantastic sounds and bonus plays make The Incredible Wizard just like 
coin-op games!

Copyright (c)1982 Astrocade, Inc.  All Rights Reserved


                THE INCREDIBLE WIZARD #2017
    Created by Tom McHugh, Scot Norris, and Julie Malan.
     With creative consultation and in conjunction with
                   Action Graphics, Inc.
                Produced by Astrocade, Inc.

          Licensed from Bally/Midway Mfg. Co. and 
   based on the original (c) "Wizard of Wor" game done by
           Dave Nutting Associates (A Bally Co.)
  Cassette documentation by Scot Norris and Dave Armstrong
          Copyright Action Graphics, Inc. 2/22/82


Loading Instructions

1.  Turn on your Astrocade and TV set, then select channel 3 or 4.

2.  Connect the hand controls by inserting control #1 into the first
    jack on the back left side (as you face the front of the Astrocade).
    From left to right, the jacks connect to players 1, 2, 4 and 3.

3.  Insert the game cartridge, label side up, into the cartridge slot.
    Press it down firmly to lock it into position.

4.  Press the RESET button and the menu of games will be displayed. 


The Incredible Wizard (1 or 2 players) 

     A player is referred to as a "worrior" as he or she is in the Dungeons of 
Wor, the Wizard's homeland.  In two player mode, both players play at the same 
time, in the same maze.  Player 1 is on the left, player 2 on the right.  Their 
adversaries are the Wizard and his pets, the Worlings. 

Starting the Game 

     Choose "1-THE WIZARD."  Another menu comes up asking for a one or two 
player game.  Choose one, and a third menu will ask for easy, medium, or hard.  
Choosing one of these will start the game. 

     Before each maze there is a screen display to inform the player(s) to "GET 
READY," and of any bonuses awarded.  Then a super large "GO" screen appears for 
a few seconds before the next maze starts.  The worriors enter the maze from the 
bottom and have ten seconds to leave their home squares before they get booted 
in automatically. 

Playing The Game

     The hand control functions for The Incredible Wizard are:

     Joystick   Moves the worrior up, down, left, or right.
     Trigger    Shoots your "Concentrated Unified-Field Disturbance Rifle"
                in the direction you're facing. 

     Because of the nature of a unified-field disturbance, only one shot can be 
"in the air" at a time, and until it strikes a wall, monster, another shot, or 
the other worrior, another shot cannot be fired.  Long corridors can be 
dangerous because while the shot is traversing the corridor, a monster can come 
in behind it and eat the player, who could not shoot again.  This puts a great 
importance on WHEN the player shoots, and when NOT to shoot.  Alternately, short 
shots hit nearby walls and can be reloaded quickly, giving the player a rapid-
fire capability.  The problem with short shots is there is only one chance to 
shoot a monster or he will sneak in between shots and run over the player. 

     There are two objectives in The Incredible Wizard: descend as far as 
possible into the dungeons and score as many points as possible.  Higher point 
totals are achieved by shooting the Worluk and the Wizard to earn a point 
multiplier on the next maze.  Descending into the eighth maze earns the player 
the title "Worlord" and the privilege of challenging the Worlord dungeons.  An 
extra player is given at the fourth maze, nicknamed "The Arena," at the eighth 
maze entering the Worlord dungeons, and at the eleventh maze, the pinnacle of 
the Worlords, "The PIT."  Extra players are also awarded every four more mazes, 
e.g. 15, 19..., and another PIT is encountered, giving Worlords a standard to 
compare each other's ability, as in "I made it to FOUR PITS!!!" 

     The first creature to battle is Burwor, the hopping monster.  He is the 
slowest of all the monsters and is always visible.  After Burwor is Garwor, the 
chomping monster.  Then, Thorwor, the "lightning" monster, as he is the fastest 
of the three basic monsters.  Both Thorwor and Garwor are invisible until the 
player is in the same CORRIDOR as the monster.  The real world analogy is that a 
person walking around a corner is "invisible" until they "appear" in the front 
of the observer.

     A RADAR at the bottom of each maze tracks these "invisible" monsters.  
Although the radar has no lines to show the walls in the maze, one can get very 
good at knowing where a monster is located in the maze.  The radar is critical 
in tracking Thorwor as he moves too fast to rely exclusively on reflexes.  DON'T 
WALK AROUND A CORNER JUST BECAUSE NO MONSTER IS VISIBLE!!  Check the radar 
first.

     Clearing all these monsters out of a maze brings out Worluk, the flying 
monster.  Worluk is visible all the time and will try to escape out of one of 
the two magic doors.  He is very fast and can be avoided if the player chooses 
to do so, but then double score may not be earned for the next maze.  Should you 
try and stop him, maneuver towards the door and cover it, so when Worluk tries 
to leave, you are in position to shoot him.  After the Worluk escapes or is 
shot, the Wizard may appear.

     The Wizard comes out more frequently in higher mazes, and is more difficult 
as the player descends deeper into his dungeon.  He disappears and reappears and 
cannot be tracked by radar.  Avoiding the Wizard is impossible, as he will 
teleport closer and closer to either worrior until one of them has "bit the 
dust" or has shot him.  Shooting the Wizard makes his magic waver and the entire 
dungeon shakes with his demise.  He cannot be completely destroyed and will be 
back in a subsequent maze.  While he is walking around, he is shooting lightning 
bolts in random directions waiting for a mistake. 

     To battle the Wizard, one can try to anticipate his movement into a 
corridor and shoot down that corridor, or one can wait for him to walk in front 
of you and shoot him then.  The latter method has a serious drawback.  While 
waiting for him, he is reappearing closer and closer to you, and he might show 
up right behind you!  Shooting the Wizard doubles the next maze's points, so 
shooting both the Worluk and the Wizard is good for QUADRUPLE (4x) points in the 
subsequent maze.

SCORING

Name         Color                   Point Value
Burwor       Blue                    10 points
Garwor       Yellow                  20 points
Thorwor      Red                     50 points
Worluk       Blue with Yellow Wings  100 points
The Wizard   Blue                    250 points
Worriors     Yellow or Blue          100 points


PLAYING AGAIN

     To play The Incredible Wizard again, press the RESET button, and follow the 
instructions for starting the game.
