Home » CEEFAX disks » telesoftware11.adl » 16-12-88/NEWKEYS

16-12-88/NEWKEYS

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » CEEFAX disks » telesoftware11.adl
Filename: 16-12-88/NEWKEYS
Read OK:
File size: 20FD bytes
Load address: FFFF1900
Exec address: FFFF8023
File contents
   10REM> NEWKEYS
   20DIM mcode &200 :REM: machine code at mcode
   30savereg=&FC :REM: interrupt accumulator save register
   40irq1v=&204 :REM: primary interrupt vector
   50bytev=&20A :REM: Osbyte indirection vector
   60drb=&FE60 :REM: data register B
   70ddrb=&FE62 :REM: data direction register B
   80pcr=&FE6C :REM: peripheral control register
   90ifr=&FE6D :REM: interrupt flag register
  100ier=&FE6E :REM: interrupt enable register
  110FOR pass=0 TO 2 STEP 2
  120P%=mcode
  130[OPT pass
  140LDX irq1v \ current primary interrupt vector, low byte
  150LDY irq1v+1 \ current primary interrupt vector, high byte
  160CPY #interrupt DIV 256 \ compare high byte
  170BEQ disable \ restore old vector if irq1v altered
  180STX oldirq1v \ save original irq1 vector, low byte
  190STY oldirq1v+1 \ save original irq1 vector, high byte
  200LDX bytev \ Osbyte indirection vector, low byte
  210LDY bytev+1 \ Osbyte indirection vector, high byte
  220STX oldbytev \ save original Osbyte vector, low byte
  230STY oldbytev+1 \ save original Osbyte vector, high byte
  240LDX #interrupt MOD 256 \ new irq1 vector, low byte
  250LDY #interrupt DIV 256 \ new irq1 vector, high byte
  260SEI \ set interrupt disable flag
  270STX irq1v \ alter irq1 vector, low byte
  280STY irq1v+1 \ alter irq1 vector, high byte
  290CLI \ clear interrupt disable flag
  300LDX #newinkey MOD 256 \ new Osbyte vector, low byte
  310LDY #newinkey DIV 256 \ new Osbyte vector, high byte
  320STX bytev \ alter Osbyte vector, low byte
  330STY bytev+1 \ alter Osbyte vector, high byte
  340LDA #&98 \ %10011000, ie. enable CB1/2
  350STA ier \ interrupt enable register
  360LDA pcr \ peripheral control register
  370AND #&0F \ AND with %00001111, ie clear bits 4-7
  380ORA #&50 \ OR with %01010000, ie. set bits 4 and 6
  390STA pcr \ interrupt on +ve transition, CB2 input, DRB to clear
  400LDA #&00 \ user port input
  410STA ddrb \ data direction register B
  420RTS \ return to BASIC
  430.disable
  440LDA #&18 \ %00011000 ready to clear bits 3 and 4 of ier
  450LDX oldirq1v \ original irq1 vector, low byte
  460LDY oldirq1v+1 \ original irq1 vector, high byte
  470SEI \ set interrupt disable flag
  480STA ier \ interrupt enable register
  490LDA pcr \ peripheral control register
  500AND #&0F \ clear bits 4-7
  510STA pcr \ peripheral control register
  520STX irq1v \ restore irq1 vector, low byte
  530STY irq1v+1 \ restore irq1 vector, high byte
  540CLI \ clear interrupt disable flag
  550LDX oldbytev \ original Osbyte vector, low byte
  560LDY oldbytev+1 \ original Osbyte vector, high byte
  570STX bytev \ restore Osbyte vector, low byte
  580STY bytev+1 \ restore Osbyte vector, high byte
  590RTS \ return to BASIC
  600.interrupt
  610LDA savereg \ interrupt accumulator save register
  620PHA \ and push it on the stack
  630LDA ifr \ interrupt flag register
  640BPL notuser \ bit 7 is set if VIA-B interrupt
  650AND #&18 \ AND with %00011000, ie. test bits 3 and 4
  660BEQ notuser \ exit if not CB1 or CB2
  670AND #&10 \ AND with %00010000, ie. test CB1
  680BNE xpulse \ bit 4 set for an X direction movement
  690LDA drb \ Y direction, load data register B
  700AND #&04 \ AND with %00000100, ie. test bit 2
  710BNE ydown \ if bit 2 is set then Y is going down
  720INC ycoord \ Y is going up so increment Y coordinate
  730BNE exit \ branch if in the range 1 to 255
  740BEQ decy \ if zero then alter to 255
  750.ydown
  760LDA ycoord \ load Y coordinate
  770BEQ exit \ branch if zero because it can't go any lower
  780.decy
  790DEC ycoord \ reduce Y coordinate by 1
  800JMP exit \ restore interrupt accumulator save register and RTI
  810.xpulse
  820LDA drb \ load input register B
  830ROR A \ bit 0 into carry
  840BCS xdown \ X is going down if bit 0 is set
  850INC xcoord \ X is going up if bit 0 is clear
  860BNE exit \ exit if X coordinate is in the range from 1 to 255
  870BEQ decx \ if X coordinate = 0 then make it 255
  880.xdown
  890LDA xcoord \ load X coordinate
  900BEQ exit \ if it is zero it can't go any lower
  910.decx
  920DEC xcoord \ decrease X coordinate by 1
  930.exit
  940PLA \ pull interrupt accumulator save register off the stack
  950STA savereg \ and restore zero page
  960RTI \ return from interrupt
  970.notuser
  980PLA \ pull the interrupt accumulator save register off the stack
  990STA savereg \ restore the zero page address
 1000JMP (oldirq1v) \ exit via the original vector
 1010.newinkey
 1020PHP \ push status register onto stack
 1030CMP #&81 \ is this Osbyte &81?
 1040BNE notinkey \ if not then exit via original vector
 1050CPY #&FF \ is this a -ve INKEY?
 1060BEQ inkey \ if it is then branch to new INKEY routine
 1070.notinkey
 1080PLP \ pull status register off the stack
 1090.oldcode
 1100JMP (oldbytev) \ and exit via the original Osbyte vector
 1110.inkey
 1120TXA \ INKEY number in the X register
 1130PHA \ push INKEY number onto stack
 1140LDA #&81 \ Osbyte &81
 1150JSR oldcode \ perform the original INKEY function
 1160CPX #&FF \ X = &FF if the required key is pressed
 1170BNE notpressed \ if required key not pressed then check the mouse
 1180PLA \ pull INKEY number off stack
 1190.pullout
 1200LDA #&81 \ Osbyte &81
 1210PLP \ pull status register off the stack
 1220RTS \ and return to BASIC
 1230.notpressed
 1240PLA \ pull INKEY number off stack
 1250CMP up \ are you looking for the cursor up key?
 1260BNE trydown \ if not then check cursor down
 1270LDA ycoord \ Y coordinate from mouse
 1280CMP #&88 \ if greater than &87 then simulate key press
 1290BCC pullout \ if less than &88 then exit without key press
 1300BCS resety \ simulate key press
 1310.trydown
 1320CMP down \ are you looking for the cursor down key?
 1330BNE isitleft \ if not then check cursor left
 1340LDA ycoord \ Y coordinate from mouse
 1350CMP #&78 \ if less than &78 then simulate key press
 1360BCS pullout \ if greater than &77 then exit without key press
 1370.resety
 1380LDA #&80 \ reset Y coordinate to &80
 1390STA ycoord
 1400BNE found \ unconditional branch to simulate key press
 1410.isitleft
 1420CMP left \ are you looking for cursor left key?
 1430BNE isitright \ if not then check cursor right
 1440LDA xcoord \ X coordinate from mouse
 1450CMP #&78 \ if less than &78 then simulate key press
 1460BCS pullout \ if greater than &77 then exit without key press
 1470BCC resetx \ if less than &78 then simulate key press
 1480.isitright
 1490CMP right \ are you looking for cursor right key?
 1500BNE trybuttons \ if not then check 3 other possible keys
 1510LDA xcoord \ X coordinate from mouse
 1520CMP #&88 \ if greater than &87 then simulate key press
 1530BCC pullout \ if less than &88 then exit without key press
 1540.resetx
 1550LDA #&80 \ restore X coordinate to &80
 1560STA xcoord
 1570BNE found \ unconditional branch to simulate key press
 1580.trybuttons
 1590CMP centrebutton \ is it the first of 3 possible keys?
 1600BNE tryright \ if not then try the second key
 1610LDA drb \ load input register B
 1620JMP two \ check for mouse centre button pressed
 1630.tryright
 1640CMP rightbutton \ is it the second of 3 possible keys?
 1650BNE tryleft \ if not then try the third key
 1660LDA drb \ load input register B
 1670JMP one \ check for mouse right button pressed
 1680.tryleft
 1690CMP leftbutton \ is it the third of 3 possible buttons?
 1700BNE pullout \ if not then exit without simulated key press
 1710LDA drb \ load input register B
 1720ROL A
 1730.two
 1740ROL A
 1750.one
 1760ROL A
 1770BCS pullout \ exit without key press if mouse button not pressed
 1780.found
 1790LDA #&81 \ Osbyte &81
 1800LDX #&FF \ key pressed
 1810LDY #&FF \ key pressed
 1820PLP \ pull status register off the stack
 1830RTS \ return to BASIC
 1840.rightbutton
 1850EQUB -90 \ delete
 1860.centrebutton
 1870EQUB -74 \ return
 1880.leftbutton
 1890EQUB -106 \ copy
 1900.up
 1910EQUB -58 \ cursor up
 1920.down
 1930EQUB -42 \ cursor down
 1940.left
 1950EQUB -26 \ cursor left
 1960.right
 1970EQUB -122 \ cursor right
 1980.oldirq1v
 1990EQUW &00 \ original irq1 vector
 2000.oldbytev
 2010EQUW &00 \ original Osbyte vector
 2020.xcoord
 2030.H%
 2040EQUB &80 \ mouse X coordinate 0-255
 2050.ycoord
 2060.V%
 2070EQUB &80 \ mouse Y coordinate 0-255
 2080.lastbyte
 2090]
 2100NEXT
 2110CALL mcode :REM: enable new code
 2120MODE7
 2130mouse$=CHR$141+CHR$132+CHR$157+CHR$131+"Press keyboard or move the mouse  "+CHR$156
 2140PRINTTAB(0,1)mouse$
 2150PRINTTAB(0,2)mouse$
 2160PRINTTAB(10,7)"Bytes used = &";~(lastbyte-mcode)
 2170ON ERROR GOTO 2300
 2180VDU23,1,0;0;0;0;
 2190REPEAT
 2200PRINTTAB(10,11)"X = &";~?H%;" "
 2210PRINTTAB(20,11)"Y = &";~?V%;" "
 2220IF INKEY(-106) PRINTTAB(10,15)"Copy" ELSE PRINTTAB(10,15)"    "
 2230IF INKEY(-74) PRINTTAB(15,15)"Return" ELSE PRINTTAB(15,15)"      "
 2240IF INKEY(-90) PRINTTAB(22,15)"Delete" ELSE PRINTTAB(22,15)"      "
 2250IF INKEY(-58) PRINTTAB(17,18)"Up" ELSE PRINTTAB(17,18)"  "
 2260IF INKEY(-42) PRINTTAB(16,22)"Down" ELSE PRINTTAB(16,22)"    "
 2270IF INKEY(-26) PRINTTAB(10,20)"Left" ELSE PRINTTAB(10,20)"    "
 2280IF INKEY(-122) PRINTTAB(22,20)"Right" ELSE PRINTTAB(22,20)"     "
 2290UNTIL FALSE
 2300CALL mcode :REM: disable new code
 2310VDU23,1,1;0;0;0;31,0,23
 2320END

