; disassembly of 'quest1_1528' by 6502dis v1.1
; org=$1528

Labels
------


SEC
MODE
$1528
MAIN
INIT
COLOURS
ESCAPE
label3
label4
label5
INIT
MAIN
LIVES
ZXKEYS
AFTERKEYS
JTINDEX
JMPTABLE
INVEN
PLAYSOUND
SETPALETTE
DETECTKEYS
SCROLL3
CARRYING
M5
PACING
M7
M8
M9
N1
N2
N3
N4
N5
N6
N7
N8
N9
W3
W4
WF
LOC1
LOC2
YESNO
ESC1
MESSAGES
PRINTOBJ
SCREEN
SCROLL
U2
U3
U4
U5
U6
U7
WWN

W5



Zero Page Addresses
-------------------

See bottom of page for initial zero page settings on first start.

&70 Holds the ZX keypress

Z  - #&00
X  - #&02

Is then copied to &6f location
&71 Holds the ZX keypress

:  - #&00
/  - #&01

When "RETURN" to Jump is pressed

$6d - #&00
$53 - #&00
$52 - #&01

DATA locations
--------------

A list of objects is stored at:-

  $0caf

  { SWORD AIR COIN RUBY GOLD BUCKET TORCH TORCH TORCH 
    STOOL WAND EMPTY TORCH }

A list of message fragments is stored at:-
   
  $0a7c

  { }

$09cf compare with keypress

The screen/room information begins at &0400->&0800

Each screen/room is row: 6 blocks
                    col: 9 blocks

There are X rooms in total.

Codes for scenery blocks is:-
-----------------------------

#&0 = AIR
#&1 = WALL
#&2 = SLOPE ( "/" ) +ve
#&3 = SLOPE ( "\" ) -ve
#&4 = LADDER
#&5 = LADDER
#&6 = WALKWAY
#&7 =
#&8 = DOORWAY
#&9 = 
#&b = LADDER into WATER
#&c = WATER
#&A = BED

Inventory stored in 4 bytes in &09c0 ?


More Data
---------

Data at &1220?


Zero Page Addresses
-------------------

$30    --    Set to #&ff each "PLAY" 
$31    --    Copy of $30 made in "WAIT"
&33    --    Value of timer taken at start of each "PLAY"
&34    --   
&35    --   
&36    --   
&37    --   