�> NEWKEYS
*� mcode &200 :�: machine code at mcode
7savereg=&FC :�: interrupt accumulator save register
(+irq1v=&204 :�: primary interrupt vector
2,bytev=&20A :�: Osbyte indirection vector
<!drb=&FE60 :�: data register B
F,ddrb=&FE62 :�: data direction register B
P-pcr=&FE6C :�: peripheral control register
Z)ifr=&FE6D :�: interrupt flag register
d+ier=&FE6E :�: interrupt enable register
n� pass=0 � 2 � 2
xP%=mcode
�
[OPT pass
�:LDX irq1v \ current primary interrupt vector, low byte
�=LDY irq1v+1 \ current primary interrupt vector, high byte
�,CPY #interrupt � 256 \ compare high byte
�5BEQ disable \ restore old vector if irq1v altered
�6STX oldirq1v \ save original irq1 vector, low byte
�9STY oldirq1v+1 \ save original irq1 vector, high byte
�3LDX bytev \ Osbyte indirection vector, low byte
�6LDY bytev+1 \ Osbyte indirection vector, high byte
�8STX oldbytev \ save original Osbyte vector, low byte
�;STY oldbytev+1 \ save original Osbyte vector, high byte
�4LDX #interrupt � 256 \ new irq1 vector, low byte
�5LDY #interrupt � 256 \ new irq1 vector, high byte
$SEI \ set interrupt disable flag
+STX irq1v \ alter irq1 vector, low byte
.STY irq1v+1 \ alter irq1 vector, high byte
"&CLI \ clear interrupt disable flag
,5LDX #newinkey � 256 \ new Osbyte vector, low byte
66LDY #newinkey � 256 \ new Osbyte vector, high byte
@-STX bytev \ alter Osbyte vector, low byte
J0STY bytev+1 \ alter Osbyte vector, high byte
T*LDA #&98 \ %10011000, ie. enable CB1/2
^'STA ier \ interrupt enable register
h)LDA pcr \ peripheral control register
r0� #&0F \ � with %00001111, ie clear bits 4-7
|4�A #&50 \ � with %01010000, ie. set bits 4 and 6
�BSTA pcr \ interrupt on +ve transition, CB2 input, DRB to clear
�LDA #&00 \ user port input
�(STA ddrb \ data direction register B
�RTS \ return to BASIC
�.disable
�;LDA #&18 \ %00011000 ready to clear bits 3 and 4 of ier
�1LDX oldirq1v \ original irq1 vector, low byte
�4LDY oldirq1v+1 \ original irq1 vector, high byte
�$SEI \ set interrupt disable flag
�'STA ier \ interrupt enable register
�)LDA pcr \ peripheral control register
�� #&0F \ clear bits 4-7
�)STA pcr \ peripheral control register
-STX irq1v \ restore irq1 vector, low byte
0STY irq1v+1 \ restore irq1 vector, high byte
&CLI \ clear interrupt disable flag
&3LDX oldbytev \ original Osbyte vector, low byte
06LDY oldbytev+1 \ original Osbyte vector, high byte
:/STX bytev \ restore Osbyte vector, low byte
D2STY bytev+1 \ restore Osbyte vector, high byte
NRTS \ return to BASIC
X.interrupt
b5LDA savereg \ interrupt accumulator save register
l"PHA \ and push it on the stack
v%LDA ifr \ interrupt flag register
�1BPL notuser \ bit 7 is set if VIA-B interrupt
�4� #&18 \ � with %00011000, ie. test bits 3 and 4
�(BEQ notuser \ exit if not CB1 or CB2
�+� #&10 \ � with %00010000, ie. test CB1
�6BNE xpulse \ bit 4 set for an X direction movement
�/LDA drb \ Y direction, load data register B
�-� #&04 \ � with %00000100, ie. test bit 2
�4BNE ydown \ if bit 2 is set then Y is going down
�8INC ycoord \ Y is going up so increment Y coordinate
�.BNE exit \ branch if in the range 1 to 255
�(BEQ decy \ if zero then alter to 255
�
.ydown
�"LDA ycoord \ load Y coordinate
;BEQ exit \ branch if zero because it can't go any lower
	.decy
)DEC ycoord \ reduce Y coordinate by 1
 BJMP exit \ restore interrupt accumulator save register and RTI
*.xpulse
4#LDA drb \ load input register B
>ROR A \ bit 0 into carry
H/BCS xdown \ X is going down if bit 0 is set
R0INC xcoord \ X is going up if bit 0 is clear
\ABNE exit \ exit if X coordinate is in the range from 1 to 255
f3BEQ decx \ if X coordinate = 0 then make it 255
p
.xdown
z"LDA xcoord \ load X coordinate
�2BEQ exit \ if it is zero it can't go any lower
�	.decx
�+DEC xcoord \ decrease X coordinate by 1
�	.exit
�@PLA \ pull interrupt accumulator save register off the stack
�'STA savereg \ and restore zero page
�RTI \ return from interrupt
�.notuser
�DPLA \ pull the interrupt accumulator save register off the stack
�/STA savereg \ restore the zero page address
�1JMP (oldirq1v) \ exit via the original vector
�
.newinkey
�)PHP \ push status register onto stack
"CMP #&81 \ is this Osbyte &81?
7BNE notinkey \ if not then exit via original vector
CPY #&FF \ is this a -ve �?
$5BEQ inkey \ if it is then branch to new � routine
.
.notinkey
8,PLP \ pull status register off the stack
B.oldcode
L<JMP (oldbytev) \ and exit via the original Osbyte vector
V
.inkey
`$TXA \ � number in the X register
j"PHA \ push � number onto stack
tLDA #&81 \ Osbyte &81
~1JSR oldcode \ perform the original � function
�5CPX #&FF \ X = &FF if the required key is pressed
�EBNE notpressed \ if required key not pressed then check the mouse
�!PLA \ pull � number off stack
�.pullout
�LDA #&81 \ Osbyte &81
�,PLP \ pull status register off the stack
�RTS \ and return to BASIC
�.notpressed
�!PLA \ pull � number off stack
�3CMP up \ are you looking for the cursor up key?
�/BNE trydown \ if not then check cursor down
�(LDA ycoord \ Y coordinate from mouse
:CMP #&88 \ if greater than &87 then simulate key press

>BCC pullout \ if less than &88 then exit without key press
#BCS resety \ simulate key press
.trydown
(7CMP down \ are you looking for the cursor down key?
20BNE isitleft \ if not then check cursor left
<(LDA ycoord \ Y coordinate from mouse
F7CMP #&78 \ if less than &78 then simulate key press
PABCS pullout \ if greater than &77 then exit without key press
Z.resety
d(LDA #&80 \ reset Y coordinate to &80
nSTA ycoord
x:BNE found \ unconditional branch to simulate key press
�
.isitleft
�3CMP left \ are you looking for cursor left key?
�2BNE isitright \ if not then check cursor right
�(LDA xcoord \ X coordinate from mouse
�7CMP #&78 \ if less than &78 then simulate key press
�ABCS pullout \ if greater than &77 then exit without key press
�9BCC resetx \ if less than &78 then simulate key press
�.isitright
�5CMP right \ are you looking for cursor right key?
�<BNE trybuttons \ if not then check 3 other possible keys
�(LDA xcoord \ X coordinate from mouse
�:CMP #&88 \ if greater than &87 then simulate key press
�>BCC pullout \ if less than &88 then exit without key press
.resetx
*LDA #&80 \ restore X coordinate to &80
STA xcoord
":BNE found \ unconditional branch to simulate key press
,.trybuttons
6:CMP centrebutton \ is it the first of 3 possible keys?
@1BNE tryright \ if not then try the second key
J#LDA drb \ load input register B
T3JMP two \ check for mouse centre button pressed
^
.tryright
h:CMP rightbutton \ is it the second of 3 possible keys?
r/BNE tryleft \ if not then try the third key
|#LDA drb \ load input register B
�2JMP one \ check for mouse right button pressed
�.tryleft
�;CMP leftbutton \ is it the third of 3 possible buttons?
�>BNE pullout \ if not then exit without simulated key press
�#LDA drb \ load input register B
�	ROL A
�.two
�	ROL A
�.one
�	ROL A
�DBCS pullout \ exit without key press if mouse button not pressed
�
.found
�LDA #&81 \ Osbyte &81
LDX #&FF \ key pressed
LDY #&FF \ key pressed
,PLP \ pull status register off the stack
&RTS \ return to BASIC
0.rightbutton
:EQUB -90 \ delete
D.centrebutton
NEQUB -74 \ return
X.leftbutton
bEQUB -106 \ copy
l.up
vEQUB -58 \ cursor up
�	.down
�EQUB -42 \ cursor down
�	.left
�EQUB -26 \ cursor left
�
.right
�EQUB -122 \ cursor right
�
.oldirq1v
�#EQUW &00 \ original irq1 vector
�
.oldbytev
�%EQUW &00 \ original Osbyte vector
�.xcoord
�.H%
�'EQUB &80 \ mouse X coordinate 0-255
.ycoord
.V%
'EQUB &80 \ mouse Y coordinate 0-255
 
.lastbyte
*]
4�
>� mcode :�: enable new code
H�7
RHmouse$=�141+�132+�157+�131+"Press keyboard or move the mouse  "+�156
\�0,1)mouse$
f�0,2)mouse$
p-�10,7)"Bytes used = &";~(lastbyte-mcode)
z� � � �d|H
��23,1,0;0;0;0;
��
��10,11)"X = &";~?H%;" "
��20,11)"Y = &";~?V%;" "
�-� �(-106) �10,15)"Copy" � �10,15)"    "
�0� �(-74) �15,15)"Return" � �15,15)"      "
�0� �(-90) �22,15)"Delete" � �22,15)"      "
�(� �(-58) �17,18)"Up" � �17,18)"  "
�,� �(-42) �16,22)"Down" � �16,22)"    "
�,� �(-26) �10,20)"Left" � �10,20)"    "
�/� �(-122) �22,20)"Right" � �22,20)"     "
�� �
� � mcode :�: disable new code
	�23,1,1;0;0;0;31,0,23
	�
�
00000000  0d 00 0a 0e f4 3e 20 4e  45 57 4b 45 59 53 0d 00  |.....> NEWKEYS..|
00000010  14 2a de 20 6d 63 6f 64  65 20 26 32 30 30 20 3a  |.*. mcode &200 :|
00000020  f4 3a 20 6d 61 63 68 69  6e 65 20 63 6f 64 65 20  |.: machine code |
00000030  61 74 20 6d 63 6f 64 65  0d 00 1e 37 73 61 76 65  |at mcode...7save|
00000040  72 65 67 3d 26 46 43 20  3a f4 3a 20 69 6e 74 65  |reg=&FC :.: inte|
00000050  72 72 75 70 74 20 61 63  63 75 6d 75 6c 61 74 6f  |rrupt accumulato|
00000060  72 20 73 61 76 65 20 72  65 67 69 73 74 65 72 0d  |r save register.|
00000070  00 28 2b 69 72 71 31 76  3d 26 32 30 34 20 3a f4  |.(+irq1v=&204 :.|
00000080  3a 20 70 72 69 6d 61 72  79 20 69 6e 74 65 72 72  |: primary interr|
00000090  75 70 74 20 76 65 63 74  6f 72 0d 00 32 2c 62 79  |upt vector..2,by|
000000a0  74 65 76 3d 26 32 30 41  20 3a f4 3a 20 4f 73 62  |tev=&20A :.: Osb|
000000b0  79 74 65 20 69 6e 64 69  72 65 63 74 69 6f 6e 20  |yte indirection |
000000c0  76 65 63 74 6f 72 0d 00  3c 21 64 72 62 3d 26 46  |vector..<!drb=&F|
000000d0  45 36 30 20 3a f4 3a 20  64 61 74 61 20 72 65 67  |E60 :.: data reg|
000000e0  69 73 74 65 72 20 42 0d  00 46 2c 64 64 72 62 3d  |ister B..F,ddrb=|
000000f0  26 46 45 36 32 20 3a f4  3a 20 64 61 74 61 20 64  |&FE62 :.: data d|
00000100  69 72 65 63 74 69 6f 6e  20 72 65 67 69 73 74 65  |irection registe|
00000110  72 20 42 0d 00 50 2d 70  63 72 3d 26 46 45 36 43  |r B..P-pcr=&FE6C|
00000120  20 3a f4 3a 20 70 65 72  69 70 68 65 72 61 6c 20  | :.: peripheral |
00000130  63 6f 6e 74 72 6f 6c 20  72 65 67 69 73 74 65 72  |control register|
00000140  0d 00 5a 29 69 66 72 3d  26 46 45 36 44 20 3a f4  |..Z)ifr=&FE6D :.|
00000150  3a 20 69 6e 74 65 72 72  75 70 74 20 66 6c 61 67  |: interrupt flag|
00000160  20 72 65 67 69 73 74 65  72 0d 00 64 2b 69 65 72  | register..d+ier|
00000170  3d 26 46 45 36 45 20 3a  f4 3a 20 69 6e 74 65 72  |=&FE6E :.: inter|
00000180  72 75 70 74 20 65 6e 61  62 6c 65 20 72 65 67 69  |rupt enable regi|
00000190  73 74 65 72 0d 00 6e 14  e3 20 70 61 73 73 3d 30  |ster..n.. pass=0|
000001a0  20 b8 20 32 20 88 20 32  0d 00 78 0c 50 25 3d 6d  | . 2 . 2..x.P%=m|
000001b0  63 6f 64 65 0d 00 82 0d  5b 4f 50 54 20 70 61 73  |code....[OPT pas|
000001c0  73 0d 00 8c 3a 4c 44 58  20 69 72 71 31 76 20 5c  |s...:LDX irq1v \|
000001d0  20 63 75 72 72 65 6e 74  20 70 72 69 6d 61 72 79  | current primary|
000001e0  20 69 6e 74 65 72 72 75  70 74 20 76 65 63 74 6f  | interrupt vecto|
000001f0  72 2c 20 6c 6f 77 20 62  79 74 65 0d 00 96 3d 4c  |r, low byte...=L|
00000200  44 59 20 69 72 71 31 76  2b 31 20 5c 20 63 75 72  |DY irq1v+1 \ cur|
00000210  72 65 6e 74 20 70 72 69  6d 61 72 79 20 69 6e 74  |rent primary int|
00000220  65 72 72 75 70 74 20 76  65 63 74 6f 72 2c 20 68  |errupt vector, h|
00000230  69 67 68 20 62 79 74 65  0d 00 a0 2c 43 50 59 20  |igh byte...,CPY |
00000240  23 69 6e 74 65 72 72 75  70 74 20 81 20 32 35 36  |#interrupt . 256|
00000250  20 5c 20 63 6f 6d 70 61  72 65 20 68 69 67 68 20  | \ compare high |
00000260  62 79 74 65 0d 00 aa 35  42 45 51 20 64 69 73 61  |byte...5BEQ disa|
00000270  62 6c 65 20 5c 20 72 65  73 74 6f 72 65 20 6f 6c  |ble \ restore ol|
00000280  64 20 76 65 63 74 6f 72  20 69 66 20 69 72 71 31  |d vector if irq1|
00000290  76 20 61 6c 74 65 72 65  64 0d 00 b4 36 53 54 58  |v altered...6STX|
000002a0  20 6f 6c 64 69 72 71 31  76 20 5c 20 73 61 76 65  | oldirq1v \ save|
000002b0  20 6f 72 69 67 69 6e 61  6c 20 69 72 71 31 20 76  | original irq1 v|
000002c0  65 63 74 6f 72 2c 20 6c  6f 77 20 62 79 74 65 0d  |ector, low byte.|
000002d0  00 be 39 53 54 59 20 6f  6c 64 69 72 71 31 76 2b  |..9STY oldirq1v+|
000002e0  31 20 5c 20 73 61 76 65  20 6f 72 69 67 69 6e 61  |1 \ save origina|
000002f0  6c 20 69 72 71 31 20 76  65 63 74 6f 72 2c 20 68  |l irq1 vector, h|
00000300  69 67 68 20 62 79 74 65  0d 00 c8 33 4c 44 58 20  |igh byte...3LDX |
00000310  62 79 74 65 76 20 5c 20  4f 73 62 79 74 65 20 69  |bytev \ Osbyte i|
00000320  6e 64 69 72 65 63 74 69  6f 6e 20 76 65 63 74 6f  |ndirection vecto|
00000330  72 2c 20 6c 6f 77 20 62  79 74 65 0d 00 d2 36 4c  |r, low byte...6L|
00000340  44 59 20 62 79 74 65 76  2b 31 20 5c 20 4f 73 62  |DY bytev+1 \ Osb|
00000350  79 74 65 20 69 6e 64 69  72 65 63 74 69 6f 6e 20  |yte indirection |
00000360  76 65 63 74 6f 72 2c 20  68 69 67 68 20 62 79 74  |vector, high byt|
00000370  65 0d 00 dc 38 53 54 58  20 6f 6c 64 62 79 74 65  |e...8STX oldbyte|
00000380  76 20 5c 20 73 61 76 65  20 6f 72 69 67 69 6e 61  |v \ save origina|
00000390  6c 20 4f 73 62 79 74 65  20 76 65 63 74 6f 72 2c  |l Osbyte vector,|
000003a0  20 6c 6f 77 20 62 79 74  65 0d 00 e6 3b 53 54 59  | low byte...;STY|
000003b0  20 6f 6c 64 62 79 74 65  76 2b 31 20 5c 20 73 61  | oldbytev+1 \ sa|
000003c0  76 65 20 6f 72 69 67 69  6e 61 6c 20 4f 73 62 79  |ve original Osby|
000003d0  74 65 20 76 65 63 74 6f  72 2c 20 68 69 67 68 20  |te vector, high |
000003e0  62 79 74 65 0d 00 f0 34  4c 44 58 20 23 69 6e 74  |byte...4LDX #int|
000003f0  65 72 72 75 70 74 20 83  20 32 35 36 20 5c 20 6e  |errupt . 256 \ n|
00000400  65 77 20 69 72 71 31 20  76 65 63 74 6f 72 2c 20  |ew irq1 vector, |
00000410  6c 6f 77 20 62 79 74 65  0d 00 fa 35 4c 44 59 20  |low byte...5LDY |
00000420  23 69 6e 74 65 72 72 75  70 74 20 81 20 32 35 36  |#interrupt . 256|
00000430  20 5c 20 6e 65 77 20 69  72 71 31 20 76 65 63 74  | \ new irq1 vect|
00000440  6f 72 2c 20 68 69 67 68  20 62 79 74 65 0d 01 04  |or, high byte...|
00000450  24 53 45 49 20 5c 20 73  65 74 20 69 6e 74 65 72  |$SEI \ set inter|
00000460  72 75 70 74 20 64 69 73  61 62 6c 65 20 66 6c 61  |rupt disable fla|
00000470  67 0d 01 0e 2b 53 54 58  20 69 72 71 31 76 20 5c  |g...+STX irq1v \|
00000480  20 61 6c 74 65 72 20 69  72 71 31 20 76 65 63 74  | alter irq1 vect|
00000490  6f 72 2c 20 6c 6f 77 20  62 79 74 65 0d 01 18 2e  |or, low byte....|
000004a0  53 54 59 20 69 72 71 31  76 2b 31 20 5c 20 61 6c  |STY irq1v+1 \ al|
000004b0  74 65 72 20 69 72 71 31  20 76 65 63 74 6f 72 2c  |ter irq1 vector,|
000004c0  20 68 69 67 68 20 62 79  74 65 0d 01 22 26 43 4c  | high byte.."&CL|
000004d0  49 20 5c 20 63 6c 65 61  72 20 69 6e 74 65 72 72  |I \ clear interr|
000004e0  75 70 74 20 64 69 73 61  62 6c 65 20 66 6c 61 67  |upt disable flag|
000004f0  0d 01 2c 35 4c 44 58 20  23 6e 65 77 69 6e 6b 65  |..,5LDX #newinke|
00000500  79 20 83 20 32 35 36 20  5c 20 6e 65 77 20 4f 73  |y . 256 \ new Os|
00000510  62 79 74 65 20 76 65 63  74 6f 72 2c 20 6c 6f 77  |byte vector, low|
00000520  20 62 79 74 65 0d 01 36  36 4c 44 59 20 23 6e 65  | byte..66LDY #ne|
00000530  77 69 6e 6b 65 79 20 81  20 32 35 36 20 5c 20 6e  |winkey . 256 \ n|
00000540  65 77 20 4f 73 62 79 74  65 20 76 65 63 74 6f 72  |ew Osbyte vector|
00000550  2c 20 68 69 67 68 20 62  79 74 65 0d 01 40 2d 53  |, high byte..@-S|
00000560  54 58 20 62 79 74 65 76  20 5c 20 61 6c 74 65 72  |TX bytev \ alter|
00000570  20 4f 73 62 79 74 65 20  76 65 63 74 6f 72 2c 20  | Osbyte vector, |
00000580  6c 6f 77 20 62 79 74 65  0d 01 4a 30 53 54 59 20  |low byte..J0STY |
00000590  62 79 74 65 76 2b 31 20  5c 20 61 6c 74 65 72 20  |bytev+1 \ alter |
000005a0  4f 73 62 79 74 65 20 76  65 63 74 6f 72 2c 20 68  |Osbyte vector, h|
000005b0  69 67 68 20 62 79 74 65  0d 01 54 2a 4c 44 41 20  |igh byte..T*LDA |
000005c0  23 26 39 38 20 5c 20 25  31 30 30 31 31 30 30 30  |#&98 \ %10011000|
000005d0  2c 20 69 65 2e 20 65 6e  61 62 6c 65 20 43 42 31  |, ie. enable CB1|
000005e0  2f 32 0d 01 5e 27 53 54  41 20 69 65 72 20 5c 20  |/2..^'STA ier \ |
000005f0  69 6e 74 65 72 72 75 70  74 20 65 6e 61 62 6c 65  |interrupt enable|
00000600  20 72 65 67 69 73 74 65  72 0d 01 68 29 4c 44 41  | register..h)LDA|
00000610  20 70 63 72 20 5c 20 70  65 72 69 70 68 65 72 61  | pcr \ periphera|
00000620  6c 20 63 6f 6e 74 72 6f  6c 20 72 65 67 69 73 74  |l control regist|
00000630  65 72 0d 01 72 30 80 20  23 26 30 46 20 5c 20 80  |er..r0. #&0F \ .|
00000640  20 77 69 74 68 20 25 30  30 30 30 31 31 31 31 2c  | with %00001111,|
00000650  20 69 65 20 63 6c 65 61  72 20 62 69 74 73 20 34  | ie clear bits 4|
00000660  2d 37 0d 01 7c 34 84 41  20 23 26 35 30 20 5c 20  |-7..|4.A #&50 \ |
00000670  84 20 77 69 74 68 20 25  30 31 30 31 30 30 30 30  |. with %01010000|
00000680  2c 20 69 65 2e 20 73 65  74 20 62 69 74 73 20 34  |, ie. set bits 4|
00000690  20 61 6e 64 20 36 0d 01  86 42 53 54 41 20 70 63  | and 6...BSTA pc|
000006a0  72 20 5c 20 69 6e 74 65  72 72 75 70 74 20 6f 6e  |r \ interrupt on|
000006b0  20 2b 76 65 20 74 72 61  6e 73 69 74 69 6f 6e 2c  | +ve transition,|
000006c0  20 43 42 32 20 69 6e 70  75 74 2c 20 44 52 42 20  | CB2 input, DRB |
000006d0  74 6f 20 63 6c 65 61 72  0d 01 90 1e 4c 44 41 20  |to clear....LDA |
000006e0  23 26 30 30 20 5c 20 75  73 65 72 20 70 6f 72 74  |#&00 \ user port|
000006f0  20 69 6e 70 75 74 0d 01  9a 28 53 54 41 20 64 64  | input...(STA dd|
00000700  72 62 20 5c 20 64 61 74  61 20 64 69 72 65 63 74  |rb \ data direct|
00000710  69 6f 6e 20 72 65 67 69  73 74 65 72 20 42 0d 01  |ion register B..|
00000720  a4 19 52 54 53 20 5c 20  72 65 74 75 72 6e 20 74  |..RTS \ return t|
00000730  6f 20 42 41 53 49 43 0d  01 ae 0c 2e 64 69 73 61  |o BASIC.....disa|
00000740  62 6c 65 0d 01 b8 3b 4c  44 41 20 23 26 31 38 20  |ble...;LDA #&18 |
00000750  5c 20 25 30 30 30 31 31  30 30 30 20 72 65 61 64  |\ %00011000 read|
00000760  79 20 74 6f 20 63 6c 65  61 72 20 62 69 74 73 20  |y to clear bits |
00000770  33 20 61 6e 64 20 34 20  6f 66 20 69 65 72 0d 01  |3 and 4 of ier..|
00000780  c2 31 4c 44 58 20 6f 6c  64 69 72 71 31 76 20 5c  |.1LDX oldirq1v \|
00000790  20 6f 72 69 67 69 6e 61  6c 20 69 72 71 31 20 76  | original irq1 v|
000007a0  65 63 74 6f 72 2c 20 6c  6f 77 20 62 79 74 65 0d  |ector, low byte.|
000007b0  01 cc 34 4c 44 59 20 6f  6c 64 69 72 71 31 76 2b  |..4LDY oldirq1v+|
000007c0  31 20 5c 20 6f 72 69 67  69 6e 61 6c 20 69 72 71  |1 \ original irq|
000007d0  31 20 76 65 63 74 6f 72  2c 20 68 69 67 68 20 62  |1 vector, high b|
000007e0  79 74 65 0d 01 d6 24 53  45 49 20 5c 20 73 65 74  |yte...$SEI \ set|
000007f0  20 69 6e 74 65 72 72 75  70 74 20 64 69 73 61 62  | interrupt disab|
00000800  6c 65 20 66 6c 61 67 0d  01 e0 27 53 54 41 20 69  |le flag...'STA i|
00000810  65 72 20 5c 20 69 6e 74  65 72 72 75 70 74 20 65  |er \ interrupt e|
00000820  6e 61 62 6c 65 20 72 65  67 69 73 74 65 72 0d 01  |nable register..|
00000830  ea 29 4c 44 41 20 70 63  72 20 5c 20 70 65 72 69  |.)LDA pcr \ peri|
00000840  70 68 65 72 61 6c 20 63  6f 6e 74 72 6f 6c 20 72  |pheral control r|
00000850  65 67 69 73 74 65 72 0d  01 f4 1b 80 20 23 26 30  |egister..... #&0|
00000860  46 20 5c 20 63 6c 65 61  72 20 62 69 74 73 20 34  |F \ clear bits 4|
00000870  2d 37 0d 01 fe 29 53 54  41 20 70 63 72 20 5c 20  |-7...)STA pcr \ |
00000880  70 65 72 69 70 68 65 72  61 6c 20 63 6f 6e 74 72  |peripheral contr|
00000890  6f 6c 20 72 65 67 69 73  74 65 72 0d 02 08 2d 53  |ol register...-S|
000008a0  54 58 20 69 72 71 31 76  20 5c 20 72 65 73 74 6f  |TX irq1v \ resto|
000008b0  72 65 20 69 72 71 31 20  76 65 63 74 6f 72 2c 20  |re irq1 vector, |
000008c0  6c 6f 77 20 62 79 74 65  0d 02 12 30 53 54 59 20  |low byte...0STY |
000008d0  69 72 71 31 76 2b 31 20  5c 20 72 65 73 74 6f 72  |irq1v+1 \ restor|
000008e0  65 20 69 72 71 31 20 76  65 63 74 6f 72 2c 20 68  |e irq1 vector, h|
000008f0  69 67 68 20 62 79 74 65  0d 02 1c 26 43 4c 49 20  |igh byte...&CLI |
00000900  5c 20 63 6c 65 61 72 20  69 6e 74 65 72 72 75 70  |\ clear interrup|
00000910  74 20 64 69 73 61 62 6c  65 20 66 6c 61 67 0d 02  |t disable flag..|
00000920  26 33 4c 44 58 20 6f 6c  64 62 79 74 65 76 20 5c  |&3LDX oldbytev \|
00000930  20 6f 72 69 67 69 6e 61  6c 20 4f 73 62 79 74 65  | original Osbyte|
00000940  20 76 65 63 74 6f 72 2c  20 6c 6f 77 20 62 79 74  | vector, low byt|
00000950  65 0d 02 30 36 4c 44 59  20 6f 6c 64 62 79 74 65  |e..06LDY oldbyte|
00000960  76 2b 31 20 5c 20 6f 72  69 67 69 6e 61 6c 20 4f  |v+1 \ original O|
00000970  73 62 79 74 65 20 76 65  63 74 6f 72 2c 20 68 69  |sbyte vector, hi|
00000980  67 68 20 62 79 74 65 0d  02 3a 2f 53 54 58 20 62  |gh byte..:/STX b|
00000990  79 74 65 76 20 5c 20 72  65 73 74 6f 72 65 20 4f  |ytev \ restore O|
000009a0  73 62 79 74 65 20 76 65  63 74 6f 72 2c 20 6c 6f  |sbyte vector, lo|
000009b0  77 20 62 79 74 65 0d 02  44 32 53 54 59 20 62 79  |w byte..D2STY by|
000009c0  74 65 76 2b 31 20 5c 20  72 65 73 74 6f 72 65 20  |tev+1 \ restore |
000009d0  4f 73 62 79 74 65 20 76  65 63 74 6f 72 2c 20 68  |Osbyte vector, h|
000009e0  69 67 68 20 62 79 74 65  0d 02 4e 19 52 54 53 20  |igh byte..N.RTS |
000009f0  5c 20 72 65 74 75 72 6e  20 74 6f 20 42 41 53 49  |\ return to BASI|
00000a00  43 0d 02 58 0e 2e 69 6e  74 65 72 72 75 70 74 0d  |C..X..interrupt.|
00000a10  02 62 35 4c 44 41 20 73  61 76 65 72 65 67 20 5c  |.b5LDA savereg \|
00000a20  20 69 6e 74 65 72 72 75  70 74 20 61 63 63 75 6d  | interrupt accum|
00000a30  75 6c 61 74 6f 72 20 73  61 76 65 20 72 65 67 69  |ulator save regi|
00000a40  73 74 65 72 0d 02 6c 22  50 48 41 20 5c 20 61 6e  |ster..l"PHA \ an|
00000a50  64 20 70 75 73 68 20 69  74 20 6f 6e 20 74 68 65  |d push it on the|
00000a60  20 73 74 61 63 6b 0d 02  76 25 4c 44 41 20 69 66  | stack..v%LDA if|
00000a70  72 20 5c 20 69 6e 74 65  72 72 75 70 74 20 66 6c  |r \ interrupt fl|
00000a80  61 67 20 72 65 67 69 73  74 65 72 0d 02 80 31 42  |ag register...1B|
00000a90  50 4c 20 6e 6f 74 75 73  65 72 20 5c 20 62 69 74  |PL notuser \ bit|
00000aa0  20 37 20 69 73 20 73 65  74 20 69 66 20 56 49 41  | 7 is set if VIA|
00000ab0  2d 42 20 69 6e 74 65 72  72 75 70 74 0d 02 8a 34  |-B interrupt...4|
00000ac0  80 20 23 26 31 38 20 5c  20 80 20 77 69 74 68 20  |. #&18 \ . with |
00000ad0  25 30 30 30 31 31 30 30  30 2c 20 69 65 2e 20 74  |%00011000, ie. t|
00000ae0  65 73 74 20 62 69 74 73  20 33 20 61 6e 64 20 34  |est bits 3 and 4|
00000af0  0d 02 94 28 42 45 51 20  6e 6f 74 75 73 65 72 20  |...(BEQ notuser |
00000b00  5c 20 65 78 69 74 20 69  66 20 6e 6f 74 20 43 42  |\ exit if not CB|
00000b10  31 20 6f 72 20 43 42 32  0d 02 9e 2b 80 20 23 26  |1 or CB2...+. #&|
00000b20  31 30 20 5c 20 80 20 77  69 74 68 20 25 30 30 30  |10 \ . with %000|
00000b30  31 30 30 30 30 2c 20 69  65 2e 20 74 65 73 74 20  |10000, ie. test |
00000b40  43 42 31 0d 02 a8 36 42  4e 45 20 78 70 75 6c 73  |CB1...6BNE xpuls|
00000b50  65 20 5c 20 62 69 74 20  34 20 73 65 74 20 66 6f  |e \ bit 4 set fo|
00000b60  72 20 61 6e 20 58 20 64  69 72 65 63 74 69 6f 6e  |r an X direction|
00000b70  20 6d 6f 76 65 6d 65 6e  74 0d 02 b2 2f 4c 44 41  | movement.../LDA|
00000b80  20 64 72 62 20 5c 20 59  20 64 69 72 65 63 74 69  | drb \ Y directi|
00000b90  6f 6e 2c 20 6c 6f 61 64  20 64 61 74 61 20 72 65  |on, load data re|
00000ba0  67 69 73 74 65 72 20 42  0d 02 bc 2d 80 20 23 26  |gister B...-. #&|
00000bb0  30 34 20 5c 20 80 20 77  69 74 68 20 25 30 30 30  |04 \ . with %000|
00000bc0  30 30 31 30 30 2c 20 69  65 2e 20 74 65 73 74 20  |00100, ie. test |
00000bd0  62 69 74 20 32 0d 02 c6  34 42 4e 45 20 79 64 6f  |bit 2...4BNE ydo|
00000be0  77 6e 20 5c 20 69 66 20  62 69 74 20 32 20 69 73  |wn \ if bit 2 is|
00000bf0  20 73 65 74 20 74 68 65  6e 20 59 20 69 73 20 67  | set then Y is g|
00000c00  6f 69 6e 67 20 64 6f 77  6e 0d 02 d0 38 49 4e 43  |oing down...8INC|
00000c10  20 79 63 6f 6f 72 64 20  5c 20 59 20 69 73 20 67  | ycoord \ Y is g|
00000c20  6f 69 6e 67 20 75 70 20  73 6f 20 69 6e 63 72 65  |oing up so incre|
00000c30  6d 65 6e 74 20 59 20 63  6f 6f 72 64 69 6e 61 74  |ment Y coordinat|
00000c40  65 0d 02 da 2e 42 4e 45  20 65 78 69 74 20 5c 20  |e....BNE exit \ |
00000c50  62 72 61 6e 63 68 20 69  66 20 69 6e 20 74 68 65  |branch if in the|
00000c60  20 72 61 6e 67 65 20 31  20 74 6f 20 32 35 35 0d  | range 1 to 255.|
00000c70  02 e4 28 42 45 51 20 64  65 63 79 20 5c 20 69 66  |..(BEQ decy \ if|
00000c80  20 7a 65 72 6f 20 74 68  65 6e 20 61 6c 74 65 72  | zero then alter|
00000c90  20 74 6f 20 32 35 35 0d  02 ee 0a 2e 79 64 6f 77  | to 255.....ydow|
00000ca0  6e 0d 02 f8 22 4c 44 41  20 79 63 6f 6f 72 64 20  |n..."LDA ycoord |
00000cb0  5c 20 6c 6f 61 64 20 59  20 63 6f 6f 72 64 69 6e  |\ load Y coordin|
00000cc0  61 74 65 0d 03 02 3b 42  45 51 20 65 78 69 74 20  |ate...;BEQ exit |
00000cd0  5c 20 62 72 61 6e 63 68  20 69 66 20 7a 65 72 6f  |\ branch if zero|
00000ce0  20 62 65 63 61 75 73 65  20 69 74 20 63 61 6e 27  | because it can'|
00000cf0  74 20 67 6f 20 61 6e 79  20 6c 6f 77 65 72 0d 03  |t go any lower..|
00000d00  0c 09 2e 64 65 63 79 0d  03 16 29 44 45 43 20 79  |...decy...)DEC y|
00000d10  63 6f 6f 72 64 20 5c 20  72 65 64 75 63 65 20 59  |coord \ reduce Y|
00000d20  20 63 6f 6f 72 64 69 6e  61 74 65 20 62 79 20 31  | coordinate by 1|
00000d30  0d 03 20 42 4a 4d 50 20  65 78 69 74 20 5c 20 72  |.. BJMP exit \ r|
00000d40  65 73 74 6f 72 65 20 69  6e 74 65 72 72 75 70 74  |estore interrupt|
00000d50  20 61 63 63 75 6d 75 6c  61 74 6f 72 20 73 61 76  | accumulator sav|
00000d60  65 20 72 65 67 69 73 74  65 72 20 61 6e 64 20 52  |e register and R|
00000d70  54 49 0d 03 2a 0b 2e 78  70 75 6c 73 65 0d 03 34  |TI..*..xpulse..4|
00000d80  23 4c 44 41 20 64 72 62  20 5c 20 6c 6f 61 64 20  |#LDA drb \ load |
00000d90  69 6e 70 75 74 20 72 65  67 69 73 74 65 72 20 42  |input register B|
00000da0  0d 03 3e 1c 52 4f 52 20  41 20 5c 20 62 69 74 20  |..>.ROR A \ bit |
00000db0  30 20 69 6e 74 6f 20 63  61 72 72 79 0d 03 48 2f  |0 into carry..H/|
00000dc0  42 43 53 20 78 64 6f 77  6e 20 5c 20 58 20 69 73  |BCS xdown \ X is|
00000dd0  20 67 6f 69 6e 67 20 64  6f 77 6e 20 69 66 20 62  | going down if b|
00000de0  69 74 20 30 20 69 73 20  73 65 74 0d 03 52 30 49  |it 0 is set..R0I|
00000df0  4e 43 20 78 63 6f 6f 72  64 20 5c 20 58 20 69 73  |NC xcoord \ X is|
00000e00  20 67 6f 69 6e 67 20 75  70 20 69 66 20 62 69 74  | going up if bit|
00000e10  20 30 20 69 73 20 63 6c  65 61 72 0d 03 5c 41 42  | 0 is clear..\AB|
00000e20  4e 45 20 65 78 69 74 20  5c 20 65 78 69 74 20 69  |NE exit \ exit i|
00000e30  66 20 58 20 63 6f 6f 72  64 69 6e 61 74 65 20 69  |f X coordinate i|
00000e40  73 20 69 6e 20 74 68 65  20 72 61 6e 67 65 20 66  |s in the range f|
00000e50  72 6f 6d 20 31 20 74 6f  20 32 35 35 0d 03 66 33  |rom 1 to 255..f3|
00000e60  42 45 51 20 64 65 63 78  20 5c 20 69 66 20 58 20  |BEQ decx \ if X |
00000e70  63 6f 6f 72 64 69 6e 61  74 65 20 3d 20 30 20 74  |coordinate = 0 t|
00000e80  68 65 6e 20 6d 61 6b 65  20 69 74 20 32 35 35 0d  |hen make it 255.|
00000e90  03 70 0a 2e 78 64 6f 77  6e 0d 03 7a 22 4c 44 41  |.p..xdown..z"LDA|
00000ea0  20 78 63 6f 6f 72 64 20  5c 20 6c 6f 61 64 20 58  | xcoord \ load X|
00000eb0  20 63 6f 6f 72 64 69 6e  61 74 65 0d 03 84 32 42  | coordinate...2B|
00000ec0  45 51 20 65 78 69 74 20  5c 20 69 66 20 69 74 20  |EQ exit \ if it |
00000ed0  69 73 20 7a 65 72 6f 20  69 74 20 63 61 6e 27 74  |is zero it can't|
00000ee0  20 67 6f 20 61 6e 79 20  6c 6f 77 65 72 0d 03 8e  | go any lower...|
00000ef0  09 2e 64 65 63 78 0d 03  98 2b 44 45 43 20 78 63  |..decx...+DEC xc|
00000f00  6f 6f 72 64 20 5c 20 64  65 63 72 65 61 73 65 20  |oord \ decrease |
00000f10  58 20 63 6f 6f 72 64 69  6e 61 74 65 20 62 79 20  |X coordinate by |
00000f20  31 0d 03 a2 09 2e 65 78  69 74 0d 03 ac 40 50 4c  |1.....exit...@PL|
00000f30  41 20 5c 20 70 75 6c 6c  20 69 6e 74 65 72 72 75  |A \ pull interru|
00000f40  70 74 20 61 63 63 75 6d  75 6c 61 74 6f 72 20 73  |pt accumulator s|
00000f50  61 76 65 20 72 65 67 69  73 74 65 72 20 6f 66 66  |ave register off|
00000f60  20 74 68 65 20 73 74 61  63 6b 0d 03 b6 27 53 54  | the stack...'ST|
00000f70  41 20 73 61 76 65 72 65  67 20 5c 20 61 6e 64 20  |A savereg \ and |
00000f80  72 65 73 74 6f 72 65 20  7a 65 72 6f 20 70 61 67  |restore zero pag|
00000f90  65 0d 03 c0 1f 52 54 49  20 5c 20 72 65 74 75 72  |e....RTI \ retur|
00000fa0  6e 20 66 72 6f 6d 20 69  6e 74 65 72 72 75 70 74  |n from interrupt|
00000fb0  0d 03 ca 0c 2e 6e 6f 74  75 73 65 72 0d 03 d4 44  |.....notuser...D|
00000fc0  50 4c 41 20 5c 20 70 75  6c 6c 20 74 68 65 20 69  |PLA \ pull the i|
00000fd0  6e 74 65 72 72 75 70 74  20 61 63 63 75 6d 75 6c  |nterrupt accumul|
00000fe0  61 74 6f 72 20 73 61 76  65 20 72 65 67 69 73 74  |ator save regist|
00000ff0  65 72 20 6f 66 66 20 74  68 65 20 73 74 61 63 6b  |er off the stack|
00001000  0d 03 de 2f 53 54 41 20  73 61 76 65 72 65 67 20  |.../STA savereg |
00001010  5c 20 72 65 73 74 6f 72  65 20 74 68 65 20 7a 65  |\ restore the ze|
00001020  72 6f 20 70 61 67 65 20  61 64 64 72 65 73 73 0d  |ro page address.|
00001030  03 e8 31 4a 4d 50 20 28  6f 6c 64 69 72 71 31 76  |..1JMP (oldirq1v|
00001040  29 20 5c 20 65 78 69 74  20 76 69 61 20 74 68 65  |) \ exit via the|
00001050  20 6f 72 69 67 69 6e 61  6c 20 76 65 63 74 6f 72  | original vector|
00001060  0d 03 f2 0d 2e 6e 65 77  69 6e 6b 65 79 0d 03 fc  |.....newinkey...|
00001070  29 50 48 50 20 5c 20 70  75 73 68 20 73 74 61 74  |)PHP \ push stat|
00001080  75 73 20 72 65 67 69 73  74 65 72 20 6f 6e 74 6f  |us register onto|
00001090  20 73 74 61 63 6b 0d 04  06 22 43 4d 50 20 23 26  | stack..."CMP #&|
000010a0  38 31 20 5c 20 69 73 20  74 68 69 73 20 4f 73 62  |81 \ is this Osb|
000010b0  79 74 65 20 26 38 31 3f  0d 04 10 37 42 4e 45 20  |yte &81?...7BNE |
000010c0  6e 6f 74 69 6e 6b 65 79  20 5c 20 69 66 20 6e 6f  |notinkey \ if no|
000010d0  74 20 74 68 65 6e 20 65  78 69 74 20 76 69 61 20  |t then exit via |
000010e0  6f 72 69 67 69 6e 61 6c  20 76 65 63 74 6f 72 0d  |original vector.|
000010f0  04 1a 1f 43 50 59 20 23  26 46 46 20 5c 20 69 73  |...CPY #&FF \ is|
00001100  20 74 68 69 73 20 61 20  2d 76 65 20 a6 3f 0d 04  | this a -ve .?..|
00001110  24 35 42 45 51 20 69 6e  6b 65 79 20 5c 20 69 66  |$5BEQ inkey \ if|
00001120  20 69 74 20 69 73 20 74  68 65 6e 20 62 72 61 6e  | it is then bran|
00001130  63 68 20 74 6f 20 6e 65  77 20 a6 20 72 6f 75 74  |ch to new . rout|
00001140  69 6e 65 0d 04 2e 0d 2e  6e 6f 74 69 6e 6b 65 79  |ine.....notinkey|
00001150  0d 04 38 2c 50 4c 50 20  5c 20 70 75 6c 6c 20 73  |..8,PLP \ pull s|
00001160  74 61 74 75 73 20 72 65  67 69 73 74 65 72 20 6f  |tatus register o|
00001170  66 66 20 74 68 65 20 73  74 61 63 6b 0d 04 42 0c  |ff the stack..B.|
00001180  2e 6f 6c 64 63 6f 64 65  0d 04 4c 3c 4a 4d 50 20  |.oldcode..L<JMP |
00001190  28 6f 6c 64 62 79 74 65  76 29 20 5c 20 61 6e 64  |(oldbytev) \ and|
000011a0  20 65 78 69 74 20 76 69  61 20 74 68 65 20 6f 72  | exit via the or|
000011b0  69 67 69 6e 61 6c 20 4f  73 62 79 74 65 20 76 65  |iginal Osbyte ve|
000011c0  63 74 6f 72 0d 04 56 0a  2e 69 6e 6b 65 79 0d 04  |ctor..V..inkey..|
000011d0  60 24 54 58 41 20 5c 20  a6 20 6e 75 6d 62 65 72  |`$TXA \ . number|
000011e0  20 69 6e 20 74 68 65 20  58 20 72 65 67 69 73 74  | in the X regist|
000011f0  65 72 0d 04 6a 22 50 48  41 20 5c 20 70 75 73 68  |er..j"PHA \ push|
00001200  20 a6 20 6e 75 6d 62 65  72 20 6f 6e 74 6f 20 73  | . number onto s|
00001210  74 61 63 6b 0d 04 74 19  4c 44 41 20 23 26 38 31  |tack..t.LDA #&81|
00001220  20 5c 20 4f 73 62 79 74  65 20 26 38 31 0d 04 7e  | \ Osbyte &81..~|
00001230  31 4a 53 52 20 6f 6c 64  63 6f 64 65 20 5c 20 70  |1JSR oldcode \ p|
00001240  65 72 66 6f 72 6d 20 74  68 65 20 6f 72 69 67 69  |erform the origi|
00001250  6e 61 6c 20 a6 20 66 75  6e 63 74 69 6f 6e 0d 04  |nal . function..|
00001260  88 35 43 50 58 20 23 26  46 46 20 5c 20 58 20 3d  |.5CPX #&FF \ X =|
00001270  20 26 46 46 20 69 66 20  74 68 65 20 72 65 71 75  | &FF if the requ|
00001280  69 72 65 64 20 6b 65 79  20 69 73 20 70 72 65 73  |ired key is pres|
00001290  73 65 64 0d 04 92 45 42  4e 45 20 6e 6f 74 70 72  |sed...EBNE notpr|
000012a0  65 73 73 65 64 20 5c 20  69 66 20 72 65 71 75 69  |essed \ if requi|
000012b0  72 65 64 20 6b 65 79 20  6e 6f 74 20 70 72 65 73  |red key not pres|
000012c0  73 65 64 20 74 68 65 6e  20 63 68 65 63 6b 20 74  |sed then check t|
000012d0  68 65 20 6d 6f 75 73 65  0d 04 9c 21 50 4c 41 20  |he mouse...!PLA |
000012e0  5c 20 70 75 6c 6c 20 a6  20 6e 75 6d 62 65 72 20  |\ pull . number |
000012f0  6f 66 66 20 73 74 61 63  6b 0d 04 a6 0c 2e 70 75  |off stack.....pu|
00001300  6c 6c 6f 75 74 0d 04 b0  19 4c 44 41 20 23 26 38  |llout....LDA #&8|
00001310  31 20 5c 20 4f 73 62 79  74 65 20 26 38 31 0d 04  |1 \ Osbyte &81..|
00001320  ba 2c 50 4c 50 20 5c 20  70 75 6c 6c 20 73 74 61  |.,PLP \ pull sta|
00001330  74 75 73 20 72 65 67 69  73 74 65 72 20 6f 66 66  |tus register off|
00001340  20 74 68 65 20 73 74 61  63 6b 0d 04 c4 1d 52 54  | the stack....RT|
00001350  53 20 5c 20 61 6e 64 20  72 65 74 75 72 6e 20 74  |S \ and return t|
00001360  6f 20 42 41 53 49 43 0d  04 ce 0f 2e 6e 6f 74 70  |o BASIC.....notp|
00001370  72 65 73 73 65 64 0d 04  d8 21 50 4c 41 20 5c 20  |ressed...!PLA \ |
00001380  70 75 6c 6c 20 a6 20 6e  75 6d 62 65 72 20 6f 66  |pull . number of|
00001390  66 20 73 74 61 63 6b 0d  04 e2 33 43 4d 50 20 75  |f stack...3CMP u|
000013a0  70 20 5c 20 61 72 65 20  79 6f 75 20 6c 6f 6f 6b  |p \ are you look|
000013b0  69 6e 67 20 66 6f 72 20  74 68 65 20 63 75 72 73  |ing for the curs|
000013c0  6f 72 20 75 70 20 6b 65  79 3f 0d 04 ec 2f 42 4e  |or up key?.../BN|
000013d0  45 20 74 72 79 64 6f 77  6e 20 5c 20 69 66 20 6e  |E trydown \ if n|
000013e0  6f 74 20 74 68 65 6e 20  63 68 65 63 6b 20 63 75  |ot then check cu|
000013f0  72 73 6f 72 20 64 6f 77  6e 0d 04 f6 28 4c 44 41  |rsor down...(LDA|
00001400  20 79 63 6f 6f 72 64 20  5c 20 59 20 63 6f 6f 72  | ycoord \ Y coor|
00001410  64 69 6e 61 74 65 20 66  72 6f 6d 20 6d 6f 75 73  |dinate from mous|
00001420  65 0d 05 00 3a 43 4d 50  20 23 26 38 38 20 5c 20  |e...:CMP #&88 \ |
00001430  69 66 20 67 72 65 61 74  65 72 20 74 68 61 6e 20  |if greater than |
00001440  26 38 37 20 74 68 65 6e  20 73 69 6d 75 6c 61 74  |&87 then simulat|
00001450  65 20 6b 65 79 20 70 72  65 73 73 0d 05 0a 3e 42  |e key press...>B|
00001460  43 43 20 70 75 6c 6c 6f  75 74 20 5c 20 69 66 20  |CC pullout \ if |
00001470  6c 65 73 73 20 74 68 61  6e 20 26 38 38 20 74 68  |less than &88 th|
00001480  65 6e 20 65 78 69 74 20  77 69 74 68 6f 75 74 20  |en exit without |
00001490  6b 65 79 20 70 72 65 73  73 0d 05 14 23 42 43 53  |key press...#BCS|
000014a0  20 72 65 73 65 74 79 20  5c 20 73 69 6d 75 6c 61  | resety \ simula|
000014b0  74 65 20 6b 65 79 20 70  72 65 73 73 0d 05 1e 0c  |te key press....|
000014c0  2e 74 72 79 64 6f 77 6e  0d 05 28 37 43 4d 50 20  |.trydown..(7CMP |
000014d0  64 6f 77 6e 20 5c 20 61  72 65 20 79 6f 75 20 6c  |down \ are you l|
000014e0  6f 6f 6b 69 6e 67 20 66  6f 72 20 74 68 65 20 63  |ooking for the c|
000014f0  75 72 73 6f 72 20 64 6f  77 6e 20 6b 65 79 3f 0d  |ursor down key?.|
00001500  05 32 30 42 4e 45 20 69  73 69 74 6c 65 66 74 20  |.20BNE isitleft |
00001510  5c 20 69 66 20 6e 6f 74  20 74 68 65 6e 20 63 68  |\ if not then ch|
00001520  65 63 6b 20 63 75 72 73  6f 72 20 6c 65 66 74 0d  |eck cursor left.|
00001530  05 3c 28 4c 44 41 20 79  63 6f 6f 72 64 20 5c 20  |.<(LDA ycoord \ |
00001540  59 20 63 6f 6f 72 64 69  6e 61 74 65 20 66 72 6f  |Y coordinate fro|
00001550  6d 20 6d 6f 75 73 65 0d  05 46 37 43 4d 50 20 23  |m mouse..F7CMP #|
00001560  26 37 38 20 5c 20 69 66  20 6c 65 73 73 20 74 68  |&78 \ if less th|
00001570  61 6e 20 26 37 38 20 74  68 65 6e 20 73 69 6d 75  |an &78 then simu|
00001580  6c 61 74 65 20 6b 65 79  20 70 72 65 73 73 0d 05  |late key press..|
00001590  50 41 42 43 53 20 70 75  6c 6c 6f 75 74 20 5c 20  |PABCS pullout \ |
000015a0  69 66 20 67 72 65 61 74  65 72 20 74 68 61 6e 20  |if greater than |
000015b0  26 37 37 20 74 68 65 6e  20 65 78 69 74 20 77 69  |&77 then exit wi|
000015c0  74 68 6f 75 74 20 6b 65  79 20 70 72 65 73 73 0d  |thout key press.|
000015d0  05 5a 0b 2e 72 65 73 65  74 79 0d 05 64 28 4c 44  |.Z..resety..d(LD|
000015e0  41 20 23 26 38 30 20 5c  20 72 65 73 65 74 20 59  |A #&80 \ reset Y|
000015f0  20 63 6f 6f 72 64 69 6e  61 74 65 20 74 6f 20 26  | coordinate to &|
00001600  38 30 0d 05 6e 0e 53 54  41 20 79 63 6f 6f 72 64  |80..n.STA ycoord|
00001610  0d 05 78 3a 42 4e 45 20  66 6f 75 6e 64 20 5c 20  |..x:BNE found \ |
00001620  75 6e 63 6f 6e 64 69 74  69 6f 6e 61 6c 20 62 72  |unconditional br|
00001630  61 6e 63 68 20 74 6f 20  73 69 6d 75 6c 61 74 65  |anch to simulate|
00001640  20 6b 65 79 20 70 72 65  73 73 0d 05 82 0d 2e 69  | key press.....i|
00001650  73 69 74 6c 65 66 74 0d  05 8c 33 43 4d 50 20 6c  |sitleft...3CMP l|
00001660  65 66 74 20 5c 20 61 72  65 20 79 6f 75 20 6c 6f  |eft \ are you lo|
00001670  6f 6b 69 6e 67 20 66 6f  72 20 63 75 72 73 6f 72  |oking for cursor|
00001680  20 6c 65 66 74 20 6b 65  79 3f 0d 05 96 32 42 4e  | left key?...2BN|
00001690  45 20 69 73 69 74 72 69  67 68 74 20 5c 20 69 66  |E isitright \ if|
000016a0  20 6e 6f 74 20 74 68 65  6e 20 63 68 65 63 6b 20  | not then check |
000016b0  63 75 72 73 6f 72 20 72  69 67 68 74 0d 05 a0 28  |cursor right...(|
000016c0  4c 44 41 20 78 63 6f 6f  72 64 20 5c 20 58 20 63  |LDA xcoord \ X c|
000016d0  6f 6f 72 64 69 6e 61 74  65 20 66 72 6f 6d 20 6d  |oordinate from m|
000016e0  6f 75 73 65 0d 05 aa 37  43 4d 50 20 23 26 37 38  |ouse...7CMP #&78|
000016f0  20 5c 20 69 66 20 6c 65  73 73 20 74 68 61 6e 20  | \ if less than |
00001700  26 37 38 20 74 68 65 6e  20 73 69 6d 75 6c 61 74  |&78 then simulat|
00001710  65 20 6b 65 79 20 70 72  65 73 73 0d 05 b4 41 42  |e key press...AB|
00001720  43 53 20 70 75 6c 6c 6f  75 74 20 5c 20 69 66 20  |CS pullout \ if |
00001730  67 72 65 61 74 65 72 20  74 68 61 6e 20 26 37 37  |greater than &77|
00001740  20 74 68 65 6e 20 65 78  69 74 20 77 69 74 68 6f  | then exit witho|
00001750  75 74 20 6b 65 79 20 70  72 65 73 73 0d 05 be 39  |ut key press...9|
00001760  42 43 43 20 72 65 73 65  74 78 20 5c 20 69 66 20  |BCC resetx \ if |
00001770  6c 65 73 73 20 74 68 61  6e 20 26 37 38 20 74 68  |less than &78 th|
00001780  65 6e 20 73 69 6d 75 6c  61 74 65 20 6b 65 79 20  |en simulate key |
00001790  70 72 65 73 73 0d 05 c8  0e 2e 69 73 69 74 72 69  |press.....isitri|
000017a0  67 68 74 0d 05 d2 35 43  4d 50 20 72 69 67 68 74  |ght...5CMP right|
000017b0  20 5c 20 61 72 65 20 79  6f 75 20 6c 6f 6f 6b 69  | \ are you looki|
000017c0  6e 67 20 66 6f 72 20 63  75 72 73 6f 72 20 72 69  |ng for cursor ri|
000017d0  67 68 74 20 6b 65 79 3f  0d 05 dc 3c 42 4e 45 20  |ght key?...<BNE |
000017e0  74 72 79 62 75 74 74 6f  6e 73 20 5c 20 69 66 20  |trybuttons \ if |
000017f0  6e 6f 74 20 74 68 65 6e  20 63 68 65 63 6b 20 33  |not then check 3|
00001800  20 6f 74 68 65 72 20 70  6f 73 73 69 62 6c 65 20  | other possible |
00001810  6b 65 79 73 0d 05 e6 28  4c 44 41 20 78 63 6f 6f  |keys...(LDA xcoo|
00001820  72 64 20 5c 20 58 20 63  6f 6f 72 64 69 6e 61 74  |rd \ X coordinat|
00001830  65 20 66 72 6f 6d 20 6d  6f 75 73 65 0d 05 f0 3a  |e from mouse...:|
00001840  43 4d 50 20 23 26 38 38  20 5c 20 69 66 20 67 72  |CMP #&88 \ if gr|
00001850  65 61 74 65 72 20 74 68  61 6e 20 26 38 37 20 74  |eater than &87 t|
00001860  68 65 6e 20 73 69 6d 75  6c 61 74 65 20 6b 65 79  |hen simulate key|
00001870  20 70 72 65 73 73 0d 05  fa 3e 42 43 43 20 70 75  | press...>BCC pu|
00001880  6c 6c 6f 75 74 20 5c 20  69 66 20 6c 65 73 73 20  |llout \ if less |
00001890  74 68 61 6e 20 26 38 38  20 74 68 65 6e 20 65 78  |than &88 then ex|
000018a0  69 74 20 77 69 74 68 6f  75 74 20 6b 65 79 20 70  |it without key p|
000018b0  72 65 73 73 0d 06 04 0b  2e 72 65 73 65 74 78 0d  |ress.....resetx.|
000018c0  06 0e 2a 4c 44 41 20 23  26 38 30 20 5c 20 72 65  |..*LDA #&80 \ re|
000018d0  73 74 6f 72 65 20 58 20  63 6f 6f 72 64 69 6e 61  |store X coordina|
000018e0  74 65 20 74 6f 20 26 38  30 0d 06 18 0e 53 54 41  |te to &80....STA|
000018f0  20 78 63 6f 6f 72 64 0d  06 22 3a 42 4e 45 20 66  | xcoord..":BNE f|
00001900  6f 75 6e 64 20 5c 20 75  6e 63 6f 6e 64 69 74 69  |ound \ unconditi|
00001910  6f 6e 61 6c 20 62 72 61  6e 63 68 20 74 6f 20 73  |onal branch to s|
00001920  69 6d 75 6c 61 74 65 20  6b 65 79 20 70 72 65 73  |imulate key pres|
00001930  73 0d 06 2c 0f 2e 74 72  79 62 75 74 74 6f 6e 73  |s..,..trybuttons|
00001940  0d 06 36 3a 43 4d 50 20  63 65 6e 74 72 65 62 75  |..6:CMP centrebu|
00001950  74 74 6f 6e 20 5c 20 69  73 20 69 74 20 74 68 65  |tton \ is it the|
00001960  20 66 69 72 73 74 20 6f  66 20 33 20 70 6f 73 73  | first of 3 poss|
00001970  69 62 6c 65 20 6b 65 79  73 3f 0d 06 40 31 42 4e  |ible keys?..@1BN|
00001980  45 20 74 72 79 72 69 67  68 74 20 5c 20 69 66 20  |E tryright \ if |
00001990  6e 6f 74 20 74 68 65 6e  20 74 72 79 20 74 68 65  |not then try the|
000019a0  20 73 65 63 6f 6e 64 20  6b 65 79 0d 06 4a 23 4c  | second key..J#L|
000019b0  44 41 20 64 72 62 20 5c  20 6c 6f 61 64 20 69 6e  |DA drb \ load in|
000019c0  70 75 74 20 72 65 67 69  73 74 65 72 20 42 0d 06  |put register B..|
000019d0  54 33 4a 4d 50 20 74 77  6f 20 5c 20 63 68 65 63  |T3JMP two \ chec|
000019e0  6b 20 66 6f 72 20 6d 6f  75 73 65 20 63 65 6e 74  |k for mouse cent|
000019f0  72 65 20 62 75 74 74 6f  6e 20 70 72 65 73 73 65  |re button presse|
00001a00  64 0d 06 5e 0d 2e 74 72  79 72 69 67 68 74 0d 06  |d..^..tryright..|
00001a10  68 3a 43 4d 50 20 72 69  67 68 74 62 75 74 74 6f  |h:CMP rightbutto|
00001a20  6e 20 5c 20 69 73 20 69  74 20 74 68 65 20 73 65  |n \ is it the se|
00001a30  63 6f 6e 64 20 6f 66 20  33 20 70 6f 73 73 69 62  |cond of 3 possib|
00001a40  6c 65 20 6b 65 79 73 3f  0d 06 72 2f 42 4e 45 20  |le keys?..r/BNE |
00001a50  74 72 79 6c 65 66 74 20  5c 20 69 66 20 6e 6f 74  |tryleft \ if not|
00001a60  20 74 68 65 6e 20 74 72  79 20 74 68 65 20 74 68  | then try the th|
00001a70  69 72 64 20 6b 65 79 0d  06 7c 23 4c 44 41 20 64  |ird key..|#LDA d|
00001a80  72 62 20 5c 20 6c 6f 61  64 20 69 6e 70 75 74 20  |rb \ load input |
00001a90  72 65 67 69 73 74 65 72  20 42 0d 06 86 32 4a 4d  |register B...2JM|
00001aa0  50 20 6f 6e 65 20 5c 20  63 68 65 63 6b 20 66 6f  |P one \ check fo|
00001ab0  72 20 6d 6f 75 73 65 20  72 69 67 68 74 20 62 75  |r mouse right bu|
00001ac0  74 74 6f 6e 20 70 72 65  73 73 65 64 0d 06 90 0c  |tton pressed....|
00001ad0  2e 74 72 79 6c 65 66 74  0d 06 9a 3b 43 4d 50 20  |.tryleft...;CMP |
00001ae0  6c 65 66 74 62 75 74 74  6f 6e 20 5c 20 69 73 20  |leftbutton \ is |
00001af0  69 74 20 74 68 65 20 74  68 69 72 64 20 6f 66 20  |it the third of |
00001b00  33 20 70 6f 73 73 69 62  6c 65 20 62 75 74 74 6f  |3 possible butto|
00001b10  6e 73 3f 0d 06 a4 3e 42  4e 45 20 70 75 6c 6c 6f  |ns?...>BNE pullo|
00001b20  75 74 20 5c 20 69 66 20  6e 6f 74 20 74 68 65 6e  |ut \ if not then|
00001b30  20 65 78 69 74 20 77 69  74 68 6f 75 74 20 73 69  | exit without si|
00001b40  6d 75 6c 61 74 65 64 20  6b 65 79 20 70 72 65 73  |mulated key pres|
00001b50  73 0d 06 ae 23 4c 44 41  20 64 72 62 20 5c 20 6c  |s...#LDA drb \ l|
00001b60  6f 61 64 20 69 6e 70 75  74 20 72 65 67 69 73 74  |oad input regist|
00001b70  65 72 20 42 0d 06 b8 09  52 4f 4c 20 41 0d 06 c2  |er B....ROL A...|
00001b80  08 2e 74 77 6f 0d 06 cc  09 52 4f 4c 20 41 0d 06  |..two....ROL A..|
00001b90  d6 08 2e 6f 6e 65 0d 06  e0 09 52 4f 4c 20 41 0d  |...one....ROL A.|
00001ba0  06 ea 44 42 43 53 20 70  75 6c 6c 6f 75 74 20 5c  |..DBCS pullout \|
00001bb0  20 65 78 69 74 20 77 69  74 68 6f 75 74 20 6b 65  | exit without ke|
00001bc0  79 20 70 72 65 73 73 20  69 66 20 6d 6f 75 73 65  |y press if mouse|
00001bd0  20 62 75 74 74 6f 6e 20  6e 6f 74 20 70 72 65 73  | button not pres|
00001be0  73 65 64 0d 06 f4 0a 2e  66 6f 75 6e 64 0d 06 fe  |sed.....found...|
00001bf0  19 4c 44 41 20 23 26 38  31 20 5c 20 4f 73 62 79  |.LDA #&81 \ Osby|
00001c00  74 65 20 26 38 31 0d 07  08 1a 4c 44 58 20 23 26  |te &81....LDX #&|
00001c10  46 46 20 5c 20 6b 65 79  20 70 72 65 73 73 65 64  |FF \ key pressed|
00001c20  0d 07 12 1a 4c 44 59 20  23 26 46 46 20 5c 20 6b  |....LDY #&FF \ k|
00001c30  65 79 20 70 72 65 73 73  65 64 0d 07 1c 2c 50 4c  |ey pressed...,PL|
00001c40  50 20 5c 20 70 75 6c 6c  20 73 74 61 74 75 73 20  |P \ pull status |
00001c50  72 65 67 69 73 74 65 72  20 6f 66 66 20 74 68 65  |register off the|
00001c60  20 73 74 61 63 6b 0d 07  26 19 52 54 53 20 5c 20  | stack..&.RTS \ |
00001c70  72 65 74 75 72 6e 20 74  6f 20 42 41 53 49 43 0d  |return to BASIC.|
00001c80  07 30 10 2e 72 69 67 68  74 62 75 74 74 6f 6e 0d  |.0..rightbutton.|
00001c90  07 3a 15 45 51 55 42 20  2d 39 30 20 5c 20 64 65  |.:.EQUB -90 \ de|
00001ca0  6c 65 74 65 0d 07 44 11  2e 63 65 6e 74 72 65 62  |lete..D..centreb|
00001cb0  75 74 74 6f 6e 0d 07 4e  15 45 51 55 42 20 2d 37  |utton..N.EQUB -7|
00001cc0  34 20 5c 20 72 65 74 75  72 6e 0d 07 58 0f 2e 6c  |4 \ return..X..l|
00001cd0  65 66 74 62 75 74 74 6f  6e 0d 07 62 14 45 51 55  |eftbutton..b.EQU|
00001ce0  42 20 2d 31 30 36 20 5c  20 63 6f 70 79 0d 07 6c  |B -106 \ copy..l|
00001cf0  07 2e 75 70 0d 07 76 18  45 51 55 42 20 2d 35 38  |..up..v.EQUB -58|
00001d00  20 5c 20 63 75 72 73 6f  72 20 75 70 0d 07 80 09  | \ cursor up....|
00001d10  2e 64 6f 77 6e 0d 07 8a  1a 45 51 55 42 20 2d 34  |.down....EQUB -4|
00001d20  32 20 5c 20 63 75 72 73  6f 72 20 64 6f 77 6e 0d  |2 \ cursor down.|
00001d30  07 94 09 2e 6c 65 66 74  0d 07 9e 1a 45 51 55 42  |....left....EQUB|
00001d40  20 2d 32 36 20 5c 20 63  75 72 73 6f 72 20 6c 65  | -26 \ cursor le|
00001d50  66 74 0d 07 a8 0a 2e 72  69 67 68 74 0d 07 b2 1c  |ft.....right....|
00001d60  45 51 55 42 20 2d 31 32  32 20 5c 20 63 75 72 73  |EQUB -122 \ curs|
00001d70  6f 72 20 72 69 67 68 74  0d 07 bc 0d 2e 6f 6c 64  |or right.....old|
00001d80  69 72 71 31 76 0d 07 c6  23 45 51 55 57 20 26 30  |irq1v...#EQUW &0|
00001d90  30 20 5c 20 6f 72 69 67  69 6e 61 6c 20 69 72 71  |0 \ original irq|
00001da0  31 20 76 65 63 74 6f 72  0d 07 d0 0d 2e 6f 6c 64  |1 vector.....old|
00001db0  62 79 74 65 76 0d 07 da  25 45 51 55 57 20 26 30  |bytev...%EQUW &0|
00001dc0  30 20 5c 20 6f 72 69 67  69 6e 61 6c 20 4f 73 62  |0 \ original Osb|
00001dd0  79 74 65 20 76 65 63 74  6f 72 0d 07 e4 0b 2e 78  |yte vector.....x|
00001de0  63 6f 6f 72 64 0d 07 ee  07 2e 48 25 0d 07 f8 27  |coord.....H%...'|
00001df0  45 51 55 42 20 26 38 30  20 5c 20 6d 6f 75 73 65  |EQUB &80 \ mouse|
00001e00  20 58 20 63 6f 6f 72 64  69 6e 61 74 65 20 30 2d  | X coordinate 0-|
00001e10  32 35 35 0d 08 02 0b 2e  79 63 6f 6f 72 64 0d 08  |255.....ycoord..|
00001e20  0c 07 2e 56 25 0d 08 16  27 45 51 55 42 20 26 38  |...V%...'EQUB &8|
00001e30  30 20 5c 20 6d 6f 75 73  65 20 59 20 63 6f 6f 72  |0 \ mouse Y coor|
00001e40  64 69 6e 61 74 65 20 30  2d 32 35 35 0d 08 20 0d  |dinate 0-255.. .|
00001e50  2e 6c 61 73 74 62 79 74  65 0d 08 2a 05 5d 0d 08  |.lastbyte..*.]..|
00001e60  34 05 ed 0d 08 3e 1f d6  20 6d 63 6f 64 65 20 3a  |4....>.. mcode :|
00001e70  f4 3a 20 65 6e 61 62 6c  65 20 6e 65 77 20 63 6f  |.: enable new co|
00001e80  64 65 0d 08 48 06 eb 37  0d 08 52 48 6d 6f 75 73  |de..H..7..RHmous|
00001e90  65 24 3d bd 31 34 31 2b  bd 31 33 32 2b bd 31 35  |e$=.141+.132+.15|
00001ea0  37 2b bd 31 33 31 2b 22  50 72 65 73 73 20 6b 65  |7+.131+"Press ke|
00001eb0  79 62 6f 61 72 64 20 6f  72 20 6d 6f 76 65 20 74  |yboard or move t|
00001ec0  68 65 20 6d 6f 75 73 65  20 20 22 2b bd 31 35 36  |he mouse  "+.156|
00001ed0  0d 08 5c 10 f1 8a 30 2c  31 29 6d 6f 75 73 65 24  |..\...0,1)mouse$|
00001ee0  0d 08 66 10 f1 8a 30 2c  32 29 6d 6f 75 73 65 24  |..f...0,2)mouse$|
00001ef0  0d 08 70 2d f1 8a 31 30  2c 37 29 22 42 79 74 65  |..p-..10,7)"Byte|
00001f00  73 20 75 73 65 64 20 3d  20 26 22 3b 7e 28 6c 61  |s used = &";~(la|
00001f10  73 74 62 79 74 65 2d 6d  63 6f 64 65 29 0d 08 7a  |stbyte-mcode)..z|
00001f20  0e ee 20 85 20 e5 20 8d  64 7c 48 0d 08 84 12 ef  |.. . . .d|H.....|
00001f30  32 33 2c 31 2c 30 3b 30  3b 30 3b 30 3b 0d 08 8e  |23,1,0;0;0;0;...|
00001f40  05 f5 0d 08 98 1c f1 8a  31 30 2c 31 31 29 22 58  |........10,11)"X|
00001f50  20 3d 20 26 22 3b 7e 3f  48 25 3b 22 20 22 0d 08  | = &";~?H%;" "..|
00001f60  a2 1c f1 8a 32 30 2c 31  31 29 22 59 20 3d 20 26  |....20,11)"Y = &|
00001f70  22 3b 7e 3f 56 25 3b 22  20 22 0d 08 ac 2d e7 20  |";~?V%;" "...-. |
00001f80  a6 28 2d 31 30 36 29 20  f1 8a 31 30 2c 31 35 29  |.(-106) ..10,15)|
00001f90  22 43 6f 70 79 22 20 8b  20 f1 8a 31 30 2c 31 35  |"Copy" . ..10,15|
00001fa0  29 22 20 20 20 20 22 0d  08 b6 30 e7 20 a6 28 2d  |)"    "...0. .(-|
00001fb0  37 34 29 20 f1 8a 31 35  2c 31 35 29 22 52 65 74  |74) ..15,15)"Ret|
00001fc0  75 72 6e 22 20 8b 20 f1  8a 31 35 2c 31 35 29 22  |urn" . ..15,15)"|
00001fd0  20 20 20 20 20 20 22 0d  08 c0 30 e7 20 a6 28 2d  |      "...0. .(-|
00001fe0  39 30 29 20 f1 8a 32 32  2c 31 35 29 22 44 65 6c  |90) ..22,15)"Del|
00001ff0  65 74 65 22 20 8b 20 f1  8a 32 32 2c 31 35 29 22  |ete" . ..22,15)"|
00002000  20 20 20 20 20 20 22 0d  08 ca 28 e7 20 a6 28 2d  |      "...(. .(-|
00002010  35 38 29 20 f1 8a 31 37  2c 31 38 29 22 55 70 22  |58) ..17,18)"Up"|
00002020  20 8b 20 f1 8a 31 37 2c  31 38 29 22 20 20 22 0d  | . ..17,18)"  ".|
00002030  08 d4 2c e7 20 a6 28 2d  34 32 29 20 f1 8a 31 36  |..,. .(-42) ..16|
00002040  2c 32 32 29 22 44 6f 77  6e 22 20 8b 20 f1 8a 31  |,22)"Down" . ..1|
00002050  36 2c 32 32 29 22 20 20  20 20 22 0d 08 de 2c e7  |6,22)"    "...,.|
00002060  20 a6 28 2d 32 36 29 20  f1 8a 31 30 2c 32 30 29  | .(-26) ..10,20)|
00002070  22 4c 65 66 74 22 20 8b  20 f1 8a 31 30 2c 32 30  |"Left" . ..10,20|
00002080  29 22 20 20 20 20 22 0d  08 e8 2f e7 20 a6 28 2d  |)"    ".../. .(-|
00002090  31 32 32 29 20 f1 8a 32  32 2c 32 30 29 22 52 69  |122) ..22,20)"Ri|
000020a0  67 68 74 22 20 8b 20 f1  8a 32 32 2c 32 30 29 22  |ght" . ..22,20)"|
000020b0  20 20 20 20 20 22 0d 08  f2 07 fd 20 a3 0d 08 fc  |     "..... ....|
000020c0  20 d6 20 6d 63 6f 64 65  20 3a f4 3a 20 64 69 73  | . mcode :.: dis|
000020d0  61 62 6c 65 20 6e 65 77  20 63 6f 64 65 0d 09 06  |able new code...|
000020e0  19 ef 32 33 2c 31 2c 31  3b 30 3b 30 3b 30 3b 33  |..23,1,1;0;0;0;3|
000020f0  31 2c 30 2c 32 33 0d 09  10 05 e0 0d ff           |1,0,23.......|
000020fd
16-12-88/NEWKEYS.m0
16-12-88/NEWKEYS.m1
16-12-88/NEWKEYS.m2
16-12-88/NEWKEYS.m4
16-12-88/NEWKEYS.m5