&47    --           [#&FF]
&57    --   
&53    --           [#&FF]
&5d    --           [#&FF]

&63    --           [#&FF]
&67    --   
&68    --   (#&00) 
&69    --   (#&00)  [#&e8]

&6c    --           [#&FF]
&6d    --   

&70    --      
&71    --
&72    --   Scratch variable 
&73    --    
&74    --    
&75    --    
&76    --    
&77    --    
&78    --    
&79    --    
&7f    --

&9d    --

&ALIVE --             [#&00]

SUBSIDIARY ROUTINES
====================

/*----------------------------------------
 *
 *  Entry Point $0910
 *
 *----------------------------------------*/
$0910: a9 51            LDA #$51
$0912: 38               SEC
$0913: e5 74            SBC $74
$0915: 85 7c            STA $7c
$0917: e9 03            SBC #$03
$0919: 85 7b            STA $7b
$091b: a5 77            LDA $77
$091d: 38               SEC
$091e: e5 85            SBC $85
$0920: 85 79            STA $79
$0922: a5 78            LDA $78
$0924: e5 86            SBC $86
$0926: d0 14            BNE $093c
$0928: a5 79            LDA $79
$092a: c9 03            CMP #$03
$092c: 90 0b            BCC $0939
$092e: c5 7c            CMP $7c
$0930: b0 0a            BCS $093c
$0932: c5 7b            CMP $7b
$0934: b0 03            BCS $0939
$0936: a9 ff            LDA #$ff
$0938: 60               RTS

$0939: a9 01            LDA #$01
$093b: 60               RTS
$093c: a9 00            LDA #$00
$093e: 60               RTS
$093f: a5 71            LDA $71
$0941: 30 0a            BMI $094d
$0943: f0 04            BEQ $0949
$0945: de 30 0c         DEC $0c30,X
$0948: 60               RTS

$0949: fe 30 0c         INC $0c30,X
$094c: 60               RTS

$094d: c9 ff            CMP #$ff
$094f: f0 06            BEQ $0957
$0951: de 30 0c         DEC $0c30,X
$0954: de 30 0c         DEC $0c30,X
$0957: 60               RTS

/*----------------------------------------
 *
 *  Entry Point $016a
 *
 *----------------------------------------*/
.SEC:  38               SEC
$016b: 60               RTS
/*----------------------------------------*/

/*----------------------------------------
 *
 *  Entry Point $087f
 *
 *----------------------------------------*/
.MODE: a9 16            LDA #$16     //
$0881: 20 ee ff         JSR $ffee    // 
$0882: a9 02            LDA #$02     //
$0883: 20 ee ff         JSR $ffee    //  Mode 2  ( &3000 -> &7fff = &4fff bytes)

$0884: a9 08            LDA #$08
$0885: 8d 00 fe         STA $fe00    //  SHELIA, Interlace and delay
$0886: a9 c0            LDA #$c0
$0887: 8d 01 fe         STA $fe01    //  SHELIA, nonsense only first 6 bits used.
                                     //          Normal, non-interlaced sync
                                     //          No delay.
$0888: a9 9b            LDA #$9b
$0889: a2 90            LDX #$90
$088a: 20 f4 ff         JSR $fff4    //  OSBYTE Write to video ULA palette register 97
$088b: a2 f0            LDX #$f0
$088c: 4c f4 ff         JMP $fff4    //  OSBYTE Write to video ULA palette register f7
/*----------------------------------------*/

/*----------------------------------------
 *
 *  Entry Point $03e0 (NOTE THIS IS ALSO KBD BUFFER)
 *
 *    Clear memory from $3000 -> $ff00 ! ! !
 *
 *----------------------------------------*/
$03e0: a9 00            LDA #$00
$03e2: aa               TAX
$03e3: 9d 00 30         STA $3000,X
$03e6: e8               INX
$03e7: d0 fa            BNE $03e3
$03e9: ee e5 03         INC $03e5
$03ec: 10 f5            BPL $03e3
$03ee: 4c 28 15         JMP $1528
/*----------------------------------------*/

MAIN ROUTINES
=============
$1528 is called after the relocation code at $4340 has run and called the small routine at $03e0.

/*----------------------------------------
 *
 *  Entry Point
 *
 *----------------------------------------*/
$1528: 20 80 08         JSR MODE
$152b: 20 cc 2b         JSR COLOURS
$152e: 4c 3d 2a         JMP ESCAPE

// Mode 2 Screen Layout:-
// -----------------------
//   128 bytes wide
//   
//
//   8 bits * 32 
//
//
/*----------------------------------------*/
/*
/* Does the snazzy screen scroll
/*
/*----------------------------------------*/
.INIT: 20 6a 01         JSR SEC                 { SEC, RTS }
$1534: a9 50            LDA #$50
$1536: 85 72            STA $72
.LOOP: 20 01 21         JSR MOVESCREENLEFT             // Generates &83,&84
$153b: 20 4f 21         JSR SETSCREENADDRESS    // CRTC processing
$153e: 20 a5 20         JSR WRITESCREEN
$1541: c6 72            DEC $72
$1543: d0 f3            BNE .LOOP               // Do this 80 times - vertical scrolling
      
/*----------------------------------------
 *
 *  Main loop
 *
 *  28/2/2006
/*-----------------------------------------
.MAIN: a5 75            LDA $ALIVE        // Starts at zero
$1547: 10 03            BPL $154c
$1549: 4c 91 29         JMP .LIVES        // Jump here when dead

$154c: a5 ec            LDA $ec
$154e: c9 f0            CMP #$f0
$1550: d0 03            BNE $1555
$1552: 4c 3d 2a         JMP ESCAPE       // ESCAPE pressed - do a restart

$1555: e6 67            INC $67           // Initial value &67=#&00
$1557: d0 0a            BNE CONT         // Carry on if not zero, not sure but is checked later on

                                          // Carried out first time round the loop (when =#&00)
$1559: e6 68            INC $68           //   and every 255 times round the MAIN loop
$155b: a5 69            LDA $69
$155d: c9 01            CMP #$01          // Hmmm, $69 is reset to #$e8 when escaped pressed
$155f: f0 02            BEQ CONT         //                       =232
$1561: c6 69            DEC $69           //
/*-----------------------------------*/
.CONT: ae 17 0c         LDX JTINDEX
$1566: ad cf 0b         LDA $0bcf
$1569: dd f6 09         CMP $09f6,X
$156c: d0 48            BNE PLAY

$156e: 86 89            STX $89           // Used for restoring value in .RESTART ( when not called by 'ESCAPE ' )
$1570: bd 08 0a         LDA $0a08,X
$1573: 30 17            BMI $158c
$1575: a9 ff            LDA #$ff
$1577: 9d 08 0a         STA $0a08,X
$157a: e6 57            INC $57
$157c: e0 00            CPX #$00
$157e: f0 08            BEQ $1588
$1580: e0 02            CPX #$02
$1582: f0 04            BEQ $1588
$1584: e0 04            CPX #$04
$1586: d0 04            BNE $158c
/*-----------------------------------*/
$1588: a9 30            LDA #$30
$158a: 85 34            STA $34
/*-----------------------------------*/
$158c: a5 35            LDA $35
$158e: 85 37            STA $37

/*----------------------------------------
 *
 *  Preseve values... to set a restore point
 *                    if you die...
 *
 *----------------------------------------*/
$1590: a2 03            LDX #$03
$1592: bd c0 09         LDA $CARRYING,X
$1595: 9d f1 09         STA $09f1,X
$1598: ca               DEX
$1599: 10 f7            BPL $1592
/*-----------------------------------*/
$159b: a5 9c            LDA $HOLDING
$159d: 85 14            STA $14
/*-----------------------------------*/
$159f: a2 0b            LDX #$0b
.LOOP: bd a0 0b         LDA $0ba0,X
$15a4: 9d 24 0d         STA $0d24,X
$15a7: bd e8 0b         LDA $0be8,X
$15aa: 9d f8 0c         STA $0cf8,X
$15ad: bd 30 0c         LDA $0c30,X
$15b0: 9d 04 0d         STA $0d04,X
$15b3: ca               DEX
$15b4: 10 eb            BPL LOOP






//  Execute one game "frame"
//
//
//
/*-----------------------------------*/
.PLAY: a9 ff            LDA #$ff
$15b8: 85 9d            STA $9d
$15ba: 85 30            STA $30
$15bc: 85 33            STA $33
$15be: a9 13            LDA #$13
$15c0: 20 f4 ff         JSR $fff4           // OSBYTE - Disable events
$15c3: ad 79 fe         LDA $fe79           // VIA-B Timer2 MSB / mirrored location
$15c6: 85 32            STA $32             // Save for later
$15c8: 20 5a 1e         JSR INVEN          // Has "I" been pressed?
$15cb: 20 ec 15         JSR JMPTABLE       // Affects Red Demons and Green man
$15ce: 20 ad 2d         JSR SETPALETTE     // Test &34 for Minus, Zero or 20
$15d1: 20 58 17         JSR DETECTKEYS     // React to keypresses
$15d4: 20 fb 20         JSR SCROLL3        // Adjust SCRHI SCRLO screen origin
$15d7: 20 01 2c         JSR TAKE           // Need this to pick stuff up
$15da: 20 ea 2c         JSR WAIT           // Without this get flicker/semi-invisible man
$15dd: 20 92 20         JSR PACING         // Speed Timing issues
$15e0: 20 e4 2c         JSR M7             // Without this no man appears but you can scroll freely! manipulates 0c30
$15e3: 20 6e 1d         JSR M8
$15e6: 20 b7 2f         JSR M9
$15e9: 4c 45 15         JMP MAIN
/*-----------------------------------*/
 *  Use .JTINDEX to get index into $0a11 for entry
 *
 *  Range min #&00 max #&27
 *
 * Contents of $0a11:-
 *  {$00,$03,$09,$0c,$12,$18,$24,$24,$21,$50,$1d,$d0,$c0,$b0,
 *   $ff,$e0,$a0,$00,$20,$10,$00,$90,$00,$10,$10,$80,$00,$00,
 *   $00,$02,$00,$03,$01,$00,$05,$02}
 * 
 * On restart JTINDEX is #&03 so routine will jump to routine N5
/*-----------------------------------*/
.JMPTABLE  : ac 17 0c   LDY JTINDEX
$15ef: b9 11 0a         LDA $0a11,Y
$15f2: 8d f6 15         STA $15f6   
$15f5: 10 ff            BPL $15f6         // Index into the jump table below
/*----------------------------------------*/
$15f7: 4c 80 18         JMP .N1
$15fa: 20 80 18         JSR .N1
$15fd: 4c 1b 2b         JMP .N2
$1600: 4c 7b 26         JMP .N3
$1603: 20 7b 26         JSR .N3
$1606: 4c 44 23         JMP .N4
$1609: 20 44 23         JSR .N4

$160c: 4c fc 22         JMP .N5           // N5 is called on startup
$160f: 20 44 23         JSR .N4
$1612: 20 15 23         JSR .N6
$1615: 20 20 23         JSR .N7
$1618: 4c 39 2e         JMP .N8
$161b: 20 39 2e         JSR .N8
$161e: 4c c5 25         JMP .N9
/*----------------------------------------*/
.W4:   a5 71            LDA $71
$1623: 30 7a            BMI .LOC1
$1625: bd 18 0d         LDA $0d18,X
$1628: c9 04            CMP #$04
$162a: 30 0d            BMI .LOC2
$162c: 20 c0 00         JSR $00c0
$162f: f0 08            BEQ .LOC2
$1631: a9 ff            LDA #$ff
$1633: 85 71            STA $71
$1635: 85 70            STA $70
$1637: 18               CLC
$1638: 60               RTS

.LOC2: bd a0 0b         LDA $0ba0,X
$163c: 85 77            STA $77
$163e: 29 07            AND #$07
$1640: f0 5d            BEQ .LOC1
$1642: 18               CLC
$1643: 65 74            ADC $74
$1645: c9 08            CMP #$08
$1647: 10 56            BPL .LOC1
$1649: bd e8 0b         LDA $0be8,X
$164c: 85 78            STA $78
$164e: a5 71            LDA $71
$1650: f0 15            BEQ $1667
$1652: bd 30 0c         LDA $0c30,X
$1655: 85 76            STA $76
$1657: c6 76            DEC $76
$1659: 30 44            BMI .LOC1
$165b: 20 69 07         JSR $0769  <--- DISPLAY
$165e: d0 1f            BNE $167f
$1660: 68               PLA
$1661: 68               PLA
$1662: 4c 60 18         JMP $1860
$1665: 30 38            BMI .LOC1
$1667: bd 30 0c         LDA $0c30,X
$166a: 18               CLC
$166b: 65 73            ADC $73
$166d: 85 76            STA $76
$166f: 20 69 07         JSR $0769
$1672: c9 01            CMP #$01
$1674: f0 29            BEQ .LOC1
$1676: c9 04            CMP #$04
$1678: f0 14            BEQ $168e
$167a: bd 30 0c         LDA $0c30,X
$167d: 85 76            STA $76
$167f: 20 69 07         JSR $0769
$1682: c9 0b            CMP #$0b
$1684: f0 08            BEQ $168e
$1686: c9 06            CMP #$06
$1688: 10 15            BPL .LOC1
$168a: c9 04            CMP #$04
$168c: 30 11            BMI .LOC1
$168e: bd 30 0c         LDA $0c30,X
$1691: 29 01            AND #$01
$1693: 18               CLC
$1694: 69 04            ADC #$04
$1696: 9d 18 0d         STA $0d18,X
$1699: a9 ff            LDA #$ff
$169b: 85 70            STA $70
$169d: 18               CLC
$169e: 60               RTS

.LOC1: a9 ff            LDA #$ff
$16a1: 85 71            STA $71
$16a3: 38               SEC
$16a4: 60               RTS


// Entry with Y set to index into zeropage...
//

_KEYS: a5 9e            LDA $9e
$16a7: 30 35            BMI $16de    // RTS
$16a9: a4 9c            LDY $HOLDING
$16ab: 30 31            BMI $16de    // RTS
$16ad: a5 50            LDA $50
$16af: d0 2d            BNE $16de    // RTS

$16b1: b9 00 00         LDA $0000,Y
$16b4: c9 04            CMP #$04
$16b6: f0 1f            BEQ $16d7
$16b8: 48               PHA
$16b9: a5 70            LDA $70
$16bb: 99 00 00         STA $0000,Y
$16be: 20 dc 2e         JSR .U2
$16c1: 68               PLA
$16c2: 99 00 00         STA $0000,Y
$16c5: 84 72            STY $72
$16c7: 20 9a 21         JSR .U3
$16ca: 20 dc 2e         JSR .U2
$16cd: 20 50 1c         JSR .U4
$16d0: 20 3f 1c         JSR .U5
$16d3: a4 72            LDY $72
$16d5: 90 07            BCC $16de

$16d7: a9 ff            LDA #$ff
$16d9: 85 71            STA $71
$16db: 85 70            STA $70
$16dd: 60               RTS

$16de: 18               CLC
$16df: 60               RTS

.WWN: a5 9e             LDA $9e
$16e2: 85 70            STA $70              // set-seventy
$16e4: a2 2f            LDX #$2f
$16e6: 10 c9            BPL $16b1

//
//  Call with &9d,&79,&70,&7f
//
.W5: a2 2f              LDX #$2f
$16ea: a5 9d            LDA $9d
$16ec: 10 14            BPL $1702
$16ee: 20 98 21         JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$16f1: 20 10 09         JSR $0910
$16f4: a5 79            LDA $79
$16f6: c9 10            CMP #$10
$16f8: 30 04            BMI $16fe
$16fa: c9 3b            CMP #$3b
$16fc: 30 04            BMI $1702
$16fe: a5 70            LDA $70
$1700: 85 9d            STA $9d

$1702: ad 47 0d         LDA $0d47
$1705: 85 7f            STA $7f
$1707: 20 cc 2c         JSR .U7
$170a: 60               RTS

.W3: a5 70              LDA $70
$170d: 30 11            BMI $1720
$170f: bd a0 0b         LDA $0ba0,X
$1712: 29 01            AND #$01
$1714: a4 50            LDY $50
$1716: f0 02            BEQ $171a
$1718: 49 01            EOR #$01
$171a: 18               CLC
$171b: 65 70            ADC $70
$171d: 9d 18 0d         STA $0d18,X
$1720: bd 18 0d         LDA $0d18,X
$1723: 60               RTS

.WF: a5 09              LDA $09
$1726: c9 04            CMP #$04
$1728: d0 2d            BNE $1757
$172a: ad 17 0c         LDA .JTINDEX
$172d: cd f1 0b         CMP $0bf1
$1730: d0 25            BNE $1757
$1732: ac 5f 0c         LDY $0c5f
$1735: 88               DEY
$1736: cc 39 0c         CPY $0c39
$1739: d0 1c            BNE $1757
$173b: ad a9 0b         LDA $0ba9
$173e: 38               SEC
$173f: ed cf 0b         SBC $0bcf
$1742: 90 13            BCC $1757
$1744: c9 03            CMP #$03
$1746: b0 0f            BCS $1757
$1748: a9 ff            LDA #$ff
$174a: 85 6d            STA $6d
$174c: 85 53            STA $53
$174e: 85 6c            STA $6c
$1750: a2 68            LDX #$68       // Sound command address block is 0968
$1752: 20 35 0a         JSR .PLAYSOUND
$1755: 68               PLA
$1756: 68               PLA
$1757: 60               RTS
/*----------------------------------------
 *
 *  1/3/2006 Keypress routine...
 *
 *----------------------------------------*/
.DETECTKEYS: a2 2f      LDX #$2f
$175a: 20 75 20         JSR U8
$175d: 90 03            BCC $1762
$175f: 4c 35 1f         JMP $1f35

$1762: a5 63            LDA $63
$1764: 30 03            BMI $1769
$1766: 4c b5 27         JMP $27b5
$1769: a9 00            LDA #$00
$176b: a4 ec            LDY $ec
$176d: c0 c9            CPY #$c9   // Keypress - RETURN
$176f: f0 02            BEQ $1773
$1771: 85 52            STA $52

$1773: a5 ed            LDA $ed
$1775: 20 24 2f         JSR FKEYS
$1778: 10 05            BPL $177f
$177a: a5 ec            LDA $ec
$177c: 20 24 2f         JSR FKEYS
$177f: a5 9e            LDA $9e
$1781: 30 0f            BMI Z1
$1783: 20 18 1d         JSR W1    //  
$1786: a5 ed            LDA $ed
$1788: 20 34 2f         JSR PRSKEYS
$178b: 30 05            BMI Z1
$178d: a5 ec            LDA $ec
$178f: 20 34 2f         JSR PRSKEYS

.Z1: a9 ff              LDA #$ff
$1794: 85 70            STA $70
$1796: 85 71            STA $71
$1798: a2 2f            LDX #$2f
$179a: a5 53            LDA $53
$179c: 30 03            BMI $17a1
$179e: 4c ce 1a         JMP $1ace

$17a1: 20 98 21         JSR U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$17a4: 20 10 09         JSR $0910
$17a7: a5 ec            LDA $ec      // Keypress "C" Scroll whole screen left...
$17a9: c9 d2            CMP #$d2
$17ab: d0 0a            BNE $17b7
$17ad: a5 79            LDA $79
$17af: c9 10            CMP #$10     // extent left
$17b1: 30 17            BMI $17ca
$17b3: a9 02            LDA #$02
$17b5: 10 0e            BPL $17c5
$17b7: a5 ec            LDA $ec      // Keypress "V" scroll whole screen right...
$17b9: c9 e3            CMP #$e3
$17bb: d0 0d            BNE $17ca
$17bd: a5 79            LDA $79
$17bf: c9 3b            CMP #$3b     // extent right
$17c1: 10 07            BPL $17ca
$17c3: a9 00            LDA #$00

$17c5: 85 9d            STA $9d
$17c7: 4c 75 18         JMP MOVESCREEN    // scrolling

$17ca: a5 62            LDA $62
$17cc: 10 01            BPL $17cf
$17ce: 60               RTS
/*----------------------------------------*/


                                              // Can jump left and right

$17cf: a5 52            LDA $52
$17d1: d0 21            BNE $17f4
$17d3: a5 ec            LDA $ec
$17d5: c9 c9            CMP #$c9              // Keypress "RETURN" - Jump
$17d7: d0 1b            BNE $17f4
$17d9: a9 00            LDA #$00
$17db: 85 6d            STA $6d
$17dd: 85 53            STA $53
$17df: a9 01            LDA #$01
$17e1: 85 52            STA $52
$17e3: a5 ed            LDA $ed
$17e5: 20 85 2e         JSR .ZXKEYS           // Set &70 or &71 if "ZX:/" pressed
$17e8: a5 70            LDA $70
$17ea: 85 6f            STA $6f

$17ec: a2 70            LDX #$70
$17ee: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0970
$17f1: 4c 08 1b         JMP .AFTERKEYS






$17f4: a5 ed            LDA $ed              // Keyboard rollover
$17f6: 20 85 2e         JSR .ZXKEYS
$17f9: 10 05            BPL $1800
$17fb: a5 ec            LDA $ec
$17fd: 20 85 2e         JSR .ZXKEYS
$1800: a5 70            LDA $70
$1802: c5 62            CMP $62  // set after last screenwrite
$1804: d0 06            BNE $180c
$1806: a9 ff            LDA #$ff
$1808: 85 70            STA $70
$180a: 30 69            BMI .MOVESCREEN

$180c: a5 70            LDA $70
$180e: 30 27            BMI $1837
$1810: 20 98 21         JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}

$1813: 30 22            BMI $1837
$1815: 20 8b 1c         JSR .W2
$1818: b0 10            BCS $182a
$181a: 20 a5 16         JSR _KEYS
$181d: b0 56            BCS .MOVESCREEN
$181f: a2 b8            LDX #$b8        
$1821: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 09b8
$1824: 20 0b 17         JSR .W3
$1827: 4c 6d 18         JMP $186d
$182a: a5 9e            LDA $9e
$182c: 30 17            BMI $1845
$182e: a5 6b            LDA $6b
$1830: 85 70            STA $70
$1832: 30 41            BMI .MOVESCREEN
$1834: 4c 60 18         JMP $1860
$1837: 20 21 16         JSR .W4
$183a: a5 71            LDA $71
$183c: 30 37            BMI .MOVESCREEN
$183e: a2 a0            LDX #$a0
$1840: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 09a0
$1843: 10 28            BPL $186d
$1845: a5 67            LDA $67
$1847: 29 01            AND #$01
$1849: d0 2a            BNE .MOVESCREEN
$184b: a5 6b            LDA $6b
$184d: 85 70            STA $70
$184f: ad 47 0d         LDA $0d47
$1852: 49 01            EOR #$01
$1854: 8d 47 0d         STA $0d47
$1857: ad cf 0b         LDA $0bcf
$185a: 29 07            AND #$07
$185c: c9 05            CMP #$05
$185e: 30 15            BMI .MOVESCREEN
$1860: a2 60            LDX #$60
$1862: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0960
$1865: a9 00            LDA #$00
$1867: 85 53            STA $53
$1869: 85 6c            STA $6c
$186b: f0 04            BEQ $1871
$186d: a5 70            LDA $70
$186f: 85 9e            STA $9e
$1871: a5 70            LDA $70
$1873: 85 9d            STA $9d


.MOVESCREEN: 20 ac 2e   JSR .VB   // 9e set to index  // $70 holds 00,01
$1878: 20 e8 16         JSR .W5
$187b: a2 2f            LDX #$2f
$187d: 86 62            STX $62
$187f: 60               RTS
/*----------------------------------------*/

.N1: a9 9b              LDA #$9b
$1882: a2 a2            LDX #$a2   // OSBYTE - Not used by OS 1.2!!!!!!!!
$1884: 20 f4 ff         JSR $fff4
$1887: a9 03            LDA #$03
$1889: 85 65            STA $65
$188b: a2 1b            LDX #$1b

.WN: 20 9a 1a           JSR .W6
$1890: c6 64            DEC $64
$1892: a6 64            LDX $64
$1894: c6 65            DEC $65
$1896: 10 f5            BPL .WN
$1898: 60               RTS
/*----------------------------------------*/

.WC: a5 12              LDA $12
$189b: f0 61            BEQ $18fe
$189d: c6 60            DEC $60
$189f: d0 06            BNE $18a7
$18a1: 20 ad 19         JSR .W7
$18a4: 4c fe 18         JMP $18fe
$18a7: a5 9c            LDA $HOLDING
$18a9: d0 53            BNE $18fe

$18ab: a9 ff            LDA #$ff
$18ad: 85 70            STA $70
$18af: a5 ec            LDA $ec
$18b1: 20 85 2e         JSR .ZXKEYS
$18b4: a2 2f            LDX #$2f
$18b6: a5 70            LDA $70
$18b8: 30 04            BMI $18be      // Neither "Z" or "X" pressed...
$18ba: c5 9e            CMP $9e        // Don't know what $9e is...
$18bc: d0 40            BNE $18fe
$18be: a5 60            LDA $60
$18c0: 29 01            AND #$01
$18c2: d0 35            BNE $18f9
$18c4: a5 60            LDA $60
$18c6: 29 08            AND #$08
$18c8: d0 06            BNE $18d0
$18ca: a5 70            LDA $70
$18cc: 30 2b            BMI $18f9
$18ce: 10 06            BPL $18d6
$18d0: a5 9e            LDA $9e       // "Z" as it is 00
$18d2: 49 02            EOR #$02
$18d4: 85 70            STA $70

$18d6: a2 2f            LDX #$2f     // "X" as it is 02
$18d8: 20 98 21         JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$18db: 20 8b 1c         JSR .W2
$18de: b0 19            BCS $18f9
$18e0: a5 50            LDA $50
$18e2: 10 06            BPL $18ea
$18e4: 20 c5 19         JSR .W8
$18e7: 4c fe 18         JMP $18fe
$18ea: a6 64            LDX $64
$18ec: 20 98 21         JSR .U6      // Call with $64, U6 sets {$73, $74, $76, $77, $78, $80}
$18ef: 20 8b 1c         JSR .W2
$18f2: b0 05            BCS $18f9
$18f4: a5 50            LDA $50
$18f6: 30 06            BMI $18fe
$18f8: 60               RTS

$18f9: a9 ff            LDA #$ff
$18fb: 85 70            STA $70
$18fd: 60               RTS

$18fe: a0 0f            LDY #$0f
$1900: 20 9a 21         JSR .U3
$1903: 20 9d 22         JSR .WRITESCRN2
$1906: a9 40            LDA #$40
$1908: 85 61            STA $61
$190a: 85 12            STA $12
$190c: 85 62            STA $62
$190e: a6 64            LDX $64
$1910: 4c 4e 24         JMP .WO
$1913: a9 01            LDA #$01
$1915: 85 13            STA $13
$1917: b4 00            LDY $00,X
$1919: 20 af 07         JSR $07af
$191c: a5 77            LDA $77
$191e: d0 0a            BNE $192a
$1920: a5 76            LDA $76
$1922: d0 0d            BNE $1931
$1924: 98               TYA
$1925: 49 01            EOR #$01
$1927: 95 00            STA $00,X
$1929: 60               RTS

$192a: c9 60            CMP #$60
$192c: 90 03            BCC $1931
$192e: 20 48 24         JSR .V7
$1931: 4c 4e 24         JMP .WO
.WD: a5 63              LDA $63
$1936: 10 db            BPL $1913
$1938: ad 17 0c         LDA .JTINDEX
$193b: dd 40 0b         CMP $0b40,X
$193e: d0 d3            BNE $1913
$1940: a0 2f            LDY #$2f
$1942: 20 af 07         JSR $07af
$1945: a5 77            LDA $77
$1947: dd 4d 0a         CMP $0a4d,X
$194a: b0 c7            BCS $1913
$194c: a5 76            LDA $76
$194e: dd 58 0a         CMP $0a58,X
$1951: b0 c0            BCS $1913
$1953: a9 00            LDA #$00
$1955: 85 50            STA $50
$1957: a5 9e            LDA $9e
$1959: 30 0a            BMI $1965
$195b: c5 70            CMP $70
$195d: f0 06            BEQ $1965
$195f: a5 9c            LDA $HOLDING
$1961: d0 02            BNE $1965
$1963: c6 50            DEC $50
$1965: bd 18 0d         LDA $0d18,X
$1968: c9 04            CMP #$04
$196a: 30 07            BMI $1973
$196c: a5 9e            LDA $9e
$196e: 30 09            BMI $1979
$1970: 4c 4e 24         JMP .WO
$1973: 29 02            AND #$02
$1975: c5 70            CMP $70
$1977: d0 04            BNE $197d
$1979: e6 50            INC $50
$197b: 10 07            BPL $1984
$197d: a5 50            LDA $50
$197f: d0 03            BNE $1984
$1981: 4c 07 1a         JMP $1a07
$1984: a4 9e            LDY $9e
$1986: a5 50            LDA $50
$1988: d0 0f            BNE $1999
$198a: a5 76            LDA $76
$198c: d0 0b            BNE $1999
$198e: a5 77            LDA $77
$1990: d9 e6 09         CMP $09e6,Y
$1993: f0 3a            BEQ $19cf
$1995: 10 70            BPL $1a07
$1997: 30 53            BMI $19ec
$1999: a5 76            LDA $76
$199b: c9 04            CMP #$04
$199d: 10 68            BPL $1a07
$199f: a5 77            LDA $77
$19a1: c9 04            CMP #$04
$19a3: 10 62            BPL $1a07
$19a5: a5 50            LDA $50
$19a7: f0 1c            BEQ .W8
$19a9: 10 0c            BPL $19b7
$19ab: 30 00            BMI .W7
.W7: a9 80            LDA #$80
$19af: 95 00            STA $00,X
$19b1: a2 80            LDX #$80
$19b3: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0980
$19b6: 60               RTS

$19b7: a9 00            LDA #$00
$19b9: 85 63            STA $63
$19bb: a2 60            LDX #$60
$19bd: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0960
$19c0: a6 64            LDX $64
$19c2: 4c 4e 24         JMP .WO
.W8: a5 6d            LDA $6d
$19c7: 10 23            BPL $19ec
$19c9: a5 71            LDA $71
$19cb: f0 e0            BEQ .W7
$19cd: d0 e8            BNE $19b7
$19cf: 24 61            BIT $61
$19d1: 70 06            BVS $19d9
$19d3: a9 00            LDA #$00
$19d5: 85 12            STA $12
$19d7: f0 de            BEQ $19b7
$19d9: a5 6d            LDA $6d
$19db: 10 2a            BPL $1a07
$19dd: a9 32            LDA #$32             // Timer value
$19df: 85 60            STA $60
$19e1: a9 ff            LDA #$ff
$19e3: 85 62            STA $62
$19e5: 85 71            STA $71
$19e7: 85 70            STA $70
$19e9: 86 61            STX $61
$19eb: 60               RTS

$19ec: a5 70            LDA $70
$19ee: 49 02            EOR #$02
$19f0: 85 70            STA $70
$19f2: 85 62            STA $62
$19f4: 20 98 21         JSR .U6      // Call with $61, U6 sets {$73, $74, $76, $77, $78, $80}
$19f7: 20 8b 1c         JSR .W2
$19fa: 90 17            BCC $1a13
$19fc: a2 2f            LDX #$2f
$19fe: a5 70            LDA $70
$1a00: 29 02            AND #$02
$1a02: 85 70            STA $70

$1a04: 4c e8 16         JMP .W5
$1a07: a5 5d            LDA $5d
$1a09: c9 ff            CMP #$ff
$1a0b: f0 03            BEQ $1a10
$1a0d: 4c 13 19         JMP $1913
$1a10: 4c 4e 24         JMP .WO
$1a13: a9 ff            LDA #$ff
$1a15: 85 61            STA $61
$1a17: 60               RTS

.WE: a6 64              LDX $64
$1a1a: e4 61            CPX $61
$1a1c: d0 25            BNE $1a43
$1a1e: 20 55 1a         JSR .W9
$1a21: a9 ff            LDA #$ff
$1a23: 85 71            STA $71
$1a25: a6 64            LDX $64
$1a27: bd 18 0d         LDA $0d18,X
$1a2a: 49 01            EOR #$01
$1a2c: 9d 18 0d         STA $0d18,X
$1a2f: 18               CLC
$1a30: 69 06            ADC #$06
$1a32: 85 7f            STA $7f
$1a34: 20 cc 2c         JSR .U7
$1a37: ad 47 0d         LDA $0d47
$1a3a: 49 01            EOR #$01
$1a3c: 8d 47 0d         STA $0d47
$1a3f: 20 e8 16         JSR .W5
$1a42: 60               RTS

$1a43: a5 61            LDA $61
$1a45: 30 03            BMI $1a4a
$1a47: 20 0b 17         JSR .W3
$1a4a: bd 18 0d         LDA $0d18,X
$1a4d: 18               CLC
$1a4e: 69 06            ADC #$06
$1a50: 85 7f            STA $7f
$1a52: 4c cc 2c         JMP .U7

.W9: bd 18 0d           LDA $0d18,X
$1a58: 29 02            AND #$02
$1a5a: a8               TAY
$1a5b: bd a0 0b         LDA $0ba0,X
$1a5e: 18               CLC
$1a5f: 79 e2 09         ADC $09e2,Y
$1a62: 8d af 0b         STA $0baf
$1a65: bd e8 0b         LDA $0be8,X
$1a68: 79 e3 09         ADC $09e3,Y
$1a6b: 8d f7 0b         STA $0bf7
$1a6e: bd 30 0c         LDA $0c30,X
$1a71: 8d 3f 0c         STA $0c3f
$1a74: ee 3f 0c         INC $0c3f
$1a77: a5 60            LDA $60
$1a79: 29 07            AND #$07
$1a7b: d0 05            BNE $1a82
$1a7d: a2 a0            LDX #$a0
$1a7f: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 09a0
$1a82: a5 60            LDA $60
$1a84: 29 04            AND #$04
$1a86: f0 04            BEQ $1a8c
$1a88: a9 ba            LDA #$ba
$1a8a: d0 02            BNE $1a8e
$1a8c: a9 b2            LDA #$b2
$1a8e: 8d 57 0d         STA $0d57
$1a91: a2 0f            LDX #$0f
$1a93: a9 ff            LDA #$ff
$1a95: 85 71            STA $71
$1a97: 4c cc 2c         JMP .U7

.W6: 86 64              STX $64
$1a9c: b5 00            LDA $00,X
$1a9e: 10 06            BPL $1aa6
$1aa0: 20 5d 25         JSR .WB
$1aa3: f0 1d            BEQ $1ac2
$1aa5: 60               RTS

$1aa6: e4 61            CPX $61
$1aa8: d0 06            BNE $1ab0
$1aaa: 20 99 18         JSR .WC

$1aad: 4c c2 1a         JMP $1ac2

$1ab0: 20 34 19         JSR .WD
$1ab3: a5 3e            LDA $3e
$1ab5: f0 0b            BEQ $1ac2
$1ab7: a5 13            LDA $13
$1ab9: f0 07            BEQ $1ac2
$1abb: 46 13            LSR $13
$1abd: 20 c0 00         JSR $00c0
$1ac0: d0 0b            BNE $1acd
$1ac2: 20 18 1a         JSR .WE
$1ac5: a5 61            LDA $61
$1ac7: 10 04            BPL $1acd
$1ac9: a9 40            LDA #$40
$1acb: 85 61            STA $61
$1acd: 60               RTS

$1ace: a5 6c            LDA $6c
$1ad0: 10 05            BPL $1ad7
$1ad2: a5 6d            LDA $6d
$1ad4: 10 32            BPL .AFTERKEYS
$1ad6: 60               RTS

$1ad7: 20 24 17         JSR .WF
$1ada: 20 b3 25         JSR .WG
$1add: 90 18            BCC $1af7
$1adf: a5 6c            LDA $6c
$1ae1: c9 10            CMP #$10
$1ae3: 90 04            BCC $1ae9
$1ae5: a9 02            LDA #$02
$1ae7: 85 63            STA $63
$1ae9: a9 ff            LDA #$ff
$1aeb: 85 6c            STA $6c
$1aed: 85 53            STA $53
$1aef: a2 68            LDX #$68
$1af1: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0968
$1af4: 4c 92 17         JMP .Z1

$1af7: 20 eb 1c         JSR .WH
$1afa: 90 03            BCC $1aff
$1afc: 4c 75 18         JMP .MOVESCREEN
$1aff: e6 6c            INC $6c
$1b01: a9 01            LDA #$01
$1b03: 85 71            STA $71
$1b05: 4c 75 18         JMP .MOVESCREEN
/*----------------------------------------
 *
 *  This is some kind of check after the keys
 *   have been pressed to work out what to do next
 *    I suspect this moves the screen left/right or up and down...
 *
 *----------------------------------------*/
.AFTERKEYS: ad 5f 0c    LDA $0c5f
$1b0b: c9 1c            CMP #$1c
$1b0d: 10 29            BPL SKIP

$1b0f: a5 6f            LDA $6f
$1b11: 85 70            STA $70
$1b13: a5 6d            LDA $6d
$1b15: a0 00            LDY #$00
$1b17: c9 03            CMP #$03
$1b19: 30 0b            BMI $1b26

$1b1b: a0 ff            LDY #$ff
$1b1d: c9 05            CMP #$05
$1b1f: 30 05            BMI $1b26   

$1b21: 20 24 17         JSR .WF
$1b24: a0 01            LDY #$01

$1b26: 84 71            STY $71
$1b28: 20 a5 16         JSR _KEYS
$1b2b: b0 0b            BCS $1b38

$1b2d: 20 98 21         JSR .U6      // Call with ???, U6 sets {$73, $74, $76, $77, $78, $80}
$1b30: 20 50 1c         JSR .U4
$1b33: 20 5e 1b         JSR .WJ
$1b36: 90 12            BCC CONT

.SKIP: a5 6d            LDA $6d
$1b3a: 38               SEC
$1b3b: e9 04            SBC #$04
$1b3d: 10 02            BPL $1b41

$1b3f: a9 00            LDA #$00
$1b41: 85 6c            STA $6c
$1b43: a9 ff            LDA #$ff
$1b45: 85 6d            STA $6d
$1b47: 4c d7 1a         JMP $1ad7

.CONT: 20 eb 1c         JSR .WH
$1b4d: 90 03            BCC $1b52
$1b4f: 4c 75 18         JMP .MOVESCREEN

$1b52: e6 6d            INC $6d
$1b54: a5 6f            LDA $6f
$1b56: 30 ad            BMI $1b05
$1b58: 20 0b 17         JSR .W3
$1b5b: 4c 6d 18         JMP $186d

.WJ: a5 70              LDA $70
$1b60: 10 02            BPL $1b64
$1b62: a9 00            LDA #$00
$1b64: 85 6e            STA $6e
$1b66: a5 71            LDA $71
$1b68: f0 38            BEQ $1ba2
$1b6a: 30 02            BMI $1b6e
$1b6c: c6 76            DEC $76
$1b6e: a9 01            LDA #$01
$1b70: 85 72            STA $72
$1b72: 20 c4 1b         JSR .WK
$1b75: b0 4c            BCS $1bc3
$1b77: a5 70            LDA $70
$1b79: 30 0c            BMI $1b87
$1b7b: a5 76            LDA $76
$1b7d: 18               CLC
$1b7e: 65 73            ADC $73
$1b80: 85 76            STA $76
$1b82: 20 3f 1c         JSR .U5
$1b85: b0 3c            BCS $1bc3
$1b87: a5 71            LDA $71
$1b89: 30 38            BMI $1bc3
$1b8b: a5 79            LDA $79
$1b8d: 85 77            STA $77
$1b8f: a5 7a            LDA $7a
$1b91: 85 78            STA $78
$1b93: bd 30 0c         LDA $0c30,X
$1b96: 85 76            STA $76
$1b98: c6 76            DEC $76
$1b9a: c6 72            DEC $72
$1b9c: 20 c4 1b         JSR .WK
$1b9f: b0 22            BCS $1bc3
$1ba1: 60               RTS

$1ba2: e6 76            INC $76
$1ba4: 20 3f 1c         JSR .U5
$1ba7: b0 1a            BCS $1bc3
$1ba9: a5 76            LDA $76
$1bab: 18               CLC
$1bac: 65 73            ADC $73
$1bae: 85 76            STA $76
$1bb0: 20 3f 1c         JSR .U5
$1bb3: b0 0e            BCS $1bc3
$1bb5: a5 79            LDA $79
$1bb7: 85 77            STA $77
$1bb9: a5 7a            LDA $7a
$1bbb: 85 78            STA $78
$1bbd: 20 3f 1c         JSR .U5
$1bc0: b0 01            BCS $1bc3
$1bc2: 18               CLC
$1bc3: 60               RTS

.WK: a5 76              LDA $76
$1bc6: 30 75            BMI $1c3d
$1bc8: 20 69 07         JSR $0769
$1bcb: a8               TAY
$1bcc: b9 45 0a         LDA $0a45,Y
$1bcf: 30 66            BMI $1c37
$1bd1: c0 01            CPY #$01
$1bd3: f0 68            BEQ $1c3d
$1bd5: c9 40            CMP #$40
$1bd7: d0 1d            BNE $1bf6
$1bd9: a5 5e            LDA $5e
$1bdb: 10 5a            BPL $1c37
$1bdd: a5 76            LDA $76
$1bdf: 29 03            AND #$03
$1be1: c9 03            CMP #$03
$1be3: f0 58            BEQ $1c3d
$1be5: a4 71            LDY $71
$1be7: f0 04            BEQ $1bed
$1be9: a4 70            LDY $70
$1beb: 30 4a            BMI $1c37
$1bed: 18               CLC
$1bee: 65 73            ADC $73
$1bf0: c9 04            CMP #$04
$1bf2: 10 49            BPL $1c3d
$1bf4: 30 41            BMI $1c37
$1bf6: 48               PHA
$1bf7: a5 76            LDA $76
$1bf9: 29 fc            AND #$fc
$1bfb: 85 7c            STA $7c
$1bfd: 68               PLA
$1bfe: c5 6e            CMP $6e
$1c00: f0 06            BEQ $1c08
$1c02: a4 72            LDY $72
$1c04: d0 31            BNE $1c37
$1c06: f0 04            BEQ $1c0c
$1c08: a4 72            LDY $72
$1c0a: f0 2b            BEQ $1c37
$1c0c: 48               PHA
$1c0d: a5 77            LDA $77
$1c0f: 29 07            AND #$07
$1c11: a8               TAY
$1c12: c8               INY
$1c13: 98               TYA
$1c14: 4a               LSR
$1c15: a8               TAY
$1c16: 68               PLA
$1c17: f0 05            BEQ $1c1e
$1c19: b9 1a 0d         LDA $0d1a,Y
$1c1c: 10 03            BPL $1c21
$1c1e: b9 1f 0d         LDA $0d1f,Y
$1c21: 18               CLC
$1c22: 65 7c            ADC $7c
$1c24: dd 30 0c         CMP $0c30,X
$1c27: 30 08            BMI $1c31
$1c29: d0 0e            BNE $1c39
$1c2b: a9 ff            LDA #$ff
$1c2d: 85 50            STA $50
$1c2f: 38               SEC
$1c30: 60               RTS

$1c31: a9 40            LDA #$40
$1c33: 85 50            STA $50
$1c35: 18               CLC
$1c36: 60               RTS

$1c37: 18               CLC
$1c38: 60               RTS

$1c39: a9 80            LDA #$80
$1c3b: 85 50            STA $50
$1c3d: 38               SEC
$1c3e: 60               RTS

.U5: a5 76            LDA $76
$1c41: c9 1c            CMP #$1c
$1c43: 10 09            BPL $1c4e
$1c45: 20 69 07         JSR $0769
$1c48: c9 01            CMP #$01
$1c4a: f0 02            BEQ $1c4e
$1c4c: 18               CLC
$1c4d: 60               RTS

$1c4e: 38               SEC
$1c4f: 60               RTS

.U4: c6 73            DEC $73
$1c52: c6 74            DEC $74
$1c54: a5 70            LDA $70
$1c56: 30 0a            BMI $1c62
$1c58: d0 16            BNE $1c70
$1c5a: a5 77            LDA $77
$1c5c: d0 02            BNE $1c60
$1c5e: c6 78            DEC $78
$1c60: c6 77            DEC $77
$1c62: a5 77            LDA $77
$1c64: 18               CLC
$1c65: 65 74            ADC $74
$1c67: 85 79            STA $79
$1c69: a5 78            LDA $78
$1c6b: 69 00            ADC #$00
$1c6d: 85 7a            STA $7a
$1c6f: 60               RTS

$1c70: a5 77            LDA $77
$1c72: 18               CLC
$1c73: 69 01            ADC #$01
$1c75: 85 79            STA $79
$1c77: a5 78            LDA $78
$1c79: 69 00            ADC #$00
$1c7b: 85 7a            STA $7a
$1c7d: a5 79            LDA $79
$1c7f: 18               CLC
$1c80: 65 74            ADC $74
$1c82: 85 77            STA $77
$1c84: a5 7a            LDA $7a
$1c86: 69 00            ADC #$00
$1c88: 85 78            STA $78
$1c8a: 60               RTS

.W2: a5 70              LDA $70
$1c8d: 30 38            BMI $1cc7
$1c8f: 85 6e            STA $6e
$1c91: 20 50 1c         JSR .U4
$1c94: a9 01            LDA #$01
$1c96: 85 72            STA $72
$1c98: a9 00            LDA #$00
$1c9a: 85 50            STA $50
$1c9c: a9 ff            LDA #$ff
$1c9e: 85 6b            STA $6b
$1ca0: 20 c4 1b         JSR .WK
$1ca3: a5 50            LDA $50
$1ca5: d0 32            BNE $1cd9
$1ca7: b0 1e            BCS $1cc7
$1ca9: c6 76            DEC $76
$1cab: 20 c4 1b         JSR .WK
$1cae: b0 23            BCS $1cd3
$1cb0: a5 79            LDA $79
$1cb2: 85 77            STA $77
$1cb4: a5 7a            LDA $7a
$1cb6: 85 78            STA $78
$1cb8: c6 72            DEC $72
$1cba: 20 c4 1b         JSR .WK
$1cbd: a5 50            LDA $50
$1cbf: d0 18            BNE $1cd9
$1cc1: b0 10            BCS $1cd3
$1cc3: a5 70            LDA $70
$1cc5: 85 6b            STA $6b
$1cc7: a9 ff            LDA #$ff
$1cc9: 85 70            STA $70
$1ccb: 85 71            STA $71
$1ccd: 38               SEC
$1cce: 60               RTS

$1ccf: 85 71            STA $71
$1cd1: 18               CLC
$1cd2: 60               RTS

$1cd3: a9 ff            LDA #$ff
$1cd5: 85 71            STA $71
$1cd7: 18               CLC
$1cd8: 60               RTS

$1cd9: 24 50            BIT $50
$1cdb: 10 0a            BPL $1ce7
$1cdd: 70 04            BVS $1ce3
$1cdf: a9 00            LDA #$00
$1ce1: 10 ec            BPL $1ccf
$1ce3: a9 ff            LDA #$ff
$1ce5: 30 e8            BMI $1ccf
$1ce7: a9 01            LDA #$01
$1ce9: 10 e4            BPL $1ccf
WH: a5 ec               LDA $ec
$1ced: c9 c8            CMP #$c8   // Keypress ":"
$1cef: d0 25            BNE $1d16
$1cf1: a5 8b            LDA $8b
$1cf3: c9 04            CMP #$04
$1cf5: d0 1f            BNE $1d16
$1cf7: bd a0 0b         LDA $0ba0,X
$1cfa: 29 07            AND #$07
$1cfc: c9 05            CMP #$05
$1cfe: 10 16            BPL $1d16
$1d00: a9 ff            LDA #$ff
$1d02: 85 9e            STA $9e
$1d04: 85 6d            STA $6d
$1d06: 85 6c            STA $6c
$1d08: 85 53            STA $53
$1d0a: a9 05            LDA #$05
$1d0c: 8d 47 0d         STA $0d47
$1d0f: a2 68            LDX #$68
$1d11: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0968
$1d14: 38               SEC
$1d15: 60               RTS

$1d16: 18               CLC
$1d17: 60               RTS

.W1: a5 54              LDA $54
$1d1a: 10 51            BPL $1d6d
$1d1c: a5 ec            LDA $ec
$1d1e: 20 61 1d         JSR ARROWKEYS
$1d21: f0 08            BEQ $1d2b
$1d23: a5 ed            LDA $ed
$1d25: 20 61 1d         JSR ARROWKEYS
$1d28: f0 01            BEQ $1d2b            // i.e. CMP returns zero
$1d2a: 60               RTS

$1d2b: a4 9c            LDY $HOLDING
$1d2d: 30 3e            BMI $1d6d
$1d2f: 84 54            STY $54
$1d31: a9 00            LDA #$00
$1d33: 85 56            STA $56
$1d35: a9 0e            LDA #$0e
$1d37: 99 00 00         STA $0000,Y
$1d3a: c0 0b            CPY #$0b
$1d3c: d0 19            BNE $1d57
$1d3e: e0 04            CPX #$04
$1d40: f0 15            BEQ $1d57
$1d42: a5 35            LDA $35
$1d44: f0 11            BEQ $1d57
$1d46: a9 00            LDA #$00
$1d48: 85 35            STA $35
$1d4a: a0 0c            LDY #$0c
$1d4c: 84 54            STY $54
$1d4e: a2 2f            LDX #$2f
$1d50: a5 9e            LDA $9e
$1d52: 85 0c            STA $0c
$1d54: 4c dc 2e         JMP .U2
$1d57: a2 98            LDX #$98
$1d59: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0998
$1d5c: a9 ff            LDA #$ff
$1d5e: 85 9c            STA $HOLDING
$1d60: 60               RTS

// Compare keypresses ($ec) with 09d4
//    Enters with A = $ec
//    Stores key in &55
.ARROWKEYS: a2 05              LDX #$05
$1d63: ca               DEX
$1d64: 30 07            BMI $1d6d
$1d66: dd d4 09         CMP $09d4,X         // 0,1,2,3,4  { 99, f9, b9, a9, b2 }
$1d69: d0 f8            BNE $1d63           //              <-  ->  /\  \/  D
$1d6b: 86 55            STX $55
$1d6d: 60               RTS

.M8: a4 54              LDY $54
$1d70: 30 45            BMI $1db7
$1d72: 20 9a 21         JSR .U3
$1d75: 20 10 09         JSR $0910
$1d78: f0 08            BEQ $1d82
$1d7a: 20 9d 22         JSR .WRITESCRN2
$1d7d: a4 54            LDY $54
$1d7f: 20 9a 21         JSR .U3
$1d82: a6 54            LDX $54
$1d84: a9 ff            LDA #$ff
$1d86: 85 70            STA $70
$1d88: 85 71            STA $71
$1d8a: a5 55            LDA $55
$1d8c: d0 2a            BNE $1db8


$1d8e: 85 70            STA $70       // Left Arrow
$1d90: a5 77            LDA $77
$1d92: d0 02            BNE $1d96
$1d94: c6 78            DEC $78
$1d96: c6 77            DEC $77
$1d98: a5 56            LDA $56
$1d9a: d0 03            BNE $1d9f
$1d9c: fe 30 0c         INC $0c30,X
$1d9f: 20 50 1c         JSR .U4
$1da2: a5 56            LDA $56
$1da4: 29 07            AND #$07
$1da6: c9 07            CMP #$07
$1da8: d0 04            BNE $1dae
$1daa: a9 01            LDA #$01
$1dac: 85 71            STA $71
$1dae: 20 5e 1b         JSR .WJ
$1db1: 90 78            BCC $1e2b
$1db3: a9 04            LDA #$04       // FOrce a "DROP" "D"
$1db5: 85 55            STA $55
$1db7: 60               RTS

$1db8: c9 01            CMP #$01       
$1dba: d0 0c            BNE $1dc8
     
$1dbc: e6 77            INC $77        // Right Arrow
$1dbe: d0 02            BNE $1dc2
$1dc0: e6 78            INC $78
$1dc2: a9 02            LDA #$02
$1dc4: 85 70            STA $70
$1dc6: 10 d0            BPL $1d98

$1dc8: c9 02            CMP #$02
$1dca: d0 1f            BNE $1deb

$1dcc: a5 56            LDA $56        // Up Arrow
$1dce: c9 08            CMP #$08
$1dd0: 30 05            BMI $1dd7
$1dd2: a9 04            LDA #$04
$1dd4: 85 55            STA $55
$1dd6: 60               RTS

$1dd7: a5 76            LDA $76
$1dd9: c9 1b            CMP #$1b
$1ddb: 10 f5            BPL $1dd2
$1ddd: a9 00            LDA #$00
$1ddf: 85 71            STA $71
$1de1: 20 50 1c         JSR .U4
$1de4: 20 5e 1b         JSR .WJ
$1de7: b0 e9            BCS $1dd2
$1de9: 90 40            BCC $1e2b

$1deb: c9 03            CMP #$03
$1ded: d0 30            BNE $1e1f

$1def: a5 56            LDA $56        // Down Arrow
$1df1: c9 04            CMP #$04
$1df3: 30 05            BMI $1dfa
$1df5: a9 04            LDA #$04
$1df7: 85 55            STA $55
$1df9: 60               RTS

$1dfa: a9 01            LDA #$01
$1dfc: 85 71            STA $71
$1dfe: 20 50 1c         JSR .U4
$1e01: c6 76            DEC $76
$1e03: 20 16 25         JSR .WM
$1e06: 90 23            BCC $1e2b

$1e08: a2 88            LDX #$88
$1e0a: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0988
$1e0d: a4 54            LDY $54
$1e0f: a9 ff            LDA #$ff
$1e11: 85 54            STA $54
$1e13: a9 04            LDA #$04
$1e15: 99 00 00         STA $0000,Y
$1e18: c0 0c            CPY #$0c
$1e1a: d0 3a            BNE $1e56
$1e1c: 4c 2e 2e         JMP $2e2e



//   Drop an item
//
//
$1e1f: a9 01            LDA #$01             // Drop
$1e21: 85 71            STA $71
$1e23: 20 50 1c         JSR U4
$1e26: 20 5e 1b         JSR WJ
$1e29: b0 dd            BCS $1e08

$1e2b: e6 56            INC $56
$1e2d: 20 00 01         JSR $0100
$1e30: 20 00 01         JSR $0100
$1e33: a5 71            LDA $71
$1e35: 30 0a            BMI $1e41
$1e37: f0 05            BEQ $1e3e
$1e39: de 30 0c         DEC $0c30,X
$1e3c: 10 03            BPL $1e41
$1e3e: fe 30 0c         INC $0c30,X
$1e41: 20 98 21         JSR U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$1e44: 20 75 20         JSR U8
$1e47: b0 0e            BCS $1e57
$1e49: 20 10 09         JSR $0910
$1e4c: 10 08            BPL $1e56
$1e4e: bd 48 0d         LDA $0d48,X
$1e51: 85 7f            STA $7f
$1e53: 20 c0 21         JSR U9
$1e56: 60               RTS

$1e57: 4c 3d 20         JMP .UB

.INVEN:a5 ec            LDA $ec
$1e5c: c9 a5            CMP #$a5             // Keypress "I"
$1e5e: f0 01            BEQ .INVEN1
$1e60: 60               RTS

//
// Handle the inventory option, flicks between Objects, score

.INVEN1: a2 88          LDX #$88
$1e63: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0988
$1e66: a2 68            LDX #$68
$1e68: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0988
$1e6b: 20 7e 1e         JSR .PRINTOBJ
$1e6e: 20 20 1f         JSR .INVEN3
$1e71: 20 f2 1e         JSR .SCORE
$1e74: 20 20 1f         JSR .INVEN3

.LOOp  a5 ec            LDA $ec
$1e79: c9 a5            CMP #$a5             // Until not pressing "I"
$1e7b: f0 fa            BEQ .LOOP

$1e7d: 60               RTS


.PRINTOBJ: a2 00        LDX #$00
$1e80: a0 00            LDY #$00
$1e82: 20 a4 1e         JSR .SETSCREENADDRESS
$1e85: a2 00            LDX #$00

$1e87: bd af 0c         LDA $OBJECTS,X       // &9c contains the object we are holding
$1e8a: c5 9c            CMP $HOLDING
$1e8c: f0 03            BEQ $1e91
$1e8e: e8               INX
$1e8f: d0 f6            BNE $1e87            // 255 times

$1e91: a0 ff            LDY #$ff

$1e93: e8               INX
$1e94: c8               INY
$1e95: bd af 0c         LDA $OBJECTS,X
$1e98: 30 09            BMI $1ea3
$1e9a: c9 14            CMP #$14   
$1e9c: 90 05            BCC $1ea3
$1e9e: 20 ee ff         JSR $ffee  // Print a string of stuff
$1ea1: d0 f0            BNE $1e93

$1ea3: 60               RTS


/*----------------------------------------
 *
 *  Call with X,Y as new screen offset
 *----------------------------------------*/
.SETSCREENADDRESS:a9 1e LDA #$1e     // Called by everthing under the sun....
$1ea6: 20 ee ff         JSR $ffee    //    Moves cursor to 0,0
$1ea9: 98               TYA
$1eaa: 18               CLC
$1eab: 65 87            ADC $SCRLO      // Screen Low Byte  
$1ead: 85 77            STA $77
$1eaf: 8a               TXA
$1eb0: 65 88            ADC $SCRHI      // Screen High Byte
$1eb2: 38               SEC
$1eb3: e9 06            SBC #$06      

.LOOP: c9 0a            CMP #$0a
$1eb7: 30 05            BMI .CONT
$1eb9: 38               SEC
$1eba: e9 0a            SBC #$0a
$1ebc: 10 f7            BPL .LOOP

.CONT: 4a               LSR
$1ebf: 66 77            ROR $77      // Copy of screen Low Byte
$1ec1: 4a               LSR
$1ec2: 66 77            ROR $77
$1ec4: c9 02            CMP #$02
$1ec6: d0 14            BNE .CONT2
$1ec8: 48               PHA
$1ec9: a5 77            LDA $77
$1ecb: c9 70            CMP #$70
$1ecd: 90 0c            BCC .CONT1
$1ecf: 98               TYA
$1ed0: 18               CLC
$1ed1: 69 50            ADC #$50
$1ed3: a8               TAY
$1ed4: 8a               TXA
$1ed5: 69 00            ADC #$00
$1ed7: aa               TAX
$1ed8: 68               PLA
$1ed9: d0 c9            BNE SETSCREENADDRESS

.CONT1 68               PLA
.CONT2 a8               TAY
$1edd: a9 09            LDA #$09
$1edf: a6 77            LDX $77
$1ee1: f0 06            BEQ .CONT4
.CONT3 20 ee ff         JSR $ffee   // Prints one space forward
$1ee6: ca               DEX
$1ee7: d0 fa            BNE CONT3  // Keep printing spaces until X

.CONT4 88               DEY
$1eea: 10 f7            BPL CONT3
$1eec: a9 09            LDA #$09    // Prints one space forward
$1eee: 20 ee ff         JSR $ffee
$1ef1: 60               RTS
/*----------------------------------------*/

.SCORE:  a0 00          LDY #$00
$1ef4: a2 00            LDX #$00
$1ef6: 20 a4 1e         JSR .SETSCREENADDRESS
$1ef9: a2 00            LDX #$00
$1efb: 20 15 2b         JSR .MESSAGES
$1efe: a2 00            LDX #$00
$1f00: a4 57            LDY $57
$1f02: f0 0c            BEQ $1f10
$1f04: ca               DEX

$1f05: 18               CLC
$1f06: 69 01            ADC #$01
$1f08: 90 01            BCC $1f0b
$1f0a: e8               INX

$1f0b: 88               DEY
$1f0c: f8               SED
$1f0d: d0 f6            BNE $1f05
$1f0f: a8               TAY

$1f10: 8a               TXA
$1f11: 20 fa 2f         JSR .PRINTNUMBER           // { ORA #&30, JMP &FFEE } Forces characters uppercase before display...
$1f14: 98               TYA
$1f15: 4a               LSR
$1f16: 4a               LSR
$1f17: 4a               LSR
$1f18: 4a               LSR
$1f19: 20 fa 2f         JSR .PRINTNUMBER
$1f1c: 98               TYA
$1f1d: 4c 28 2a         JMP .U1                    // Equivalent to { AND #&0F, JSR .PRINTNUMBER, RTS }


// Enter with Y the number of backspaces

.INVEN3:  a5 ec         LDA $ec
$1f22: c9 a5            CMP #$a5         // Keypress "I"
$1f24: f0 fa            BEQ .INVEN3
.LOOP1 a5 ec            LDA $ec
$1f28: c9 a5            CMP #$a5         // Wait for Keypress not "I"
$1f2a: d0 fa            BNE .LOOP1
.LOOP2 a9 7f            LDA #$7f         // Backspace
$1f2e: 20 ee ff         JSR $ffee        // OSWRITE
$1f31: 88               DEY
$1f32: d0 f8            BNE .LOOP2
$1f34: 60               RTS

$1f35: a5 86            LDA $86
$1f37: 85 78            STA $78
$1f39: a5 85            LDA $85
$1f3b: 85 77            STA $77
$1f3d: ad 5f 0c         LDA $0c5f
$1f40: f0 61            BEQ $1fa3
$1f42: a9 1c            LDA #$1c
$1f44: 85 76            STA $76
$1f46: 20 80 03         JSR $0380
$1f49: a2 2f            LDX #$2f
$1f4b: 20 3d 20         JSR .UB
$1f4e: a5 85            LDA $85
$1f50: 38               SEC
$1f51: e9 80            SBC #$80
$1f53: 85 85            STA $85
$1f55: a5 86            LDA $86
$1f57: f9 2c 0a         SBC $0a2c,Y
$1f5a: 85 86            STA $86
$1f5c: a9 04            LDA #$04
$1f5e: 85 72            STA $72
$1f60: a9 04            LDA #$04
$1f62: 85 76            STA $76
$1f64: 20 fe 1f         JSR .UC
$1f67: a2 00            LDX #$00
$1f69: 20 c3 03         JSR $03c3
$1f6c: 20 c3 03         JSR $03c3
$1f6f: e6 76            INC $76
$1f71: c6 72            DEC $72
$1f73: d0 ef            BNE $1f64
$1f75: a9 18            LDA #$18
$1f77: 85 72            STA $72
$1f79: a5 87            LDA $SCRLO
$1f7b: 38               SEC
$1f7c: e9 50            SBC #$50
$1f7e: 85 87            STA $SCRLO
$1f80: b0 02            BCS $1f84
$1f82: c6 88            DEC $SCRHI
$1f84: 20 1f 21         JSR .SCROLL5
$1f87: 20 4f 21         JSR SETSCREENADDRESS
$1f8a: 20 fe 1f         JSR .UC
$1f8d: a2 00            LDX #$00
$1f8f: 20 c3 03         JSR $03c3
$1f92: 20 c3 03         JSR $03c3
$1f95: e6 76            INC $76
$1f97: c6 72            DEC $72
$1f99: d0 de            BNE $1f79
$1f9b: a2 02            LDX #$02
$1f9d: 20 c3 03         JSR $03c3
$1fa0: 4c df 1f         JMP $1fdf
$1fa3: a9 1f            LDA #$1f
$1fa5: 85 76            STA $76
$1fa7: 20 80 03         JSR $0380
$1faa: a2 2f            LDX #$2f
$1fac: 20 3d 20         JSR .UB
$1faf: a5 85            LDA $85
$1fb1: 18               CLC
$1fb2: 69 80            ADC #$80
$1fb4: 85 85            STA $85
$1fb6: a5 86            LDA $86
$1fb8: 79 10 0d         ADC $0d10,Y
$1fbb: 85 86            STA $86
$1fbd: a9 18            LDA #$18
$1fbf: 85 72            STA $72
$1fc1: a9 17            LDA #$17
$1fc3: 85 76            STA $76
$1fc5: 20 fe 1f         JSR .UC
$1fc8: a5 87            LDA $SCRLO
$1fca: 18               CLC
$1fcb: 69 50            ADC #$50
$1fcd: 85 87            STA $SCRLO
$1fcf: 90 02            BCC $1fd3
$1fd1: e6 88            INC $SCRHI
$1fd3: 20 1f 21         JSR .SCROLL5
$1fd6: 20 4f 21         JSR SETSCREENADDRESS
$1fd9: c6 76            DEC $76
$1fdb: c6 72            DEC $72
$1fdd: d0 e6            BNE $1fc5
$1fdf: a5 85            LDA $85
$1fe1: 85 77            STA $77
$1fe3: a5 86            LDA $86
$1fe5: 85 78            STA $78
$1fe7: a9 50            LDA #$50
$1fe9: 85 74            STA $74
$1feb: 20 69 21         JSR .WRITESCRN1
$1fee: e6 77            INC $77
$1ff0: d0 02            BNE $1ff4
$1ff2: e6 78            INC $78
$1ff4: c6 74            DEC $74
$1ff6: d0 f3            BNE $1feb
$1ff8: 20 01 2c         JSR .TAKE
$1ffb: 4c 6b 29         JMP .UF

.UC: a5 85              LDA $85
$2000: 85 77            STA $77
$2002: a5 86            LDA $86
$2004: 85 78            STA $78
$2006: a5 76            LDA $76
$2008: c9 10            CMP #$10
$200a: d0 05            BNE .V1
$200c: 20 6a 01         JSR .SEC
$200f: a5 76            LDA $76
.V1: 29 03              AND #$03
$2013: 85 7b            STA $7b
$2015: a9 50            LDA #$50
$2017: 85 5b            STA $5b
$2019: 20 69 07         JSR $0769
$201c: a5 77            LDA $77
$201e: 29 07            AND #$07
$2020: 85 7c            STA $7c
$2022: d0 03            BNE $2027
$2024: 20 69 07         JSR $0769
$2027: 20 1b 01         JSR $011b
$202a: 20 8e 21         JSR .V2
$202d: a2 01            LDX #$01
$202f: 20 c3 03         JSR $03c3
$2032: e6 77            INC $77
$2034: d0 02            BNE $2038
$2036: e6 78            INC $78
$2038: c6 5b            DEC $5b
$203a: d0 e0            BNE $201c
$203c: 60               RTS

.UB: bc e8 0b           LDY $0be8,X
$2040: bd 30 0c         LDA $0c30,X
$2043: f0 18            BEQ $205d
$2045: bd a0 0b         LDA $0ba0,X
$2048: 38               SEC
$2049: e9 80            SBC #$80
$204b: 9d a0 0b         STA $0ba0,X
$204e: bd e8 0b         LDA $0be8,X
$2051: f9 2c 0a         SBC $0a2c,Y
$2054: 9d e8 0b         STA $0be8,X
$2057: a9 01            LDA #$01
$2059: 9d 30 0c         STA $0c30,X
$205c: 60               RTS

$205d: bd a0 0b         LDA $0ba0,X
$2060: 18               CLC
$2061: 69 80            ADC #$80
$2063: 9d a0 0b         STA $0ba0,X
$2066: bd e8 0b         LDA $0be8,X
$2069: 79 10 0d         ADC $0d10,Y
$206c: 9d e8 0b         STA $0be8,X
$206f: a9 18            LDA #$18
$2071: 9d 30 0c         STA $0c30,X
$2074: 60               RTS

.U8: bd 30 0c           LDA $0c30,X
$2078: f0 06            BEQ $2080
$207a: c9 19            CMP #$19
$207c: 10 02            BPL $2080
$207e: 18               CLC
$207f: 60               RTS

$2080: bc e8 0b         LDY $0be8,X
$2083: bd a0 0b         LDA $0ba0,X
$2086: d9 23 0a         CMP $0a23,Y
$2089: 90 f3            BCC $207e
$208b: d9 1a 0a         CMP $0a1a,Y
$208e: b0 ee            BCS $207e
$2090: 38               SEC
$2091: 60               RTS

//  
// If this task completes early then "idle" so it takes a fixed time.
//
.PACING: 45 21          JSR .SCROLL
$2095: a5 9d            LDA $9d
$2097: 10 0a            BPL $20a3
$2099: a5 32            LDA $32
$209b: ed 79 fe         SBC $fe79  // VIA-B Timer2 MSB
$209e: c9 50            CMP #$50   // #&50 * #&FF + 1.5uS
$20a0: 30 f7            BMI $2099  // Make sure at least 50 ticks have passed.
$20a2: 60               RTS

$20a3: f0 0f            BEQ $20b4
/*----------------------------------------
 *
 *  
 *
 *----------------------------------------*/
.WRITESCREEN: a5 85     LDA $85
$20a7: 18               CLC
$20a8: 69 4f            ADC #$4f
$20aa: 85 77            STA $77
$20ac: a5 86            LDA $86
$20ae: 69 00            ADC #$00
$20b0: 85 78            STA $78
$20b2: 10 08            BPL $20bc

$20b4: a5 85            LDA $85      // Enter here if &9d is zero
$20b6: 85 77            STA $77
$20b8: a5 86            LDA $86
$20ba: 85 78            STA $78
$20bc: 20 69 21         JSR .WRITESCRN1
$20bf: a5 77            LDA $77
$20c1: 29 07            AND #$07
$20c3: 85 7c            STA $7c
$20c5: 20 69 07         JSR $0769
$20c8: 4c d7 20         JMP $20d7
$20cb: 20 1b 01         JSR $011b
$20ce: a0 07            LDY #$07

$20d0: b1 91            LDA ($91),Y
$20d2: 91 81            STA ($81),Y
$20d4: 88               DEY
$20d5: 10 f9            BPL $20d0
$20d7: c6 76            DEC $76
$20d9: 30 c7            BMI $20a2    // RTS
$20db: 20 c3 03         JSR $03c3
$20de: a5 76            LDA $76
$20e0: 29 03            AND #$03
$20e2: 85 7b            STA $7b
$20e4: c9 03            CMP #$03
$20e6: f0 09            BEQ $20f1
$20e8: c6 10            DEC $10
$20ea: a4 10            LDY $10
$20ec: 20 34 01         JSR $0134
$20ef: d0 dd            BNE $20ce
$20f1: c6 11            DEC $11
$20f3: a4 11            LDY $11
$20f5: 20 99 07         JSR $0799
$20f8: 4c cb 20         JMP $20cb
/*----------------------------------------
 *
 *  1/3/2006
 *
 *----------------------------------------*/ 
.SCROLL3: a5 9d         LDA $9d
$20fd: 30 69            BMI $2168 // If less than zero do RTS
$20ff: f0 0e            BEQ SCROLL2               // If zero
                                                // else
/*----------------------------------------
 *
 *  Generates &83,&84
 *
 *----------------------------------------*/        // At startup
.MOVESCREENLEFT: e6 85  INC $85                        // #&d0
$2103: d0 02            BNE $2107
$2105: e6 86            INC $86                        //  #&02
$2107: e6 87            INC $SCRLO                        //  #&00
$2109: d0 02            BNE $210d
$210b: e6 88            INC $SCRHI                        //  #&06
$210d: d0 10            BNE .SCROLL5
/*----------------------------------------*/
SCROLL2: a5 85          LDA $85                        // #&d1  
$2111: d0 02            BNE $2115
$2113: c6 86            DEC $86
$2115: c6 85            DEC $85
$2117: a5 87            LDA $SCRLO
$2119: d0 02            BNE $211d
$211b: c6 88            DEC $SCRHI
$211d: c6 87            DEC $SCRLO

.SCROLL5: a5 88         LDA $SCRHI
$2121: c9 06            CMP #$06                       // Corresponds to &3000 (i.e. #&3000/#&8)
$2123: 10 06            BPL $212b
$2125: a9 0f            LDA #$0f                       
$2127: 85 88            STA $SCRHI
$2129: 10 08            BPL $2133

$212b: c9 10            CMP #$10                       // Corresponds to right extent - &8000                    
$212d: 30 04            BMI $2133                      
$212f: a9 06            LDA #$06
$2131: 85 88            STA $SCRHI

$2133: a5 88            LDA $SCRHI                        // #&06
$2135: 85 84            STA $84
$2137: a5 87            LDA $SCRLO                        // #&01 after incremented
$2139: 0a               ASL                          
$213a: 26 84            ROL $84
$213c: 0a               ASL
$213d: 26 84            ROL $84
$213f: 0a               ASL
$2140: 26 84            ROL $84
$2142: 85 83            STA $83
$2144: 60               RTS

/*----------------------------------------------
 *
 *  Screen Scrolling
 *
 *  
 *                 &88 - Screen address High Byte
 *                 &87 - Screen address Low  Byte
 *  28/2/2006
/*----------------------------------------------

.SCROLL:   a5 32        LDA $32
$2147: 38               SEC
$2148: ed 79 fe         SBC $fe79  // VIA-B Timer2 MSB
$214b: c9 3b            CMP #$3b
$214d: 10 05            BPL $2154

.SETSCREENADDRESS: a9 13         LDA #$13   // OSBYTE call / disable events
$2151: 20 f4 ff         JSR $fff4


$2154: a9 0c            LDA #$0c   // 13 - Wait for the Vertical sync...
$2156: 8d 00 fe         STA $fe00  // SHELIA 6845 CRTC address register (out of 18 registers)
                                   //                  Displayed screen start address register 
$2159: a5 88            LDA $SCRHI
$215b: 8d 01 fe         STA $fe01  // Horizontal displayed characters per line
$215e: a9 0d            LDA #$0d
$2160: 8d 00 fe         STA $fe00  // Horizontal sync
$2163: a5 87            LDA $SCRLO
$2165: 8d 01 fe         STA $fe01  // Horizontal displayed characters per line
$2168: 60               RTS


.WRITESCRN1: a9 1f      LDA #$1f
$216b: 85 76            STA $76
$216d: 20 80 03         JSR $0380
$2170: a2 02            LDX #$02
$2172: a0 07            LDY #$07
$2174: a9 00            LDA #$00
$2176: 91 81            STA ($81),Y
$2178: 88               DEY
$2179: 10 fb            BPL $2176
$217b: 20 c3 03         JSR $03c3
$217e: c6 76            DEC $76
$2180: a5 76            LDA $76
$2182: c9 1c            CMP #$1c
$2184: d0 ec            BNE $2172
$2186: a9 12            LDA #$12
$2188: 85 92            STA $92
$218a: a9 20            LDA #$20
$218c: 85 91            STA $91
.V2: a0 07              LDY #$07
$2190: b1 91            LDA ($91),Y
$2192: 91 81            STA ($81),Y
$2194: 88               DEY
$2195: 10 f9            BPL $2190
$2197: 60               RTS
/*----------------------------------------
 *
 *  Sets $73, $74, $76, $77, $78, $80
 *     Set X before calling
 *
 *----------------------------------------*/
.U6: 8a                 TXA
$2199: a8               TAY
.U3: b9 30 0c           LDA $0c30,Y
$219d: 85 76            STA $76
$219f: b9 a0 0b         LDA $0ba0,Y
$21a2: 85 77            STA $77
$21a4: b9 e8 0b         LDA $0be8,Y
$21a7: 85 78            STA $78
.WU: b9 78 0c           LDA $0c78,Y
$21ac: 4a               LSR
$21ad: 4a               LSR
$21ae: 85 74            STA $74
$21b0: b9 78 0c         LDA $0c78,Y
$21b3: 29 03            AND #$03
$21b5: 85 73            STA $73
$21b7: a9 0e            LDA #$0e
$21b9: 85 80            STA $80
$21bb: 60               RTS

.WARROWKEYS: a9 06             LDA #$06
$21be: 10 35            BPL $21f5
.U9: 20 69 07           JSR $0769
$21c3: 85 8a            STA $8a
$21c5: a5 77            LDA $77
$21c7: 29 07            AND #$07
$21c9: 85 8b            STA $8b
$21cb: a9 08            LDA #$08
$21cd: 38               SEC
$21ce: e5 8b            SBC $8b
$21d0: 85 7b            STA $7b
$21d2: a5 74            LDA $74
$21d4: 38               SEC
$21d5: e5 7b            SBC $7b
$21d7: 85 7b            STA $7b
$21d9: a5 77            LDA $77
$21db: 29 f8            AND #$f8
$21dd: 18               CLC
$21de: 69 08            ADC #$08
$21e0: 85 77            STA $77
$21e2: 90 02            BCC $21e6
$21e4: e6 78            INC $78
$21e6: 20 69 07         JSR $0769
$21e9: bd a0 0b         LDA $0ba0,X
$21ec: 85 77            STA $77
$21ee: bd e8 0b         LDA $0be8,X
$21f1: 85 78            STA $78
$21f3: a9 00            LDA #$00
$21f5: 8d 10 22         STA $2210
$21f8: a5 76            LDA $76
$21fa: 18               CLC
$21fb: 65 73            ADC $73
$21fd: 85 76            STA $76
$21ff: c6 76            DEC $76
$2201: a2 01            LDX #$01
$2203: a9 00            LDA #$00
$2205: 85 5b            STA $5b
$2207: a5 74            LDA $74
$2209: 85 95            STA $95
$220b: 20 80 03         JSR $0380
$220e: 18               CLC
$220f: 90 fe            BCC $220f
$2211: 20 39 22         JSR .V4
$2214: 4c 1a 22         JMP $221a
$2217: 20 6b 22         JSR .V5
$221a: e6 5b            INC $5b
$221c: c6 95            DEC $95
$221e: f0 08            BEQ $2228
$2220: a2 01            LDX #$01
$2222: 20 c3 03         JSR $03c3
$2225: 4c 0e 22         JMP $220e
$2228: c6 73            DEC $73
$222a: f0 08            BEQ $2234
$222c: a5 74            LDA $74
$222e: 85 95            STA $95
$2230: c6 76            DEC $76
$2232: 10 d7            BPL $220b
$2234: a9 ff            LDA #$ff
$2236: 85 66            STA $66
$2238: 60               RTS

.V4: 20 4e 01         JSR $014e
$223c: a5 66            LDA $66
$223e: f0 1f            BEQ $225f
$2240: a5 7b            LDA $7b
$2242: c5 95            CMP $95
$2244: 10 04            BPL $224a
$2246: a4 8a            LDY $8a
$2248: 10 02            BPL $224c
$224a: a4 8b            LDY $8b
$224c: b9 55 0a         LDA $0a55,Y
$224f: f0 0e            BEQ $225f
$2251: a0 07            LDY #$07
$2253: b1 81            LDA ($81),Y
$2255: d0 04            BNE $225b
$2257: b1 8f            LDA ($8f),Y
$2259: 91 81            STA ($81),Y
$225b: 88               DEY
$225c: 10 f5            BPL $2253
$225e: 60               RTS

$225f: a0 07            LDY #$07
$2261: b1 8f            LDA ($8f),Y
$2263: f0 02            BEQ $2267
$2265: 91 81            STA ($81),Y
$2267: 88               DEY
$2268: 10 f7            BPL $2261
$226a: 60               RTS

.V5: 20 4e 01         JSR $014e
$226e: a0 07            LDY #$07
$2270: b1 8f            LDA ($8f),Y
$2272: 91 81            STA ($81),Y
$2274: 88               DEY
$2275: 10 f9            BPL $2270
$2277: 60               RTS

.WWK: a5 74            LDA $74
$227a: 85 95            STA $95
$227c: 20 80 03         JSR $0380
$227f: a0 07            LDY #$07
$2281: a9 00            LDA #$00
$2283: 91 81            STA ($81),Y
$2285: 88               DEY
$2286: 10 fb            BPL $2283
$2288: c6 95            DEC $95
$228a: f0 08            BEQ $2294
$228c: a2 01            LDX #$01
$228e: 20 c3 03         JSR $03c3
$2291: 4c 7f 22         JMP $227f
$2294: c6 73            DEC $73
$2296: f0 04            BEQ $229c
$2298: e6 76            INC $76
$229a: 10 dc            BPL .WWK
$229c: 60               RTS


.WRITESCRN2: a5 77      LDA $77
$229f: 85 97            STA $97
$22a1: a5 78            LDA $78
$22a3: 85 98            STA $98
$22a5: a5 73            LDA $73
$22a7: 85 96            STA $96
$22a9: 18               CLC
$22aa: 65 76            ADC $76
$22ac: 85 76            STA $76
$22ae: c6 76            DEC $76
$22b0: a5 76            LDA $76
$22b2: 29 03            AND #$03
$22b4: 85 7b            STA $7b
$22b6: a5 77            LDA $77
$22b8: 29 07            AND #$07
$22ba: 85 7c            STA $7c
$22bc: a5 74            LDA $74
$22be: 85 95            STA $95
$22c0: 20 80 03         JSR $0380
$22c3: 20 69 07         JSR $0769
$22c6: 20 1b 01         JSR $011b
$22c9: a0 07            LDY #$07
$22cb: b1 91            LDA ($91),Y  // SCREEN ADDRESS?
$22cd: 91 81            STA ($81),Y
$22cf: 88               DEY
$22d0: 10 f9            BPL $22cb
$22d2: c6 95            DEC $95
$22d4: f0 19            BEQ $22ef
$22d6: e6 77            INC $77
$22d8: d0 02            BNE $22dc
$22da: e6 78            INC $78
$22dc: a2 01            LDX #$01
$22de: 20 c3 03         JSR $03c3
$22e1: a5 77            LDA $77
$22e3: 29 07            AND #$07
$22e5: 85 7c            STA $7c
$22e7: f0 da            BEQ $22c3
$22e9: 20 2a 01         JSR $012a
$22ec: 4c c9 22         JMP $22c9
$22ef: a5 97            LDA $97
$22f1: 85 77            STA $77
$22f3: a5 98            LDA $98
$22f5: 85 78            STA $78
$22f7: c6 96            DEC $96
$22f9: d0 b3            BNE $22ae
$22fb: 60               RTS

.N5: a9 9b              LDA #$9b
$22fe: a2 a1            LDX #$a1
$2300: 20 f4 ff         JSR $fff4  // Write #$a1 EOR #&07 is #$a6 to register 1 palette - sets to cyan
$2303: a2 1f            LDX #$1f

$2305: a9 01            LDA #$01
$2307: 85 65            STA $65
$2309: 20 8d 18         JSR .WN
$230c: a5 63            LDA $63
$230e: d0 04            BNE $2314
$2310: a9 05            LDA #$05
$2312: 85 63            STA $63
$2314: 60               RTS

.N6: a9 9b              LDA #$9b
$2317: a2 a3            LDX #$a3
$2319: 20 f4 ff         JSR $fff4
$231c: a2 21            LDX #$21
$231e: d0 e5            BNE $2305

.N7: ad aa 0b           LDA $0baa
$2323: c9 aa            CMP #$aa
$2325: 30 0f            BMI $2336

$2327: c9 ac            CMP #$ac
$2329: 10 0b            BPL $2336
$232b: ad 3a 0c         LDA $0c3a

$232e: c9 10            CMP #$10
$2330: 10 04            BPL $2336

$2332: c9 0c            CMP #$0c
$2334: 10 01            BPL $2337
$2336: 60               RTS

$2337: a9 ff            LDA #$ff
$2339: 85 75            STA $ALIVE          //DEAD

$233b: a2 2a            LDX #$2a
$233d: a9 1d            LDA #$1d
$233f: 85 7f            STA $7f
$2341: 4c cc 2c         JMP .U7
.N4: a9 05            LDA #$05
$2346: 85 65            STA $65
$2348: a2 22            LDX #$22
$234a: 86 64            STX $64
$234c: a0 2f            LDY #$2f
$234e: 20 af 07         JSR $07af
$2351: a5 77            LDA $77
$2353: c9 03            CMP #$03
$2355: b0 0a            BCS $2361
$2357: a5 76            LDA $76
$2359: c9 03            CMP #$03
$235b: b0 04            BCS $2361
$235d: a9 06            LDA #$06
$235f: 85 63            STA $63
$2361: a4 22            LDY $22
$2363: c0 02            CPY #$02
$2365: 30 6e            BMI $23d5
$2367: 20 af 07         JSR $07af
$236a: a5 77            LDA $77
$236c: d0 41            BNE $23af
$236e: a5 76            LDA $76
$2370: d0 3d            BNE $23af
$2372: a4 59            LDY $59
$2374: 20 9a 21         JSR .U3
$2377: 20 10 09         JSR $0910
$237a: f0 03            BEQ $237f
$237c: 20 9d 22         JSR .WRITESCRN2
$237f: a6 59            LDX $59
$2381: a9 04            LDA #$04
$2383: 9d 30 0c         STA $0c30,X
$2386: 95 00            STA $00,X
$2388: a5 59            LDA $59
$238a: 0a               ASL
$238b: 6d c2 0b         ADC $0bc2
$238e: 9d a0 0b         STA $0ba0,X
$2391: a9 ff            LDA #$ff
$2393: 85 59            STA $59
$2395: a9 00            LDA #$00
$2397: 85 22            STA $22
$2399: 60               RTS

$239a: a2 22            LDX #$22
$239c: a0 16            LDY #$16
$239e: 20 af 07         JSR $07af
$23a1: a5 77            LDA $77
$23a3: d0 11            BNE $23b6
$23a5: a5 76            LDA $76
$23a7: d0 0d            BNE $23b6
$23a9: 46 22            LSR $22
$23ab: 20 48 24         JSR .V7
$23ae: 60               RTS

$23af: a2 58            LDX #$58
$23b1: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0958
$23b4: a2 22            LDX #$22
$23b6: 20 4e 24         JSR .WO
$23b9: 20 0b 17         JSR .W3
$23bc: 18               CLC
$23bd: 69 0c            ADC #$0c
$23bf: 85 7f            STA $7f
$23c1: 20 cc 2c         JSR .U7
$23c4: a4 59            LDY $59
$23c6: 30 d1            BMI $2399
$23c8: ad 3a 0d         LDA $0d3a
$23cb: 29 06            AND #$06
$23cd: c9 04            CMP #$04
$23cf: d0 01            BNE $23d2
$23d1: 4a               LSR
$23d2: 4c c1 2e         JMP $2ec1
$23d5: a2 16            LDX #$16
$23d7: a0 04            LDY #$04
$23d9: b9 00 00         LDA $0000,Y
$23dc: c9 06            CMP #$06
$23de: f0 14            BEQ $23f4
$23e0: 20 af 07         JSR $07af
$23e3: 30 0f            BMI $23f4
$23e5: a5 77            LDA $77
$23e7: a6 22            LDX $22
$23e9: d5 15            CMP $15,X
$23eb: b0 07            BCS $23f4
$23ed: b9 30 0c         LDA $0c30,Y
$23f0: c9 0c            CMP #$0c
$23f2: 10 18            BPL $240c
$23f4: a2 16            LDX #$16
$23f6: 88               DEY
$23f7: c0 01            CPY #$01
$23f9: d0 de            BNE $23d9
$23fb: a5 63            LDA $63
$23fd: 10 9b            BPL $239a
$23ff: a0 2f            LDY #$2f
$2401: 20 af 07         JSR $07af
$2404: a5 77            LDA $77
$2406: a6 22            LDX $22
$2408: d5 15            CMP $15,X
$240a: b0 8e            BCS $239a
$240c: a2 22            LDX #$22
$240e: a9 01            LDA #$01
$2410: 85 22            STA $22
$2412: 20 af 07         JSR $07af
$2415: a5 77            LDA $77
$2417: c9 02            CMP #$02
$2419: b0 94            BCS $23af
$241b: a5 76            LDA $76
$241d: c9 03            CMP #$03
$241f: 10 8e            BPL $23af
$2421: a2 ff            LDX #$ff
$2423: 84 59            STY $59
$2425: b9 00 00         LDA $0000,Y
$2428: c9 03            CMP #$03
$242a: 30 08            BMI $2434
$242c: c9 0e            CMP #$0e
$242e: d0 06            BNE $2436
$2430: 86 54            STX $54
$2432: 30 02            BMI $2436
$2434: 86 9c            STX $HOLDING
$2436: a9 08            LDA #$08
$2438: 99 00 00         STA $0000,Y
$243b: a9 15            LDA #$15
$243d: 85 22            STA $22
$243f: 20 48 24         JSR .V7
$2442: a2 88            LDX #$88
$2444: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0988
$2447: 60               RTS

.V7: 20 97 24           JSR .WP
$244b: 4c 9f 24         JMP $249f

.WO: 20 28 25           JSR .SETSCRNADDR   // ONLY call to 
$2451: 30 04            BMI $2457
$2453: 90 1c            BCC $2471
$2455: b0 2e            BCS $2485
$2457: 20 44 25         JSR .WR
$245a: b0 08            BCS $2464
$245c: a4 65            LDY $65
$245e: a5 71            LDA $71
$2460: 99 40 00         STA $0040,Y
$2463: 60               RTS

$2464: 20 57 25         JSR .WS
$2467: 90 2d            BCC $2496
$2469: 20 b3 24         JSR .MANIPSCRNADDR
$246c: a5 82            LDA $82
$246e: 30 37            BMI $24a7
$2470: 60               RTS

$2471: b9 40 00         LDA $0040,Y
$2474: 30 02            BMI $2478
$2476: 85 71            STA $71
$2478: 20 44 25         JSR .WR
$247b: 90 1a            BCC .WP
$247d: 20 57 25         JSR .WS
$2480: 90 14            BCC $2496
$2482: 4c b3 24         JMP .MANIPSCRNADDR
$2485: 20 57 25         JSR .WS
$2488: 90 15            BCC $249f
$248a: a4 65            LDY $65
$248c: b9 40 00         LDA $0040,Y
$248f: 85 71            STA $71
$2491: 20 44 25         JSR .WR
$2494: b0 09            BCS $249f
$2496: 60               RTS

.WP: a4 65              LDY $65
$2499: a9 ff            LDA #$ff
$249b: 99 38 00         STA $0038,Y
$249e: 60               RTS

$249f: a4 65            LDY $65
$24a1: a9 ff            LDA #$ff
$24a3: 99 40 00         STA $0040,Y
$24a6: 60               RTS

$24a7: a4 65            LDY $65
$24a9: a5 82            LDA $82
$24ab: 29 01            AND #$01
$24ad: 49 01            EOR #$01
$24af: 99 40 00         STA $0040,Y
$24b2: 60               RTS

.MANIPSCRNADDR: a4 65   LDY $65
$24b5: b9 38 00         LDA $0038,Y
$24b8: 10 02            BPL $24bc
$24ba: a5 81            LDA $81
$24bc: 29 02            AND #$02
$24be: 49 02            EOR #$02
$24c0: 99 38 00         STA $0038,Y
$24c3: 60               RTS

.WW: 20 28 25           JSR .SETSCRNADDR
$24c7: 30 19            BMI $24e2
$24c9: 90 2e            BCC $24f9
$24cb: a9 ff            LDA #$ff
$24cd: 85 71            STA $71
$24cf: 20 16 25         JSR .WM
$24d2: 90 cb            BCC $249f
$24d4: a5 40            LDA $40
$24d6: 85 71            STA $71
$24d8: a9 ff            LDA #$ff
$24da: 85 70            STA $70
$24dc: 20 16 25         JSR .WM
$24df: b0 c6            BCS $24a7
$24e1: 60               RTS

$24e2: 20 16 25         JSR .WM
$24e5: 90 40            BCC $2527
$24e7: a5 70            LDA $70
$24e9: 30 c8            BMI .MANIPSCRNADDR
$24eb: a9 ff            LDA #$ff
$24ed: 85 71            STA $71
$24ef: 20 16 25         JSR .WM
$24f2: 90 33            BCC $2527
$24f4: a9 00            LDA #$00
$24f6: 85 40            STA $40
$24f8: 60               RTS

$24f9: a5 40            LDA $40
$24fb: 30 02            BMI $24ff
$24fd: 85 71            STA $71
$24ff: a9 ff            LDA #$ff
$2501: 85 70            STA $70
$2503: 20 16 25         JSR .WM
$2506: 90 8f            BCC .WP
$2508: a5 38            LDA $38
$250a: 85 70            STA $70
$250c: a9 ff            LDA #$ff
$250e: 85 71            STA $71
$2510: 20 16 25         JSR .WM
$2513: b0 9e            BCS .MANIPSCRNADDR
$2515: 60               RTS

.WM: a9 01            LDA #$01
$2518: 85 5e            STA $5e
$251a: 20 98 21         JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$251d: 20 50 1c         JSR .U4
$2520: 20 5e 1b         JSR .WJ
$2523: a9 ff            LDA #$ff
$2525: 85 5e            STA $5e
$2527: 60               RTS

//
// Called with $70,$71
//
.SETSCRNADDR: a4 65     LDY $65
$252a: 18               CLC
$252b: a5 70            LDA $70
$252d: 85 81            STA $81
$252f: a5 71            LDA $71
$2531: 85 82            STA $82
$2533: b9 38 00         LDA $0038,Y
$2536: 10 09            BPL $2541
$2538: b9 40 00         LDA $0040,Y
$253b: 30 03            BMI $2540
$253d: 38               SEC
$253e: 85 71            STA $71
$2540: 60               RTS

$2541: 85 70            STA $70
$2543: 60               RTS

.WR: bd a0 0b           LDA $0ba0,X
$2547: 29 07            AND #$07
$2549: c9 03            CMP #$03
$254b: d0 08            BNE $2555
$254d: 8a               TXA
$254e: a8               TAY
$254f: 20 a9 21         JSR .WU
$2552: 4c 21 16         JMP .W4
$2555: 38               SEC
$2556: 60               RTS

.WS: 20 98 21           JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$255a: 4c 8b 1c         JMP .W2
.WA: c9 ff              CMP #$ff
$255f: f0 29            BEQ .WX
$2561: a9 ff            LDA #$ff
$2563: 85 70            STA $70
$2565: a9 01            LDA #$01
$2567: 85 71            STA $71
$2569: bd 30 0c         LDA $0c30,X
$256c: f0 03            BEQ $2571
$256e: a9 00            LDA #$00
$2570: 60               RTS

$2571: a9 ff            LDA #$ff
$2573: 95 00            STA $00,X
$2575: 20 98 21         JSR .U6
$2578: e6 73            INC $73
$257a: 20 9d 22         JSR .WRITESCRN2
$257d: a6 64            LDX $64
$257f: a5 68            LDA $68
$2581: 9d 18 0d         STA $0d18,X
$2584: a2 88            LDX #$88
$2586: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0988

$2589: 60               RTS

.WX: a5 68            LDA $68
$258c: 38               SEC
$258d: fd 18 0d         SBC $0d18,X
$2590: c9 02            CMP #$02
$2592: b0 02            BCS .WY
$2594: 90 f3            BCC $2589

.WY: a9 03              LDA #$03
$2598: 9d 18 0d         STA $0d18,X

.WWF: bd 10 0b          LDA $0b10,X
$259e: 9d a0 0b         STA $0ba0,X
$25a1: bd 40 0b         LDA $0b40,X
$25a4: 9d e8 0b         STA $0be8,X
$25a7: bd 70 0b         LDA $0b70,X
$25aa: 9d 30 0c         STA $0c30,X
.WWC: bd 80 0e          LDA $0e80,X
$25b0: 95 00            STA $00,X
$25b2: 60               RTS

.WG: 20 98 21           JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$25b6: a9 01            LDA #$01
$25b8: 85 71            STA $71
$25ba: a9 ff            LDA #$ff
$25bc: 85 70            STA $70
$25be: 20 50 1c         JSR .U4
$25c1: 20 5e 1b         JSR .WJ
$25c4: 60               RTS

.N9: a2 23              LDX #$23
$25c7: 86 64            STX $64
$25c9: a9 00            LDA #$00
$25cb: 85 65            STA $65
$25cd: a5 63            LDA $63
$25cf: 30 06            BMI $25d7
$25d1: 20 02 2e         JSR .PALETTE2
$25d4: 4c 5a 26         JMP $265a

$25d7: a5 23            LDA $23
$25d9: 30 36            BMI $2611
$25db: a0 0c            LDY #$0c
$25dd: c4 54            CPY $54
$25df: d0 5a            BNE $263b
$25e1: 20 af 07         JSR $07af
$25e4: a5 70            LDA $70
$25e6: 29 02            AND #$02
$25e8: 4a               LSR
$25e9: a8               TAY
$25ea: a5 76            LDA $76
$25ec: c9 02            CMP #$02
$25ee: 90 0c            BCC $25fc
$25f0: c9 03            CMP #$03
$25f2: b0 47            BCS $263b
$25f4: a5 77            LDA $77
$25f6: c9 0c            CMP #$0c
$25f8: b0 41            BCS $263b
$25fa: 90 1f            BCC $261b
$25fc: a5 71            LDA $71
$25fe: c9 01            CMP #$01
$2600: f0 f4            BEQ $25f6
$2602: a5 77            LDA $77
$2604: d9 ed 09         CMP $09ed,Y
$2607: b0 ed            BCS $25f6
$2609: a2 80            LDX #$80
$260b: 86 23            STX $23
$260d: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0980
$2610: 60               RTS

$2611: c9 ff            CMP #$ff
$2613: f0 fb            BEQ $2610
$2615: 20 5d 25         JSR .WA
$2618: f0 56            BEQ $2670
$261a: 60               RTS

$261b: a5 55            LDA $55      // set to #&04 elsewhere
$261d: c9 02            CMP #$02
$261f: 10 0c            BPL $262d
$2621: 0a               ASL
$2622: 85 70            STA $70               // Used in call to .WW
$2624: a9 00            LDA #$00
$2626: 85 71            STA $71
$2628: 20 48 24         JSR .V7               // Used in call to .WW
$262b: 30 3c            BMI $2669

$262d: a5 70            LDA $70
$262f: 10 02            BPL $2633
$2631: a9 00            LDA #$00
$2633: 49 02            EOR #$02
$2635: 85 70            STA $70
$2637: a5 55            LDA $55
$2639: d0 e9            BNE $2624
$263b: a0 2f            LDY #$2f
$263d: 20 af 07         JSR $07af
$2640: a5 77            LDA $77
$2642: c9 40            CMP #$40
$2644: b0 14            BCS $265a
$2646: c9 0a            CMP #$0a
$2648: b0 1a            BCS $2664
$264a: a5 76            LDA $76
$264c: c9 04            CMP #$04
$264e: b0 14            BCS $2664
$2650: a9 08            LDA #$08
$2652: 85 63            STA $63
$2654: 20 48 24         JSR .V7
$2657: 4c 09 2e         JMP $2e09

$265a: a2 23            LDX #$23
$265c: a0 14            LDY #$14
$265e: 20 af 07         JSR $07af
$2661: 4c 69 26         JMP $2669
$2664: a2 78            LDX #$78
$2666: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0978

$2669: a2 23            LDX #$23
$266b: 20 c4 24         JSR .WW
$266e: b0 a0            BCS $2610
$2670: 20 0b 17         JSR .W3
$2673: 18               CLC
$2674: 69 12            ADC #$12
$2676: 85 7f            STA $7f
$2678: 4c cc 2c         JMP .U7
.N3: a9 03              LDA #$03
$267d: 85 65            STA $65
$267f: a2 29            LDX #$29
$2681: 86 64            STX $64
$2683: 20 c0 00         JSR $00c0
$2686: d0 70            BNE $26f8
$2688: a0 08            LDY #$08
$268a: b9 00 00         LDA $0000,Y
$268d: c9 06            CMP #$06
$268f: f0 30            BEQ $26c1
$2691: 20 af 07         JSR $07af
$2694: a6 65            LDX $65
$2696: a5 77            LDA $77
$2698: c9 04            CMP #$04
$269a: b0 25            BCS $26c1
$269c: a5 76            LDA $76
$269e: c9 03            CMP #$03
$26a0: 10 1f            BPL $26c1
$26a2: c9 02            CMP #$02
$26a4: 30 08            BMI $26ae
$26a6: a5 71            LDA $71
$26a8: 49 01            EOR #$01
$26aa: 95 40            STA $40,X
$26ac: 10 1a            BPL $26c8
$26ae: a5 70            LDA $70
$26b0: 49 02            EOR #$02
$26b2: 95 38            STA $38,X
$26b4: bd 56 0c         LDA $0c56,X
$26b7: c9 04            CMP #$04
$26b9: d0 0d            BNE $26c8
$26bb: a9 12            LDA #$12
$26bd: 95 26            STA $26,X
$26bf: d0 07            BNE $26c8
$26c1: a6 64            LDX $64
$26c3: 88               DEY
$26c4: c0 04            CPY #$04
$26c6: d0 c2            BNE $268a
$26c8: a6 64            LDX $64
$26ca: b4 00            LDY $00,X
$26cc: 10 06            BPL $26d4
$26ce: 20 8a 25         JSR .WX
$26d1: 4c f8 26         JMP $26f8
$26d4: 20 af 07         JSR $07af
$26d7: a5 77            LDA $77
$26d9: d0 0f            BNE $26ea
$26db: a5 76            LDA $76
$26dd: d0 0b            BNE $26ea
$26df: 20 48 24         JSR .V7
$26e2: b5 00            LDA $00,X
$26e4: 49 01            EOR #$01
$26e6: 95 00            STA $00,X
$26e8: d0 0e            BNE $26f8
$26ea: 20 4e 24         JSR .WO
$26ed: 20 0b 17         JSR .W3
$26f0: 18               CLC
$26f1: 69 16            ADC #$16
$26f3: 85 7f            STA $7f
$26f5: 20 cc 2c         JSR .U7
$26f8: c6 64            DEC $64
$26fa: a6 64            LDX $64
$26fc: c6 65            DEC $65
$26fe: 30 03            BMI $2703
$2700: 4c 83 26         JMP $2683
$2703: a2 25            LDX #$25
$2705: 86 64            STX $64
$2707: a9 ff            LDA #$ff
$2709: 85 70            STA $70
$270b: b5 00            LDA $00,X
$270d: 30 22            BMI $2731
$270f: d0 5d            BNE $276e
$2711: bd 30 0c         LDA $0c30,X
$2714: c9 16            CMP #$16
$2716: f0 14            BEQ $272c
$2718: a9 00            LDA #$00
$271a: 85 71            STA $71
$271c: a9 1c            LDA #$1c
$271e: 85 7f            STA $7f
$2720: 20 cc 2c         JSR .U7
$2723: c6 64            DEC $64
$2725: a6 64            LDX $64
$2727: e0 23            CPX #$23
$2729: d0 dc            BNE $2707
$272b: 60               RTS

$272c: a9 ff            LDA #$ff
$272e: 95 00            STA $00,X
$2730: 60               RTS

$2731: a5 63            LDA $63
$2733: 10 0c            BPL $2741
$2735: bc cb 09         LDY $09cb,X
$2738: a2 2f            LDX #$2f
$273a: 20 af 07         JSR $07af
$273d: a5 77            LDA $77
$273f: f0 1f            BEQ $2760
$2741: a2 29            LDX #$29
$2743: 20 af 07         JSR $07af
$2746: a5 77            LDA $77
$2748: f0 16            BEQ $2760
$274a: ca               DEX
$274b: e0 25            CPX #$25
$274d: d0 f4            BNE $2743
$274f: a6 64            LDX $64
$2751: 20 c0 00         JSR $00c0
$2754: d0 cd            BNE $2723
$2756: b5 00            LDA $00,X
$2758: 85 70            STA $70
$275a: c9 ff            CMP #$ff
$275c: d0 c5            BNE $2723
$275e: f0 ba            BEQ $271a
$2760: 8a               TXA
$2761: a4 64            LDY $64
$2763: 99 00 00         STA $0000,Y
$2766: a2 80            LDX #$80
$2768: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0980

$276b: 4c 23 27         JMP $2723
$276e: bd 30 0c         LDA $0c30,X
$2771: c9 08            CMP #$08
$2773: f0 19            BEQ $278e
$2775: b4 00            LDY $00,X
$2777: fe a0 0b         INC $0ba0,X
$277a: 20 af 07         JSR $07af
$277d: de a0 0b         DEC $0ba0,X
$2780: a9 80            LDA #$80
$2782: 85 71            STA $71
$2784: a9 1c            LDA #$1c
$2786: 85 7f            STA $7f
$2788: 20 cc 2c         JSR .U7
$278b: 4c 23 27         JMP $2723
$278e: b4 00            LDY $00,X
$2790: c0 2f            CPY #$2f
$2792: f0 1b            BEQ $27af
$2794: a9 ff            LDA #$ff
$2796: 99 00 00         STA $0000,Y
$2799: a5 68            LDA $68
$279b: 99 18 0d         STA $0d18,Y
$279e: a9 00            LDA #$00
$27a0: 95 00            STA $00,X
$27a2: a2 88            LDX #$88
$27a4: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0988
$27a7: a2 90            LDX #$90
$27a9: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0990
$27ac: 4c 23 27         JMP $2723

$27af: a9 07            LDA #$07
$27b1: 85 63            STA $63
$27b3: d0 e9            BNE $279e
$27b5: d0 37            BNE $27ee
$27b7: a5 5d            LDA $5d
$27b9: 30 03            BMI $27be
$27bb: 4c cd 28         JMP $28cd
$27be: a9 01            LDA #$01
$27c0: 85 71            STA $71
$27c2: a9 ff            LDA #$ff
$27c4: 85 70            STA $70
$27c6: 20 16 25         JSR .WM
$27c9: b0 05            BCS $27d0
$27cb: e6 6c            INC $6c
$27cd: 4c e8 16         JMP .W5
$27d0: a5 6c            LDA $6c
$27d2: 30 09            BMI $27dd
$27d4: c9 0e            CMP #$0e
$27d6: 90 05            BCC $27dd
$27d8: a9 02            LDA #$02
$27da: 85 63            STA $63
$27dc: 60               RTS

$27dd: a9 ff            LDA #$ff
$27df: 85 6c            STA $6c
$27e1: a5 5d            LDA $5d
$27e3: c9 80            CMP #$80
$27e5: d0 5d            BNE $2844
$27e7: a9 01            LDA #$01
$27e9: 85 63            STA $63
$27eb: 4c 6b 29         JMP .UF
$27ee: 20 b3 25         JSR .WG
$27f1: b0 5a            BCS $284d
$27f3: 4c e8 16         JMP .W5
$27f6: a2 1d            LDX #$1d
$27f8: 20 96 25         JSR .WY
$27fb: a2 1c            LDX #$1c
$27fd: a5 1c            LDA $1c
$27ff: 10 03            BPL $2804
$2801: 20 96 25         JSR .WY
$2804: a2 2f            LDX #$2f
$2806: a9 00            LDA #$00
$2808: 85 5d            STA $5d
$280a: 85 99            STA $99
$280c: ad cf 0b         LDA $0bcf
$280f: 38               SEC
$2810: e9 06            SBC #$06
$2812: 8d e4 0b         STA $0be4
$2815: ad 17 0c         LDA .JTINDEX
$2818: e9 00            SBC #$00
$281a: 8d 2c 0c         STA $0c2c
$281d: ad cf 0b         LDA $0bcf
$2820: 18               CLC
$2821: 69 06            ADC #$06
$2823: 8d e5 0b         STA $0be5
$2826: ad 17 0c         LDA .JTINDEX
$2829: 69 00            ADC #$00
$282b: 8d 2d 0c         STA $0c2d
$282e: ad 5f 0c         LDA $0c5f
$2831: 8d 74 0c         STA $0c74
$2834: 8d 75 0c         STA $0c75
$2837: 20 6b 29         JSR .UF
$283a: a9 45            LDA #$45
$283c: 85 1d            STA $1d
$283e: a9 44            LDA #$44
$2840: 85 1c            STA $1c
$2842: 10 aa            BPL $27ee
$2844: a5 47            LDA $47
$2846: 30 ae            BMI $27f6
$2848: a9 05            LDA #$05
$284a: 85 63            STA $63
$284c: 60               RTS

$284d: a4 75            LDY $ALIVE
$284f: d0 08            BNE $2859            // Branch if $ALIVE not zero
$2851: a2 90            LDX #$90
$2853: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0990
$2856: 20 77 29         JSR .WZ

$2859: a4 75            LDY $ALIVE
$285b: e6 75            INC $ALIVE
$285d: a5 5d            LDA $5d
$285f: f0 2d            BEQ $288e
$2861: a5 63            LDA $63
$2863: c9 01            CMP #$01
$2865: d0 06            BNE $286d
$2867: c0 60            CPY #$60
$2869: f0 4b            BEQ $28b6            // if $ALIVE = 60
$286b: d0 21            BNE $288e

$286d: 98               TYA
$286e: c9 20            CMP #$20
$2870: f0 1f            BEQ $2891
$2872: 10 37            BPL $28ab
$2874: 29 03            AND #$03
$2876: d0 0d            BNE $2885

$2878: ad 74 09         LDA $0974
$287b: 69 02            ADC #$02
$287d: 8d 74 09         STA $0974
$2880: a2 70            LDX #$70
$2882: 20 35 0a         JSR .PLAYSOUND       // Sound command address block is 0970

$2885: a5 75            LDA $ALIVE
$2887: 29 04            AND #$04
$2889: 4a               LSR
$288a: 85 7f            STA $7f
$288c: 10 1f            BPL $28ad

$288e: 98               TYA

$288f: d0 1a            BNE $28ab
$2891: 20 98 21         JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$2894: a5 77            LDA $77
$2896: 8d b7 0b         STA $0bb7
$2899: a5 78            LDA $78
$289b: 8d ff 0b         STA $0bff
$289e: a5 76            LDA $76
$28a0: 8d 47 0c         STA $0c47
$28a3: a9 64            LDA #$64
$28a5: 8d 74 09         STA $0974
$28a8: 20 9d 22         JSR .WRITESCRN2

$28ab: a2 17            LDX #$17
$28ad: a9 ff            LDA #$ff
$28af: 85 70            STA $70
$28b1: 85 71            STA $71
$28b3: 4c cc 2c         JMP .U7

$28b6: a0 17            LDY #$17
$28b8: 20 9a 21         JSR .U3
$28bb: 20 9d 22         JSR .WRITESCRN2
$28be: a9 00            LDA #$00
$28c0: 85 75            STA $ALIVE                  // DEAD
$28c2: a9 ff            LDA #$ff
$28c4: 85 63            STA $63
$28c6: a9 02            LDA #$02
$28c8: 85 70            STA $70
$28ca: 4c d9 17         JMP $17d9
$28cd: a5 99            LDA $99
$28cf: f0 15            BEQ $28e6
$28d1: a5 54            LDA $54
$28d3: 10 11            BPL $28e6
$28d5: c6 99            DEC $99
$28d7: 20 89 2f         JSR .WWA
$28da: a4 9c            LDY $HOLDING
$28dc: 30 08            BMI $28e6
$28de: a2 2f            LDX #$2f
$28e0: 20 d4 2e         JSR .WWB
$28e3: 20 77 29         JSR .WZ
$28e6: a9 05            LDA #$05
$28e8: 85 65            STA $65
$28ea: a2 1d            LDX #$1d
$28ec: 86 64            STX $64
$28ee: b4 00            LDY $00,X
$28f0: 30 19            BMI $290b
$28f2: 20 af 07         JSR $07af
$28f5: a5 77            LDA $77
$28f7: d0 08            BNE $2901
$28f9: e6 5d            INC $5d
$28fb: a9 ff            LDA #$ff
$28fd: 95 00            STA $00,X
$28ff: 30 0a            BMI $290b
$2901: a9 01            LDA #$01
$2903: 85 71            STA $71
$2905: 20 4e 24         JSR .WO
$2908: 20 18 1a         JSR .WE
$290b: c6 65            DEC $65
$290d: a6 64            LDX $64
$290f: ca               DEX
$2910: e0 1b            CPX #$1b
$2912: d0 d8            BNE $28ec
$2914: a5 5d            LDA $5d
$2916: c9 02            CMP #$02
$2918: 30 91            BMI $28ab
$291a: d0 13            BNE $292f
$291c: a0 17            LDY #$17
$291e: 20 9a 21         JSR .U3
$2921: 20 9d 22         JSR .WRITESCRN2
$2924: a9 46            LDA #$46
$2926: 85 1d            STA $1d
$2928: 85 1c            STA $1c
$292a: e6 5d            INC $5d
$292c: 4c 6b 29         JMP .UF
$292f: c9 04            CMP #$04
$2931: d0 06            BNE $2939
$2933: 85 99            STA $99
$2935: a9 47            LDA #$47
$2937: d0 ed            BNE $2926
$2939: c9 06            CMP #$06
$293b: d0 1d            BNE $295a
$293d: a9 01            LDA #$01
$293f: 85 63            STA $63
$2941: a9 00            LDA #$00
$2943: 85 75            STA $ALIVE         //DEAD
$2945: a9 18            LDA #$18
$2947: 85 47            STA $47
$2949: a2 1c            LDX #$1c
$294b: 20 ad 25         JSR .WWC
$294e: a2 1d            LDX #$1d
$2950: 20 ad 25         JSR .WWC
$2953: a9 80            LDA #$80
$2955: 85 5d            STA $5d
$2957: 4c 6b 29         JMP .UF
$295a: a4 1d            LDY $1d
$295c: a2 2f            LDX #$2f
$295e: 20 af 07         JSR $07af
$2961: a9 ff            LDA #$ff
$2963: 85 71            STA $71
$2965: 20 4e 24         JSR .WO
$2968: 4c 1f 18         JMP $181f
.UF: a9 05            LDA #$05
$296d: 85 65            STA $65
$296f: 20 48 24         JSR .V7
$2972: c6 65            DEC $65
$2974: 10 f9            BPL $296f
$2976: 60               RTS

.WZ: a2 2f            LDX #$2f
$2979: a4 9c            LDY $HOLDING
$297b: 30 13            BMI $2990
$297d: 84 54            STY $54
$297f: a9 00            LDA #$00
$2981: 85 56            STA $56
$2983: a9 0e            LDA #$0e
$2985: 99 00 00         STA $0000,Y
$2988: a9 ff            LDA #$ff
$298a: 85 9c            STA $HOLDING
$298c: a9 03            LDA #$03
$298e: 85 55            STA $55
$2990: 60               RTS

.LIVES:c9 ff            CMP #$ff
$2993: f0 78            BEQ .LIV1   // DEAD ?
$2995: c6 46            DEC $46
$2997: d0 03            BNE $299c
$2999: 4c 34 2a         JMP .GAMEOVER

$299c: 20 7b 2a         JSR .PRINTANDPAUSE
$299f: a2 0b            LDX #$0b
$29a1: a5 37            LDA $37
$29a3: 85 35            STA $35
$29a5: bd 24 0d         LDA $0d24,X
$29a8: 9d a0 0b         STA $0ba0,X
$29ab: bd f8 0c         LDA $0cf8,X
$29ae: 9d e8 0b         STA $0be8,X
$29b1: bd 04 0d         LDA $0d04,X
$29b4: 9d 30 0c         STA $0c30,X
$29b7: a9 04            LDA #$04
$29b9: 95 00            STA $00,X
$29bb: ca               DEX
$29bc: 10 e3            BPL $29a1
$29be: a2 03            LDX #$03
$29c0: bc f1 09         LDY $09f1,X
$29c3: 98               TYA
$29c4: 9d c0 09         STA $CARRYING,X
$29c7: 30 05            BMI $29ce
$29c9: a9 06            LDA #$06
$29cb: 99 00 00         STA $0000,Y
$29ce: ca               DEX
$29cf: 10 ef            BPL $29c0
$29d1: a4 14            LDY $14          // 9c was copied to &14 at the start...
$29d3: 84 9c            STY $HOLDING
$29d5: a9 02            LDA #$02
$29d7: 99 00 00         STA $0000,Y

$29da: a6 89            LDX $89

// X=3 if called from .ESCAPE
//
.RESTART: a9 ff         LDA #$ff
$29de: 85 63            STA $63
$29e0: 85 5d            STA $5d
$29e2: 85 47            STA $47
$29e4: 85 6c            STA $6c
$29e6: 85 53            STA $53
$29e8: a9 00            LDA #$00
$29ea: 85 75            STA $ALIVE
$29ec: 85 9e            STA $9e
$29ee: 8d 47 0d         STA $0d47
$29f1: bd ff 09         LDA $09ff,X
$29f4: 8d 5f 0c         STA $0c5f
$29f7: bd f6 09         LDA $09f6,X
$29fa: 8d cf 0b         STA $0bcf
$29fd: 38               SEC
$29fe: e9 78            SBC #$78
$2a00: 85 85            STA $85
$2a02: 8a               TXA
$2a03: 8d 17 0c         STA .JTINDEX
$2a06: e9 00            SBC #$00
$2a08: 85 86            STA $86
$2a0a: 4c 31 15         JMP INIT          // RESTART THE GAME !!!

.LIV1: a0 03            LDY #$03
$2a0f: be c0 09         LDX $CARRYING,Y
$2a12: ca               DEX
$2a13: ca               DEX
$2a14: e0 03            CPX #$03
$2a16: b0 02            BCS $2a1a
$2a18: e6 57            INC $57
$2a1a: 88               DEY
$2a1b: 10 f2            BPL $2a0f
$2a1d: 18               CLC
$2a1e: a5 57            LDA $57
$2a20: 65 69            ADC $69
$2a22: 65 46            ADC $46
$2a24: 85 57            STA $57
$2a26: d0 0c            BNE .GAMEOVER

.U1:   20 2f 2a         JSR .WWE

$2a2b: a0 0a            LDY #$0a
$2a2d: a9 00            LDA #$00

.WWE: 29 0f             AND #$0f
$2a31: 4c fa 2f         JMP .PRINTNUMBER




.GAMEOVER: 20 7b 2a     JSR .PRINTANDPAUSE

.PAUSE  a5 ec           LDA $ec
$2a39: c9 e2            CMP #$e2    // SPACE You have to press S-P-A-C-E-!-!-!
$2a3b: d0 fa            BNE .PAUSE

.ESCAPE: a9 04          LDA #$04
$2a3f: 85 46            STA $46
$2a41: a2 08            LDX #$08
$2a43: a9 00            LDA #$00
$2a45: 85 35            STA $35
$2a47: 9d 08 0a         STA $0a08,X
$2a4a: ca               DEX
$2a4b: 10 f6            BPL $2a43
$2a4d: a2 03            LDX #$03
$2a4f: a9 ff            LDA #$ff
$2a51: 9d c0 09         STA $CARRYING,X
$2a54: ca               DEX
$2a55: 10 fa            BPL $2a51
$2a57: 85 9c            STA $HOLDING
$2a59: 85 57            STA $57
$2a5b: a9 e8            LDA #$e8
$2a5d: 85 69            STA $69           // Tested in MAIN loop
$2a5f: ea               NOP
$2a60: a2 2f            LDX #$2f
$2a62: 20 96 25         JSR .WY
$2a65: ca               DEX
$2a66: e0 18            CPX #$18
$2a68: 10 f8            BPL $2a62
$2a6a: a2 0b            LDX #$0b
$2a6c: 20 9b 25         JSR .WWF
$2a6f: a9 04            LDA #$04
$2a71: 95 00            STA $00,X
$2a73: ca               DEX
$2a74: 10 f6            BPL $2a6c
$2a76: a2 03            LDX #$03
$2a78: 4c dc 29         JMP .RESTART

.PRINTANDPAUSE:20 8c 2a JSR .YOUFELL
$2a7e: a9 80            LDA #$80
$2a80: 85 72            STA $72
$2a82: a9 13            LDA #$13     // Disable events 80 times. //pause
$2a84: 20 f4 ff         JSR $fff4
$2a87: c6 72            DEC $72
$2a89: d0 f7            BNE $2a82
$2a8b: 60               RTS

.YOUFELL: 20 f2 1e      JSR .SCORE
$2a8f: a2 02            LDX #$02
$2a91: a0 e0            LDY #$e0
$2a93: 20 a4 1e         JSR .SETSCREENADDRESS
$2a96: a5 75            LDA $ALIVE
$2a98: c9 ff            CMP #$ff
$2a9a: f0 64            BEQ $2b00
$2a9c: a4 63            LDY $63
$2a9e: c0 06            CPY #$06
$2aa0: 10 17            BPL $2ab9
$2aa2: a2 07            LDX #$07
$2aa4: 20 15 2b         JSR .MESSAGES
$2aa7: a2 02            LDX #$02
$2aa9: a0 f0            LDY #$f0
$2aab: 20 a4 1e         JSR .SETSCREENADDRESS
$2aae: a4 63            LDY $63
$2ab0: be a6 0c         LDX $0ca6,Y
$2ab3: 20 15 2b         JSR .MESSAGES
$2ab6: 4c d9 2a         JMP $2ad9
$2ab9: a2 0b            LDX #$0b
$2abb: 20 15 2b         JSR .MESSAGES
$2abe: a2 02            LDX #$02
$2ac0: a0 f0            LDY #$f0
$2ac2: 20 a4 1e         JSR .SETSCREENADDRESS
$2ac5: a4 63            LDY $63
$2ac7: be a6 0c         LDX $0ca6,Y
$2aca: 20 15 2b         JSR .MESSAGES
$2acd: a2 03            LDX #$03
$2acf: a0 7c            LDY #$7c
$2ad1: 20 a4 1e         JSR .SETSCREENADDRESS
$2ad4: a2 1f            LDX #$1f
$2ad6: 20 15 2b         JSR .MESSAGES
$2ad9: a2 04            LDX #$04
$2adb: a0 20            LDY #$20
$2add: 20 a4 1e         JSR .SETSCREENADDRESS
$2ae0: a5 46            LDA $46
$2ae2: f0 10            BEQ $2af4
$2ae4: a2 0f            LDX #$0f
$2ae6: c9 01            CMP #$01
$2ae8: f0 02            BEQ $2aec
$2aea: a2 2e            LDX #$2e
$2aec: 09 30            ORA #$30
$2aee: 20 ee ff         JSR $ffee     // PRINT
$2af1: 4c 15 2b         JMP .MESSAGES
$2af4: a2 04            LDX #$04
$2af6: a0 bc            LDY #$bc
$2af8: 20 a4 1e         JSR .SETSCREENADDRESS
$2afb: a2 44            LDX #$44
$2afd: 4c 02 2b         JMP $2b02
$2b00: a2 54            LDX #$54
$2b02: 20 15 2b         JSR .MESSAGES
$2b05: a2 04            LDX #$04
$2b07: a0 28            LDY #$28
$2b09: 20 a4 1e         JSR .SETSCREENADDRESS
$2b0c: a2 3a            LDX #$3a
$2b0e: 4c 15 2b         JMP .MESSAGES
$2b11: 20 ee ff         JSR $ffee  // PRINT
$2b14: e8               INX

.MESSAGES: bd 7c 0a     LDA $0a7c,X
$2b18: 10 f7            BPL $2b11
$2b1a: 60               RTS

.N2: a5 5d              LDA $5d
$2b1d: 30 01            BMI $2b20
$2b1f: 60               RTS

$2b20: c9 ff            CMP #$ff
$2b22: f0 59            BEQ $2b7d
$2b24: a5 47            LDA $47
$2b26: 30 0c            BMI $2b34
$2b28: c6 60            DEC $60
$2b2a: d0 08            BNE $2b34
$2b2c: c6 47            DEC $47
$2b2e: d0 04            BNE $2b34
$2b30: a9 03            LDA #$03
$2b32: 85 63            STA $63

$2b34: ad 5f 0c         LDA $0c5f
$2b37: c9 08            CMP #$08
$2b39: 90 07            BCC $2b42
$2b3b: ad cf 0b         LDA $0bcf
$2b3e: c9 90            CMP #$90
$2b40: b0 06            BCS $2b48
$2b42: a9 ff            LDA #$ff
$2b44: 85 5d            STA $5d
$2b46: d0 35            BNE $2b7d

$2b48: a5 3e            LDA $3e
$2b4a: f0 31            BEQ $2b7d
$2b4c: a5 08            LDA $08
$2b4e: c9 04            CMP #$04
$2b50: d0 15            BNE $2b67
$2b52: a2 2b            LDX #$2b
$2b54: a0 08            LDY #$08
$2b56: 20 af 07         JSR $07af
$2b59: a5 77            LDA $77
$2b5b: c9 04            CMP #$04
$2b5d: b0 08            BCS $2b67
$2b5f: a9 00            LDA #$00
$2b61: 85 3e            STA $3e
$2b63: 86 1d            STX $1d
$2b65: f0 16            BEQ $2b7d

$2b67: ad 39 0c         LDA $0c39
$2b6a: c9 12            CMP #$12
$2b6c: d0 0f            BNE $2b7d
$2b6e: ad a9 0b         LDA $0ba9
$2b71: c9 b0            CMP #$b0
$2b73: 90 08            BCC $2b7d
$2b75: c9 b3            CMP #$b3
$2b77: b0 04            BCS $2b7d
$2b79: a9 08            LDA #$08
$2b7b: 85 3f            STA $3f

$2b7d: 20 e4 2b         JSR .WWH
$2b80: 20 b8 2b         JSR .WWI
$2b83: 20 8d 2b         JSR .WWJ

$2b86: a2 1c            LDX #$1c
$2b88: c6 65            DEC $65
$2b8a: 4c 9a 1a         JMP .W6

.WWJ: a2 1d             LDX #$1d
$2b8f: a9 05            LDA #$05
$2b91: 85 65            STA $65
$2b93: ad bd 0b         LDA $0bbd
$2b96: c9 c3            CMP #$c3
$2b98: 90 1b            BCC $2bb5
$2b9a: a9 01            LDA #$01
$2b9c: 85 3e            STA $3e
$2b9e: a0 08            LDY #$08
$2ba0: 20 9a 21         JSR .U3
$2ba3: 20 10 09         JSR $0910
$2ba6: f0 03            BEQ $2bab
$2ba8: 20 9d 22         JSR .WRITESCRN2
$2bab: a9 0a            LDA #$0a
$2bad: 8d f0 0b         STA $0bf0
$2bb0: a2 1d            LDX #$1d
$2bb2: 20 ad 25         JSR .WWC
$2bb5: 4c 9a 1a         JMP .W6

.WWI: a5 3e             LDA $3e
$2bba: 30 27            BMI $2be3
$2bbc: d0 0e            BNE .COLOURS
$2bbe: a5 67            LDA $67
$2bc0: 29 08            AND #$08
$2bc2: f0 04            BEQ $2bc8
$2bc4: a0 05            LDY #$05
$2bc6: 10 0a            BPL $2bd2
$2bc8: a0 02            LDY #$02
$2bca: 10 06            BPL $2bd2


.COLOURS: a9 ff         LDA #$ff
$2bce: 85 3e            STA $3e
$2bd0: a0 08            LDY #$08
$2bd2: a9 02            LDA #$02
$2bd4: 85 72            STA $72
$2bd6: a9 9b            LDA #$9b
.LOOP: be 7f 0d         LDX $0d7f,Y
$2bdb: 20 f4 ff         JSR $fff4      // OSBYTE set up pallete { e0 d0 c0 e3 d1 c7 e1 d3 c7 }
$2bde: 88               DEY            //                 EOR 7 { e7 d7 c7 e4 d6 c0 e6 d4 c0 }
$2bdf: c6 72            DEC $72
$2be1: 10 f5            BPL .LOOP
$2be3: 60               RTS

.WWH: a6 3f            LDX $3f
$2be6: 30 18            BMI $2c00
$2be8: a9 01            LDA #$01
$2bea: 85 71            STA $71
$2bec: a9 ff            LDA #$ff
$2bee: 85 70            STA $70
$2bf0: 20 16 25         JSR .WM
$2bf3: b0 03            BCS $2bf8
$2bf5: 4c cc 2c         JMP .U7
$2bf8: a9 ff            LDA #$ff
$2bfa: 85 3f            STA $3f
$2bfc: 60               RTS

$2bfd: de 30 0c         DEC $0c30,X
$2c00: 60               RTS

.TAKE: a9 1d            LDA #$1d
$2c03: 85 76            STA $76
$2c05: a6 9b            LDX $9b
$2c07: 30 1a            BMI $2c23

$2c09: bd c5 09         LDA $09c5,X
$2c0c: 85 77            STA $77
$2c0e: bd ca 09         LDA $09ca,X
$2c11: 85 78            STA $78
$2c13: bc c0 09         LDY $CARRYING,X
$2c16: a9 ff            LDA #$ff
$2c18: 85 9b            STA $9b
$2c1a: 9d c0 09         STA $CARRYING,X
$2c1d: 20 a9 21         JSR .WU
$2c20: 20 78 22         JSR .WWK

$2c23: a5 32            LDA $32
$2c25: 38               SEC
$2c26: ed 79 fe         SBC $fe79  // VIA-B MSB of timer
$2c29: c9 0d            CMP #$0d
$2c2b: 30 f6            BMI $2c23

$2c2d: a2 02            LDX #$02
$2c2f: a0 03            LDY #$03
$2c31: a5 85            LDA $85
$2c33: 18               CLC
$2c34: 69 46            ADC #$46
$2c36: 8d c8 09         STA $09c8
$2c39: a5 86            LDA $86
$2c3b: 69 00            ADC #$00
$2c3d: 8d cd 09         STA $09cd
$2c40: b9 c5 09         LDA $09c5,Y
$2c43: 38               SEC
$2c44: e9 0a            SBC #$0a
$2c46: 9d c5 09         STA $09c5,X
$2c49: b9 ca 09         LDA $09ca,Y
$2c4c: e9 00            SBC #$00
$2c4e: 9d ca 09         STA $09ca,X
$2c51: 88               DEY
$2c52: ca               DEX
$2c53: 10 eb            BPL $2c40
$2c55: a2 03            LDX #$03
$2c57: bc c0 09         LDY $CARRYING,X
$2c5a: 30 48            BMI $2ca4
$2c5c: b9 48 0d         LDA $0d48,Y
$2c5f: 85 7f            STA $7f
$2c61: 20 a9 21         JSR .WU
$2c64: a9 1d            LDA #$1d
$2c66: 85 76            STA $76
$2c68: bd c5 09         LDA $09c5,X
$2c6b: 85 77            STA $77
$2c6d: bd ca 09         LDA $09ca,X
$2c70: 85 78            STA $78
$2c72: 86 96            STX $96
$2c74: 20 bc 21         JSR .WARROWKEYS
$2c77: a5 9d            LDA $9d
$2c79: 30 27            BMI $2ca2
$2c7b: f0 0b            BEQ $2c88
$2c7d: a5 77            LDA $77
$2c7f: d0 02            BNE $2c83
$2c81: c6 78            DEC $78
$2c83: c6 77            DEC $77
$2c85: 4c 93 2c         JMP $2c93
$2c88: a5 77            LDA $77
$2c8a: 18               CLC
$2c8b: 65 74            ADC $74
$2c8d: 85 77            STA $77
$2c8f: 90 02            BCC $2c93
$2c91: e6 78            INC $78
$2c93: a9 03            LDA #$03
$2c95: 85 73            STA $73
$2c97: a9 01            LDA #$01
$2c99: 85 74            STA $74
$2c9b: a9 1d            LDA #$1d
$2c9d: 85 76            STA $76
$2c9f: 20 78 22         JSR .WWK
$2ca2: a6 96            LDX $96
$2ca4: ca               DEX
$2ca5: 10 b0            BPL $2c57
$2ca7: a6 99            LDX $99
$2ca9: e0 04            CPX #$04
$2cab: 10 1e            BPL $2ccb
$2cad: 20 92 01         JSR $0192
$2cb0: a9 c6            LDA #$c6
$2cb2: 85 7f            STA $7f
$2cb4: 20 bc 21         JSR .WARROWKEYS
$2cb7: a6 9a            LDX $9a
$2cb9: e4 99            CPX $99
$2cbb: f0 0e            BEQ $2ccb
$2cbd: 20 92 01         JSR $0192
$2cc0: a9 dc            LDA #$dc
$2cc2: 85 7f            STA $7f
$2cc4: 20 bc 21         JSR .WARROWKEYS
$2cc7: a5 99            LDA $99
$2cc9: 85 9a            STA $9a
$2ccb: 60               RTS
/*----------------------------------------*
 * Called with &70,&71,&7F,X              *
 *                                        *
 *----------------------------------------*/
.U7: e6 30              INC $30                 // Set to #&ff every "PLAY"
$2cce: a4 30            LDY $30
$2cd0: a5 70            LDA $70
$2cd2: 99 88 08         STA $0888,Y
$2cd5: a5 71            LDA $71
$2cd7: 99 90 08         STA $0890,Y
$2cda: a5 7f            LDA $7f
$2cdc: 99 98 08         STA $0898,Y
$2cdf: 8a               TXA
$2ce0: 99 80 08         STA .MODE,Y
$2ce3: 60               RTS

.M7: a9 ff              LDA #$ff
$2ce6: 85 5a            STA $5a
$2ce8: 30 0e            BMI .WAITs3  // Will always do this as bit 7 of A is set

.WAIT:   a9 18          LDA #$18
$2cec: 85 6a            STA $6a
$2cee: a9 00            LDA #$00
$2cf0: 85 5a            STA $5a
.WAITs6: a5 30          LDA $30
$2cf4: 85 31            STA $31
$2cf6: e6 31            INC $31

.WAITs3: a5 5a          LDA $5a
$2cfa: 30 19            BMI .WAITs1  // If bit 7 is set

$2cfc: a5 32            LDA $32
$2cfe: 38               SEC        // Set carry
$2cff: ed 79 fe         SBC $fe79  // VIA-B MSB of timer
$2d02: c9 3b            CMP #$3b
$2d04: 30 01            BMI .WAITs2  // If bit 7 is set, i.e. time is up
$2d06: 60               RTS

.WAITs2: 4a               LSR
$2d08: 85 79            STA $79
$2d0a: a9 32            LDA #$32
$2d0c: 38               SEC
$2d0d: e5 79            SBC $79
$2d0f: e5 6a            SBC $6a
$2d11: c9 11            CMP #$11
$2d13: 10 e3            BPL .WAITs3

.WAITs1: c6 31          DEC $31
$2d17: 30 17            BMI $2d30
$2d19: a4 31            LDY $31
$2d1b: be 80 08         LDX .MODE,Y
$2d1e: 30 f5            BMI .WAITs1

$2d20: b9 88 08         LDA $0888,Y
$2d23: c9 80            CMP #$80
$2d25: f0 4b            BEQ .WAITs4
$2d27: bd 30 0c         LDA $0c30,X
$2d2a: c5 6a            CMP $6a
$2d2c: 10 14            BPL .WAITs5
$2d2e: 30 e5            BMI .WAITs1
$2d30: a5 33            LDA $33
$2d32: 49 ff            EOR #$ff
$2d34: 85 33            STA $33
$2d36: f0 ba            BEQ .WAITs6
$2d38: a5 6a            LDA $6a
$2d3a: 38               SEC
$2d3b: e9 04            SBC #$04
$2d3d: 85 6a            STA $6a
$2d3f: 10 b1            BPL .WAITs6
$2d41: 60               RTS

.WAITs5: 20 98 21         JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$2d45: 20 10 09         JSR $0910
$2d48: 08               PHP
$2d49: f0 03            BEQ .WAITs7
$2d4b: 20 9d 22         JSR .WRITESCRN2

.WAITs7: a4 31            LDY $31
$2d50: be 80 08         LDX .MODE,Y
$2d53: 28               PLP
$2d54: 30 05            BMI .WAITs8
$2d56: a9 ff            LDA #$ff
$2d58: 99 80 08         STA .MODE,Y

.WAITs8: b9 88 08         LDA $0888,Y
$2d5e: 85 70            STA $70
$2d60: b9 90 08         LDA $0890,Y
$2d63: 85 71            STA $71
$2d65: 20 00 01         JSR $0100
$2d68: 20 3f 09         JSR $093f
$2d6b: a9 80            LDA #$80
$2d6d: 99 88 08         STA $0888,Y
$2d70: 30 86            BMI .WAITs3

.WAITs4: 20 98 21         JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$2d75: a4 31            LDY $31
$2d77: be 80 08         LDX .MODE,Y
$2d7a: a9 ff            LDA #$ff
$2d7c: 99 80 08         STA .MODE,Y
$2d7f: e0 18            CPX #$18
$2d81: 10 07            BPL .WAITs9
$2d83: bd 48 0d         LDA $0d48,X
$2d86: 85 7f            STA $7f
$2d88: d0 15            BNE .WAITsA

.WAITs9: b9 98 08         LDA $0898,Y
$2d8d: a8               TAY
$2d8e: b9 60 0d         LDA $0d60,Y
$2d91: 85 7f            STA $7f
$2d93: c0 0c            CPY #$0c
$2d95: 10 04            BPL .WAITsB
$2d97: a9 0d            LDA #$0d
$2d99: d0 02            BNE .WAITsC

.WAITsB: a9 0e            LDA #$0e

.WAITsC: 85 80            STA $80

.WAITsA: b5 00            LDA $00,X

$2da1: 10 04            BPL .WAITsD
$2da3: a9 00            LDA #$00
$2da5: 85 66            STA $66
.WAITsD: 20 c0 21         JSR .U9
$2daa: 4c f8 2c         JMP .WAITs3

.SETPALETTE:   a5 34    LDA $34
$2daf: 30 42            BMI $2df3    // RTS
$2db1: c6 34            DEC $34
$2db3: a5 34            LDA $34
$2db5: f0 63            BEQ $2e1a
$2db7: c9 20            CMP #$20
$2db9: f0 03            BEQ $2dbe
$2dbb: 10 37            BPL $2df4     // Most likely outcome
$2dbd: 60               RTS           // Never gets here!

$2dbe: ad 17 0c         LDA .JTINDEX
$2dc1: 8d f6 0b         STA $0bf6
$2dc4: 8d f5 0b         STA $0bf5
$2dc7: 4a               LSR
$2dc8: a8               TAY
$2dc9: b9 89 0c         LDA $0c89,Y
$2dcc: 8d ae 0b         STA $0bae
$2dcf: 18               CLC
$2dd0: 69 07            ADC #$07
$2dd2: 8d ad 0b         STA $0bad
$2dd5: b9 8c 0c         LDA $0c8c,Y
$2dd8: 8d 3e 0c         STA $0c3e
$2ddb: 18               CLC
$2ddc: 69 02            ADC #$02
$2dde: 8d 3d 0c         STA $0c3d
$2de1: b9 5c 0d         LDA $0d5c,Y
$2de4: 8d 55 0d         STA $0d55
$2de7: f0 05            BEQ $2dee
$2de9: a2 0d            LDX #$0d
$2deb: 20 cc 2c         JSR .U7
$2dee: a2 0e            LDX #$0e
$2df0: 4c cc 2c         JMP .U7
$2df3: 60               RTS

$2df4: c9 28            CMP #$28
$2df6: 10 06            BPL $2dfe
$2df8: 29 02            AND #$02
$2dfa: d0 0d            BNE $2e09
$2dfc: f0 04            BEQ .PALETTE2
$2dfe: 29 04            AND #$04
$2e00: d0 07            BNE $2e09

.PALETTE2: a9 9b              LDA #$9b    
$2e04: a2 00            LDX #$00
$2e06: 4c f4 ff         JMP $fff4    // Write to video ULA palette - register 1 value 0
/*----------------------------------------*/
$2e09: a2 a8            LDX #$a8
$2e0b: 20 35 0a         JSR .PLAYSOUND     // Sound command address block is 09a8
$2e0e: a2 b0            LDX #$b0
$2e10: 20 35 0a         JSR .PLAYSOUND     // Sound command address block is 09b0
$2e13: a9 9b            LDA #$9b     // Write to video ULA palette - register 1 value 7
$2e15: a2 07            LDX #$07
$2e17: 4c f4 ff         JMP $fff4
/*----------------------------------------*/
$2e1a: a2 0e            LDX #$0e
$2e1c: 20 98 21         JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$2e1f: 20 10 09         JSR $0910
$2e22: f0 03            BEQ $2e27
$2e24: 20 9d 22         JSR .WRITESCRN2
$2e27: a0 0d            LDY #$0d
$2e29: ad 55 0d         LDA $0d55
$2e2c: f0 c5            BEQ $2df3
$2e2e: 20 9a 21         JSR .U3
$2e31: 20 10 09         JSR $0910
$2e34: f0 bd            BEQ $2df3
$2e36: 4c 9d 22         JMP .WRITESCRN2

.N8: a2 2f              LDX #$2f
$2e3b: 20 98 21         JSR .U6      // Call with #$2f, U6 sets {$73, $74, $76, $77, $78, $80}
$2e3e: 20 69 07         JSR $0769
$2e41: c9 0b            CMP #$0b
$2e43: 30 24            BMI $2e69
$2e45: a5 63            LDA $63
$2e47: c9 04            CMP #$04
$2e49: 90 04            BCC $2e4f
$2e4b: c9 07            CMP #$07
$2e4d: 90 35            BCC $2e84
$2e4f: a9 ff            LDA #$ff
$2e51: 85 63            STA $63
$2e53: a9 9b            LDA #$9b
$2e55: a2 94            LDX #$94
$2e57: 20 f4 ff         JSR $fff4    // Palette
$2e5a: a5 9c            LDA $HOLDING
$2e5c: c9 01            CMP #$01
$2e5e: f0 10            BEQ $2e70
$2e60: c6 36            DEC $36
$2e62: d0 10            BNE $2e74
$2e64: a9 04            LDA #$04
$2e66: 85 63            STA $63
$2e68: 60               RTS

$2e69: a9 9b            LDA #$9b
$2e6b: a2 90            LDX #$90
$2e6d: 20 f4 ff         JSR $fff4
$2e70: a9 1e            LDA #$1e
$2e72: 85 36            STA $36
$2e74: a0 0b            LDY #$0b
$2e76: 20 9a 21         JSR .U3
$2e79: 20 69 07         JSR $0769
$2e7c: c9 0b            CMP #$0b
$2e7e: 30 04            BMI $2e84
$2e80: a9 01            LDA #$01
$2e82: 85 35            STA $35
$2e84: 60               RTS

.ZXKEYS: c9 e1          CMP #$e1   // "Z"
$2e87: d0 05            BNE $2e8e
$2e89: a9 00            LDA #$00
$2e8b: 85 70            STA $70
$2e8d: 60               RTS

$2e8e: c9 c2            CMP #$c2   // "X"
$2e90: d0 05            BNE $2e97
$2e92: a9 02            LDA #$02
$2e94: 85 70            STA $70
$2e96: 60               RTS

$2e97: c9 c8            CMP #$c8   // ":"
$2e99: d0 05            BNE $2ea0
$2e9b: a9 00            LDA #$00
$2e9d: 85 71            STA $71
$2e9f: 60               RTS

$2ea0: c9 e8            CMP #$e8   // "/"
$2ea2: d0 05            BNE $2ea9
$2ea4: a9 01            LDA #$01
$2ea6: 85 71            STA $71
$2ea8: 60               RTS

$2ea9: a9 ff            LDA #$ff
$2eab: 60               RTS

.VB: a4 9c              LDY $HOLDING
$2eae: 30 73            BMI $2f23
$2eb0: a5 9e            LDA $9e
$2eb2: 10 0d            BPL $2ec1
$2eb4: b9 00 00         LDA $0000,Y
$2eb7: c9 06            CMP #$06
$2eb9: f0 21            BEQ .U2
$2ebb: a9 08            LDA #$08
$2ebd: 99 00 00         STA $0000,Y
$2ec0: 60               RTS

$2ec1: d9 00 00         CMP $0000,Y
$2ec4: f0 0e            BEQ .WWB
$2ec6: 99 00 00         STA $0000,Y
$2ec9: 20 9a 21         JSR .WWM
$2ecc: 20 10 09         JSR $0910
$2ecf: 10 03            BPL .WWB
$2ed1: 4c 9d 22         JMP .WRITESCRN2
.WWB: 20 dc 2e          JSR .U2
$2ed7: 98               TYA
$2ed8: aa               TAX
$2ed9: 4c cc 2c         JMP .U7

.U2: c0 02              CPY #$02
$2ede: 10 0f            BPL $2eef
$2ee0: a5 9e            LDA $9e
$2ee2: f0 05            BEQ $2ee9
$2ee4: b9 dd 09         LDA $09dd,Y
$2ee7: d0 03            BNE $2eec
$2ee9: b9 da 09         LDA $09da,Y
$2eec: 99 48 0d         STA $0d48,Y
$2eef: bd 30 0c         LDA $0c30,X
$2ef2: 18               CLC
$2ef3: 69 01            ADC #$01
$2ef5: 99 30 0c         STA $0c30,Y
$2ef8: b9 00 00         LDA $0000,Y
$2efb: d0 14            BNE $2f11
$2efd: bd a0 0b         LDA $0ba0,X
$2f00: 38               SEC
$2f01: f9 a0 08         SBC $08a0,Y
$2f04: 99 a0 0b         STA $0ba0,Y
$2f07: bd e8 0b         LDA $0be8,X
$2f0a: e9 00            SBC #$00
$2f0c: 99 e8 0b         STA $0be8,Y
$2f0f: 10 12            BPL $2f23
$2f11: bd a0 0b         LDA $0ba0,X
$2f14: 18               CLC
$2f15: 79 b0 08         ADC $08b0,Y
$2f18: 99 a0 0b         STA $0ba0,Y
$2f1b: bd e8 0b         LDA $0be8,X
$2f1e: 69 00            ADC #$00
$2f20: 99 e8 0b         STA $0be8,Y
$2f23: 60               RTS
/*------------------------------------
 * Called with Keypress in Accumulator
 * Work out which function key was pressed...
 * and stores in &99
 * 28/02/2006
 *------------------------------------*/
.FKEYS:   a2 03         LDX #$03
.LOOP: dd cf 09         CMP $09cf,X        //     { f3, f2, f1, a0 }
$2f29: f0 05            BEQ .CONT          // Keys  F3, F2, F1, F0 
$2f2b: ca               DEX
$2f2c: 30 05            BMI .END           // When X is #&FF
$2f2e: 10 f6            BPL .LOOP
.CONT: 8a               TXA
$2f31: 85 99            STA $99            // If match, store index in &99 
.END:  60               RTS

.PRSKEYS: c9 b7         CMP #$b7           // "P" Pick up
$2f36: d0 4d            BNE $2f85
$2f38: a0 0b            LDY #$0b
$2f3a: a2 2f            LDX #$2f
$2f3c: b9 00 00         LDA $0000,Y
$2f3f: c9 04            CMP #$04
$2f41: d0 19            BNE $2f5c
$2f43: 20 af 07         JSR $07af


    $07af: 85 76            STA $76
    $07b0: f0 10            BEQ $07fa
    $07b1: b0 0a            BCS $07f6
    $07b2: a9 00            LDA #$00
    $07b3: 85 71            STA $71
    $07b4: 38               SEC
    $07b5: e5 76            SBC $76
    $07b6: 85 76            STA $76
    $07b7: 60               RTS


$2f46: a5 71            LDA $71
$2f48: c9 01            CMP #$01
$2f4a: f0 10            BEQ $2f5c
$2f4c: a5 76            LDA $76
$2f4e: c9 02            CMP #$02
$2f50: 10 0a            BPL $2f5c
$2f52: a6 77            LDX $77
$2f54: a5 70            LDA $70
$2f56: f0 08            BEQ $2f60
$2f58: e0 05            CPX #$05
$2f5a: 90 0c            BCC $2f68    // Do-it!

$2f5c: 88               DEY
$2f5d: 10 db            BPL $2f3a
$2f5f: 60               RTS

$2f60: 20 a9 21         JSR .WU
$2f63: ca               DEX
$2f64: e4 74            CPX $74
$2f66: b0 f4            BCS $2f5c

$2f68: a5 9c            LDA $HOLDING
$2f6a: 10 03            BPL STOREOBJ
$2f6c: 84 9c            STY $HOLDING
$2f6e: 60               RTS

.STOREOBJ: a2 03        LDX #$03
$2f71: bd c0 09         LDA $CARRYING,X
$2f74: 10 0b            BPL $2f81
$2f76: 98               TYA
$2f77: 9d c0 09         STA $CARRYING,X
$2f7a: a9 08            LDA #$08
$2f7c: 99 00 00         STA $0000,Y
$2f7f: 10 03            BPL $2f84
$2f81: ca               DEX
$2f82: 10 ed            BPL $2f71
$2f84: 60               RTS

$2f85: c9 b3            CMP #$b3     // more keys "R" retrieve from store
$2f87: d0 19            BNE $2fa2
.WWA: a6 99             LDX $99
$2f8b: a5 9c            LDA $HOLDING
$2f8d: 10 12            BPL $2fa1
$2f8f: bc c0 09         LDY $CARRYING,X
$2f92: 30 0d            BMI $2fa1
$2f94: 20 e0 16         JSR .WWN
$2f97: b0 08            BCS $2fa1
$2f99: a6 99            LDX $99
$2f9b: 86 9b            STX $9b
$2f9d: 84 9c            STY $HOLDING
$2f9f: a9 ff            LDA #$ff
$2fa1: 60               RTS

$2fa2: c9 d1            CMP #$d1      // "S" Store?
$2fa4: d0 0e            BNE $2fb4
$2fa6: a4 9c            LDY $HOLDING
$2fa8: 30 0a            BMI $2fb4
$2faa: 20 6f 2f         JSR .STOREOBJ
$2fad: 8a               TXA
$2fae: 30 04            BMI $2fb4
$2fb0: a9 ff            LDA #$ff
$2fb2: 85 9c            STA $HOLDING

$2fb4: a9 00            LDA #$00
$2fb6: 60               RTS

/*----------------------------------------
 *
 *  Funny kind of indexed addressing?
 *
 *----------------------------------------*/
.M9:   a0 0b            LDY #$0b
$2fb9: 84 96            STY $96
$2fbb: b9 48 0d         LDA $0d48,Y
$2fbe: 85 7f            STA $7f
$2fc0: b9 00 00         LDA $0000,Y
$2fc3: 8d c7 2f         STA $2fc7
$2fc6: 10 ff            BPL $2fc7
$2fc8: 10 1b            BPL $2fe5
$2fca: 10 19            BPL $2fe5
$2fcc: 10 0a            BPL $2fd8
$2fce: 10 15            BPL $2fe5
$2fd0: 10 1a            BPL $2fec
$2fd2: 10 11            BPL $2fe5
$2fd4: 10 de            BPL $2fb4
$2fd6: 10 0d            BPL $2fe5
$2fd8: 20 9a 21         JSR .U3
$2fdb: 98               TYA
$2fdc: aa               TAX
$2fdd: 20 10 09         JSR $0910    // What does this do
$2fe0: 10 03            BPL $2fe5
$2fe2: 20 c0 21         JSR .U9
$2fe5: c6 96            DEC $96
$2fe7: a4 96            LDY $96
$2fe9: 10 d0            BPL $2fbb
$2feb: 60               RTS

$2fec: a9 06            LDA #$06
$2fee: 99 00 00         STA $0000,Y
$2ff1: 20 9a 21         JSR .U3
$2ff4: 20 9d 22         JSR .WRITESCRN2
$2ff7: 4c e5 2f         JMP $2fe5



.PRINTNUMBER: d8        CLD
$2ffb: 09 30            ORA #$30
$2ffd: 4c ee ff         JMP $ffee  // Print a number  // THE SCORE


/*----------------------------------------
 *
 *  Some kind of screen sorcery...
 *             Scrolling maybe?
 *----------------------------------------*/
$3000: 5f               .BYTE $5f
$3001: ee 52 5f         INC $5f52
$3004: ad 4f 5f         LDA $5f4f
$3007: 29 a0            AND #$a0
$3009: 00               BRK
$300a: 8c b1 5f         STY $5fb1
$300d: b9 00 60         LDA $6000,Y           
$3010: 99 00 7c         STA $7c00,Y           // Mode 7 Screen Space
$3013: c8               INY
$3014: d0 f7            BNE $300d
$3016: ee 67 5f         INC $5f67
$3019: ee 6a 5f         INC $5f6a
$301c: ad 67 5f         LDA $5f67
$301f: 29 03            AND #$03
$3021: d0 e5            BNE $3008
$3023: ad 67 5f         LDA $5f67
$3026: c9 78            CMP #$78
$3028: f0 1b            BEQ $3045

.LOOP: a5 ec            LDA $ec
$302c: d0 05            BNE $3033
$302e: a9 ff            LDA #$ff
$3030: 8d b1 5f         STA $5fb1
$3033: a5 ec            LDA $ec
$3035: c9 e2            CMP #$e2   // Keypress "SPACE"
$3037: d0 f1            BNE .LOOP

$3039: ad b1 5f         LDA $5fb1
$303c: f0 ec            BEQ $302a
$303e: a9 7c            LDA #$7c
$3040: 8d 6a 5f         STA $5f6a
$3043: d0 c3            BNE $3008

.YESNO: a5 ec           LDA $ec
$3047: c9 c4            CMP #$c4   // Keypress "Y"
$3049: f0 07            BEQ $3052
$304b: c9 d5            CMP #$d5   // Keypress "N"
$304d: d0 f6            BNE .YESNO
$304f: 4c 40 43         JMP $4340
$3052: a9 60            LDA #$60
$3054: 8d 67 5f         STA $5f67
$3057: 10 e5            BPL $303e
$3059: 00               BRK
$305a: 60               RTS

$305b: 7e 66 66         ROR $6666,X
$305e: 66 00            ROR $00
$3060: 00               BRK
$3061: 00               BRK
$3062: 00               BRK
$3063: 00               BRK
$3064: 00               BRK
$3065: 00               BRK
$3066: 00               BRK
$3067: 00               BRK
$3068: 7c               .BYTE $7c
$3069: 66 66            ROR $66
$306b: 7c               .BYTE $7c
$306c: 66 66            ROR $66
$306e: 7c               .BYTE $7c
$306f: 00               BRK

$3070: 60               RTS
$3071: 60               RTS
$3072: 60               RTS
$3073: 60               RTS
$3074: 60               RTS
$3075: 60               RTS
$3076: 7e 00 3c         ROR $3c00,X
$3079: 66 66            ROR $66
$307b: 66 66            ROR $66
$307d: 66 3c            ROR $3c
$307f: 00               BRK
$3080: 3c               .BYTE $3c
$3081: 66 60            ROR $60
$3083: 60               RTS
$3084: 60               RTS
$3085: 66 3c            ROR $3c
$3087: 00               BRK
$3088: 66 6c            ROR $6c
$308a: 78               SEI
$308b: 70 78            BVS $3105
$308d: 6c 66 00         JMP ($0066)
$3090: 00               BRK
$3091: 00               BRK
$3092: 00               BRK
$3093: 00               BRK
$3094: 00               BRK
$3095: 00               BRK
$3096: 00               BRK
$3097: 00               BRK
$3098: 00               BRK
$3099: 00               BRK
$309a: 00               BRK
$309b: 00               BRK
$309c: 00               BRK
$309d: 00               BRK
$309e: 00               BRK
$309f: 00               BRK
$30a0: 00               BRK
$30a1: 00               BRK
$30a2: 00               BRK
$30a3: 00               BRK
$30a4: 00               BRK
$30a5: 00               BRK
$30a6: 00               BRK
$30a7: 00               BRK

/*----------------------------------------
 *
 *  Zero page settings
 *
 *----------------------------------------*/

$0000: 04               .BYTE $04
$0001: 04               .BYTE $04
$0002: 04               .BYTE $04
$0003: 04               .BYTE $04
$0004: 04               .BYTE $04
$0005: 04               .BYTE $04
$0006: 04               .BYTE $04
$0007: 04               .BYTE $04
$0008: 04               .BYTE $04
$0009: 04               .BYTE $04
$000a: 04               .BYTE $04
$000b: 04               .BYTE $04
$000c: 00               BRK
$000d: 00               BRK
$000e: 00               BRK
$000f: 00               BRK
$0010: 00               BRK
$0011: 00               BRK
$0012: 00               BRK
$0013: 00               BRK
$0014: 00               BRK
$0015: 18               CLC
$0016: 3c               .BYTE $3c
$0017: 00               BRK
$0018: 30 32            BMI $004c
$001a: 34               .BYTE $34
$001b: 36 38            ROL $38,X
$001d: 3a               .BYTE $3a
$001e: 3c               .BYTE $3c
$001f: 3e 40 42         ROL $4240,X
$0022: 00               BRK
$0023: 00               BRK
$0024: 80               .BYTE $80
$0025: 80               .BYTE $80
$0026: 12               .BYTE $12
$0027: 12               .BYTE $12
$0028: 12               .BYTE $12
$0029: 12               .BYTE $12
$002a: ff               .BYTE $ff
$002b: 00               BRK
$002c: 00               BRK
$002d: 00               BRK
$002e: 00               BRK
$002f: 00               BRK
$0030: 00               BRK
$0031: 00               BRK
$0032: 00               BRK
$0033: 00               BRK
$0034: ff               .BYTE $ff
$0035: 00               BRK
$0036: 00               BRK
$0037: 00               BRK
$0038: ff               .BYTE $ff
$0039: ff               .BYTE $ff
$003a: ff               .BYTE $ff
$003b: ff               .BYTE $ff
$003c: ff               .BYTE $ff
$003d: ff               .BYTE $ff
$003e: ff               .BYTE $ff
$003f: ff               .BYTE $ff
$0040: ff               .BYTE $ff
$0041: ff               .BYTE $ff
$0042: ff               .BYTE $ff
$0043: ff               .BYTE $ff
$0044: ff               .BYTE $ff
$0045: ff               .BYTE $ff
$0046: 64               .BYTE $64
$0047: ff               .BYTE $ff
$0048: fd 00 02         SBC $0200,X
$004b: ff               .BYTE $ff
$004c: 80               .BYTE $80
$004d: 08               PHP
$004e: 80               .BYTE $80
$004f: f8               SED
$0050: 00               BRK
$0051: 00               BRK
$0052: 00               BRK
$0053: ff               .BYTE $ff
$0054: ff               .BYTE $ff
$0055: 00               BRK
$0056: 00               BRK
$0057: ff               .BYTE $ff
$0058: 00               BRK
$0059: ff               .BYTE $ff
$005a: 00               BRK
$005b: 06 1e            ASL $1e
$005d: ff               .BYTE $ff
$005e: ff               .BYTE $ff
$005f: 00               BRK
$0060: 00               BRK
$0061: ff               .BYTE $ff
$0062: 00               BRK
$0063: ff               .BYTE $ff
$0064: 00               BRK
$0065: 00               BRK
$0066: 00               BRK
$0067: 00               BRK
$0068: 00               BRK
$0069: 00               BRK
$006a: 00               BRK
$006b: 00               BRK
$006c: ff               .BYTE $ff
$006d: ff               .BYTE $ff
$006e: 00               BRK
$006f: 00               BRK
$0070: 00               BRK
$0071: 00               BRK
$0072: 00               BRK
$0073: 00               BRK
$0074: 00               BRK
$0075: 00               BRK
$0076: 00               BRK
$0077: 00               BRK
$0078: 00               BRK
$0079: 00               BRK
$007a: 00               BRK
$007b: 00               BRK
$007c: 00               BRK
$007d: 00               BRK
$007e: 00               BRK
$007f: 00               BRK
$0080: 00               BRK
$0081: 00               BRK
$0082: 00               BRK
$0083: 00               BRK
$0084: 30 d0            BMI $0056
$0086: 02               .BYTE $02
$0087: 00               BRK
$0088: 06 00            ASL $00
$008a: 00               BRK
$008b: 00               BRK
$008c: 00               BRK
$008d: 00               BRK
$008e: 00               BRK
$008f: 00               BRK
$0090: 00               BRK
$0091: 00               BRK
$0092: 00               BRK
$0093: 00               BRK
$0094: 00               BRK
$0095: 00               BRK
$0096: 00               BRK
$0097: 00               BRK
$0098: 00               BRK
$0099: 00               BRK