Home » CEEFAX disks » telesoftware11.adl » 16-12-88/T\MOU04
16-12-88/T\MOU04
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/T\MOU04 |
Read OK: | ✔ |
File size: | 6CAB bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
Using a mouse with the BBC microcomputer - by - Gordon Horsington ----------------------------------------------------------------- Module 4. Using the negative INKEY and keyboard scan to read a mouse -------------------------------------------------------------------- In module 3 you were shown how the negative INKEY command can be modified to include reading the mouse buttons as if they are keys on the computer keyboard. This is a very useful technique because it allows the user of a program to use the mouse buttons or the keyboard or both to input data. In this module I will explain how this idea can be extended so that mouse movement can be used as a substitute for the cursor keys. The four cursor keys are often used to indicate movement in the direction of their arrows and for this reason they seem to be an obvious choice for substitution with mouse movement. The mouse is sensitive to quite small movements and produces an interrupt at almost the slightest touch. Because the mouse is so sensitive it is necessary to build in a bit of software buffering so that only a significant movement of the mouse will be recognised as being equivalent to a key press. This has some parallels with the mouse button polling interval used in the program EVENT (module 3) which ensured that only relatively long keypresses were interpreted as significant repeats. The BASIC function INKEY with a negative number in the brackets, eg. INKEY(-74), can be used to test whether a particular key is pressed when the function is called. The INKEY function is executed via the Osbyte indirection vector using Osbyte &81 with X = the (negative) INKEY value and Y = &FF. The function can be intercepted by redirecting the Osbyte vector to a new INKEY routine. The program NEWKEYS duplicates the negative INKEY function for the cursor keys, Delete, Copy and Return, so that these keys can be scanned both on the keyboard and on the mouse. The revectored Osbyte indirection vector used in NEWKEYS points to the code labeled newinkey which checks to see if a negative INKEY function is being executed. If it is not a negative INKEY then the new routine exits via the original Osbyte vector. If a negative INKEY is being executed then the new routine first of all executes the original code to see if the required keyboard button is pressed. If it is then the new routine returns control to the operating system. If the key being scanned is not pressed on the keyboard then the new routine checks to see if the key is one which has been allocated to one of the mouse buttons or to the mouse movement. If the key has been allocated then either the DRB is polled to see if the appropriate mouse button is pressed or the mouse coordinates are examined to see if a significant mouse movement has taken place. If the required mouse button is pressed or sufficient movement has taken place then a return from Osbyte &81 is made with both X=&FF and Y=&FF. This has the effect of simulating a TRUE return from the negative INKEY function. If the required mouse button is not pressed or if insufficient movement has taken place then a return is made from Osbyte &81 with the X and Y registers storing the numbers with which they returned from the original INKEY routine and this has the effect of a FALSE return from the function. The mouse interrupt processing is a background task quite separate from the interception of the negative INKEY routine and, in the demonstration program NEWKEYS, I have ensured that at least eight interrupts are received from the chosen direction before the appropriate negative INKEY function is returned with a TRUE result. This is done by starting both X and Y coordinates at &80 and incrementing or decrementing them as required with each mouse interrupt. When a coordinate either exceeds &88 or is less that &78 then the appropriate negative INKEY will be simulated and the coordinate reset to &80 ready to be incremented or decremented again. This provides the required movement buffering and the sensitivity of the process can be adjusted by editing lines 1280, 1350, 1450 and 1520. The ideas demonstrated in NEWKEYS are implemented in the program LOADER which will be broadcast with this module. This is a program, written by Jeremy Brayshaw, which can be used to automaticly download Telesoftware files using an Acorn Teletext adaptor. The program has been modified so that either the Cursor keys with the Space bar and the Return key, or the mouse, or any combination of both keyboard and mouse can be used to select and download files from the Telesoftware menu. 10 REM> NEWKEYS 20 DIM mcode &200 :REM: machine code at mcode 30 savereg=&FC :REM: interrupt accumulator save register 40 irq1v=&204 :REM: primary interrupt vector 50 bytev=&20A :REM: Osbyte indirection vector 60 drb=&FE60 :REM: data register B 70 ddrb=&FE62 :REM: data direction register B 80 pcr=&FE6C :REM: peripheral control register 90 ifr=&FE6D :REM: interrupt flag register 100 ier=&FE6E :REM: interrupt enable register 110 FOR pass=0 TO 2 STEP 2 120 P%=mcode 130 [ OPT pass 140 LDX irq1v \ current primary interrupt vector, low byte 150 LDY irq1v+1 \ current primary interrupt vector, high byte 160 CPY #interrupt DIV 256 \ compare high byte 170 BEQ disable \ restore old vector if irq1v altered 180 STX oldirq1v \ save original irq1 vector, low byte 190 STY oldirq1v+1 \ save original irq1 vector, high byte 200 LDX bytev \ Osbyte indirection vector, low byte 210 LDY bytev+1 \ Osbyte indirection vector, high byte 220 STX oldbytev \ save original Osbyte vector, low byte 230 STY oldbytev+1 \ save original Osbyte vector, high byte 240 LDX #interrupt MOD 256 \ new irq1 vector, low byte 250 LDY #interrupt DIV 256 \ new irq1 vector, high byte 260 SEI \ set interrupt disable flag 270 STX irq1v \ alter irq1 vector, low byte 280 STY irq1v+1 \ alter irq1 vector, high byte 290 CLI \ clear interrupt disable flag 300 LDX #newinkey MOD 256 \ new Osbyte vector, low byte 310 LDY #newinkey DIV 256 \ new Osbyte vector, high byte 320 STX bytev \ alter Osbyte vector, low byte 330 STY bytev+1 \ alter Osbyte vector, high byte 340 LDA #&98 \ %10011000, ie. enable CB1/2 350 STA ier \ interrupt enable register 360 LDA pcr \ peripheral control register 370 AND #&0F \ AND with %00001111, ie clear bits 4-7 380 ORA #&50 \ OR with %01010000, ie. set bits 4 and 6 390 STA pcr \ interrupt on +ve transition, CB2 input, \ DRB to clear 400 LDA #&00 \ user port input 410 STA ddrb \ data direction register B 420 RTS \ return to BASIC 430 .disable 440 LDA #&18 \ %00011000 ready to clear bits 3 and 4 of ier 450 LDX oldirq1v \ original irq1 vector, low byte 460 LDY oldirq1v+1 \ original irq1 vector, high byte 470 SEI \ set interrupt disable flag 480 STA ier \ interrupt enable register 490 LDA pcr \ peripheral control register 500 AND #&0F \ clear bits 4-7 510 STA pcr \ peripheral control register 520 STX irq1v \ restore irq1 vector, low byte 530 STY irq1v+1 \ restore irq1 vector, high byte 540 CLI \ clear interrupt disable flag 550 LDX oldbytev \ original Osbyte vector, low byte 560 LDY oldbytev+1 \ original Osbyte vector, high byte 570 STX bytev \ restore Osbyte vector, low byte 580 STY bytev+1 \ restore Osbyte vector, high byte 590 RTS \ return to BASIC 600 .interrupt 610 LDA savereg \ interrupt accumulator save register 620 PHA \ and push it on the stack 630 LDA ifr \ interrupt flag register 640 BPL notuser \ bit 7 is set if VIA-B interrupt 650 AND #&18 \ AND with %00011000, ie. test bits 3 and 4 660 BEQ notuser \ exit if not CB1 or CB2 670 AND #&10 \ AND with %00010000, ie. test CB1 680 BNE xpulse \ bit 4 set for an X direction movement 690 LDA drb \ Y direction, load data register B 700 AND #&04 \ AND with %00000100, ie. test bit 2 710 BNE ydown \ if bit 2 is set then Y is going down 720 INC ycoord \ Y is going up so increment Y coordinate 730 BNE exit \ branch if in the range 1 to 255 740 BEQ decy \ if zero then alter to 255 750 .ydown 760 LDA ycoord \ load Y coordinate 770 BEQ exit \ branch if zero because it can't go any lower 780 .decy 790 DEC ycoord \ reduce Y coordinate by 1 800 JMP exit \ restore interrupt accumulator save register \ and RTI 810 .xpulse 820 LDA drb \ load input register B 830 ROR A \ bit 0 into carry 840 BCS xdown \ X is going down if bit 0 is set 850 INC xcoord \ X is going up if bit 0 is clear 860 BNE exit \ exit if X coordinate is in the range from \ 1 to 255 870 BEQ decx \ if X coordinate = 0 then make it 255 880 .xdown 890 LDA xcoord \ load X coordinate 900 BEQ exit \ if it is zero it can't go any lower 910 .decx 920 DEC xcoord \ decrease X coordinate by 1 930 .exit 940 PLA \ pull interrupt accumulator save register \ off the stack 950 STA savereg \ and restore zero page 960 RTI \ return from interrupt 970 .notuser 980 PLA \ pull the interrupt accumulator save \ register off the stack 990 STA savereg \ restore the zero page address 1000 JMP (oldirq1v) \ exit via the original vector 1010 .newinkey 1020 PHP \ push status register onto stack 1030 CMP #&81 \ is this Osbyte &81? 1040 BNE notinkey \ if not then exit via original vector 1050 CPY #&FF \ is this a -ve INKEY? 1060 BEQ inkey \ if it is then branch to new INKEY routine 1070 .notinkey 1080 PLP \ pull status register off the stack 1090 .oldcode 1100 JMP (oldbytev) \ and exit via the original Osbyte vector 1110 .inkey 1120 TXA \ INKEY number in the X register 1130 PHA \ push INKEY number onto stack 1140 LDA #&81 \ Osbyte &81 1150 JSR oldcode \ perform the original INKEY function 1160 CPX #&FF \ X = &FF if the required key is pressed 1170 BNE notpressed \ if required key not pressed then check \ the mouse 1180 PLA \ pull INKEY number off stack 1190 .pullout 1200 LDA #&81 \ Osbyte &81 1210 PLP \ pull status register off the stack 1220 RTS \ and return to BASIC 1230 .notpressed 1240 PLA \ pull INKEY number off stack 1250 CMP up \ are you looking for the cursor up key? 1260 BNE trydown \ if not then check cursor down 1270 LDA ycoord \ Y coordinate from mouse 1280 CMP #&88 \ if greater than &87 then simulate key press 1290 BCC pullout \ if less than &88 then exit without key press 1300 BCS resety \ simulate key press 1310 .trydown 1320 CMP down \ are you looking for the cursor down key? 1330 BNE isitleft \ if not then check cursor left 1340 LDA ycoord \ Y coordinate from mouse 1350 CMP #&78 \ if less than &78 then simulate key press 1360 BCS pullout \ if greater than &77 then exit without \ key press 1370 .resety 1380 LDA #&80 \ reset Y coordinate to &80 1390 STA ycoord 1400 BNE found \ unconditional branch to simulate key press 1410 .isitleft 1420 CMP left \ are you looking for cursor left key? 1430 BNE isitright \ if not then check cursor right 1440 LDA xcoord \ X coordinate from mouse 1450 CMP #&78 \ if less than &78 then simulate key press 1460 BCS pullout \ if greater than &77 then exit without \ key press 1470 BCC resetx \ if less than &78 then simulate key press 1480 .isitright 1490 CMP right \ are you looking for cursor right key? 1500 BNE trybuttons \ if not then check 3 other possible keys 1510 LDA xcoord \ X coordinate from mouse 1520 CMP #&88 \ if greater than &87 then simulate key press 1530 BCC pullout \ if less than &88 then exit without key press 1540 .resetx 1550 LDA #&80 \ restore X coordinate to &80 1560 STA xcoord 1570 BNE found \ unconditional branch to simulate key press 1580 .trybuttons 1590 CMP centrebutton \ is it the first of 3 possible keys? 1600 BNE tryright \ if not then try the second key 1610 LDA drb \ load input register B 1620 JMP two \ check for mouse centre button pressed 1630 .tryright 1640 CMP rightbutton \ is it the second of 3 possible keys? 1650 BNE tryleft \ if not then try the third key 1660 LDA drb \ load input register B 1670 JMP one \ check for mouse right button pressed 1680 .tryleft 1690 CMP leftbutton \ is it the third of 3 possible buttons? 1700 BNE pullout \ if not then exit without simulated key \ press 1710 LDA drb \ load input register B 1720 ROL A 1730 .two 1740 ROL A 1750 .one 1760 ROL A 1770 BCS pullout \ exit without key press if mouse button \ not pressed 1780 .found 1790 LDA #&81 \ Osbyte &81 1800 LDX #&FF \ key pressed 1810 LDY #&FF \ key pressed 1820 PLP \ pull status register off the stack 1830 RTS \ return to BASIC 1840 .rightbutton 1850 EQUB -90 \ delete 1860 .centrebutton 1870 EQUB -74 \ return 1880 .leftbutton 1890 EQUB -106 \ copy 1900 .up 1910 EQUB -58 \ cursor up 1920 .down 1930 EQUB -42 \ cursor down 1940 .left 1950 EQUB -26 \ cursor left 1960 .right 1970 EQUB -122 \ cursor right 1980 .oldirq1v 1990 EQUW &00 \ original irq1 vector 2000 .oldbytev 2010 EQUW &00 \ original Osbyte vector 2020 .xcoord 2030 EQUB &80 \ mouse X coordinate 0-255 2040 .ycoord 2050 EQUB &80 \ mouse Y coordinate 0-255 2060 .lastbyte 2070 ] 2080 NEXT 2090 CALL mcode :REM: enable new code 2100 MODE7 2110 mouse$=CHR$141+CHR$132+CHR$157+CHR$131+ "Press keyboard or move the mouse "+CHR$156 2120 PRINTTAB(0,1)mouse$ 2130 PRINTTAB(0,2)mouse$ 2140 PRINTTAB(10,7)"Bytes used = &";~(lastbyte-mcode) 2150 ON ERROR GOTO 2280 2160 VDU23,1,0;0;0;0; 2170 REPEAT 2180 PRINTTAB(10,11)"X = &";~?H%;" " 2190 PRINTTAB(20,11)"Y = &";~?V%;" " 2200 IF INKEY(-106) PRINTTAB(10,15)"Copy" ELSE PRINTTAB(10,15)" " 2210 IF INKEY(-74) PRINTTAB(15,15)"Return" ELSE PRINTTAB(15,15)" " 2220 IF INKEY(-90) PRINTTAB(22,15)"Delete" ELSE PRINTTAB(22,15)" " 2230 IF INKEY(-58) PRINTTAB(17,18)"Up" ELSE PRINTTAB(17,18)" " 2240 IF INKEY(-42) PRINTTAB(16,22)"Down" ELSE PRINTTAB(16,22)" " 2250 IF INKEY(-26) PRINTTAB(10,20)"Left" ELSE PRINTTAB(10,20)" " 2260 IF INKEY(-122) PRINTTAB(22,20)"Right" ELSE PRINTTAB(22,20)" " 2270 UNTIL FALSE 2280 CALL mcode :REM: disable new code 2290 VDU23,1,1;0;0;0;31,0,23 2300 END The program NEWSCAN uses a similar idea to that used in NEWKEYS except that the Osbyte keyboard scan has been intercepted instead of the Osbyte negative INKEY routine. The keyboard scan uses Osbyte &79 or Osbyute &7A. Osbyte &79 and Osbyte &7A use the internal key numbers and not the INKEY numbers as used by Osbyte &81. The internal key numbers can be obtained by taking the negative INKEY number, from the list of INKEY numbers in the User Guide, and Exclusive ORing the INKEY number with &FF. For example, to find the internal key number for Return first look up the negtive INKEY number for Return. This is -74. Use BASIC to Exclusive OR -74 with &FF. PRINT ~ -74 EOR &FF FFFFFF49 The result is the least significant byte of the answer, ie. &49 Chain the program NEWSCAN and move the mouse around. You will see that the keyboard scan returns the internal key number for the appropriate cursor key buttons. The mouse buttons return the internal key number for the Delete, Copy and Return keys. 10 REM> NEWSCAN 20 DIM mcode &200 :REM: machine code at mcode 30 savereg=&FC :REM: interrupt accumulator save register 40 irq1v=&204 :REM: primary interrupt vector 50 bytev=&20A :REM: Osbyte indirection vector 60 drb=&FE60 :REM: data register B 70 ddrb=&FE62 :REM: data direction register B 80 pcr=&FE6C :REM: peripheral control register 90 ifr=&FE6D :REM: interrupt flag register 100 ier=&FE6E :REM: interrupt enable register 110 osbyte=&FFF4 120 FOR pass=0 TO 2 STEP 2 130 P%=mcode 140 [ OPT pass 150 LDX irq1v \ current primary interrupt vector, low byte 160 LDY irq1v+1 \ current primary interrupt vector, high byte 170 CPY #interrupt DIV 256 \ compare high byte 180 BEQ disable \ restore old vector if altered 190 STX oldirq1v \ save original irq1 vector, low byte 200 STY oldirq1v+1 \ save original irq1 vector, high byte 210 LDX bytev \ Osbyte indirection vector, low byte 220 LDY bytev+1 \ Osbyte indirection vector, high byte 230 STX oldbytev \ save original Osbyte vector, low byte 240 STY oldbytev+1 \ save original Osbyte vector, high byte 250 LDX #interrupt MOD 256 \ new irq1 vector, low byte 260 LDY #interrupt DIV 256 \ new irq1 vector, high byte 270 SEI \ set interrupt disable flag 280 STX irq1v \ alter irq1 vector, low byte 290 STY irq1v+1 \ alter irq1 vector, high byte 300 CLI \ clear interrupt disable flag 310 LDX #newscan MOD 256 \ new Osbyte vector, low byte 320 LDY #newscan DIV 256 \ new Osbyte vector, high byte 330 STX bytev \ alter Osbyte vector, low byte 340 STY bytev+1 \ alter Osbyte vector, high byte 350 LDA #&98 \ %10011000, ie. enable CB1/2 360 STA ier \ interrupt enable register 370 LDA pcr \ peripheral control register 380 AND #&0F \ AND with %00001111, ie clear bits 4-7 390 ORA #&50 \ OR with %01010000, ie. set bits 4 and 6 400 STA pcr \ interrupt on +ve transition, CB2 input, \ DRB to clear 410 LDA #&00 \ user port input 420 STA ddrb \ data direction register B 430 RTS \ return to BASIC 440 .disable 450 LDA #&18 \ %00011000 ready to clear bits 3 and 4 of ier 460 LDX oldirq1v \ original irq1 vector, low byte 470 LDY oldirq1v+1 \ original irq1 vector, high byte 480 SEI \ set interrupt disable flag 490 STA ier \ interrupt enable register 500 LDA pcr \ peripheral control register 510 AND #&0F \ clear bits 4-7 520 STA pcr \ peripheral control register 530 STX irq1v \ restore irq1 vector, low byte 540 STY irq1v+1 \ restore irq1 vector, high byte 550 CLI \ clear interrupt disable flag 560 LDX oldbytev \ original Osbyte vector, low byte 570 LDY oldbytev+1 \ original Osbyte vector, high byte 580 STX bytev \ restore Osbyte vector, low byte 590 STY bytev+1 \ restore Osbyte vector, high byte 600 RTS \ return to BASIC 610 .interrupt 620 LDA savereg \ interrupt accumulator save register 630 PHA \ and push it on the stack 640 LDA ifr \ interrupt flag register 650 BPL notuser \ bit 7 is set if VIA-B interrupt 660 AND #&18 \ AND with %00011000, ie. test bits 3 and 4 670 BEQ notuser \ exit if not CB1 or CB2 680 AND #&10 \ AND with %00010000, ie. test CB1 690 BNE xpulse \ bit 4 set for an X direction movement 700 LDA drb \ Y direction, load data register B 710 AND #&04 \ AND with %00000100, ie. test bit 2 720 BNE ydown \ if bit 2 is set then Y is going down 730 INC ycoord \ Y is going up so increment Y coordinate 740 BNE exit \ branch if in the range 1 to 255 750 BEQ decy \ if zero then alter to 255 760 .ydown 770 LDA ycoord \ load Y coordinate 780 BEQ exit \ branch if zero because it can't go any lower 790 .decy 800 DEC ycoord \ reduce Y coordinate by 1 810 JMP exit \ restore interrupt accumulator save register \ and RTI 820 .xpulse 830 LDA drb \ load data register B 840 ROR A \ bit 0 into carry 850 BCS xdown \ X is going down if bit 0 is set 860 INC xcoord \ X is going up if bit 0 is clear 870 BNE exit \ exit if X coordinate is in the range from \ 1 to 255 880 BEQ decx \ if X coordinate = 0 then make it 255 890 .xdown 900 LDA xcoord \ load X coordinate 910 BEQ exit \ if it is zero it can't go any lower 920 .decx 930 DEC xcoord \ decrease X coordinate by 1 940 .exit 950 PLA \ pull interrupt accumulator save register \ off the stack 960 STA savereg \ and restore zero page 970 RTI \ return from interrupt 980 .notuser 990 PLA \ pull the interrupt accumulator save \ register off the stack 1000 STA savereg \ restore the zero page address 1010 JMP (oldirq1v) \ exit via the original vector 1020 .newscan 1030 PHP \ push status register 1040 CMP #&79 \ is this Osbyte &79? 1050 BEQ scan \ if it is branch to new keyboard scan routine 1060 CMP #&7A \ is this Osbyte &7A? 1070 BEQ scan \ branch if Osbyte &7A 1080 .notscan 1090 PLP \ restore status register and return to BASIC 1100 .oldcode 1110 JMP (oldbytev) \ exit via original Osbyte vector 1120 .scan 1130 PHA \ push the Osbyte code (either &79 or &7A) 1140 JSR oldcode \ perform the original Osbyte call 1150 CPX #&FF \ key pressed if X <> &FF 1160 BEQ notpressed \ branch if key not pressed 1170 .pullout 1180 PLA \ pull Osbyte code (either &79 or &7A) 1190 PLP \ pull the status register 1200 RTS \ and return to BASIC 1210 .notpressed 1220 LDA drb \ load data register B 1230 ROL A \ bit 7 of register B into carry 1240 BCC rightpress \ carry clear if right button pressed 1250 ROL A \ bit 6 into carry 1260 BCC centrepress \ bit 6 clear if centre button pressed 1270 ROL A \ bit 5 into carry 1280 BCC leftpress \ bit 5 clear if left button pressed 1290 LDA xcoord \ X coordinate from mouse movement 1300 CMP #&88 \ is the X coordinate > &87? 1310 BCS rightarrow \ branch if X coordinate is high enough 1320 CMP #&78 \ is the X coordinate < &78? 1330 BCC leftarrow \ branch if Y coordinate is low enough 1340 LDA ycoord \ Y coordinate from mouse movement 1350 CMP #&88 \ is the Y coordinate > &87? 1360 BCS uparrow \ branch if Y coordinate is high enough 1370 CMP #&78 \ is the Y coordinate < &78? 1380 BCS pullout \ return to BASIC if it is not 1390 LDX down \ simulate a press on the cursor down key 1400 BNE resety \ unconditional branch to reset Y coordinate 1410 .uparrow 1420 LDX up \ simulate a press on the cursor up key 1430 .resety 1440 LDA #&80 \ reset the Y coordinate to &80 1450 STA ycoord 1460 BNE pullout \ unconditional branch to return to BASIC 1470 .rightarrow 1480 LDX right \ simulate a press on the cursor right key 1490 BNE resetx \ unconditional branch to reset X coordinate 1500 .leftarrow 1510 LDX left \ simulate a press on the cursor left key 1520 .resetx 1530 LDA #&80 \ reset Y coordinate to &80 1540 STA xcoord 1550 BNE pullout \ unconditional branch to return to BASIC 1560 .leftpress 1570 LDX leftbutton \ simulate a key press from left mouse button 1580 BNE pullout \ unconditional branch to return to BASIC 1590 .rightpress 1600 LDX rightbutton \ simulate a key press from right mouse \ button 1610 BNE pullout \ unconditional branch to return to BASIC 1620 .centrepress 1630 LDX centrebutton \ simulate a key press from centre mouse \ button 1640 BNE pullout \ unconditional branch to return to BASIC 1650 .rightbutton 1660 EQUB &59 \ delete internal key number 1670 .centrebutton 1680 EQUB &49 \ return internal key number 1690 .leftbutton 1700 EQUB &69 \ copy internal key number 1710 .up 1720 EQUB &39 \ cursor up internal key number 1730 .down 1740 EQUB &29 \ cursor down internal key number 1750 .left 1760 EQUB &19 \ cursor left internal key number 1770 .right 1780 EQUB &79 \ cursor right internal key number 1790 .oldirq1v 1800 EQUW &00 \ original irq1 vector 1810 .oldbytev 1820 EQUW &00 \ original Osbyte indirection vector 1830 .xcoord 1840 EQUB &80 \ mouse X coordinate 0-255 1850 .ycoord 1860 EQUB &80 \ mouse Y coordinate 0-255 1870 .lastbyte 1880 ] 1890 NEXT 1900 CALL mcode :REM: enable new code 1910 MODE7 1920 mouse$=CHR$141+CHR$132+CHR$157+CHR$131+ "Press keyboard or move the mouse "+CHR$156 1930 PRINTTAB(0,1)mouse$ 1940 PRINTTAB(0,2)mouse$ 1950 PRINTTAB(10,6)"Bytes used = &";~(lastbyte-mcode) 1960 ON ERROR GOTO 2100 1970 VDU23,1,0;0;0;0; 1980 REPEAT 1990 PRINTTAB(10,10)"X = &";~?H%;" " 2000 PRINTTAB(20,10)"Y = &";~?V%;" " 2010 A%=&79 2020 X%=16 2030 answer=(USR(osbyte) AND &FF00)DIV &100 2040 PRINTTAB(9,15)"Osbyte &79, X = &";~answer;" " 2050 A%=&7A 2060 X%=0 2070 answer=(USR(osbyte) AND &FF00)DIV &100 2080 PRINTTAB(9,20)"Osbyte &7A, X = &";~answer;" " 2090 UNTIL FALSE 2100 CALL mcode :REM: disable new code 2110 VDU23,1,1;0;0;0;31,0,23 2120 END
00000000 55 73 69 6e 67 20 61 20 6d 6f 75 73 65 20 77 69 |Using a mouse wi| 00000010 74 68 20 74 68 65 20 42 42 43 20 6d 69 63 72 6f |th the BBC micro| 00000020 63 6f 6d 70 75 74 65 72 20 2d 20 62 79 20 2d 20 |computer - by - | 00000030 47 6f 72 64 6f 6e 20 48 6f 72 73 69 6e 67 74 6f |Gordon Horsingto| 00000040 6e 0d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |n.--------------| 00000050 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000080 2d 2d 2d 0d 0d 4d 6f 64 75 6c 65 20 34 2e 20 55 |---..Module 4. U| 00000090 73 69 6e 67 20 74 68 65 20 6e 65 67 61 74 69 76 |sing the negativ| 000000a0 65 20 49 4e 4b 45 59 20 61 6e 64 20 6b 65 79 62 |e INKEY and keyb| 000000b0 6f 61 72 64 20 73 63 61 6e 20 74 6f 20 72 65 61 |oard scan to rea| 000000c0 64 20 61 20 6d 6f 75 73 65 0d 2d 2d 2d 2d 2d 2d |d a mouse.------| 000000d0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000100 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0d |--------------..| 00000110 49 6e 20 6d 6f 64 75 6c 65 20 33 20 79 6f 75 20 |In module 3 you | 00000120 77 65 72 65 20 73 68 6f 77 6e 20 68 6f 77 20 74 |were shown how t| 00000130 68 65 20 6e 65 67 61 74 69 76 65 20 49 4e 4b 45 |he negative INKE| 00000140 59 20 63 6f 6d 6d 61 6e 64 20 63 61 6e 20 62 65 |Y command can be| 00000150 20 6d 6f 64 69 66 69 65 64 0d 74 6f 20 69 6e 63 | modified.to inc| 00000160 6c 75 64 65 20 72 65 61 64 69 6e 67 20 74 68 65 |lude reading the| 00000170 20 6d 6f 75 73 65 20 62 75 74 74 6f 6e 73 20 61 | mouse buttons a| 00000180 73 20 69 66 20 74 68 65 79 20 61 72 65 20 6b 65 |s if they are ke| 00000190 79 73 20 6f 6e 20 74 68 65 20 63 6f 6d 70 75 74 |ys on the comput| 000001a0 65 72 0d 6b 65 79 62 6f 61 72 64 2e 20 54 68 69 |er.keyboard. Thi| 000001b0 73 20 69 73 20 61 20 76 65 72 79 20 75 73 65 66 |s is a very usef| 000001c0 75 6c 20 74 65 63 68 6e 69 71 75 65 20 62 65 63 |ul technique bec| 000001d0 61 75 73 65 20 69 74 20 61 6c 6c 6f 77 73 20 74 |ause it allows t| 000001e0 68 65 20 75 73 65 72 20 6f 66 20 61 0d 70 72 6f |he user of a.pro| 000001f0 67 72 61 6d 20 74 6f 20 75 73 65 20 74 68 65 20 |gram to use the | 00000200 6d 6f 75 73 65 20 62 75 74 74 6f 6e 73 20 6f 72 |mouse buttons or| 00000210 20 74 68 65 20 6b 65 79 62 6f 61 72 64 20 6f 72 | the keyboard or| 00000220 20 62 6f 74 68 20 74 6f 20 69 6e 70 75 74 20 64 | both to input d| 00000230 61 74 61 2e 20 49 6e 0d 74 68 69 73 20 6d 6f 64 |ata. In.this mod| 00000240 75 6c 65 20 49 20 77 69 6c 6c 20 65 78 70 6c 61 |ule I will expla| 00000250 69 6e 20 68 6f 77 20 74 68 69 73 20 69 64 65 61 |in how this idea| 00000260 20 63 61 6e 20 62 65 20 65 78 74 65 6e 64 65 64 | can be extended| 00000270 20 73 6f 20 74 68 61 74 20 6d 6f 75 73 65 0d 6d | so that mouse.m| 00000280 6f 76 65 6d 65 6e 74 20 63 61 6e 20 62 65 20 75 |ovement can be u| 00000290 73 65 64 20 61 73 20 61 20 73 75 62 73 74 69 74 |sed as a substit| 000002a0 75 74 65 20 66 6f 72 20 74 68 65 20 63 75 72 73 |ute for the curs| 000002b0 6f 72 20 6b 65 79 73 2e 20 54 68 65 20 66 6f 75 |or keys. The fou| 000002c0 72 20 63 75 72 73 6f 72 0d 6b 65 79 73 20 61 72 |r cursor.keys ar| 000002d0 65 20 6f 66 74 65 6e 20 75 73 65 64 20 74 6f 20 |e often used to | 000002e0 69 6e 64 69 63 61 74 65 20 6d 6f 76 65 6d 65 6e |indicate movemen| 000002f0 74 20 69 6e 20 74 68 65 20 64 69 72 65 63 74 69 |t in the directi| 00000300 6f 6e 20 6f 66 20 74 68 65 69 72 20 61 72 72 6f |on of their arro| 00000310 77 73 0d 61 6e 64 20 66 6f 72 20 74 68 69 73 20 |ws.and for this | 00000320 72 65 61 73 6f 6e 20 74 68 65 79 20 73 65 65 6d |reason they seem| 00000330 20 74 6f 20 62 65 20 61 6e 20 6f 62 76 69 6f 75 | to be an obviou| 00000340 73 20 63 68 6f 69 63 65 20 66 6f 72 20 73 75 62 |s choice for sub| 00000350 73 74 69 74 75 74 69 6f 6e 0d 77 69 74 68 20 6d |stitution.with m| 00000360 6f 75 73 65 20 6d 6f 76 65 6d 65 6e 74 2e 0d 0d |ouse movement...| 00000370 54 68 65 20 6d 6f 75 73 65 20 69 73 20 73 65 6e |The mouse is sen| 00000380 73 69 74 69 76 65 20 74 6f 20 71 75 69 74 65 20 |sitive to quite | 00000390 73 6d 61 6c 6c 20 6d 6f 76 65 6d 65 6e 74 73 20 |small movements | 000003a0 61 6e 64 20 70 72 6f 64 75 63 65 73 20 61 6e 20 |and produces an | 000003b0 69 6e 74 65 72 72 75 70 74 0d 61 74 20 61 6c 6d |interrupt.at alm| 000003c0 6f 73 74 20 74 68 65 20 73 6c 69 67 68 74 65 73 |ost the slightes| 000003d0 74 20 74 6f 75 63 68 2e 20 42 65 63 61 75 73 65 |t touch. Because| 000003e0 20 74 68 65 20 6d 6f 75 73 65 20 69 73 20 73 6f | the mouse is so| 000003f0 20 73 65 6e 73 69 74 69 76 65 20 69 74 20 69 73 | sensitive it is| 00000400 0d 6e 65 63 65 73 73 61 72 79 20 74 6f 20 62 75 |.necessary to bu| 00000410 69 6c 64 20 69 6e 20 61 20 62 69 74 20 6f 66 20 |ild in a bit of | 00000420 73 6f 66 74 77 61 72 65 20 62 75 66 66 65 72 69 |software bufferi| 00000430 6e 67 20 73 6f 20 74 68 61 74 20 6f 6e 6c 79 20 |ng so that only | 00000440 61 0d 73 69 67 6e 69 66 69 63 61 6e 74 20 6d 6f |a.significant mo| 00000450 76 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 6d 6f |vement of the mo| 00000460 75 73 65 20 77 69 6c 6c 20 62 65 20 72 65 63 6f |use will be reco| 00000470 67 6e 69 73 65 64 20 61 73 20 62 65 69 6e 67 20 |gnised as being | 00000480 65 71 75 69 76 61 6c 65 6e 74 0d 74 6f 20 61 20 |equivalent.to a | 00000490 6b 65 79 20 70 72 65 73 73 2e 20 54 68 69 73 20 |key press. This | 000004a0 68 61 73 20 73 6f 6d 65 20 70 61 72 61 6c 6c 65 |has some paralle| 000004b0 6c 73 20 77 69 74 68 20 74 68 65 20 6d 6f 75 73 |ls with the mous| 000004c0 65 20 62 75 74 74 6f 6e 20 70 6f 6c 6c 69 6e 67 |e button polling| 000004d0 0d 69 6e 74 65 72 76 61 6c 20 75 73 65 64 20 69 |.interval used i| 000004e0 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 20 45 56 |n the program EV| 000004f0 45 4e 54 20 28 6d 6f 64 75 6c 65 20 33 29 20 77 |ENT (module 3) w| 00000500 68 69 63 68 20 65 6e 73 75 72 65 64 20 74 68 61 |hich ensured tha| 00000510 74 20 6f 6e 6c 79 0d 72 65 6c 61 74 69 76 65 6c |t only.relativel| 00000520 79 20 6c 6f 6e 67 20 6b 65 79 70 72 65 73 73 65 |y long keypresse| 00000530 73 20 77 65 72 65 20 69 6e 74 65 72 70 72 65 74 |s were interpret| 00000540 65 64 20 61 73 20 73 69 67 6e 69 66 69 63 61 6e |ed as significan| 00000550 74 20 72 65 70 65 61 74 73 2e 0d 0d 54 68 65 20 |t repeats...The | 00000560 42 41 53 49 43 20 66 75 6e 63 74 69 6f 6e 20 49 |BASIC function I| 00000570 4e 4b 45 59 20 77 69 74 68 20 61 20 6e 65 67 61 |NKEY with a nega| 00000580 74 69 76 65 20 6e 75 6d 62 65 72 20 69 6e 20 74 |tive number in t| 00000590 68 65 20 62 72 61 63 6b 65 74 73 2c 20 65 67 2e |he brackets, eg.| 000005a0 0d 49 4e 4b 45 59 28 2d 37 34 29 2c 20 63 61 6e |.INKEY(-74), can| 000005b0 20 62 65 20 75 73 65 64 20 74 6f 20 74 65 73 74 | be used to test| 000005c0 20 77 68 65 74 68 65 72 20 61 20 70 61 72 74 69 | whether a parti| 000005d0 63 75 6c 61 72 20 6b 65 79 20 69 73 20 70 72 65 |cular key is pre| 000005e0 73 73 65 64 20 77 68 65 6e 0d 74 68 65 20 66 75 |ssed when.the fu| 000005f0 6e 63 74 69 6f 6e 20 69 73 20 63 61 6c 6c 65 64 |nction is called| 00000600 2e 20 54 68 65 20 49 4e 4b 45 59 20 66 75 6e 63 |. The INKEY func| 00000610 74 69 6f 6e 20 69 73 20 65 78 65 63 75 74 65 64 |tion is executed| 00000620 20 76 69 61 20 74 68 65 20 4f 73 62 79 74 65 0d | via the Osbyte.| 00000630 69 6e 64 69 72 65 63 74 69 6f 6e 20 76 65 63 74 |indirection vect| 00000640 6f 72 20 75 73 69 6e 67 20 4f 73 62 79 74 65 20 |or using Osbyte | 00000650 26 38 31 20 77 69 74 68 20 58 20 3d 20 74 68 65 |&81 with X = the| 00000660 20 28 6e 65 67 61 74 69 76 65 29 20 49 4e 4b 45 | (negative) INKE| 00000670 59 20 76 61 6c 75 65 0d 61 6e 64 20 59 20 3d 20 |Y value.and Y = | 00000680 26 46 46 2e 20 54 68 65 20 66 75 6e 63 74 69 6f |&FF. The functio| 00000690 6e 20 63 61 6e 20 62 65 20 69 6e 74 65 72 63 65 |n can be interce| 000006a0 70 74 65 64 20 62 79 20 72 65 64 69 72 65 63 74 |pted by redirect| 000006b0 69 6e 67 20 74 68 65 20 4f 73 62 79 74 65 0d 76 |ing the Osbyte.v| 000006c0 65 63 74 6f 72 20 74 6f 20 61 20 6e 65 77 20 49 |ector to a new I| 000006d0 4e 4b 45 59 20 72 6f 75 74 69 6e 65 2e 20 54 68 |NKEY routine. Th| 000006e0 65 20 70 72 6f 67 72 61 6d 20 4e 45 57 4b 45 59 |e program NEWKEY| 000006f0 53 20 64 75 70 6c 69 63 61 74 65 73 20 74 68 65 |S duplicates the| 00000700 20 6e 65 67 61 74 69 76 65 0d 49 4e 4b 45 59 20 | negative.INKEY | 00000710 66 75 6e 63 74 69 6f 6e 20 66 6f 72 20 74 68 65 |function for the| 00000720 20 63 75 72 73 6f 72 20 6b 65 79 73 2c 20 44 65 | cursor keys, De| 00000730 6c 65 74 65 2c 20 43 6f 70 79 20 61 6e 64 20 52 |lete, Copy and R| 00000740 65 74 75 72 6e 2c 20 73 6f 20 74 68 61 74 20 74 |eturn, so that t| 00000750 68 65 73 65 0d 6b 65 79 73 20 63 61 6e 20 62 65 |hese.keys can be| 00000760 20 73 63 61 6e 6e 65 64 20 62 6f 74 68 20 6f 6e | scanned both on| 00000770 20 74 68 65 20 6b 65 79 62 6f 61 72 64 20 61 6e | the keyboard an| 00000780 64 20 6f 6e 20 74 68 65 20 6d 6f 75 73 65 2e 0d |d on the mouse..| 00000790 0d 54 68 65 20 72 65 76 65 63 74 6f 72 65 64 20 |.The revectored | 000007a0 4f 73 62 79 74 65 20 69 6e 64 69 72 65 63 74 69 |Osbyte indirecti| 000007b0 6f 6e 20 76 65 63 74 6f 72 20 75 73 65 64 20 69 |on vector used i| 000007c0 6e 20 4e 45 57 4b 45 59 53 20 70 6f 69 6e 74 73 |n NEWKEYS points| 000007d0 20 74 6f 20 74 68 65 0d 63 6f 64 65 20 6c 61 62 | to the.code lab| 000007e0 65 6c 65 64 20 6e 65 77 69 6e 6b 65 79 20 77 68 |eled newinkey wh| 000007f0 69 63 68 20 63 68 65 63 6b 73 20 74 6f 20 73 65 |ich checks to se| 00000800 65 20 69 66 20 61 20 6e 65 67 61 74 69 76 65 20 |e if a negative | 00000810 49 4e 4b 45 59 20 66 75 6e 63 74 69 6f 6e 20 69 |INKEY function i| 00000820 73 0d 62 65 69 6e 67 20 65 78 65 63 75 74 65 64 |s.being executed| 00000830 2e 20 49 66 20 69 74 20 69 73 20 6e 6f 74 20 61 |. If it is not a| 00000840 20 6e 65 67 61 74 69 76 65 20 49 4e 4b 45 59 20 | negative INKEY | 00000850 74 68 65 6e 20 74 68 65 20 6e 65 77 20 72 6f 75 |then the new rou| 00000860 74 69 6e 65 20 65 78 69 74 73 0d 76 69 61 20 74 |tine exits.via t| 00000870 68 65 20 6f 72 69 67 69 6e 61 6c 20 4f 73 62 79 |he original Osby| 00000880 74 65 20 76 65 63 74 6f 72 2e 20 49 66 20 61 20 |te vector. If a | 00000890 6e 65 67 61 74 69 76 65 20 49 4e 4b 45 59 20 69 |negative INKEY i| 000008a0 73 20 62 65 69 6e 67 20 65 78 65 63 75 74 65 64 |s being executed| 000008b0 20 74 68 65 6e 0d 74 68 65 20 6e 65 77 20 72 6f | then.the new ro| 000008c0 75 74 69 6e 65 20 66 69 72 73 74 20 6f 66 20 61 |utine first of a| 000008d0 6c 6c 20 65 78 65 63 75 74 65 73 20 74 68 65 20 |ll executes the | 000008e0 6f 72 69 67 69 6e 61 6c 20 63 6f 64 65 20 74 6f |original code to| 000008f0 20 73 65 65 20 69 66 20 74 68 65 0d 72 65 71 75 | see if the.requ| 00000900 69 72 65 64 20 6b 65 79 62 6f 61 72 64 20 62 75 |ired keyboard bu| 00000910 74 74 6f 6e 20 69 73 20 70 72 65 73 73 65 64 2e |tton is pressed.| 00000920 20 49 66 20 69 74 20 69 73 20 74 68 65 6e 20 74 | If it is then t| 00000930 68 65 20 6e 65 77 20 72 6f 75 74 69 6e 65 20 72 |he new routine r| 00000940 65 74 75 72 6e 73 0d 63 6f 6e 74 72 6f 6c 20 74 |eturns.control t| 00000950 6f 20 74 68 65 20 6f 70 65 72 61 74 69 6e 67 20 |o the operating | 00000960 73 79 73 74 65 6d 2e 20 49 66 20 74 68 65 20 6b |system. If the k| 00000970 65 79 20 62 65 69 6e 67 20 73 63 61 6e 6e 65 64 |ey being scanned| 00000980 20 69 73 20 6e 6f 74 20 70 72 65 73 73 65 64 0d | is not pressed.| 00000990 6f 6e 20 74 68 65 20 6b 65 79 62 6f 61 72 64 20 |on the keyboard | 000009a0 74 68 65 6e 20 74 68 65 20 6e 65 77 20 72 6f 75 |then the new rou| 000009b0 74 69 6e 65 20 63 68 65 63 6b 73 20 74 6f 20 73 |tine checks to s| 000009c0 65 65 20 69 66 20 74 68 65 20 6b 65 79 20 69 73 |ee if the key is| 000009d0 20 6f 6e 65 20 77 68 69 63 68 0d 68 61 73 20 62 | one which.has b| 000009e0 65 65 6e 20 61 6c 6c 6f 63 61 74 65 64 20 74 6f |een allocated to| 000009f0 20 6f 6e 65 20 6f 66 20 74 68 65 20 6d 6f 75 73 | one of the mous| 00000a00 65 20 62 75 74 74 6f 6e 73 20 6f 72 20 74 6f 20 |e buttons or to | 00000a10 74 68 65 20 6d 6f 75 73 65 20 6d 6f 76 65 6d 65 |the mouse moveme| 00000a20 6e 74 2e 0d 49 66 20 74 68 65 20 6b 65 79 20 68 |nt..If the key h| 00000a30 61 73 20 62 65 65 6e 20 61 6c 6c 6f 63 61 74 65 |as been allocate| 00000a40 64 20 74 68 65 6e 20 65 69 74 68 65 72 20 74 68 |d then either th| 00000a50 65 20 44 52 42 20 69 73 20 70 6f 6c 6c 65 64 20 |e DRB is polled | 00000a60 74 6f 20 73 65 65 20 69 66 20 74 68 65 0d 61 70 |to see if the.ap| 00000a70 70 72 6f 70 72 69 61 74 65 20 6d 6f 75 73 65 20 |propriate mouse | 00000a80 62 75 74 74 6f 6e 20 69 73 20 70 72 65 73 73 65 |button is presse| 00000a90 64 20 6f 72 20 74 68 65 20 6d 6f 75 73 65 20 63 |d or the mouse c| 00000aa0 6f 6f 72 64 69 6e 61 74 65 73 20 61 72 65 20 65 |oordinates are e| 00000ab0 78 61 6d 69 6e 65 64 0d 74 6f 20 73 65 65 20 69 |xamined.to see i| 00000ac0 66 20 61 20 73 69 67 6e 69 66 69 63 61 6e 74 20 |f a significant | 00000ad0 6d 6f 75 73 65 20 6d 6f 76 65 6d 65 6e 74 20 68 |mouse movement h| 00000ae0 61 73 20 74 61 6b 65 6e 20 70 6c 61 63 65 2e 0d |as taken place..| 00000af0 0d 49 66 20 74 68 65 20 72 65 71 75 69 72 65 64 |.If the required| 00000b00 20 6d 6f 75 73 65 20 62 75 74 74 6f 6e 20 69 73 | mouse button is| 00000b10 20 70 72 65 73 73 65 64 20 6f 72 20 73 75 66 66 | pressed or suff| 00000b20 69 63 69 65 6e 74 20 6d 6f 76 65 6d 65 6e 74 20 |icient movement | 00000b30 68 61 73 20 74 61 6b 65 6e 0d 70 6c 61 63 65 20 |has taken.place | 00000b40 74 68 65 6e 20 61 20 72 65 74 75 72 6e 20 66 72 |then a return fr| 00000b50 6f 6d 20 4f 73 62 79 74 65 20 26 38 31 20 69 73 |om Osbyte &81 is| 00000b60 20 6d 61 64 65 20 77 69 74 68 20 62 6f 74 68 20 | made with both | 00000b70 58 3d 26 46 46 20 61 6e 64 20 59 3d 26 46 46 2e |X=&FF and Y=&FF.| 00000b80 0d 54 68 69 73 20 68 61 73 20 74 68 65 20 65 66 |.This has the ef| 00000b90 66 65 63 74 20 6f 66 20 73 69 6d 75 6c 61 74 69 |fect of simulati| 00000ba0 6e 67 20 61 20 54 52 55 45 20 72 65 74 75 72 6e |ng a TRUE return| 00000bb0 20 66 72 6f 6d 20 74 68 65 20 6e 65 67 61 74 69 | from the negati| 00000bc0 76 65 20 49 4e 4b 45 59 0d 66 75 6e 63 74 69 6f |ve INKEY.functio| 00000bd0 6e 2e 20 49 66 20 74 68 65 20 72 65 71 75 69 72 |n. If the requir| 00000be0 65 64 20 6d 6f 75 73 65 20 62 75 74 74 6f 6e 20 |ed mouse button | 00000bf0 69 73 20 6e 6f 74 20 70 72 65 73 73 65 64 20 6f |is not pressed o| 00000c00 72 20 69 66 20 69 6e 73 75 66 66 69 63 69 65 6e |r if insufficien| 00000c10 74 0d 6d 6f 76 65 6d 65 6e 74 20 68 61 73 20 74 |t.movement has t| 00000c20 61 6b 65 6e 20 70 6c 61 63 65 20 74 68 65 6e 20 |aken place then | 00000c30 61 20 72 65 74 75 72 6e 20 69 73 20 6d 61 64 65 |a return is made| 00000c40 20 66 72 6f 6d 20 4f 73 62 79 74 65 20 26 38 31 | from Osbyte &81| 00000c50 20 77 69 74 68 20 74 68 65 20 58 0d 61 6e 64 20 | with the X.and | 00000c60 59 20 72 65 67 69 73 74 65 72 73 20 73 74 6f 72 |Y registers stor| 00000c70 69 6e 67 20 74 68 65 20 6e 75 6d 62 65 72 73 20 |ing the numbers | 00000c80 77 69 74 68 20 77 68 69 63 68 20 74 68 65 79 20 |with which they | 00000c90 72 65 74 75 72 6e 65 64 20 66 72 6f 6d 20 74 68 |returned from th| 00000ca0 65 0d 6f 72 69 67 69 6e 61 6c 20 49 4e 4b 45 59 |e.original INKEY| 00000cb0 20 72 6f 75 74 69 6e 65 20 61 6e 64 20 74 68 69 | routine and thi| 00000cc0 73 20 68 61 73 20 74 68 65 20 65 66 66 65 63 74 |s has the effect| 00000cd0 20 6f 66 20 61 20 46 41 4c 53 45 20 72 65 74 75 | of a FALSE retu| 00000ce0 72 6e 20 66 72 6f 6d 20 74 68 65 0d 66 75 6e 63 |rn from the.func| 00000cf0 74 69 6f 6e 2e 0d 0d 54 68 65 20 6d 6f 75 73 65 |tion...The mouse| 00000d00 20 69 6e 74 65 72 72 75 70 74 20 70 72 6f 63 65 | interrupt proce| 00000d10 73 73 69 6e 67 20 69 73 20 61 20 62 61 63 6b 67 |ssing is a backg| 00000d20 72 6f 75 6e 64 20 74 61 73 6b 20 71 75 69 74 65 |round task quite| 00000d30 20 73 65 70 61 72 61 74 65 20 66 72 6f 6d 0d 74 | separate from.t| 00000d40 68 65 20 69 6e 74 65 72 63 65 70 74 69 6f 6e 20 |he interception | 00000d50 6f 66 20 74 68 65 20 6e 65 67 61 74 69 76 65 20 |of the negative | 00000d60 49 4e 4b 45 59 20 72 6f 75 74 69 6e 65 20 61 6e |INKEY routine an| 00000d70 64 2c 20 69 6e 20 74 68 65 20 64 65 6d 6f 6e 73 |d, in the demons| 00000d80 74 72 61 74 69 6f 6e 0d 70 72 6f 67 72 61 6d 20 |tration.program | 00000d90 4e 45 57 4b 45 59 53 2c 20 49 20 68 61 76 65 20 |NEWKEYS, I have | 00000da0 65 6e 73 75 72 65 64 20 74 68 61 74 20 61 74 20 |ensured that at | 00000db0 6c 65 61 73 74 20 65 69 67 68 74 20 69 6e 74 65 |least eight inte| 00000dc0 72 72 75 70 74 73 20 61 72 65 0d 72 65 63 65 69 |rrupts are.recei| 00000dd0 76 65 64 20 66 72 6f 6d 20 74 68 65 20 63 68 6f |ved from the cho| 00000de0 73 65 6e 20 64 69 72 65 63 74 69 6f 6e 20 62 65 |sen direction be| 00000df0 66 6f 72 65 20 74 68 65 20 61 70 70 72 6f 70 72 |fore the appropr| 00000e00 69 61 74 65 20 6e 65 67 61 74 69 76 65 20 49 4e |iate negative IN| 00000e10 4b 45 59 0d 66 75 6e 63 74 69 6f 6e 20 69 73 20 |KEY.function is | 00000e20 72 65 74 75 72 6e 65 64 20 77 69 74 68 20 61 20 |returned with a | 00000e30 54 52 55 45 20 72 65 73 75 6c 74 2e 20 54 68 69 |TRUE result. Thi| 00000e40 73 20 69 73 20 64 6f 6e 65 20 62 79 20 73 74 61 |s is done by sta| 00000e50 72 74 69 6e 67 20 62 6f 74 68 20 58 0d 61 6e 64 |rting both X.and| 00000e60 20 59 20 63 6f 6f 72 64 69 6e 61 74 65 73 20 61 | Y coordinates a| 00000e70 74 20 26 38 30 20 61 6e 64 20 69 6e 63 72 65 6d |t &80 and increm| 00000e80 65 6e 74 69 6e 67 20 6f 72 20 64 65 63 72 65 6d |enting or decrem| 00000e90 65 6e 74 69 6e 67 20 74 68 65 6d 20 61 73 20 72 |enting them as r| 00000ea0 65 71 75 69 72 65 64 0d 77 69 74 68 20 65 61 63 |equired.with eac| 00000eb0 68 20 6d 6f 75 73 65 20 69 6e 74 65 72 72 75 70 |h mouse interrup| 00000ec0 74 2e 20 57 68 65 6e 20 61 20 63 6f 6f 72 64 69 |t. When a coordi| 00000ed0 6e 61 74 65 20 65 69 74 68 65 72 20 65 78 63 65 |nate either exce| 00000ee0 65 64 73 20 26 38 38 20 6f 72 20 69 73 20 6c 65 |eds &88 or is le| 00000ef0 73 73 0d 74 68 61 74 20 26 37 38 20 74 68 65 6e |ss.that &78 then| 00000f00 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 | the appropriate| 00000f10 20 6e 65 67 61 74 69 76 65 20 49 4e 4b 45 59 20 | negative INKEY | 00000f20 77 69 6c 6c 20 62 65 20 73 69 6d 75 6c 61 74 65 |will be simulate| 00000f30 64 20 61 6e 64 20 74 68 65 0d 63 6f 6f 72 64 69 |d and the.coordi| 00000f40 6e 61 74 65 20 72 65 73 65 74 20 74 6f 20 26 38 |nate reset to &8| 00000f50 30 20 72 65 61 64 79 20 74 6f 20 62 65 20 69 6e |0 ready to be in| 00000f60 63 72 65 6d 65 6e 74 65 64 20 6f 72 20 64 65 63 |cremented or dec| 00000f70 72 65 6d 65 6e 74 65 64 20 61 67 61 69 6e 2e 20 |remented again. | 00000f80 54 68 69 73 0d 70 72 6f 76 69 64 65 73 20 74 68 |This.provides th| 00000f90 65 20 72 65 71 75 69 72 65 64 20 6d 6f 76 65 6d |e required movem| 00000fa0 65 6e 74 20 62 75 66 66 65 72 69 6e 67 20 61 6e |ent buffering an| 00000fb0 64 20 74 68 65 20 73 65 6e 73 69 74 69 76 69 74 |d the sensitivit| 00000fc0 79 20 6f 66 20 74 68 65 0d 70 72 6f 63 65 73 73 |y of the.process| 00000fd0 20 63 61 6e 20 62 65 20 61 64 6a 75 73 74 65 64 | can be adjusted| 00000fe0 20 62 79 20 65 64 69 74 69 6e 67 20 6c 69 6e 65 | by editing line| 00000ff0 73 20 31 32 38 30 2c 20 31 33 35 30 2c 20 31 34 |s 1280, 1350, 14| 00001000 35 30 20 61 6e 64 20 31 35 32 30 2e 0d 0d 54 68 |50 and 1520...Th| 00001010 65 20 69 64 65 61 73 20 64 65 6d 6f 6e 73 74 72 |e ideas demonstr| 00001020 61 74 65 64 20 69 6e 20 4e 45 57 4b 45 59 53 20 |ated in NEWKEYS | 00001030 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 |are implemented | 00001040 69 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 20 4c |in the program L| 00001050 4f 41 44 45 52 0d 77 68 69 63 68 20 77 69 6c 6c |OADER.which will| 00001060 20 62 65 20 62 72 6f 61 64 63 61 73 74 20 77 69 | be broadcast wi| 00001070 74 68 20 74 68 69 73 20 6d 6f 64 75 6c 65 2e 20 |th this module. | 00001080 54 68 69 73 20 69 73 20 61 20 70 72 6f 67 72 61 |This is a progra| 00001090 6d 2c 20 77 72 69 74 74 65 6e 20 62 79 0d 4a 65 |m, written by.Je| 000010a0 72 65 6d 79 20 42 72 61 79 73 68 61 77 2c 20 77 |remy Brayshaw, w| 000010b0 68 69 63 68 20 63 61 6e 20 62 65 20 75 73 65 64 |hich can be used| 000010c0 20 74 6f 20 61 75 74 6f 6d 61 74 69 63 6c 79 20 | to automaticly | 000010d0 64 6f 77 6e 6c 6f 61 64 20 54 65 6c 65 73 6f 66 |download Telesof| 000010e0 74 77 61 72 65 0d 66 69 6c 65 73 20 75 73 69 6e |tware.files usin| 000010f0 67 20 61 6e 20 41 63 6f 72 6e 20 54 65 6c 65 74 |g an Acorn Telet| 00001100 65 78 74 20 61 64 61 70 74 6f 72 2e 20 54 68 65 |ext adaptor. The| 00001110 20 70 72 6f 67 72 61 6d 20 68 61 73 20 62 65 65 | program has bee| 00001120 6e 20 6d 6f 64 69 66 69 65 64 20 73 6f 0d 74 68 |n modified so.th| 00001130 61 74 20 65 69 74 68 65 72 20 74 68 65 20 43 75 |at either the Cu| 00001140 72 73 6f 72 20 6b 65 79 73 20 77 69 74 68 20 74 |rsor keys with t| 00001150 68 65 20 53 70 61 63 65 20 62 61 72 20 61 6e 64 |he Space bar and| 00001160 20 74 68 65 20 52 65 74 75 72 6e 20 6b 65 79 2c | the Return key,| 00001170 20 6f 72 20 74 68 65 0d 6d 6f 75 73 65 2c 20 6f | or the.mouse, o| 00001180 72 20 61 6e 79 20 63 6f 6d 62 69 6e 61 74 69 6f |r any combinatio| 00001190 6e 20 6f 66 20 62 6f 74 68 20 6b 65 79 62 6f 61 |n of both keyboa| 000011a0 72 64 20 61 6e 64 20 6d 6f 75 73 65 20 63 61 6e |rd and mouse can| 000011b0 20 62 65 20 75 73 65 64 20 74 6f 20 73 65 6c 65 | be used to sele| 000011c0 63 74 0d 61 6e 64 20 64 6f 77 6e 6c 6f 61 64 20 |ct.and download | 000011d0 66 69 6c 65 73 20 66 72 6f 6d 20 74 68 65 20 54 |files from the T| 000011e0 65 6c 65 73 6f 66 74 77 61 72 65 20 6d 65 6e 75 |elesoftware menu| 000011f0 2e 0d 0d 0d 20 20 20 31 30 20 52 45 4d 3e 20 4e |.... 10 REM> N| 00001200 45 57 4b 45 59 53 0d 20 20 20 32 30 20 44 49 4d |EWKEYS. 20 DIM| 00001210 20 6d 63 6f 64 65 20 26 32 30 30 20 3a 52 45 4d | mcode &200 :REM| 00001220 3a 20 6d 61 63 68 69 6e 65 20 63 6f 64 65 20 61 |: machine code a| 00001230 74 20 6d 63 6f 64 65 0d 20 20 20 33 30 20 73 61 |t mcode. 30 sa| 00001240 76 65 72 65 67 3d 26 46 43 20 3a 52 45 4d 3a 20 |vereg=&FC :REM: | 00001250 69 6e 74 65 72 72 75 70 74 20 61 63 63 75 6d 75 |interrupt accumu| 00001260 6c 61 74 6f 72 20 73 61 76 65 20 72 65 67 69 73 |lator save regis| 00001270 74 65 72 0d 20 20 20 34 30 20 69 72 71 31 76 3d |ter. 40 irq1v=| 00001280 26 32 30 34 20 3a 52 45 4d 3a 20 70 72 69 6d 61 |&204 :REM: prima| 00001290 72 79 20 69 6e 74 65 72 72 75 70 74 20 76 65 63 |ry interrupt vec| 000012a0 74 6f 72 0d 20 20 20 35 30 20 62 79 74 65 76 3d |tor. 50 bytev=| 000012b0 26 32 30 41 20 3a 52 45 4d 3a 20 4f 73 62 79 74 |&20A :REM: Osbyt| 000012c0 65 20 69 6e 64 69 72 65 63 74 69 6f 6e 20 76 65 |e indirection ve| 000012d0 63 74 6f 72 0d 20 20 20 36 30 20 64 72 62 3d 26 |ctor. 60 drb=&| 000012e0 46 45 36 30 20 3a 52 45 4d 3a 20 64 61 74 61 20 |FE60 :REM: data | 000012f0 72 65 67 69 73 74 65 72 20 42 0d 20 20 20 37 30 |register B. 70| 00001300 20 64 64 72 62 3d 26 46 45 36 32 20 3a 52 45 4d | ddrb=&FE62 :REM| 00001310 3a 20 64 61 74 61 20 64 69 72 65 63 74 69 6f 6e |: data direction| 00001320 20 72 65 67 69 73 74 65 72 20 42 0d 20 20 20 38 | register B. 8| 00001330 30 20 70 63 72 3d 26 46 45 36 43 20 3a 52 45 4d |0 pcr=&FE6C :REM| 00001340 3a 20 70 65 72 69 70 68 65 72 61 6c 20 63 6f 6e |: peripheral con| 00001350 74 72 6f 6c 20 72 65 67 69 73 74 65 72 0d 20 20 |trol register. | 00001360 20 39 30 20 69 66 72 3d 26 46 45 36 44 20 3a 52 | 90 ifr=&FE6D :R| 00001370 45 4d 3a 20 69 6e 74 65 72 72 75 70 74 20 66 6c |EM: interrupt fl| 00001380 61 67 20 72 65 67 69 73 74 65 72 0d 20 20 31 30 |ag register. 10| 00001390 30 20 69 65 72 3d 26 46 45 36 45 20 3a 52 45 4d |0 ier=&FE6E :REM| 000013a0 3a 20 69 6e 74 65 72 72 75 70 74 20 65 6e 61 62 |: interrupt enab| 000013b0 6c 65 20 72 65 67 69 73 74 65 72 0d 20 20 31 31 |le register. 11| 000013c0 30 20 46 4f 52 20 70 61 73 73 3d 30 20 54 4f 20 |0 FOR pass=0 TO | 000013d0 32 20 53 54 45 50 20 32 0d 20 20 31 32 30 20 50 |2 STEP 2. 120 P| 000013e0 25 3d 6d 63 6f 64 65 0d 20 20 31 33 30 20 5b 20 |%=mcode. 130 [ | 000013f0 20 20 20 20 20 20 4f 50 54 20 70 61 73 73 0d 20 | OPT pass. | 00001400 20 31 34 30 20 20 20 20 20 20 20 20 20 4c 44 58 | 140 LDX| 00001410 20 69 72 71 31 76 20 20 20 20 20 5c 20 63 75 72 | irq1v \ cur| 00001420 72 65 6e 74 20 70 72 69 6d 61 72 79 20 69 6e 74 |rent primary int| 00001430 65 72 72 75 70 74 20 76 65 63 74 6f 72 2c 20 6c |errupt vector, l| 00001440 6f 77 20 62 79 74 65 0d 20 20 31 35 30 20 20 20 |ow byte. 150 | 00001450 20 20 20 20 20 20 4c 44 59 20 69 72 71 31 76 2b | LDY irq1v+| 00001460 31 20 20 20 5c 20 63 75 72 72 65 6e 74 20 70 72 |1 \ current pr| 00001470 69 6d 61 72 79 20 69 6e 74 65 72 72 75 70 74 20 |imary interrupt | 00001480 76 65 63 74 6f 72 2c 20 68 69 67 68 20 62 79 74 |vector, high byt| 00001490 65 0d 20 20 31 36 30 20 20 20 20 20 20 20 20 20 |e. 160 | 000014a0 43 50 59 20 23 69 6e 74 65 72 72 75 70 74 20 44 |CPY #interrupt D| 000014b0 49 56 20 32 35 36 20 5c 20 63 6f 6d 70 61 72 65 |IV 256 \ compare| 000014c0 20 68 69 67 68 20 62 79 74 65 0d 20 20 31 37 30 | high byte. 170| 000014d0 20 20 20 20 20 20 20 20 20 42 45 51 20 64 69 73 | BEQ dis| 000014e0 61 62 6c 65 20 20 20 5c 20 72 65 73 74 6f 72 65 |able \ restore| 000014f0 20 6f 6c 64 20 76 65 63 74 6f 72 20 69 66 20 69 | old vector if i| 00001500 72 71 31 76 20 61 6c 74 65 72 65 64 0d 20 20 31 |rq1v altered. 1| 00001510 38 30 20 20 20 20 20 20 20 20 20 53 54 58 20 6f |80 STX o| 00001520 6c 64 69 72 71 31 76 20 20 5c 20 73 61 76 65 20 |ldirq1v \ save | 00001530 6f 72 69 67 69 6e 61 6c 20 69 72 71 31 20 76 65 |original irq1 ve| 00001540 63 74 6f 72 2c 20 6c 6f 77 20 62 79 74 65 0d 20 |ctor, low byte. | 00001550 20 31 39 30 20 20 20 20 20 20 20 20 20 53 54 59 | 190 STY| 00001560 20 6f 6c 64 69 72 71 31 76 2b 31 20 5c 20 73 61 | oldirq1v+1 \ sa| 00001570 76 65 20 6f 72 69 67 69 6e 61 6c 20 69 72 71 31 |ve original irq1| 00001580 20 76 65 63 74 6f 72 2c 20 68 69 67 68 20 62 79 | vector, high by| 00001590 74 65 0d 20 20 32 30 30 20 20 20 20 20 20 20 20 |te. 200 | 000015a0 20 4c 44 58 20 62 79 74 65 76 20 20 20 20 20 5c | LDX bytev \| 000015b0 20 4f 73 62 79 74 65 20 69 6e 64 69 72 65 63 74 | Osbyte indirect| 000015c0 69 6f 6e 20 76 65 63 74 6f 72 2c 20 6c 6f 77 20 |ion vector, low | 000015d0 62 79 74 65 0d 20 20 32 31 30 20 20 20 20 20 20 |byte. 210 | 000015e0 20 20 20 4c 44 59 20 62 79 74 65 76 2b 31 20 20 | LDY bytev+1 | 000015f0 20 5c 20 4f 73 62 79 74 65 20 69 6e 64 69 72 65 | \ Osbyte indire| 00001600 63 74 69 6f 6e 20 76 65 63 74 6f 72 2c 20 68 69 |ction vector, hi| 00001610 67 68 20 62 79 74 65 0d 20 20 32 32 30 20 20 20 |gh byte. 220 | 00001620 20 20 20 20 20 20 53 54 58 20 6f 6c 64 62 79 74 | STX oldbyt| 00001630 65 76 20 20 5c 20 73 61 76 65 20 6f 72 69 67 69 |ev \ save origi| 00001640 6e 61 6c 20 4f 73 62 79 74 65 20 76 65 63 74 6f |nal Osbyte vecto| 00001650 72 2c 20 6c 6f 77 20 62 79 74 65 0d 20 20 32 33 |r, low byte. 23| 00001660 30 20 20 20 20 20 20 20 20 20 53 54 59 20 6f 6c |0 STY ol| 00001670 64 62 79 74 65 76 2b 31 20 5c 20 73 61 76 65 20 |dbytev+1 \ save | 00001680 6f 72 69 67 69 6e 61 6c 20 4f 73 62 79 74 65 20 |original Osbyte | 00001690 76 65 63 74 6f 72 2c 20 68 69 67 68 20 62 79 74 |vector, high byt| 000016a0 65 0d 20 20 32 34 30 20 20 20 20 20 20 20 20 20 |e. 240 | 000016b0 4c 44 58 20 23 69 6e 74 65 72 72 75 70 74 20 4d |LDX #interrupt M| 000016c0 4f 44 20 32 35 36 20 5c 20 6e 65 77 20 69 72 71 |OD 256 \ new irq| 000016d0 31 20 76 65 63 74 6f 72 2c 20 6c 6f 77 20 62 79 |1 vector, low by| 000016e0 74 65 0d 20 20 32 35 30 20 20 20 20 20 20 20 20 |te. 250 | 000016f0 20 4c 44 59 20 23 69 6e 74 65 72 72 75 70 74 20 | LDY #interrupt | 00001700 44 49 56 20 32 35 36 20 5c 20 6e 65 77 20 69 72 |DIV 256 \ new ir| 00001710 71 31 20 76 65 63 74 6f 72 2c 20 68 69 67 68 20 |q1 vector, high | 00001720 62 79 74 65 0d 20 20 32 36 30 20 20 20 20 20 20 |byte. 260 | 00001730 20 20 20 53 45 49 20 20 20 20 20 20 20 20 20 20 | SEI | 00001740 20 5c 20 73 65 74 20 69 6e 74 65 72 72 75 70 74 | \ set interrupt| 00001750 20 64 69 73 61 62 6c 65 20 66 6c 61 67 0d 20 20 | disable flag. | 00001760 32 37 30 20 20 20 20 20 20 20 20 20 53 54 58 20 |270 STX | 00001770 69 72 71 31 76 20 20 20 20 20 5c 20 61 6c 74 65 |irq1v \ alte| 00001780 72 20 69 72 71 31 20 76 65 63 74 6f 72 2c 20 6c |r irq1 vector, l| 00001790 6f 77 20 62 79 74 65 0d 20 20 32 38 30 20 20 20 |ow byte. 280 | 000017a0 20 20 20 20 20 20 53 54 59 20 69 72 71 31 76 2b | STY irq1v+| 000017b0 31 20 20 20 5c 20 61 6c 74 65 72 20 69 72 71 31 |1 \ alter irq1| 000017c0 20 76 65 63 74 6f 72 2c 20 68 69 67 68 20 62 79 | vector, high by| 000017d0 74 65 0d 20 20 32 39 30 20 20 20 20 20 20 20 20 |te. 290 | 000017e0 20 43 4c 49 20 20 20 20 20 20 20 20 20 20 20 5c | CLI \| 000017f0 20 63 6c 65 61 72 20 69 6e 74 65 72 72 75 70 74 | clear interrupt| 00001800 20 64 69 73 61 62 6c 65 20 66 6c 61 67 0d 20 20 | disable flag. | 00001810 33 30 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 |300 LDX | 00001820 23 6e 65 77 69 6e 6b 65 79 20 4d 4f 44 20 32 35 |#newinkey MOD 25| 00001830 36 20 5c 20 6e 65 77 20 4f 73 62 79 74 65 20 76 |6 \ new Osbyte v| 00001840 65 63 74 6f 72 2c 20 6c 6f 77 20 62 79 74 65 0d |ector, low byte.| 00001850 20 20 33 31 30 20 20 20 20 20 20 20 20 20 4c 44 | 310 LD| 00001860 59 20 23 6e 65 77 69 6e 6b 65 79 20 44 49 56 20 |Y #newinkey DIV | 00001870 32 35 36 20 5c 20 6e 65 77 20 4f 73 62 79 74 65 |256 \ new Osbyte| 00001880 20 76 65 63 74 6f 72 2c 20 68 69 67 68 20 62 79 | vector, high by| 00001890 74 65 0d 20 20 33 32 30 20 20 20 20 20 20 20 20 |te. 320 | 000018a0 20 53 54 58 20 62 79 74 65 76 20 20 20 20 20 5c | STX bytev \| 000018b0 20 61 6c 74 65 72 20 4f 73 62 79 74 65 20 76 65 | alter Osbyte ve| 000018c0 63 74 6f 72 2c 20 6c 6f 77 20 62 79 74 65 0d 20 |ctor, low byte. | 000018d0 20 33 33 30 20 20 20 20 20 20 20 20 20 53 54 59 | 330 STY| 000018e0 20 62 79 74 65 76 2b 31 20 20 20 5c 20 61 6c 74 | bytev+1 \ alt| 000018f0 65 72 20 4f 73 62 79 74 65 20 76 65 63 74 6f 72 |er Osbyte vector| 00001900 2c 20 68 69 67 68 20 62 79 74 65 0d 20 20 33 34 |, high byte. 34| 00001910 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 23 26 |0 LDA #&| 00001920 39 38 20 20 20 20 20 20 5c 20 25 31 30 30 31 31 |98 \ %10011| 00001930 30 30 30 2c 20 69 65 2e 20 65 6e 61 62 6c 65 20 |000, ie. enable | 00001940 43 42 31 2f 32 0d 20 20 33 35 30 20 20 20 20 20 |CB1/2. 350 | 00001950 20 20 20 20 53 54 41 20 69 65 72 20 20 20 20 20 | STA ier | 00001960 20 20 5c 20 69 6e 74 65 72 72 75 70 74 20 65 6e | \ interrupt en| 00001970 61 62 6c 65 20 72 65 67 69 73 74 65 72 0d 20 20 |able register. | 00001980 33 36 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 |360 LDA | 00001990 70 63 72 20 20 20 20 20 20 20 5c 20 70 65 72 69 |pcr \ peri| 000019a0 70 68 65 72 61 6c 20 63 6f 6e 74 72 6f 6c 20 72 |pheral control r| 000019b0 65 67 69 73 74 65 72 0d 20 20 33 37 30 20 20 20 |egister. 370 | 000019c0 20 20 20 20 20 20 41 4e 44 20 23 26 30 46 20 20 | AND #&0F | 000019d0 20 20 20 20 5c 20 41 4e 44 20 77 69 74 68 20 25 | \ AND with %| 000019e0 30 30 30 30 31 31 31 31 2c 20 69 65 20 63 6c 65 |00001111, ie cle| 000019f0 61 72 20 62 69 74 73 20 34 2d 37 0d 20 20 33 38 |ar bits 4-7. 38| 00001a00 30 20 20 20 20 20 20 20 20 20 4f 52 41 20 23 26 |0 ORA #&| 00001a10 35 30 20 20 20 20 20 20 5c 20 4f 52 20 77 69 74 |50 \ OR wit| 00001a20 68 20 25 30 31 30 31 30 30 30 30 2c 20 69 65 2e |h %01010000, ie.| 00001a30 20 73 65 74 20 62 69 74 73 20 34 20 61 6e 64 20 | set bits 4 and | 00001a40 36 0d 20 20 33 39 30 20 20 20 20 20 20 20 20 20 |6. 390 | 00001a50 53 54 41 20 70 63 72 20 20 20 20 20 20 20 5c 20 |STA pcr \ | 00001a60 69 6e 74 65 72 72 75 70 74 20 6f 6e 20 2b 76 65 |interrupt on +ve| 00001a70 20 74 72 61 6e 73 69 74 69 6f 6e 2c 20 43 42 32 | transition, CB2| 00001a80 20 69 6e 70 75 74 2c 0d 20 20 20 20 20 20 20 20 | input,. | 00001a90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00001aa0 20 20 20 20 5c 20 44 52 42 20 74 6f 20 63 6c 65 | \ DRB to cle| 00001ab0 61 72 0d 20 20 34 30 30 20 20 20 20 20 20 20 20 |ar. 400 | 00001ac0 20 4c 44 41 20 23 26 30 30 20 20 20 20 20 20 5c | LDA #&00 \| 00001ad0 20 75 73 65 72 20 70 6f 72 74 20 69 6e 70 75 74 | user port input| 00001ae0 0d 20 20 34 31 30 20 20 20 20 20 20 20 20 20 53 |. 410 S| 00001af0 54 41 20 64 64 72 62 20 20 20 20 20 20 5c 20 64 |TA ddrb \ d| 00001b00 61 74 61 20 64 69 72 65 63 74 69 6f 6e 20 72 65 |ata direction re| 00001b10 67 69 73 74 65 72 20 42 0d 20 20 34 32 30 20 20 |gister B. 420 | 00001b20 20 20 20 20 20 20 20 52 54 53 20 20 20 20 20 20 | RTS | 00001b30 20 20 20 20 20 5c 20 72 65 74 75 72 6e 20 74 6f | \ return to| 00001b40 20 42 41 53 49 43 0d 20 20 34 33 30 20 2e 64 69 | BASIC. 430 .di| 00001b50 73 61 62 6c 65 0d 20 20 34 34 30 20 20 20 20 20 |sable. 440 | 00001b60 20 20 20 20 4c 44 41 20 23 26 31 38 20 20 20 20 | LDA #&18 | 00001b70 20 20 5c 20 25 30 30 30 31 31 30 30 30 20 72 65 | \ %00011000 re| 00001b80 61 64 79 20 74 6f 20 63 6c 65 61 72 20 62 69 74 |ady to clear bit| 00001b90 73 20 33 20 61 6e 64 20 34 20 6f 66 20 69 65 72 |s 3 and 4 of ier| 00001ba0 0d 20 20 34 35 30 20 20 20 20 20 20 20 20 20 4c |. 450 L| 00001bb0 44 58 20 6f 6c 64 69 72 71 31 76 20 20 5c 20 6f |DX oldirq1v \ o| 00001bc0 72 69 67 69 6e 61 6c 20 69 72 71 31 20 76 65 63 |riginal irq1 vec| 00001bd0 74 6f 72 2c 20 6c 6f 77 20 62 79 74 65 0d 20 20 |tor, low byte. | 00001be0 34 36 30 20 20 20 20 20 20 20 20 20 4c 44 59 20 |460 LDY | 00001bf0 6f 6c 64 69 72 71 31 76 2b 31 20 5c 20 6f 72 69 |oldirq1v+1 \ ori| 00001c00 67 69 6e 61 6c 20 69 72 71 31 20 76 65 63 74 6f |ginal irq1 vecto| 00001c10 72 2c 20 68 69 67 68 20 62 79 74 65 0d 20 20 34 |r, high byte. 4| 00001c20 37 30 20 20 20 20 20 20 20 20 20 53 45 49 20 20 |70 SEI | 00001c30 20 20 20 20 20 20 20 20 20 5c 20 73 65 74 20 69 | \ set i| 00001c40 6e 74 65 72 72 75 70 74 20 64 69 73 61 62 6c 65 |nterrupt disable| 00001c50 20 66 6c 61 67 0d 20 20 34 38 30 20 20 20 20 20 | flag. 480 | 00001c60 20 20 20 20 53 54 41 20 69 65 72 20 20 20 20 20 | STA ier | 00001c70 20 20 5c 20 69 6e 74 65 72 72 75 70 74 20 65 6e | \ interrupt en| 00001c80 61 62 6c 65 20 72 65 67 69 73 74 65 72 0d 20 20 |able register. | 00001c90 34 39 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 |490 LDA | 00001ca0 70 63 72 20 20 20 20 20 20 20 5c 20 70 65 72 69 |pcr \ peri| 00001cb0 70 68 65 72 61 6c 20 63 6f 6e 74 72 6f 6c 20 72 |pheral control r| 00001cc0 65 67 69 73 74 65 72 0d 20 20 35 30 30 20 20 20 |egister. 500 | 00001cd0 20 20 20 20 20 20 41 4e 44 20 23 26 30 46 20 20 | AND #&0F | 00001ce0 20 20 20 20 5c 20 63 6c 65 61 72 20 62 69 74 73 | \ clear bits| 00001cf0 20 34 2d 37 0d 20 20 35 31 30 20 20 20 20 20 20 | 4-7. 510 | 00001d00 20 20 20 53 54 41 20 70 63 72 20 20 20 20 20 20 | STA pcr | 00001d10 20 5c 20 70 65 72 69 70 68 65 72 61 6c 20 63 6f | \ peripheral co| 00001d20 6e 74 72 6f 6c 20 72 65 67 69 73 74 65 72 0d 20 |ntrol register. | 00001d30 20 35 32 30 20 20 20 20 20 20 20 20 20 53 54 58 | 520 STX| 00001d40 20 69 72 71 31 76 20 20 20 20 20 5c 20 72 65 73 | irq1v \ res| 00001d50 74 6f 72 65 20 69 72 71 31 20 76 65 63 74 6f 72 |tore irq1 vector| 00001d60 2c 20 6c 6f 77 20 62 79 74 65 0d 20 20 35 33 30 |, low byte. 530| 00001d70 20 20 20 20 20 20 20 20 20 53 54 59 20 69 72 71 | STY irq| 00001d80 31 76 2b 31 20 20 20 5c 20 72 65 73 74 6f 72 65 |1v+1 \ restore| 00001d90 20 69 72 71 31 20 76 65 63 74 6f 72 2c 20 68 69 | irq1 vector, hi| 00001da0 67 68 20 62 79 74 65 0d 20 20 35 34 30 20 20 20 |gh byte. 540 | 00001db0 20 20 20 20 20 20 43 4c 49 20 20 20 20 20 20 20 | CLI | 00001dc0 20 20 20 20 5c 20 63 6c 65 61 72 20 69 6e 74 65 | \ clear inte| 00001dd0 72 72 75 70 74 20 64 69 73 61 62 6c 65 20 66 6c |rrupt disable fl| 00001de0 61 67 0d 20 20 35 35 30 20 20 20 20 20 20 20 20 |ag. 550 | 00001df0 20 4c 44 58 20 6f 6c 64 62 79 74 65 76 20 20 5c | LDX oldbytev \| 00001e00 20 6f 72 69 67 69 6e 61 6c 20 4f 73 62 79 74 65 | original Osbyte| 00001e10 20 76 65 63 74 6f 72 2c 20 6c 6f 77 20 62 79 74 | vector, low byt| 00001e20 65 0d 20 20 35 36 30 20 20 20 20 20 20 20 20 20 |e. 560 | 00001e30 4c 44 59 20 6f 6c 64 62 79 74 65 76 2b 31 20 5c |LDY oldbytev+1 \| 00001e40 20 6f 72 69 67 69 6e 61 6c 20 4f 73 62 79 74 65 | original Osbyte| 00001e50 20 76 65 63 74 6f 72 2c 20 68 69 67 68 20 62 79 | vector, high by| 00001e60 74 65 0d 20 20 35 37 30 20 20 20 20 20 20 20 20 |te. 570 | 00001e70 20 53 54 58 20 62 79 74 65 76 20 20 20 20 20 5c | STX bytev \| 00001e80 20 72 65 73 74 6f 72 65 20 4f 73 62 79 74 65 20 | restore Osbyte | 00001e90 76 65 63 74 6f 72 2c 20 6c 6f 77 20 62 79 74 65 |vector, low byte| 00001ea0 0d 20 20 35 38 30 20 20 20 20 20 20 20 20 20 53 |. 580 S| 00001eb0 54 59 20 62 79 74 65 76 2b 31 20 20 20 5c 20 72 |TY bytev+1 \ r| 00001ec0 65 73 74 6f 72 65 20 4f 73 62 79 74 65 20 76 65 |estore Osbyte ve| 00001ed0 63 74 6f 72 2c 20 68 69 67 68 20 62 79 74 65 0d |ctor, high byte.| 00001ee0 20 20 35 39 30 20 20 20 20 20 20 20 20 20 52 54 | 590 RT| 00001ef0 53 20 20 20 20 20 20 20 20 20 20 20 5c 20 72 65 |S \ re| 00001f00 74 75 72 6e 20 74 6f 20 42 41 53 49 43 0d 20 20 |turn to BASIC. | 00001f10 36 30 30 20 2e 69 6e 74 65 72 72 75 70 74 0d 20 |600 .interrupt. | 00001f20 20 36 31 30 20 20 20 20 20 20 20 20 20 4c 44 41 | 610 LDA| 00001f30 20 73 61 76 65 72 65 67 20 20 20 5c 20 69 6e 74 | savereg \ int| 00001f40 65 72 72 75 70 74 20 61 63 63 75 6d 75 6c 61 74 |errupt accumulat| 00001f50 6f 72 20 73 61 76 65 20 72 65 67 69 73 74 65 72 |or save register| 00001f60 0d 20 20 36 32 30 20 20 20 20 20 20 20 20 20 50 |. 620 P| 00001f70 48 41 20 20 20 20 20 20 20 20 20 20 20 5c 20 61 |HA \ a| 00001f80 6e 64 20 70 75 73 68 20 69 74 20 6f 6e 20 74 68 |nd push it on th| 00001f90 65 20 73 74 61 63 6b 0d 20 20 36 33 30 20 20 20 |e stack. 630 | 00001fa0 20 20 20 20 20 20 4c 44 41 20 69 66 72 20 20 20 | LDA ifr | 00001fb0 20 20 20 20 5c 20 69 6e 74 65 72 72 75 70 74 20 | \ interrupt | 00001fc0 66 6c 61 67 20 72 65 67 69 73 74 65 72 0d 20 20 |flag register. | 00001fd0 36 34 30 20 20 20 20 20 20 20 20 20 42 50 4c 20 |640 BPL | 00001fe0 6e 6f 74 75 73 65 72 20 20 20 5c 20 62 69 74 20 |notuser \ bit | 00001ff0 37 20 69 73 20 73 65 74 20 69 66 20 56 49 41 2d |7 is set if VIA-| 00002000 42 20 69 6e 74 65 72 72 75 70 74 0d 20 20 36 35 |B interrupt. 65| 00002010 30 20 20 20 20 20 20 20 20 20 41 4e 44 20 23 26 |0 AND #&| 00002020 31 38 20 20 20 20 20 20 5c 20 41 4e 44 20 77 69 |18 \ AND wi| 00002030 74 68 20 25 30 30 30 31 31 30 30 30 2c 20 69 65 |th %00011000, ie| 00002040 2e 20 74 65 73 74 20 62 69 74 73 20 33 20 61 6e |. test bits 3 an| 00002050 64 20 34 0d 20 20 36 36 30 20 20 20 20 20 20 20 |d 4. 660 | 00002060 20 20 42 45 51 20 6e 6f 74 75 73 65 72 20 20 20 | BEQ notuser | 00002070 5c 20 65 78 69 74 20 69 66 20 6e 6f 74 20 43 42 |\ exit if not CB| 00002080 31 20 6f 72 20 43 42 32 0d 20 20 36 37 30 20 20 |1 or CB2. 670 | 00002090 20 20 20 20 20 20 20 41 4e 44 20 23 26 31 30 20 | AND #&10 | 000020a0 20 20 20 20 20 5c 20 41 4e 44 20 77 69 74 68 20 | \ AND with | 000020b0 25 30 30 30 31 30 30 30 30 2c 20 69 65 2e 20 74 |%00010000, ie. t| 000020c0 65 73 74 20 43 42 31 0d 20 20 36 38 30 20 20 20 |est CB1. 680 | 000020d0 20 20 20 20 20 20 42 4e 45 20 78 70 75 6c 73 65 | BNE xpulse| 000020e0 20 20 20 20 5c 20 62 69 74 20 34 20 73 65 74 20 | \ bit 4 set | 000020f0 66 6f 72 20 61 6e 20 58 20 64 69 72 65 63 74 69 |for an X directi| 00002100 6f 6e 20 6d 6f 76 65 6d 65 6e 74 0d 20 20 36 39 |on movement. 69| 00002110 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 64 72 |0 LDA dr| 00002120 62 20 20 20 20 20 20 20 5c 20 59 20 64 69 72 65 |b \ Y dire| 00002130 63 74 69 6f 6e 2c 20 6c 6f 61 64 20 64 61 74 61 |ction, load data| 00002140 20 72 65 67 69 73 74 65 72 20 42 0d 20 20 37 30 | register B. 70| 00002150 30 20 20 20 20 20 20 20 20 20 41 4e 44 20 23 26 |0 AND #&| 00002160 30 34 20 20 20 20 20 20 5c 20 41 4e 44 20 77 69 |04 \ AND wi| 00002170 74 68 20 25 30 30 30 30 30 31 30 30 2c 20 69 65 |th %00000100, ie| 00002180 2e 20 74 65 73 74 20 62 69 74 20 32 0d 20 20 37 |. test bit 2. 7| 00002190 31 30 20 20 20 20 20 20 20 20 20 42 4e 45 20 79 |10 BNE y| 000021a0 64 6f 77 6e 20 20 20 20 20 5c 20 69 66 20 62 69 |down \ if bi| 000021b0 74 20 32 20 69 73 20 73 65 74 20 74 68 65 6e 20 |t 2 is set then | 000021c0 59 20 69 73 20 67 6f 69 6e 67 20 64 6f 77 6e 0d |Y is going down.| 000021d0 20 20 37 32 30 20 20 20 20 20 20 20 20 20 49 4e | 720 IN| 000021e0 43 20 79 63 6f 6f 72 64 20 20 20 20 5c 20 59 20 |C ycoord \ Y | 000021f0 69 73 20 67 6f 69 6e 67 20 75 70 20 73 6f 20 69 |is going up so i| 00002200 6e 63 72 65 6d 65 6e 74 20 59 20 63 6f 6f 72 64 |ncrement Y coord| 00002210 69 6e 61 74 65 0d 20 20 37 33 30 20 20 20 20 20 |inate. 730 | 00002220 20 20 20 20 42 4e 45 20 65 78 69 74 20 20 20 20 | BNE exit | 00002230 20 20 5c 20 62 72 61 6e 63 68 20 69 66 20 69 6e | \ branch if in| 00002240 20 74 68 65 20 72 61 6e 67 65 20 31 20 74 6f 20 | the range 1 to | 00002250 32 35 35 0d 20 20 37 34 30 20 20 20 20 20 20 20 |255. 740 | 00002260 20 20 42 45 51 20 64 65 63 79 20 20 20 20 20 20 | BEQ decy | 00002270 5c 20 69 66 20 7a 65 72 6f 20 74 68 65 6e 20 61 |\ if zero then a| 00002280 6c 74 65 72 20 74 6f 20 32 35 35 0d 20 20 37 35 |lter to 255. 75| 00002290 30 20 2e 79 64 6f 77 6e 0d 20 20 37 36 30 20 20 |0 .ydown. 760 | 000022a0 20 20 20 20 20 20 20 4c 44 41 20 79 63 6f 6f 72 | LDA ycoor| 000022b0 64 20 20 20 20 5c 20 6c 6f 61 64 20 59 20 63 6f |d \ load Y co| 000022c0 6f 72 64 69 6e 61 74 65 0d 20 20 37 37 30 20 20 |ordinate. 770 | 000022d0 20 20 20 20 20 20 20 42 45 51 20 65 78 69 74 20 | BEQ exit | 000022e0 20 20 20 20 20 5c 20 62 72 61 6e 63 68 20 69 66 | \ branch if| 000022f0 20 7a 65 72 6f 20 62 65 63 61 75 73 65 20 69 74 | zero because it| 00002300 20 63 61 6e 27 74 20 67 6f 20 61 6e 79 20 6c 6f | can't go any lo| 00002310 77 65 72 0d 20 20 37 38 30 20 2e 64 65 63 79 0d |wer. 780 .decy.| 00002320 20 20 37 39 30 20 20 20 20 20 20 20 20 20 44 45 | 790 DE| 00002330 43 20 79 63 6f 6f 72 64 20 20 20 20 5c 20 72 65 |C ycoord \ re| 00002340 64 75 63 65 20 59 20 63 6f 6f 72 64 69 6e 61 74 |duce Y coordinat| 00002350 65 20 62 79 20 31 0d 20 20 38 30 30 20 20 20 20 |e by 1. 800 | 00002360 20 20 20 20 20 4a 4d 50 20 65 78 69 74 20 20 20 | JMP exit | 00002370 20 20 20 5c 20 72 65 73 74 6f 72 65 20 69 6e 74 | \ restore int| 00002380 65 72 72 75 70 74 20 61 63 63 75 6d 75 6c 61 74 |errupt accumulat| 00002390 6f 72 20 73 61 76 65 20 72 65 67 69 73 74 65 72 |or save register| 000023a0 0d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 000023b0 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 61 | \ a| 000023c0 6e 64 20 52 54 49 0d 20 20 38 31 30 20 2e 78 70 |nd RTI. 810 .xp| 000023d0 75 6c 73 65 0d 20 20 38 32 30 20 20 20 20 20 20 |ulse. 820 | 000023e0 20 20 20 4c 44 41 20 64 72 62 20 20 20 20 20 20 | LDA drb | 000023f0 20 5c 20 6c 6f 61 64 20 69 6e 70 75 74 20 72 65 | \ load input re| 00002400 67 69 73 74 65 72 20 42 0d 20 20 38 33 30 20 20 |gister B. 830 | 00002410 20 20 20 20 20 20 20 52 4f 52 20 41 20 20 20 20 | ROR A | 00002420 20 20 20 20 20 5c 20 62 69 74 20 30 20 69 6e 74 | \ bit 0 int| 00002430 6f 20 63 61 72 72 79 0d 20 20 38 34 30 20 20 20 |o carry. 840 | 00002440 20 20 20 20 20 20 42 43 53 20 78 64 6f 77 6e 20 | BCS xdown | 00002450 20 20 20 20 5c 20 58 20 69 73 20 67 6f 69 6e 67 | \ X is going| 00002460 20 64 6f 77 6e 20 69 66 20 62 69 74 20 30 20 69 | down if bit 0 i| 00002470 73 20 73 65 74 0d 20 20 38 35 30 20 20 20 20 20 |s set. 850 | 00002480 20 20 20 20 49 4e 43 20 78 63 6f 6f 72 64 20 20 | INC xcoord | 00002490 20 20 5c 20 58 20 69 73 20 67 6f 69 6e 67 20 75 | \ X is going u| 000024a0 70 20 69 66 20 62 69 74 20 30 20 69 73 20 63 6c |p if bit 0 is cl| 000024b0 65 61 72 0d 20 20 38 36 30 20 20 20 20 20 20 20 |ear. 860 | 000024c0 20 20 42 4e 45 20 65 78 69 74 20 20 20 20 20 20 | BNE exit | 000024d0 5c 20 65 78 69 74 20 69 66 20 58 20 63 6f 6f 72 |\ exit if X coor| 000024e0 64 69 6e 61 74 65 20 69 73 20 69 6e 20 74 68 65 |dinate is in the| 000024f0 20 72 61 6e 67 65 20 66 72 6f 6d 0d 20 20 20 20 | range from. | 00002500 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00002510 20 20 20 20 20 20 20 20 5c 20 31 20 74 6f 20 32 | \ 1 to 2| 00002520 35 35 0d 20 20 38 37 30 20 20 20 20 20 20 20 20 |55. 870 | 00002530 20 42 45 51 20 64 65 63 78 20 20 20 20 20 20 5c | BEQ decx \| 00002540 20 69 66 20 58 20 63 6f 6f 72 64 69 6e 61 74 65 | if X coordinate| 00002550 20 3d 20 30 20 74 68 65 6e 20 6d 61 6b 65 20 69 | = 0 then make i| 00002560 74 20 32 35 35 0d 20 20 38 38 30 20 2e 78 64 6f |t 255. 880 .xdo| 00002570 77 6e 0d 20 20 38 39 30 20 20 20 20 20 20 20 20 |wn. 890 | 00002580 20 4c 44 41 20 78 63 6f 6f 72 64 20 20 20 20 5c | LDA xcoord \| 00002590 20 6c 6f 61 64 20 58 20 63 6f 6f 72 64 69 6e 61 | load X coordina| 000025a0 74 65 0d 20 20 39 30 30 20 20 20 20 20 20 20 20 |te. 900 | 000025b0 20 42 45 51 20 65 78 69 74 20 20 20 20 20 20 5c | BEQ exit \| 000025c0 20 69 66 20 69 74 20 69 73 20 7a 65 72 6f 20 69 | if it is zero i| 000025d0 74 20 63 61 6e 27 74 20 67 6f 20 61 6e 79 20 6c |t can't go any l| 000025e0 6f 77 65 72 0d 20 20 39 31 30 20 2e 64 65 63 78 |ower. 910 .decx| 000025f0 0d 20 20 39 32 30 20 20 20 20 20 20 20 20 20 44 |. 920 D| 00002600 45 43 20 78 63 6f 6f 72 64 20 20 20 20 5c 20 64 |EC xcoord \ d| 00002610 65 63 72 65 61 73 65 20 58 20 63 6f 6f 72 64 69 |ecrease X coordi| 00002620 6e 61 74 65 20 62 79 20 31 0d 20 20 39 33 30 20 |nate by 1. 930 | 00002630 2e 65 78 69 74 0d 20 20 39 34 30 20 20 20 20 20 |.exit. 940 | 00002640 20 20 20 20 50 4c 41 20 20 20 20 20 20 20 20 20 | PLA | 00002650 20 20 5c 20 70 75 6c 6c 20 69 6e 74 65 72 72 75 | \ pull interru| 00002660 70 74 20 61 63 63 75 6d 75 6c 61 74 6f 72 20 73 |pt accumulator s| 00002670 61 76 65 20 72 65 67 69 73 74 65 72 0d 20 20 20 |ave register. | 00002680 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00002690 20 20 20 20 20 20 20 20 20 5c 20 6f 66 66 20 74 | \ off t| 000026a0 68 65 20 73 74 61 63 6b 0d 20 20 39 35 30 20 20 |he stack. 950 | 000026b0 20 20 20 20 20 20 20 53 54 41 20 73 61 76 65 72 | STA saver| 000026c0 65 67 20 20 20 5c 20 61 6e 64 20 72 65 73 74 6f |eg \ and resto| 000026d0 72 65 20 7a 65 72 6f 20 70 61 67 65 0d 20 20 39 |re zero page. 9| 000026e0 36 30 20 20 20 20 20 20 20 20 20 52 54 49 20 20 |60 RTI | 000026f0 20 20 20 20 20 20 20 20 20 5c 20 72 65 74 75 72 | \ retur| 00002700 6e 20 66 72 6f 6d 20 69 6e 74 65 72 72 75 70 74 |n from interrupt| 00002710 0d 20 20 39 37 30 20 2e 6e 6f 74 75 73 65 72 0d |. 970 .notuser.| 00002720 20 20 39 38 30 20 20 20 20 20 20 20 20 20 50 4c | 980 PL| 00002730 41 20 20 20 20 20 20 20 20 20 20 20 5c 20 70 75 |A \ pu| 00002740 6c 6c 20 74 68 65 20 69 6e 74 65 72 72 75 70 74 |ll the interrupt| 00002750 20 61 63 63 75 6d 75 6c 61 74 6f 72 20 73 61 76 | accumulator sav| 00002760 65 0d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |e. | 00002770 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 00002780 72 65 67 69 73 74 65 72 20 6f 66 66 20 74 68 65 |register off the| 00002790 20 73 74 61 63 6b 0d 20 20 39 39 30 20 20 20 20 | stack. 990 | 000027a0 20 20 20 20 20 53 54 41 20 73 61 76 65 72 65 67 | STA savereg| 000027b0 20 20 20 5c 20 72 65 73 74 6f 72 65 20 74 68 65 | \ restore the| 000027c0 20 7a 65 72 6f 20 70 61 67 65 20 61 64 64 72 65 | zero page addre| 000027d0 73 73 0d 20 31 30 30 30 20 20 20 20 20 20 20 20 |ss. 1000 | 000027e0 20 4a 4d 50 20 28 6f 6c 64 69 72 71 31 76 29 20 | JMP (oldirq1v) | 000027f0 5c 20 65 78 69 74 20 76 69 61 20 74 68 65 20 6f |\ exit via the o| 00002800 72 69 67 69 6e 61 6c 20 76 65 63 74 6f 72 0d 20 |riginal vector. | 00002810 31 30 31 30 20 2e 6e 65 77 69 6e 6b 65 79 0d 20 |1010 .newinkey. | 00002820 31 30 32 30 20 20 20 20 20 20 20 20 20 50 48 50 |1020 PHP| 00002830 20 20 20 20 20 20 20 20 20 20 20 5c 20 70 75 73 | \ pus| 00002840 68 20 73 74 61 74 75 73 20 72 65 67 69 73 74 65 |h status registe| 00002850 72 20 6f 6e 74 6f 20 73 74 61 63 6b 0d 20 31 30 |r onto stack. 10| 00002860 33 30 20 20 20 20 20 20 20 20 20 43 4d 50 20 23 |30 CMP #| 00002870 26 38 31 20 20 20 20 20 20 5c 20 69 73 20 74 68 |&81 \ is th| 00002880 69 73 20 4f 73 62 79 74 65 20 26 38 31 3f 0d 20 |is Osbyte &81?. | 00002890 31 30 34 30 20 20 20 20 20 20 20 20 20 42 4e 45 |1040 BNE| 000028a0 20 6e 6f 74 69 6e 6b 65 79 20 20 5c 20 69 66 20 | notinkey \ if | 000028b0 6e 6f 74 20 74 68 65 6e 20 65 78 69 74 20 76 69 |not then exit vi| 000028c0 61 20 6f 72 69 67 69 6e 61 6c 20 76 65 63 74 6f |a original vecto| 000028d0 72 0d 20 31 30 35 30 20 20 20 20 20 20 20 20 20 |r. 1050 | 000028e0 43 50 59 20 23 26 46 46 20 20 20 20 20 20 5c 20 |CPY #&FF \ | 000028f0 69 73 20 74 68 69 73 20 61 20 2d 76 65 20 49 4e |is this a -ve IN| 00002900 4b 45 59 3f 0d 20 31 30 36 30 20 20 20 20 20 20 |KEY?. 1060 | 00002910 20 20 20 42 45 51 20 69 6e 6b 65 79 20 20 20 20 | BEQ inkey | 00002920 20 5c 20 69 66 20 69 74 20 69 73 20 74 68 65 6e | \ if it is then| 00002930 20 62 72 61 6e 63 68 20 74 6f 20 6e 65 77 20 49 | branch to new I| 00002940 4e 4b 45 59 20 72 6f 75 74 69 6e 65 0d 20 31 30 |NKEY routine. 10| 00002950 37 30 20 2e 6e 6f 74 69 6e 6b 65 79 0d 20 31 30 |70 .notinkey. 10| 00002960 38 30 20 20 20 20 20 20 20 20 20 50 4c 50 20 20 |80 PLP | 00002970 20 20 20 20 20 20 20 20 20 5c 20 70 75 6c 6c 20 | \ pull | 00002980 73 74 61 74 75 73 20 72 65 67 69 73 74 65 72 20 |status register | 00002990 6f 66 66 20 74 68 65 20 73 74 61 63 6b 0d 20 31 |off the stack. 1| 000029a0 30 39 30 20 2e 6f 6c 64 63 6f 64 65 0d 20 31 31 |090 .oldcode. 11| 000029b0 30 30 20 20 20 20 20 20 20 20 20 4a 4d 50 20 28 |00 JMP (| 000029c0 6f 6c 64 62 79 74 65 76 29 20 5c 20 61 6e 64 20 |oldbytev) \ and | 000029d0 65 78 69 74 20 76 69 61 20 74 68 65 20 6f 72 69 |exit via the ori| 000029e0 67 69 6e 61 6c 20 4f 73 62 79 74 65 20 76 65 63 |ginal Osbyte vec| 000029f0 74 6f 72 0d 20 31 31 31 30 20 2e 69 6e 6b 65 79 |tor. 1110 .inkey| 00002a00 0d 20 31 31 32 30 20 20 20 20 20 20 20 20 20 54 |. 1120 T| 00002a10 58 41 20 20 20 20 20 20 20 20 20 20 20 5c 20 49 |XA \ I| 00002a20 4e 4b 45 59 20 6e 75 6d 62 65 72 20 69 6e 20 74 |NKEY number in t| 00002a30 68 65 20 58 20 72 65 67 69 73 74 65 72 0d 20 31 |he X register. 1| 00002a40 31 33 30 20 20 20 20 20 20 20 20 20 50 48 41 20 |130 PHA | 00002a50 20 20 20 20 20 20 20 20 20 20 5c 20 70 75 73 68 | \ push| 00002a60 20 49 4e 4b 45 59 20 6e 75 6d 62 65 72 20 6f 6e | INKEY number on| 00002a70 74 6f 20 73 74 61 63 6b 0d 20 31 31 34 30 20 20 |to stack. 1140 | 00002a80 20 20 20 20 20 20 20 4c 44 41 20 23 26 38 31 20 | LDA #&81 | 00002a90 20 20 20 20 20 5c 20 4f 73 62 79 74 65 20 26 38 | \ Osbyte &8| 00002aa0 31 0d 20 31 31 35 30 20 20 20 20 20 20 20 20 20 |1. 1150 | 00002ab0 4a 53 52 20 6f 6c 64 63 6f 64 65 20 20 20 5c 20 |JSR oldcode \ | 00002ac0 70 65 72 66 6f 72 6d 20 74 68 65 20 6f 72 69 67 |perform the orig| 00002ad0 69 6e 61 6c 20 49 4e 4b 45 59 20 66 75 6e 63 74 |inal INKEY funct| 00002ae0 69 6f 6e 0d 20 31 31 36 30 20 20 20 20 20 20 20 |ion. 1160 | 00002af0 20 20 43 50 58 20 23 26 46 46 20 20 20 20 20 20 | CPX #&FF | 00002b00 5c 20 58 20 3d 20 26 46 46 20 69 66 20 74 68 65 |\ X = &FF if the| 00002b10 20 72 65 71 75 69 72 65 64 20 6b 65 79 20 69 73 | required key is| 00002b20 20 70 72 65 73 73 65 64 0d 20 31 31 37 30 20 20 | pressed. 1170 | 00002b30 20 20 20 20 20 20 20 42 4e 45 20 6e 6f 74 70 72 | BNE notpr| 00002b40 65 73 73 65 64 20 5c 20 69 66 20 72 65 71 75 69 |essed \ if requi| 00002b50 72 65 64 20 6b 65 79 20 6e 6f 74 20 70 72 65 73 |red key not pres| 00002b60 73 65 64 20 74 68 65 6e 20 63 68 65 63 6b 0d 20 |sed then check. | 00002b70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00002b80 20 20 20 20 20 20 20 20 20 20 20 5c 20 74 68 65 | \ the| 00002b90 20 6d 6f 75 73 65 0d 20 31 31 38 30 20 20 20 20 | mouse. 1180 | 00002ba0 20 20 20 20 20 50 4c 41 20 20 20 20 20 20 20 20 | PLA | 00002bb0 20 20 20 5c 20 70 75 6c 6c 20 49 4e 4b 45 59 20 | \ pull INKEY | 00002bc0 6e 75 6d 62 65 72 20 6f 66 66 20 73 74 61 63 6b |number off stack| 00002bd0 0d 20 31 31 39 30 20 2e 70 75 6c 6c 6f 75 74 0d |. 1190 .pullout.| 00002be0 20 31 32 30 30 20 20 20 20 20 20 20 20 20 4c 44 | 1200 LD| 00002bf0 41 20 23 26 38 31 20 20 20 20 20 20 5c 20 4f 73 |A #&81 \ Os| 00002c00 62 79 74 65 20 26 38 31 0d 20 31 32 31 30 20 20 |byte &81. 1210 | 00002c10 20 20 20 20 20 20 20 50 4c 50 20 20 20 20 20 20 | PLP | 00002c20 20 20 20 20 20 5c 20 70 75 6c 6c 20 73 74 61 74 | \ pull stat| 00002c30 75 73 20 72 65 67 69 73 74 65 72 20 6f 66 66 20 |us register off | 00002c40 74 68 65 20 73 74 61 63 6b 0d 20 31 32 32 30 20 |the stack. 1220 | 00002c50 20 20 20 20 20 20 20 20 52 54 53 20 20 20 20 20 | RTS | 00002c60 20 20 20 20 20 20 5c 20 61 6e 64 20 72 65 74 75 | \ and retu| 00002c70 72 6e 20 74 6f 20 42 41 53 49 43 0d 20 31 32 33 |rn to BASIC. 123| 00002c80 30 20 2e 6e 6f 74 70 72 65 73 73 65 64 0d 20 31 |0 .notpressed. 1| 00002c90 32 34 30 20 20 20 20 20 20 20 20 20 50 4c 41 20 |240 PLA | 00002ca0 20 20 20 20 20 20 20 20 20 20 5c 20 70 75 6c 6c | \ pull| 00002cb0 20 49 4e 4b 45 59 20 6e 75 6d 62 65 72 20 6f 66 | INKEY number of| 00002cc0 66 20 73 74 61 63 6b 0d 20 31 32 35 30 20 20 20 |f stack. 1250 | 00002cd0 20 20 20 20 20 20 43 4d 50 20 75 70 20 20 20 20 | CMP up | 00002ce0 20 20 20 20 5c 20 61 72 65 20 79 6f 75 20 6c 6f | \ are you lo| 00002cf0 6f 6b 69 6e 67 20 66 6f 72 20 74 68 65 20 63 75 |oking for the cu| 00002d00 72 73 6f 72 20 75 70 20 6b 65 79 3f 0d 20 31 32 |rsor up key?. 12| 00002d10 36 30 20 20 20 20 20 20 20 20 20 42 4e 45 20 74 |60 BNE t| 00002d20 72 79 64 6f 77 6e 20 20 20 5c 20 69 66 20 6e 6f |rydown \ if no| 00002d30 74 20 74 68 65 6e 20 63 68 65 63 6b 20 63 75 72 |t then check cur| 00002d40 73 6f 72 20 64 6f 77 6e 0d 20 31 32 37 30 20 20 |sor down. 1270 | 00002d50 20 20 20 20 20 20 20 4c 44 41 20 79 63 6f 6f 72 | LDA ycoor| 00002d60 64 20 20 20 20 5c 20 59 20 63 6f 6f 72 64 69 6e |d \ Y coordin| 00002d70 61 74 65 20 66 72 6f 6d 20 6d 6f 75 73 65 0d 20 |ate from mouse. | 00002d80 31 32 38 30 20 20 20 20 20 20 20 20 20 43 4d 50 |1280 CMP| 00002d90 20 23 26 38 38 20 20 20 20 20 20 5c 20 69 66 20 | #&88 \ if | 00002da0 67 72 65 61 74 65 72 20 74 68 61 6e 20 26 38 37 |greater than &87| 00002db0 20 74 68 65 6e 20 73 69 6d 75 6c 61 74 65 20 6b | then simulate k| 00002dc0 65 79 20 70 72 65 73 73 0d 20 31 32 39 30 20 20 |ey press. 1290 | 00002dd0 20 20 20 20 20 20 20 42 43 43 20 70 75 6c 6c 6f | BCC pullo| 00002de0 75 74 20 20 20 5c 20 69 66 20 6c 65 73 73 20 74 |ut \ if less t| 00002df0 68 61 6e 20 26 38 38 20 74 68 65 6e 20 65 78 69 |han &88 then exi| 00002e00 74 20 77 69 74 68 6f 75 74 20 6b 65 79 20 70 72 |t without key pr| 00002e10 65 73 73 0d 20 31 33 30 30 20 20 20 20 20 20 20 |ess. 1300 | 00002e20 20 20 42 43 53 20 72 65 73 65 74 79 20 20 20 20 | BCS resety | 00002e30 5c 20 73 69 6d 75 6c 61 74 65 20 6b 65 79 20 70 |\ simulate key p| 00002e40 72 65 73 73 0d 20 31 33 31 30 20 2e 74 72 79 64 |ress. 1310 .tryd| 00002e50 6f 77 6e 0d 20 31 33 32 30 20 20 20 20 20 20 20 |own. 1320 | 00002e60 20 20 43 4d 50 20 64 6f 77 6e 20 20 20 20 20 20 | CMP down | 00002e70 5c 20 61 72 65 20 79 6f 75 20 6c 6f 6f 6b 69 6e |\ are you lookin| 00002e80 67 20 66 6f 72 20 74 68 65 20 63 75 72 73 6f 72 |g for the cursor| 00002e90 20 64 6f 77 6e 20 6b 65 79 3f 0d 20 31 33 33 30 | down key?. 1330| 00002ea0 20 20 20 20 20 20 20 20 20 42 4e 45 20 69 73 69 | BNE isi| 00002eb0 74 6c 65 66 74 20 20 5c 20 69 66 20 6e 6f 74 20 |tleft \ if not | 00002ec0 74 68 65 6e 20 63 68 65 63 6b 20 63 75 72 73 6f |then check curso| 00002ed0 72 20 6c 65 66 74 0d 20 31 33 34 30 20 20 20 20 |r left. 1340 | 00002ee0 20 20 20 20 20 4c 44 41 20 79 63 6f 6f 72 64 20 | LDA ycoord | 00002ef0 20 20 20 5c 20 59 20 63 6f 6f 72 64 69 6e 61 74 | \ Y coordinat| 00002f00 65 20 66 72 6f 6d 20 6d 6f 75 73 65 0d 20 31 33 |e from mouse. 13| 00002f10 35 30 20 20 20 20 20 20 20 20 20 43 4d 50 20 23 |50 CMP #| 00002f20 26 37 38 20 20 20 20 20 20 5c 20 69 66 20 6c 65 |&78 \ if le| 00002f30 73 73 20 74 68 61 6e 20 26 37 38 20 74 68 65 6e |ss than &78 then| 00002f40 20 73 69 6d 75 6c 61 74 65 20 6b 65 79 20 70 72 | simulate key pr| 00002f50 65 73 73 0d 20 31 33 36 30 20 20 20 20 20 20 20 |ess. 1360 | 00002f60 20 20 42 43 53 20 70 75 6c 6c 6f 75 74 20 20 20 | BCS pullout | 00002f70 5c 20 69 66 20 67 72 65 61 74 65 72 20 74 68 61 |\ if greater tha| 00002f80 6e 20 26 37 37 20 74 68 65 6e 20 65 78 69 74 20 |n &77 then exit | 00002f90 77 69 74 68 6f 75 74 0d 20 20 20 20 20 20 20 20 |without. | 00002fa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00002fb0 20 20 20 20 5c 20 6b 65 79 20 70 72 65 73 73 0d | \ key press.| 00002fc0 20 31 33 37 30 20 2e 72 65 73 65 74 79 0d 20 31 | 1370 .resety. 1| 00002fd0 33 38 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 |380 LDA | 00002fe0 23 26 38 30 20 20 20 20 20 20 5c 20 72 65 73 65 |#&80 \ rese| 00002ff0 74 20 59 20 63 6f 6f 72 64 69 6e 61 74 65 20 74 |t Y coordinate t| 00003000 6f 20 26 38 30 0d 20 31 33 39 30 20 20 20 20 20 |o &80. 1390 | 00003010 20 20 20 20 53 54 41 20 79 63 6f 6f 72 64 0d 20 | STA ycoord. | 00003020 31 34 30 30 20 20 20 20 20 20 20 20 20 42 4e 45 |1400 BNE| 00003030 20 66 6f 75 6e 64 20 20 20 20 20 5c 20 75 6e 63 | found \ unc| 00003040 6f 6e 64 69 74 69 6f 6e 61 6c 20 62 72 61 6e 63 |onditional branc| 00003050 68 20 74 6f 20 73 69 6d 75 6c 61 74 65 20 6b 65 |h to simulate ke| 00003060 79 20 70 72 65 73 73 0d 20 31 34 31 30 20 2e 69 |y press. 1410 .i| 00003070 73 69 74 6c 65 66 74 0d 20 31 34 32 30 20 20 20 |sitleft. 1420 | 00003080 20 20 20 20 20 20 43 4d 50 20 6c 65 66 74 20 20 | CMP left | 00003090 20 20 20 20 5c 20 61 72 65 20 79 6f 75 20 6c 6f | \ are you lo| 000030a0 6f 6b 69 6e 67 20 66 6f 72 20 63 75 72 73 6f 72 |oking for cursor| 000030b0 20 6c 65 66 74 20 6b 65 79 3f 0d 20 31 34 33 30 | left key?. 1430| 000030c0 20 20 20 20 20 20 20 20 20 42 4e 45 20 69 73 69 | BNE isi| 000030d0 74 72 69 67 68 74 20 5c 20 69 66 20 6e 6f 74 20 |tright \ if not | 000030e0 74 68 65 6e 20 63 68 65 63 6b 20 63 75 72 73 6f |then check curso| 000030f0 72 20 72 69 67 68 74 0d 20 31 34 34 30 20 20 20 |r right. 1440 | 00003100 20 20 20 20 20 20 4c 44 41 20 78 63 6f 6f 72 64 | LDA xcoord| 00003110 20 20 20 20 5c 20 58 20 63 6f 6f 72 64 69 6e 61 | \ X coordina| 00003120 74 65 20 66 72 6f 6d 20 6d 6f 75 73 65 0d 20 31 |te from mouse. 1| 00003130 34 35 30 20 20 20 20 20 20 20 20 20 43 4d 50 20 |450 CMP | 00003140 23 26 37 38 20 20 20 20 20 20 5c 20 69 66 20 6c |#&78 \ if l| 00003150 65 73 73 20 74 68 61 6e 20 26 37 38 20 74 68 65 |ess than &78 the| 00003160 6e 20 73 69 6d 75 6c 61 74 65 20 6b 65 79 20 70 |n simulate key p| 00003170 72 65 73 73 0d 20 31 34 36 30 20 20 20 20 20 20 |ress. 1460 | 00003180 20 20 20 42 43 53 20 70 75 6c 6c 6f 75 74 20 20 | BCS pullout | 00003190 20 5c 20 69 66 20 67 72 65 61 74 65 72 20 74 68 | \ if greater th| 000031a0 61 6e 20 26 37 37 20 74 68 65 6e 20 65 78 69 74 |an &77 then exit| 000031b0 20 77 69 74 68 6f 75 74 0d 20 20 20 20 20 20 20 | without. | 000031c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000031d0 20 20 20 20 20 5c 20 6b 65 79 20 70 72 65 73 73 | \ key press| 000031e0 0d 20 31 34 37 30 20 20 20 20 20 20 20 20 20 42 |. 1470 B| 000031f0 43 43 20 72 65 73 65 74 78 20 20 20 20 5c 20 69 |CC resetx \ i| 00003200 66 20 6c 65 73 73 20 74 68 61 6e 20 26 37 38 20 |f less than &78 | 00003210 74 68 65 6e 20 73 69 6d 75 6c 61 74 65 20 6b 65 |then simulate ke| 00003220 79 20 70 72 65 73 73 0d 20 31 34 38 30 20 2e 69 |y press. 1480 .i| 00003230 73 69 74 72 69 67 68 74 0d 20 31 34 39 30 20 20 |sitright. 1490 | 00003240 20 20 20 20 20 20 20 43 4d 50 20 72 69 67 68 74 | CMP right| 00003250 20 20 20 20 20 5c 20 61 72 65 20 79 6f 75 20 6c | \ are you l| 00003260 6f 6f 6b 69 6e 67 20 66 6f 72 20 63 75 72 73 6f |ooking for curso| 00003270 72 20 72 69 67 68 74 20 6b 65 79 3f 0d 20 31 35 |r right key?. 15| 00003280 30 30 20 20 20 20 20 20 20 20 20 42 4e 45 20 74 |00 BNE t| 00003290 72 79 62 75 74 74 6f 6e 73 20 5c 20 69 66 20 6e |rybuttons \ if n| 000032a0 6f 74 20 74 68 65 6e 20 63 68 65 63 6b 20 33 20 |ot then check 3 | 000032b0 6f 74 68 65 72 20 70 6f 73 73 69 62 6c 65 20 6b |other possible k| 000032c0 65 79 73 0d 20 31 35 31 30 20 20 20 20 20 20 20 |eys. 1510 | 000032d0 20 20 4c 44 41 20 78 63 6f 6f 72 64 20 20 20 20 | LDA xcoord | 000032e0 5c 20 58 20 63 6f 6f 72 64 69 6e 61 74 65 20 66 |\ X coordinate f| 000032f0 72 6f 6d 20 6d 6f 75 73 65 0d 20 31 35 32 30 20 |rom mouse. 1520 | 00003300 20 20 20 20 20 20 20 20 43 4d 50 20 23 26 38 38 | CMP #&88| 00003310 20 20 20 20 20 20 5c 20 69 66 20 67 72 65 61 74 | \ if great| 00003320 65 72 20 74 68 61 6e 20 26 38 37 20 74 68 65 6e |er than &87 then| 00003330 20 73 69 6d 75 6c 61 74 65 20 6b 65 79 20 70 72 | simulate key pr| 00003340 65 73 73 0d 20 31 35 33 30 20 20 20 20 20 20 20 |ess. 1530 | 00003350 20 20 42 43 43 20 70 75 6c 6c 6f 75 74 20 20 20 | BCC pullout | 00003360 5c 20 69 66 20 6c 65 73 73 20 74 68 61 6e 20 26 |\ if less than &| 00003370 38 38 20 74 68 65 6e 20 65 78 69 74 20 77 69 74 |88 then exit wit| 00003380 68 6f 75 74 20 6b 65 79 20 70 72 65 73 73 0d 20 |hout key press. | 00003390 31 35 34 30 20 2e 72 65 73 65 74 78 0d 20 31 35 |1540 .resetx. 15| 000033a0 35 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 23 |50 LDA #| 000033b0 26 38 30 20 20 20 20 20 20 5c 20 72 65 73 74 6f |&80 \ resto| 000033c0 72 65 20 58 20 63 6f 6f 72 64 69 6e 61 74 65 20 |re X coordinate | 000033d0 74 6f 20 26 38 30 0d 20 31 35 36 30 20 20 20 20 |to &80. 1560 | 000033e0 20 20 20 20 20 53 54 41 20 78 63 6f 6f 72 64 0d | STA xcoord.| 000033f0 20 31 35 37 30 20 20 20 20 20 20 20 20 20 42 4e | 1570 BN| 00003400 45 20 66 6f 75 6e 64 20 20 20 20 20 5c 20 75 6e |E found \ un| 00003410 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 62 72 61 6e |conditional bran| 00003420 63 68 20 74 6f 20 73 69 6d 75 6c 61 74 65 20 6b |ch to simulate k| 00003430 65 79 20 70 72 65 73 73 0d 20 31 35 38 30 20 2e |ey press. 1580 .| 00003440 74 72 79 62 75 74 74 6f 6e 73 0d 20 31 35 39 30 |trybuttons. 1590| 00003450 20 20 20 20 20 20 20 20 20 43 4d 50 20 63 65 6e | CMP cen| 00003460 74 72 65 62 75 74 74 6f 6e 20 5c 20 69 73 20 69 |trebutton \ is i| 00003470 74 20 74 68 65 20 66 69 72 73 74 20 6f 66 20 33 |t the first of 3| 00003480 20 70 6f 73 73 69 62 6c 65 20 6b 65 79 73 3f 0d | possible keys?.| 00003490 20 31 36 30 30 20 20 20 20 20 20 20 20 20 42 4e | 1600 BN| 000034a0 45 20 74 72 79 72 69 67 68 74 20 20 5c 20 69 66 |E tryright \ if| 000034b0 20 6e 6f 74 20 74 68 65 6e 20 74 72 79 20 74 68 | not then try th| 000034c0 65 20 73 65 63 6f 6e 64 20 6b 65 79 0d 20 31 36 |e second key. 16| 000034d0 31 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 64 |10 LDA d| 000034e0 72 62 20 20 20 20 20 20 20 5c 20 6c 6f 61 64 20 |rb \ load | 000034f0 69 6e 70 75 74 20 72 65 67 69 73 74 65 72 20 42 |input register B| 00003500 0d 20 31 36 32 30 20 20 20 20 20 20 20 20 20 4a |. 1620 J| 00003510 4d 50 20 74 77 6f 20 20 20 20 20 20 20 5c 20 63 |MP two \ c| 00003520 68 65 63 6b 20 66 6f 72 20 6d 6f 75 73 65 20 63 |heck for mouse c| 00003530 65 6e 74 72 65 20 62 75 74 74 6f 6e 20 70 72 65 |entre button pre| 00003540 73 73 65 64 0d 20 31 36 33 30 20 2e 74 72 79 72 |ssed. 1630 .tryr| 00003550 69 67 68 74 0d 20 31 36 34 30 20 20 20 20 20 20 |ight. 1640 | 00003560 20 20 20 43 4d 50 20 72 69 67 68 74 62 75 74 74 | CMP rightbutt| 00003570 6f 6e 20 5c 20 69 73 20 69 74 20 74 68 65 20 73 |on \ is it the s| 00003580 65 63 6f 6e 64 20 6f 66 20 33 20 70 6f 73 73 69 |econd of 3 possi| 00003590 62 6c 65 20 6b 65 79 73 3f 0d 20 31 36 35 30 20 |ble keys?. 1650 | 000035a0 20 20 20 20 20 20 20 20 42 4e 45 20 74 72 79 6c | BNE tryl| 000035b0 65 66 74 20 20 20 5c 20 69 66 20 6e 6f 74 20 74 |eft \ if not t| 000035c0 68 65 6e 20 74 72 79 20 74 68 65 20 74 68 69 72 |hen try the thir| 000035d0 64 20 6b 65 79 0d 20 31 36 36 30 20 20 20 20 20 |d key. 1660 | 000035e0 20 20 20 20 4c 44 41 20 64 72 62 20 20 20 20 20 | LDA drb | 000035f0 20 20 5c 20 6c 6f 61 64 20 69 6e 70 75 74 20 72 | \ load input r| 00003600 65 67 69 73 74 65 72 20 42 0d 20 31 36 37 30 20 |egister B. 1670 | 00003610 20 20 20 20 20 20 20 20 4a 4d 50 20 6f 6e 65 20 | JMP one | 00003620 20 20 20 20 20 20 5c 20 63 68 65 63 6b 20 66 6f | \ check fo| 00003630 72 20 6d 6f 75 73 65 20 72 69 67 68 74 20 62 75 |r mouse right bu| 00003640 74 74 6f 6e 20 70 72 65 73 73 65 64 0d 20 31 36 |tton pressed. 16| 00003650 38 30 20 2e 74 72 79 6c 65 66 74 0d 20 31 36 39 |80 .tryleft. 169| 00003660 30 20 20 20 20 20 20 20 20 20 43 4d 50 20 6c 65 |0 CMP le| 00003670 66 74 62 75 74 74 6f 6e 20 5c 20 69 73 20 69 74 |ftbutton \ is it| 00003680 20 74 68 65 20 74 68 69 72 64 20 6f 66 20 33 20 | the third of 3 | 00003690 70 6f 73 73 69 62 6c 65 20 62 75 74 74 6f 6e 73 |possible buttons| 000036a0 3f 0d 20 31 37 30 30 20 20 20 20 20 20 20 20 20 |?. 1700 | 000036b0 42 4e 45 20 70 75 6c 6c 6f 75 74 20 20 20 5c 20 |BNE pullout \ | 000036c0 69 66 20 6e 6f 74 20 74 68 65 6e 20 65 78 69 74 |if not then exit| 000036d0 20 77 69 74 68 6f 75 74 20 73 69 6d 75 6c 61 74 | without simulat| 000036e0 65 64 20 6b 65 79 0d 20 20 20 20 20 20 20 20 20 |ed key. | 000036f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00003700 20 20 20 5c 20 70 72 65 73 73 0d 20 31 37 31 30 | \ press. 1710| 00003710 20 20 20 20 20 20 20 20 20 4c 44 41 20 64 72 62 | LDA drb| 00003720 20 20 20 20 20 20 20 5c 20 6c 6f 61 64 20 69 6e | \ load in| 00003730 70 75 74 20 72 65 67 69 73 74 65 72 20 42 0d 20 |put register B. | 00003740 31 37 32 30 20 20 20 20 20 20 20 20 20 52 4f 4c |1720 ROL| 00003750 20 41 0d 20 31 37 33 30 20 2e 74 77 6f 0d 20 31 | A. 1730 .two. 1| 00003760 37 34 30 20 20 20 20 20 20 20 20 20 52 4f 4c 20 |740 ROL | 00003770 41 0d 20 31 37 35 30 20 2e 6f 6e 65 0d 20 31 37 |A. 1750 .one. 17| 00003780 36 30 20 20 20 20 20 20 20 20 20 52 4f 4c 20 41 |60 ROL A| 00003790 0d 20 31 37 37 30 20 20 20 20 20 20 20 20 20 42 |. 1770 B| 000037a0 43 53 20 70 75 6c 6c 6f 75 74 20 20 20 5c 20 65 |CS pullout \ e| 000037b0 78 69 74 20 77 69 74 68 6f 75 74 20 6b 65 79 20 |xit without key | 000037c0 70 72 65 73 73 20 69 66 20 6d 6f 75 73 65 20 62 |press if mouse b| 000037d0 75 74 74 6f 6e 0d 20 20 20 20 20 20 20 20 20 20 |utton. | 000037e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000037f0 20 20 5c 20 6e 6f 74 20 70 72 65 73 73 65 64 0d | \ not pressed.| 00003800 20 31 37 38 30 20 2e 66 6f 75 6e 64 0d 20 31 37 | 1780 .found. 17| 00003810 39 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 23 |90 LDA #| 00003820 26 38 31 20 20 20 20 20 20 5c 20 4f 73 62 79 74 |&81 \ Osbyt| 00003830 65 20 26 38 31 0d 20 31 38 30 30 20 20 20 20 20 |e &81. 1800 | 00003840 20 20 20 20 4c 44 58 20 23 26 46 46 20 20 20 20 | LDX #&FF | 00003850 20 20 5c 20 6b 65 79 20 70 72 65 73 73 65 64 0d | \ key pressed.| 00003860 20 31 38 31 30 20 20 20 20 20 20 20 20 20 4c 44 | 1810 LD| 00003870 59 20 23 26 46 46 20 20 20 20 20 20 5c 20 6b 65 |Y #&FF \ ke| 00003880 79 20 70 72 65 73 73 65 64 0d 20 31 38 32 30 20 |y pressed. 1820 | 00003890 20 20 20 20 20 20 20 20 50 4c 50 20 20 20 20 20 | PLP | 000038a0 20 20 20 20 20 20 5c 20 70 75 6c 6c 20 73 74 61 | \ pull sta| 000038b0 74 75 73 20 72 65 67 69 73 74 65 72 20 6f 66 66 |tus register off| 000038c0 20 74 68 65 20 73 74 61 63 6b 0d 20 31 38 33 30 | the stack. 1830| 000038d0 20 20 20 20 20 20 20 20 20 52 54 53 20 20 20 20 | RTS | 000038e0 20 20 20 20 20 20 20 5c 20 72 65 74 75 72 6e 20 | \ return | 000038f0 74 6f 20 42 41 53 49 43 0d 20 31 38 34 30 20 2e |to BASIC. 1840 .| 00003900 72 69 67 68 74 62 75 74 74 6f 6e 0d 20 31 38 35 |rightbutton. 185| 00003910 30 20 20 20 20 20 20 20 20 20 45 51 55 42 20 2d |0 EQUB -| 00003920 39 30 20 20 20 20 20 20 5c 20 64 65 6c 65 74 65 |90 \ delete| 00003930 0d 20 31 38 36 30 20 2e 63 65 6e 74 72 65 62 75 |. 1860 .centrebu| 00003940 74 74 6f 6e 0d 20 31 38 37 30 20 20 20 20 20 20 |tton. 1870 | 00003950 20 20 20 45 51 55 42 20 2d 37 34 20 20 20 20 20 | EQUB -74 | 00003960 20 5c 20 72 65 74 75 72 6e 0d 20 31 38 38 30 20 | \ return. 1880 | 00003970 2e 6c 65 66 74 62 75 74 74 6f 6e 0d 20 31 38 39 |.leftbutton. 189| 00003980 30 20 20 20 20 20 20 20 20 20 45 51 55 42 20 2d |0 EQUB -| 00003990 31 30 36 20 20 20 20 20 5c 20 63 6f 70 79 0d 20 |106 \ copy. | 000039a0 31 39 30 30 20 2e 75 70 0d 20 31 39 31 30 20 20 |1900 .up. 1910 | 000039b0 20 20 20 20 20 20 20 45 51 55 42 20 2d 35 38 20 | EQUB -58 | 000039c0 20 20 20 20 20 5c 20 63 75 72 73 6f 72 20 75 70 | \ cursor up| 000039d0 0d 20 31 39 32 30 20 2e 64 6f 77 6e 0d 20 31 39 |. 1920 .down. 19| 000039e0 33 30 20 20 20 20 20 20 20 20 20 45 51 55 42 20 |30 EQUB | 000039f0 2d 34 32 20 20 20 20 20 20 5c 20 63 75 72 73 6f |-42 \ curso| 00003a00 72 20 64 6f 77 6e 0d 20 31 39 34 30 20 2e 6c 65 |r down. 1940 .le| 00003a10 66 74 0d 20 31 39 35 30 20 20 20 20 20 20 20 20 |ft. 1950 | 00003a20 20 45 51 55 42 20 2d 32 36 20 20 20 20 20 20 5c | EQUB -26 \| 00003a30 20 63 75 72 73 6f 72 20 6c 65 66 74 0d 20 31 39 | cursor left. 19| 00003a40 36 30 20 2e 72 69 67 68 74 0d 20 31 39 37 30 20 |60 .right. 1970 | 00003a50 20 20 20 20 20 20 20 20 45 51 55 42 20 2d 31 32 | EQUB -12| 00003a60 32 20 20 20 20 20 5c 20 63 75 72 73 6f 72 20 72 |2 \ cursor r| 00003a70 69 67 68 74 0d 20 31 39 38 30 20 2e 6f 6c 64 69 |ight. 1980 .oldi| 00003a80 72 71 31 76 0d 20 31 39 39 30 20 20 20 20 20 20 |rq1v. 1990 | 00003a90 20 20 20 45 51 55 57 20 26 30 30 20 20 20 20 20 | EQUW &00 | 00003aa0 20 5c 20 6f 72 69 67 69 6e 61 6c 20 69 72 71 31 | \ original irq1| 00003ab0 20 76 65 63 74 6f 72 0d 20 32 30 30 30 20 2e 6f | vector. 2000 .o| 00003ac0 6c 64 62 79 74 65 76 0d 20 32 30 31 30 20 20 20 |ldbytev. 2010 | 00003ad0 20 20 20 20 20 20 45 51 55 57 20 26 30 30 20 20 | EQUW &00 | 00003ae0 20 20 20 20 5c 20 6f 72 69 67 69 6e 61 6c 20 4f | \ original O| 00003af0 73 62 79 74 65 20 76 65 63 74 6f 72 0d 20 32 30 |sbyte vector. 20| 00003b00 32 30 20 2e 78 63 6f 6f 72 64 0d 20 32 30 33 30 |20 .xcoord. 2030| 00003b10 20 20 20 20 20 20 20 20 20 45 51 55 42 20 26 38 | EQUB &8| 00003b20 30 20 20 20 20 20 20 5c 20 6d 6f 75 73 65 20 58 |0 \ mouse X| 00003b30 20 63 6f 6f 72 64 69 6e 61 74 65 20 30 2d 32 35 | coordinate 0-25| 00003b40 35 0d 20 32 30 34 30 20 2e 79 63 6f 6f 72 64 0d |5. 2040 .ycoord.| 00003b50 20 32 30 35 30 20 20 20 20 20 20 20 20 20 45 51 | 2050 EQ| 00003b60 55 42 20 26 38 30 20 20 20 20 20 20 5c 20 6d 6f |UB &80 \ mo| 00003b70 75 73 65 20 59 20 63 6f 6f 72 64 69 6e 61 74 65 |use Y coordinate| 00003b80 20 30 2d 32 35 35 0d 20 32 30 36 30 20 2e 6c 61 | 0-255. 2060 .la| 00003b90 73 74 62 79 74 65 0d 20 32 30 37 30 20 5d 0d 20 |stbyte. 2070 ]. | 00003ba0 32 30 38 30 20 4e 45 58 54 0d 20 32 30 39 30 20 |2080 NEXT. 2090 | 00003bb0 43 41 4c 4c 20 6d 63 6f 64 65 20 3a 52 45 4d 3a |CALL mcode :REM:| 00003bc0 20 65 6e 61 62 6c 65 20 6e 65 77 20 63 6f 64 65 | enable new code| 00003bd0 0d 20 32 31 30 30 20 4d 4f 44 45 37 0d 20 32 31 |. 2100 MODE7. 21| 00003be0 31 30 20 6d 6f 75 73 65 24 3d 43 48 52 24 31 34 |10 mouse$=CHR$14| 00003bf0 31 2b 43 48 52 24 31 33 32 2b 43 48 52 24 31 35 |1+CHR$132+CHR$15| 00003c00 37 2b 43 48 52 24 31 33 31 2b 0d 20 20 20 20 20 |7+CHR$131+. | 00003c10 20 22 50 72 65 73 73 20 6b 65 79 62 6f 61 72 64 | "Press keyboard| 00003c20 20 6f 72 20 6d 6f 76 65 20 74 68 65 20 6d 6f 75 | or move the mou| 00003c30 73 65 20 20 22 2b 43 48 52 24 31 35 36 0d 20 32 |se "+CHR$156. 2| 00003c40 31 32 30 20 50 52 49 4e 54 54 41 42 28 30 2c 31 |120 PRINTTAB(0,1| 00003c50 29 6d 6f 75 73 65 24 0d 20 32 31 33 30 20 50 52 |)mouse$. 2130 PR| 00003c60 49 4e 54 54 41 42 28 30 2c 32 29 6d 6f 75 73 65 |INTTAB(0,2)mouse| 00003c70 24 0d 20 32 31 34 30 20 50 52 49 4e 54 54 41 42 |$. 2140 PRINTTAB| 00003c80 28 31 30 2c 37 29 22 42 79 74 65 73 20 75 73 65 |(10,7)"Bytes use| 00003c90 64 20 3d 20 26 22 3b 7e 28 6c 61 73 74 62 79 74 |d = &";~(lastbyt| 00003ca0 65 2d 6d 63 6f 64 65 29 0d 20 32 31 35 30 20 4f |e-mcode). 2150 O| 00003cb0 4e 20 45 52 52 4f 52 20 47 4f 54 4f 20 32 32 38 |N ERROR GOTO 228| 00003cc0 30 0d 20 32 31 36 30 20 56 44 55 32 33 2c 31 2c |0. 2160 VDU23,1,| 00003cd0 30 3b 30 3b 30 3b 30 3b 0d 20 32 31 37 30 20 52 |0;0;0;0;. 2170 R| 00003ce0 45 50 45 41 54 0d 20 32 31 38 30 20 50 52 49 4e |EPEAT. 2180 PRIN| 00003cf0 54 54 41 42 28 31 30 2c 31 31 29 22 58 20 3d 20 |TTAB(10,11)"X = | 00003d00 26 22 3b 7e 3f 48 25 3b 22 20 22 0d 20 32 31 39 |&";~?H%;" ". 219| 00003d10 30 20 50 52 49 4e 54 54 41 42 28 32 30 2c 31 31 |0 PRINTTAB(20,11| 00003d20 29 22 59 20 3d 20 26 22 3b 7e 3f 56 25 3b 22 20 |)"Y = &";~?V%;" | 00003d30 22 0d 20 32 32 30 30 20 49 46 20 49 4e 4b 45 59 |". 2200 IF INKEY| 00003d40 28 2d 31 30 36 29 20 50 52 49 4e 54 54 41 42 28 |(-106) PRINTTAB(| 00003d50 31 30 2c 31 35 29 22 43 6f 70 79 22 20 45 4c 53 |10,15)"Copy" ELS| 00003d60 45 20 50 52 49 4e 54 54 41 42 28 31 30 2c 31 35 |E PRINTTAB(10,15| 00003d70 29 22 20 20 20 20 22 0d 20 32 32 31 30 20 49 46 |)" ". 2210 IF| 00003d80 20 49 4e 4b 45 59 28 2d 37 34 29 20 50 52 49 4e | INKEY(-74) PRIN| 00003d90 54 54 41 42 28 31 35 2c 31 35 29 22 52 65 74 75 |TTAB(15,15)"Retu| 00003da0 72 6e 22 20 45 4c 53 45 20 50 52 49 4e 54 54 41 |rn" ELSE PRINTTA| 00003db0 42 28 31 35 2c 31 35 29 22 20 20 20 20 20 20 22 |B(15,15)" "| 00003dc0 0d 20 32 32 32 30 20 49 46 20 49 4e 4b 45 59 28 |. 2220 IF INKEY(| 00003dd0 2d 39 30 29 20 50 52 49 4e 54 54 41 42 28 32 32 |-90) PRINTTAB(22| 00003de0 2c 31 35 29 22 44 65 6c 65 74 65 22 20 45 4c 53 |,15)"Delete" ELS| 00003df0 45 20 50 52 49 4e 54 54 41 42 28 32 32 2c 31 35 |E PRINTTAB(22,15| 00003e00 29 22 20 20 20 20 20 20 22 0d 20 32 32 33 30 20 |)" ". 2230 | 00003e10 49 46 20 49 4e 4b 45 59 28 2d 35 38 29 20 50 52 |IF INKEY(-58) PR| 00003e20 49 4e 54 54 41 42 28 31 37 2c 31 38 29 22 55 70 |INTTAB(17,18)"Up| 00003e30 22 20 45 4c 53 45 20 50 52 49 4e 54 54 41 42 28 |" ELSE PRINTTAB(| 00003e40 31 37 2c 31 38 29 22 20 20 22 0d 20 32 32 34 30 |17,18)" ". 2240| 00003e50 20 49 46 20 49 4e 4b 45 59 28 2d 34 32 29 20 50 | IF INKEY(-42) P| 00003e60 52 49 4e 54 54 41 42 28 31 36 2c 32 32 29 22 44 |RINTTAB(16,22)"D| 00003e70 6f 77 6e 22 20 45 4c 53 45 20 50 52 49 4e 54 54 |own" ELSE PRINTT| 00003e80 41 42 28 31 36 2c 32 32 29 22 20 20 20 20 22 0d |AB(16,22)" ".| 00003e90 20 32 32 35 30 20 49 46 20 49 4e 4b 45 59 28 2d | 2250 IF INKEY(-| 00003ea0 32 36 29 20 50 52 49 4e 54 54 41 42 28 31 30 2c |26) PRINTTAB(10,| 00003eb0 32 30 29 22 4c 65 66 74 22 20 45 4c 53 45 20 50 |20)"Left" ELSE P| 00003ec0 52 49 4e 54 54 41 42 28 31 30 2c 32 30 29 22 20 |RINTTAB(10,20)" | 00003ed0 20 20 20 22 0d 20 32 32 36 30 20 49 46 20 49 4e | ". 2260 IF IN| 00003ee0 4b 45 59 28 2d 31 32 32 29 20 50 52 49 4e 54 54 |KEY(-122) PRINTT| 00003ef0 41 42 28 32 32 2c 32 30 29 22 52 69 67 68 74 22 |AB(22,20)"Right"| 00003f00 20 45 4c 53 45 20 50 52 49 4e 54 54 41 42 28 32 | ELSE PRINTTAB(2| 00003f10 32 2c 32 30 29 22 20 20 20 20 20 22 0d 20 32 32 |2,20)" ". 22| 00003f20 37 30 20 55 4e 54 49 4c 20 46 41 4c 53 45 0d 20 |70 UNTIL FALSE. | 00003f30 32 32 38 30 20 43 41 4c 4c 20 6d 63 6f 64 65 20 |2280 CALL mcode | 00003f40 3a 52 45 4d 3a 20 64 69 73 61 62 6c 65 20 6e 65 |:REM: disable ne| 00003f50 77 20 63 6f 64 65 0d 20 32 32 39 30 20 56 44 55 |w code. 2290 VDU| 00003f60 32 33 2c 31 2c 31 3b 30 3b 30 3b 30 3b 33 31 2c |23,1,1;0;0;0;31,| 00003f70 30 2c 32 33 0d 20 32 33 30 30 20 45 4e 44 0d 0d |0,23. 2300 END..| 00003f80 0d 54 68 65 20 70 72 6f 67 72 61 6d 20 4e 45 57 |.The program NEW| 00003f90 53 43 41 4e 20 75 73 65 73 20 61 20 73 69 6d 69 |SCAN uses a simi| 00003fa0 6c 61 72 20 69 64 65 61 20 74 6f 20 74 68 61 74 |lar idea to that| 00003fb0 20 75 73 65 64 20 69 6e 20 4e 45 57 4b 45 59 53 | used in NEWKEYS| 00003fc0 20 65 78 63 65 70 74 0d 74 68 61 74 20 74 68 65 | except.that the| 00003fd0 20 4f 73 62 79 74 65 20 6b 65 79 62 6f 61 72 64 | Osbyte keyboard| 00003fe0 20 73 63 61 6e 20 68 61 73 20 62 65 65 6e 20 69 | scan has been i| 00003ff0 6e 74 65 72 63 65 70 74 65 64 20 69 6e 73 74 65 |ntercepted inste| 00004000 61 64 20 6f 66 20 74 68 65 20 4f 73 62 79 74 65 |ad of the Osbyte| 00004010 0d 6e 65 67 61 74 69 76 65 20 49 4e 4b 45 59 20 |.negative INKEY | 00004020 72 6f 75 74 69 6e 65 2e 20 54 68 65 20 6b 65 79 |routine. The key| 00004030 62 6f 61 72 64 20 73 63 61 6e 20 75 73 65 73 20 |board scan uses | 00004040 4f 73 62 79 74 65 20 26 37 39 20 6f 72 20 4f 73 |Osbyte &79 or Os| 00004050 62 79 75 74 65 20 26 37 41 2e 0d 4f 73 62 79 74 |byute &7A..Osbyt| 00004060 65 20 26 37 39 20 61 6e 64 20 4f 73 62 79 74 65 |e &79 and Osbyte| 00004070 20 26 37 41 20 75 73 65 20 74 68 65 20 69 6e 74 | &7A use the int| 00004080 65 72 6e 61 6c 20 6b 65 79 20 6e 75 6d 62 65 72 |ernal key number| 00004090 73 20 61 6e 64 20 6e 6f 74 20 74 68 65 20 49 4e |s and not the IN| 000040a0 4b 45 59 0d 6e 75 6d 62 65 72 73 20 61 73 20 75 |KEY.numbers as u| 000040b0 73 65 64 20 62 79 20 4f 73 62 79 74 65 20 26 38 |sed by Osbyte &8| 000040c0 31 2e 20 54 68 65 20 69 6e 74 65 72 6e 61 6c 20 |1. The internal | 000040d0 6b 65 79 20 6e 75 6d 62 65 72 73 20 63 61 6e 20 |key numbers can | 000040e0 62 65 20 6f 62 74 61 69 6e 65 64 20 62 79 0d 74 |be obtained by.t| 000040f0 61 6b 69 6e 67 20 74 68 65 20 6e 65 67 61 74 69 |aking the negati| 00004100 76 65 20 49 4e 4b 45 59 20 6e 75 6d 62 65 72 2c |ve INKEY number,| 00004110 20 66 72 6f 6d 20 74 68 65 20 6c 69 73 74 20 6f | from the list o| 00004120 66 20 49 4e 4b 45 59 20 6e 75 6d 62 65 72 73 20 |f INKEY numbers | 00004130 69 6e 20 74 68 65 0d 55 73 65 72 20 47 75 69 64 |in the.User Guid| 00004140 65 2c 20 61 6e 64 20 45 78 63 6c 75 73 69 76 65 |e, and Exclusive| 00004150 20 4f 52 69 6e 67 20 74 68 65 20 49 4e 4b 45 59 | ORing the INKEY| 00004160 20 6e 75 6d 62 65 72 20 77 69 74 68 20 26 46 46 | number with &FF| 00004170 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 |. For example, t| 00004180 6f 0d 66 69 6e 64 20 74 68 65 20 69 6e 74 65 72 |o.find the inter| 00004190 6e 61 6c 20 6b 65 79 20 6e 75 6d 62 65 72 20 66 |nal key number f| 000041a0 6f 72 20 52 65 74 75 72 6e 20 66 69 72 73 74 20 |or Return first | 000041b0 6c 6f 6f 6b 20 75 70 20 74 68 65 20 6e 65 67 74 |look up the negt| 000041c0 69 76 65 20 49 4e 4b 45 59 0d 6e 75 6d 62 65 72 |ive INKEY.number| 000041d0 20 66 6f 72 20 52 65 74 75 72 6e 2e 20 54 68 69 | for Return. Thi| 000041e0 73 20 69 73 20 2d 37 34 2e 20 55 73 65 20 42 41 |s is -74. Use BA| 000041f0 53 49 43 20 74 6f 20 45 78 63 6c 75 73 69 76 65 |SIC to Exclusive| 00004200 20 4f 52 20 2d 37 34 20 77 69 74 68 20 26 46 46 | OR -74 with &FF| 00004210 2e 0d 0d 20 20 50 52 49 4e 54 20 7e 20 2d 37 34 |... PRINT ~ -74| 00004220 20 45 4f 52 20 26 46 46 0d 0d 20 20 46 46 46 46 | EOR &FF.. FFFF| 00004230 46 46 34 39 0d 0d 54 68 65 20 72 65 73 75 6c 74 |FF49..The result| 00004240 20 69 73 20 74 68 65 20 6c 65 61 73 74 20 73 69 | is the least si| 00004250 67 6e 69 66 69 63 61 6e 74 20 62 79 74 65 20 6f |gnificant byte o| 00004260 66 20 74 68 65 20 61 6e 73 77 65 72 2c 20 69 65 |f the answer, ie| 00004270 2e 20 26 34 39 0d 0d 43 68 61 69 6e 20 74 68 65 |. &49..Chain the| 00004280 20 70 72 6f 67 72 61 6d 20 4e 45 57 53 43 41 4e | program NEWSCAN| 00004290 20 61 6e 64 20 6d 6f 76 65 20 74 68 65 20 6d 6f | and move the mo| 000042a0 75 73 65 20 61 72 6f 75 6e 64 2e 20 59 6f 75 20 |use around. You | 000042b0 77 69 6c 6c 20 73 65 65 20 74 68 61 74 20 74 68 |will see that th| 000042c0 65 0d 6b 65 79 62 6f 61 72 64 20 73 63 61 6e 20 |e.keyboard scan | 000042d0 72 65 74 75 72 6e 73 20 74 68 65 20 69 6e 74 65 |returns the inte| 000042e0 72 6e 61 6c 20 6b 65 79 20 6e 75 6d 62 65 72 20 |rnal key number | 000042f0 66 6f 72 20 74 68 65 20 61 70 70 72 6f 70 72 69 |for the appropri| 00004300 61 74 65 20 63 75 72 73 6f 72 0d 6b 65 79 20 62 |ate cursor.key b| 00004310 75 74 74 6f 6e 73 2e 20 54 68 65 20 6d 6f 75 73 |uttons. The mous| 00004320 65 20 62 75 74 74 6f 6e 73 20 72 65 74 75 72 6e |e buttons return| 00004330 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 6b 65 | the internal ke| 00004340 79 20 6e 75 6d 62 65 72 20 66 6f 72 20 74 68 65 |y number for the| 00004350 0d 44 65 6c 65 74 65 2c 20 43 6f 70 79 20 61 6e |.Delete, Copy an| 00004360 64 20 52 65 74 75 72 6e 20 6b 65 79 73 2e 0d 0d |d Return keys...| 00004370 0d 20 20 20 31 30 20 52 45 4d 3e 20 4e 45 57 53 |. 10 REM> NEWS| 00004380 43 41 4e 0d 20 20 20 32 30 20 44 49 4d 20 6d 63 |CAN. 20 DIM mc| 00004390 6f 64 65 20 26 32 30 30 20 3a 52 45 4d 3a 20 6d |ode &200 :REM: m| 000043a0 61 63 68 69 6e 65 20 63 6f 64 65 20 61 74 20 6d |achine code at m| 000043b0 63 6f 64 65 0d 20 20 20 33 30 20 73 61 76 65 72 |code. 30 saver| 000043c0 65 67 3d 26 46 43 20 3a 52 45 4d 3a 20 69 6e 74 |eg=&FC :REM: int| 000043d0 65 72 72 75 70 74 20 61 63 63 75 6d 75 6c 61 74 |errupt accumulat| 000043e0 6f 72 20 73 61 76 65 20 72 65 67 69 73 74 65 72 |or save register| 000043f0 0d 20 20 20 34 30 20 69 72 71 31 76 3d 26 32 30 |. 40 irq1v=&20| 00004400 34 20 3a 52 45 4d 3a 20 70 72 69 6d 61 72 79 20 |4 :REM: primary | 00004410 69 6e 74 65 72 72 75 70 74 20 76 65 63 74 6f 72 |interrupt vector| 00004420 0d 20 20 20 35 30 20 62 79 74 65 76 3d 26 32 30 |. 50 bytev=&20| 00004430 41 20 3a 52 45 4d 3a 20 4f 73 62 79 74 65 20 69 |A :REM: Osbyte i| 00004440 6e 64 69 72 65 63 74 69 6f 6e 20 76 65 63 74 6f |ndirection vecto| 00004450 72 0d 20 20 20 36 30 20 64 72 62 3d 26 46 45 36 |r. 60 drb=&FE6| 00004460 30 20 3a 52 45 4d 3a 20 64 61 74 61 20 72 65 67 |0 :REM: data reg| 00004470 69 73 74 65 72 20 42 0d 20 20 20 37 30 20 64 64 |ister B. 70 dd| 00004480 72 62 3d 26 46 45 36 32 20 3a 52 45 4d 3a 20 64 |rb=&FE62 :REM: d| 00004490 61 74 61 20 64 69 72 65 63 74 69 6f 6e 20 72 65 |ata direction re| 000044a0 67 69 73 74 65 72 20 42 0d 20 20 20 38 30 20 70 |gister B. 80 p| 000044b0 63 72 3d 26 46 45 36 43 20 3a 52 45 4d 3a 20 70 |cr=&FE6C :REM: p| 000044c0 65 72 69 70 68 65 72 61 6c 20 63 6f 6e 74 72 6f |eripheral contro| 000044d0 6c 20 72 65 67 69 73 74 65 72 0d 20 20 20 39 30 |l register. 90| 000044e0 20 69 66 72 3d 26 46 45 36 44 20 3a 52 45 4d 3a | ifr=&FE6D :REM:| 000044f0 20 69 6e 74 65 72 72 75 70 74 20 66 6c 61 67 20 | interrupt flag | 00004500 72 65 67 69 73 74 65 72 0d 20 20 31 30 30 20 69 |register. 100 i| 00004510 65 72 3d 26 46 45 36 45 20 3a 52 45 4d 3a 20 69 |er=&FE6E :REM: i| 00004520 6e 74 65 72 72 75 70 74 20 65 6e 61 62 6c 65 20 |nterrupt enable | 00004530 72 65 67 69 73 74 65 72 0d 20 20 31 31 30 20 6f |register. 110 o| 00004540 73 62 79 74 65 3d 26 46 46 46 34 0d 20 20 31 32 |sbyte=&FFF4. 12| 00004550 30 20 46 4f 52 20 70 61 73 73 3d 30 20 54 4f 20 |0 FOR pass=0 TO | 00004560 32 20 53 54 45 50 20 32 0d 20 20 31 33 30 20 50 |2 STEP 2. 130 P| 00004570 25 3d 6d 63 6f 64 65 0d 20 20 31 34 30 20 5b 20 |%=mcode. 140 [ | 00004580 20 20 20 20 20 20 4f 50 54 20 70 61 73 73 0d 20 | OPT pass. | 00004590 20 31 35 30 20 20 20 20 20 20 20 20 20 4c 44 58 | 150 LDX| 000045a0 20 69 72 71 31 76 20 20 20 20 20 5c 20 63 75 72 | irq1v \ cur| 000045b0 72 65 6e 74 20 70 72 69 6d 61 72 79 20 69 6e 74 |rent primary int| 000045c0 65 72 72 75 70 74 20 76 65 63 74 6f 72 2c 20 6c |errupt vector, l| 000045d0 6f 77 20 62 79 74 65 0d 20 20 31 36 30 20 20 20 |ow byte. 160 | 000045e0 20 20 20 20 20 20 4c 44 59 20 69 72 71 31 76 2b | LDY irq1v+| 000045f0 31 20 20 20 5c 20 63 75 72 72 65 6e 74 20 70 72 |1 \ current pr| 00004600 69 6d 61 72 79 20 69 6e 74 65 72 72 75 70 74 20 |imary interrupt | 00004610 76 65 63 74 6f 72 2c 20 68 69 67 68 20 62 79 74 |vector, high byt| 00004620 65 0d 20 20 31 37 30 20 20 20 20 20 20 20 20 20 |e. 170 | 00004630 43 50 59 20 23 69 6e 74 65 72 72 75 70 74 20 44 |CPY #interrupt D| 00004640 49 56 20 32 35 36 20 5c 20 63 6f 6d 70 61 72 65 |IV 256 \ compare| 00004650 20 68 69 67 68 20 62 79 74 65 0d 20 20 31 38 30 | high byte. 180| 00004660 20 20 20 20 20 20 20 20 20 42 45 51 20 64 69 73 | BEQ dis| 00004670 61 62 6c 65 20 20 20 5c 20 72 65 73 74 6f 72 65 |able \ restore| 00004680 20 6f 6c 64 20 76 65 63 74 6f 72 20 69 66 20 61 | old vector if a| 00004690 6c 74 65 72 65 64 0d 20 20 31 39 30 20 20 20 20 |ltered. 190 | 000046a0 20 20 20 20 20 53 54 58 20 6f 6c 64 69 72 71 31 | STX oldirq1| 000046b0 76 20 20 5c 20 73 61 76 65 20 6f 72 69 67 69 6e |v \ save origin| 000046c0 61 6c 20 69 72 71 31 20 76 65 63 74 6f 72 2c 20 |al irq1 vector, | 000046d0 6c 6f 77 20 62 79 74 65 0d 20 20 32 30 30 20 20 |low byte. 200 | 000046e0 20 20 20 20 20 20 20 53 54 59 20 6f 6c 64 69 72 | STY oldir| 000046f0 71 31 76 2b 31 20 5c 20 73 61 76 65 20 6f 72 69 |q1v+1 \ save ori| 00004700 67 69 6e 61 6c 20 69 72 71 31 20 76 65 63 74 6f |ginal irq1 vecto| 00004710 72 2c 20 68 69 67 68 20 62 79 74 65 0d 20 20 32 |r, high byte. 2| 00004720 31 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 62 |10 LDX b| 00004730 79 74 65 76 20 20 20 20 20 5c 20 4f 73 62 79 74 |ytev \ Osbyt| 00004740 65 20 69 6e 64 69 72 65 63 74 69 6f 6e 20 76 65 |e indirection ve| 00004750 63 74 6f 72 2c 20 6c 6f 77 20 62 79 74 65 0d 20 |ctor, low byte. | 00004760 20 32 32 30 20 20 20 20 20 20 20 20 20 4c 44 59 | 220 LDY| 00004770 20 62 79 74 65 76 2b 31 20 20 20 5c 20 4f 73 62 | bytev+1 \ Osb| 00004780 79 74 65 20 69 6e 64 69 72 65 63 74 69 6f 6e 20 |yte indirection | 00004790 76 65 63 74 6f 72 2c 20 68 69 67 68 20 62 79 74 |vector, high byt| 000047a0 65 0d 20 20 32 33 30 20 20 20 20 20 20 20 20 20 |e. 230 | 000047b0 53 54 58 20 6f 6c 64 62 79 74 65 76 20 20 5c 20 |STX oldbytev \ | 000047c0 73 61 76 65 20 6f 72 69 67 69 6e 61 6c 20 4f 73 |save original Os| 000047d0 62 79 74 65 20 76 65 63 74 6f 72 2c 20 6c 6f 77 |byte vector, low| 000047e0 20 62 79 74 65 0d 20 20 32 34 30 20 20 20 20 20 | byte. 240 | 000047f0 20 20 20 20 53 54 59 20 6f 6c 64 62 79 74 65 76 | STY oldbytev| 00004800 2b 31 20 5c 20 73 61 76 65 20 6f 72 69 67 69 6e |+1 \ save origin| 00004810 61 6c 20 4f 73 62 79 74 65 20 76 65 63 74 6f 72 |al Osbyte vector| 00004820 2c 20 68 69 67 68 20 62 79 74 65 0d 20 20 32 35 |, high byte. 25| 00004830 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 23 69 |0 LDX #i| 00004840 6e 74 65 72 72 75 70 74 20 4d 4f 44 20 32 35 36 |nterrupt MOD 256| 00004850 20 5c 20 6e 65 77 20 69 72 71 31 20 76 65 63 74 | \ new irq1 vect| 00004860 6f 72 2c 20 6c 6f 77 20 62 79 74 65 0d 20 20 32 |or, low byte. 2| 00004870 36 30 20 20 20 20 20 20 20 20 20 4c 44 59 20 23 |60 LDY #| 00004880 69 6e 74 65 72 72 75 70 74 20 44 49 56 20 32 35 |interrupt DIV 25| 00004890 36 20 5c 20 6e 65 77 20 69 72 71 31 20 76 65 63 |6 \ new irq1 vec| 000048a0 74 6f 72 2c 20 68 69 67 68 20 62 79 74 65 0d 20 |tor, high byte. | 000048b0 20 32 37 30 20 20 20 20 20 20 20 20 20 53 45 49 | 270 SEI| 000048c0 20 20 20 20 20 20 20 20 20 20 20 5c 20 73 65 74 | \ set| 000048d0 20 69 6e 74 65 72 72 75 70 74 20 64 69 73 61 62 | interrupt disab| 000048e0 6c 65 20 66 6c 61 67 0d 20 20 32 38 30 20 20 20 |le flag. 280 | 000048f0 20 20 20 20 20 20 53 54 58 20 69 72 71 31 76 20 | STX irq1v | 00004900 20 20 20 20 5c 20 61 6c 74 65 72 20 69 72 71 31 | \ alter irq1| 00004910 20 76 65 63 74 6f 72 2c 20 6c 6f 77 20 62 79 74 | vector, low byt| 00004920 65 0d 20 20 32 39 30 20 20 20 20 20 20 20 20 20 |e. 290 | 00004930 53 54 59 20 69 72 71 31 76 2b 31 20 20 20 5c 20 |STY irq1v+1 \ | 00004940 61 6c 74 65 72 20 69 72 71 31 20 76 65 63 74 6f |alter irq1 vecto| 00004950 72 2c 20 68 69 67 68 20 62 79 74 65 0d 20 20 33 |r, high byte. 3| 00004960 30 30 20 20 20 20 20 20 20 20 20 43 4c 49 20 20 |00 CLI | 00004970 20 20 20 20 20 20 20 20 20 5c 20 63 6c 65 61 72 | \ clear| 00004980 20 69 6e 74 65 72 72 75 70 74 20 64 69 73 61 62 | interrupt disab| 00004990 6c 65 20 66 6c 61 67 0d 20 20 33 31 30 20 20 20 |le flag. 310 | 000049a0 20 20 20 20 20 20 4c 44 58 20 23 6e 65 77 73 63 | LDX #newsc| 000049b0 61 6e 20 4d 4f 44 20 32 35 36 20 5c 20 6e 65 77 |an MOD 256 \ new| 000049c0 20 4f 73 62 79 74 65 20 76 65 63 74 6f 72 2c 20 | Osbyte vector, | 000049d0 6c 6f 77 20 62 79 74 65 0d 20 20 33 32 30 20 20 |low byte. 320 | 000049e0 20 20 20 20 20 20 20 4c 44 59 20 23 6e 65 77 73 | LDY #news| 000049f0 63 61 6e 20 44 49 56 20 32 35 36 20 5c 20 6e 65 |can DIV 256 \ ne| 00004a00 77 20 4f 73 62 79 74 65 20 76 65 63 74 6f 72 2c |w Osbyte vector,| 00004a10 20 68 69 67 68 20 62 79 74 65 0d 20 20 33 33 30 | high byte. 330| 00004a20 20 20 20 20 20 20 20 20 20 53 54 58 20 62 79 74 | STX byt| 00004a30 65 76 20 20 20 20 20 5c 20 61 6c 74 65 72 20 4f |ev \ alter O| 00004a40 73 62 79 74 65 20 76 65 63 74 6f 72 2c 20 6c 6f |sbyte vector, lo| 00004a50 77 20 62 79 74 65 0d 20 20 33 34 30 20 20 20 20 |w byte. 340 | 00004a60 20 20 20 20 20 53 54 59 20 62 79 74 65 76 2b 31 | STY bytev+1| 00004a70 20 20 20 5c 20 61 6c 74 65 72 20 4f 73 62 79 74 | \ alter Osbyt| 00004a80 65 20 76 65 63 74 6f 72 2c 20 68 69 67 68 20 62 |e vector, high b| 00004a90 79 74 65 0d 20 20 33 35 30 20 20 20 20 20 20 20 |yte. 350 | 00004aa0 20 20 4c 44 41 20 23 26 39 38 20 20 20 20 20 20 | LDA #&98 | 00004ab0 5c 20 25 31 30 30 31 31 30 30 30 2c 20 69 65 2e |\ %10011000, ie.| 00004ac0 20 65 6e 61 62 6c 65 20 43 42 31 2f 32 0d 20 20 | enable CB1/2. | 00004ad0 33 36 30 20 20 20 20 20 20 20 20 20 53 54 41 20 |360 STA | 00004ae0 69 65 72 20 20 20 20 20 20 20 5c 20 69 6e 74 65 |ier \ inte| 00004af0 72 72 75 70 74 20 65 6e 61 62 6c 65 20 72 65 67 |rrupt enable reg| 00004b00 69 73 74 65 72 0d 20 20 33 37 30 20 20 20 20 20 |ister. 370 | 00004b10 20 20 20 20 4c 44 41 20 70 63 72 20 20 20 20 20 | LDA pcr | 00004b20 20 20 5c 20 70 65 72 69 70 68 65 72 61 6c 20 63 | \ peripheral c| 00004b30 6f 6e 74 72 6f 6c 20 72 65 67 69 73 74 65 72 0d |ontrol register.| 00004b40 20 20 33 38 30 20 20 20 20 20 20 20 20 20 41 4e | 380 AN| 00004b50 44 20 23 26 30 46 20 20 20 20 20 20 5c 20 41 4e |D #&0F \ AN| 00004b60 44 20 77 69 74 68 20 25 30 30 30 30 31 31 31 31 |D with %00001111| 00004b70 2c 20 69 65 20 63 6c 65 61 72 20 62 69 74 73 20 |, ie clear bits | 00004b80 34 2d 37 0d 20 20 33 39 30 20 20 20 20 20 20 20 |4-7. 390 | 00004b90 20 20 4f 52 41 20 23 26 35 30 20 20 20 20 20 20 | ORA #&50 | 00004ba0 5c 20 4f 52 20 77 69 74 68 20 25 30 31 30 31 30 |\ OR with %01010| 00004bb0 30 30 30 2c 20 69 65 2e 20 73 65 74 20 62 69 74 |000, ie. set bit| 00004bc0 73 20 34 20 61 6e 64 20 36 0d 20 20 34 30 30 20 |s 4 and 6. 400 | 00004bd0 20 20 20 20 20 20 20 20 53 54 41 20 70 63 72 20 | STA pcr | 00004be0 20 20 20 20 20 20 5c 20 69 6e 74 65 72 72 75 70 | \ interrup| 00004bf0 74 20 6f 6e 20 2b 76 65 20 74 72 61 6e 73 69 74 |t on +ve transit| 00004c00 69 6f 6e 2c 20 43 42 32 20 69 6e 70 75 74 2c 0d |ion, CB2 input,.| 00004c10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00004c20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 44 52 | \ DR| 00004c30 42 20 74 6f 20 63 6c 65 61 72 0d 20 20 34 31 30 |B to clear. 410| 00004c40 20 20 20 20 20 20 20 20 20 4c 44 41 20 23 26 30 | LDA #&0| 00004c50 30 20 20 20 20 20 20 5c 20 75 73 65 72 20 70 6f |0 \ user po| 00004c60 72 74 20 69 6e 70 75 74 0d 20 20 34 32 30 20 20 |rt input. 420 | 00004c70 20 20 20 20 20 20 20 53 54 41 20 64 64 72 62 20 | STA ddrb | 00004c80 20 20 20 20 20 5c 20 64 61 74 61 20 64 69 72 65 | \ data dire| 00004c90 63 74 69 6f 6e 20 72 65 67 69 73 74 65 72 20 42 |ction register B| 00004ca0 0d 20 20 34 33 30 20 20 20 20 20 20 20 20 20 52 |. 430 R| 00004cb0 54 53 20 20 20 20 20 20 20 20 20 20 20 5c 20 72 |TS \ r| 00004cc0 65 74 75 72 6e 20 74 6f 20 42 41 53 49 43 0d 20 |eturn to BASIC. | 00004cd0 20 34 34 30 20 2e 64 69 73 61 62 6c 65 0d 20 20 | 440 .disable. | 00004ce0 34 35 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 |450 LDA | 00004cf0 23 26 31 38 20 20 20 20 20 20 5c 20 25 30 30 30 |#&18 \ %000| 00004d00 31 31 30 30 30 20 72 65 61 64 79 20 74 6f 20 63 |11000 ready to c| 00004d10 6c 65 61 72 20 62 69 74 73 20 33 20 61 6e 64 20 |lear bits 3 and | 00004d20 34 20 6f 66 20 69 65 72 0d 20 20 34 36 30 20 20 |4 of ier. 460 | 00004d30 20 20 20 20 20 20 20 4c 44 58 20 6f 6c 64 69 72 | LDX oldir| 00004d40 71 31 76 20 20 5c 20 6f 72 69 67 69 6e 61 6c 20 |q1v \ original | 00004d50 69 72 71 31 20 76 65 63 74 6f 72 2c 20 6c 6f 77 |irq1 vector, low| 00004d60 20 62 79 74 65 0d 20 20 34 37 30 20 20 20 20 20 | byte. 470 | 00004d70 20 20 20 20 4c 44 59 20 6f 6c 64 69 72 71 31 76 | LDY oldirq1v| 00004d80 2b 31 20 5c 20 6f 72 69 67 69 6e 61 6c 20 69 72 |+1 \ original ir| 00004d90 71 31 20 76 65 63 74 6f 72 2c 20 68 69 67 68 20 |q1 vector, high | 00004da0 62 79 74 65 0d 20 20 34 38 30 20 20 20 20 20 20 |byte. 480 | 00004db0 20 20 20 53 45 49 20 20 20 20 20 20 20 20 20 20 | SEI | 00004dc0 20 5c 20 73 65 74 20 69 6e 74 65 72 72 75 70 74 | \ set interrupt| 00004dd0 20 64 69 73 61 62 6c 65 20 66 6c 61 67 0d 20 20 | disable flag. | 00004de0 34 39 30 20 20 20 20 20 20 20 20 20 53 54 41 20 |490 STA | 00004df0 69 65 72 20 20 20 20 20 20 20 5c 20 69 6e 74 65 |ier \ inte| 00004e00 72 72 75 70 74 20 65 6e 61 62 6c 65 20 72 65 67 |rrupt enable reg| 00004e10 69 73 74 65 72 0d 20 20 35 30 30 20 20 20 20 20 |ister. 500 | 00004e20 20 20 20 20 4c 44 41 20 70 63 72 20 20 20 20 20 | LDA pcr | 00004e30 20 20 5c 20 70 65 72 69 70 68 65 72 61 6c 20 63 | \ peripheral c| 00004e40 6f 6e 74 72 6f 6c 20 72 65 67 69 73 74 65 72 0d |ontrol register.| 00004e50 20 20 35 31 30 20 20 20 20 20 20 20 20 20 41 4e | 510 AN| 00004e60 44 20 23 26 30 46 20 20 20 20 20 20 5c 20 63 6c |D #&0F \ cl| 00004e70 65 61 72 20 62 69 74 73 20 34 2d 37 0d 20 20 35 |ear bits 4-7. 5| 00004e80 32 30 20 20 20 20 20 20 20 20 20 53 54 41 20 70 |20 STA p| 00004e90 63 72 20 20 20 20 20 20 20 5c 20 70 65 72 69 70 |cr \ perip| 00004ea0 68 65 72 61 6c 20 63 6f 6e 74 72 6f 6c 20 72 65 |heral control re| 00004eb0 67 69 73 74 65 72 0d 20 20 35 33 30 20 20 20 20 |gister. 530 | 00004ec0 20 20 20 20 20 53 54 58 20 69 72 71 31 76 20 20 | STX irq1v | 00004ed0 20 20 20 5c 20 72 65 73 74 6f 72 65 20 69 72 71 | \ restore irq| 00004ee0 31 20 76 65 63 74 6f 72 2c 20 6c 6f 77 20 62 79 |1 vector, low by| 00004ef0 74 65 0d 20 20 35 34 30 20 20 20 20 20 20 20 20 |te. 540 | 00004f00 20 53 54 59 20 69 72 71 31 76 2b 31 20 20 20 5c | STY irq1v+1 \| 00004f10 20 72 65 73 74 6f 72 65 20 69 72 71 31 20 76 65 | restore irq1 ve| 00004f20 63 74 6f 72 2c 20 68 69 67 68 20 62 79 74 65 0d |ctor, high byte.| 00004f30 20 20 35 35 30 20 20 20 20 20 20 20 20 20 43 4c | 550 CL| 00004f40 49 20 20 20 20 20 20 20 20 20 20 20 5c 20 63 6c |I \ cl| 00004f50 65 61 72 20 69 6e 74 65 72 72 75 70 74 20 64 69 |ear interrupt di| 00004f60 73 61 62 6c 65 20 66 6c 61 67 0d 20 20 35 36 30 |sable flag. 560| 00004f70 20 20 20 20 20 20 20 20 20 4c 44 58 20 6f 6c 64 | LDX old| 00004f80 62 79 74 65 76 20 20 5c 20 6f 72 69 67 69 6e 61 |bytev \ origina| 00004f90 6c 20 4f 73 62 79 74 65 20 76 65 63 74 6f 72 2c |l Osbyte vector,| 00004fa0 20 6c 6f 77 20 62 79 74 65 0d 20 20 35 37 30 20 | low byte. 570 | 00004fb0 20 20 20 20 20 20 20 20 4c 44 59 20 6f 6c 64 62 | LDY oldb| 00004fc0 79 74 65 76 2b 31 20 5c 20 6f 72 69 67 69 6e 61 |ytev+1 \ origina| 00004fd0 6c 20 4f 73 62 79 74 65 20 76 65 63 74 6f 72 2c |l Osbyte vector,| 00004fe0 20 68 69 67 68 20 62 79 74 65 0d 20 20 35 38 30 | high byte. 580| 00004ff0 20 20 20 20 20 20 20 20 20 53 54 58 20 62 79 74 | STX byt| 00005000 65 76 20 20 20 20 20 5c 20 72 65 73 74 6f 72 65 |ev \ restore| 00005010 20 4f 73 62 79 74 65 20 76 65 63 74 6f 72 2c 20 | Osbyte vector, | 00005020 6c 6f 77 20 62 79 74 65 0d 20 20 35 39 30 20 20 |low byte. 590 | 00005030 20 20 20 20 20 20 20 53 54 59 20 62 79 74 65 76 | STY bytev| 00005040 2b 31 20 20 20 5c 20 72 65 73 74 6f 72 65 20 4f |+1 \ restore O| 00005050 73 62 79 74 65 20 76 65 63 74 6f 72 2c 20 68 69 |sbyte vector, hi| 00005060 67 68 20 62 79 74 65 0d 20 20 36 30 30 20 20 20 |gh byte. 600 | 00005070 20 20 20 20 20 20 52 54 53 20 20 20 20 20 20 20 | RTS | 00005080 20 20 20 20 5c 20 72 65 74 75 72 6e 20 74 6f 20 | \ return to | 00005090 42 41 53 49 43 0d 20 20 36 31 30 20 2e 69 6e 74 |BASIC. 610 .int| 000050a0 65 72 72 75 70 74 0d 20 20 36 32 30 20 20 20 20 |errupt. 620 | 000050b0 20 20 20 20 20 4c 44 41 20 73 61 76 65 72 65 67 | LDA savereg| 000050c0 20 20 20 5c 20 69 6e 74 65 72 72 75 70 74 20 61 | \ interrupt a| 000050d0 63 63 75 6d 75 6c 61 74 6f 72 20 73 61 76 65 20 |ccumulator save | 000050e0 72 65 67 69 73 74 65 72 0d 20 20 36 33 30 20 20 |register. 630 | 000050f0 20 20 20 20 20 20 20 50 48 41 20 20 20 20 20 20 | PHA | 00005100 20 20 20 20 20 5c 20 61 6e 64 20 70 75 73 68 20 | \ and push | 00005110 69 74 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 0d |it on the stack.| 00005120 20 20 36 34 30 20 20 20 20 20 20 20 20 20 4c 44 | 640 LD| 00005130 41 20 69 66 72 20 20 20 20 20 20 20 5c 20 69 6e |A ifr \ in| 00005140 74 65 72 72 75 70 74 20 66 6c 61 67 20 72 65 67 |terrupt flag reg| 00005150 69 73 74 65 72 0d 20 20 36 35 30 20 20 20 20 20 |ister. 650 | 00005160 20 20 20 20 42 50 4c 20 6e 6f 74 75 73 65 72 20 | BPL notuser | 00005170 20 20 5c 20 62 69 74 20 37 20 69 73 20 73 65 74 | \ bit 7 is set| 00005180 20 69 66 20 56 49 41 2d 42 20 69 6e 74 65 72 72 | if VIA-B interr| 00005190 75 70 74 0d 20 20 36 36 30 20 20 20 20 20 20 20 |upt. 660 | 000051a0 20 20 41 4e 44 20 23 26 31 38 20 20 20 20 20 20 | AND #&18 | 000051b0 5c 20 41 4e 44 20 77 69 74 68 20 25 30 30 30 31 |\ AND with %0001| 000051c0 31 30 30 30 2c 20 69 65 2e 20 74 65 73 74 20 62 |1000, ie. test b| 000051d0 69 74 73 20 33 20 61 6e 64 20 34 0d 20 20 36 37 |its 3 and 4. 67| 000051e0 30 20 20 20 20 20 20 20 20 20 42 45 51 20 6e 6f |0 BEQ no| 000051f0 74 75 73 65 72 20 20 20 5c 20 65 78 69 74 20 69 |tuser \ exit i| 00005200 66 20 6e 6f 74 20 43 42 31 20 6f 72 20 43 42 32 |f not CB1 or CB2| 00005210 0d 20 20 36 38 30 20 20 20 20 20 20 20 20 20 41 |. 680 A| 00005220 4e 44 20 23 26 31 30 20 20 20 20 20 20 5c 20 41 |ND #&10 \ A| 00005230 4e 44 20 77 69 74 68 20 25 30 30 30 31 30 30 30 |ND with %0001000| 00005240 30 2c 20 69 65 2e 20 74 65 73 74 20 43 42 31 0d |0, ie. test CB1.| 00005250 20 20 36 39 30 20 20 20 20 20 20 20 20 20 42 4e | 690 BN| 00005260 45 20 78 70 75 6c 73 65 20 20 20 20 5c 20 62 69 |E xpulse \ bi| 00005270 74 20 34 20 73 65 74 20 66 6f 72 20 61 6e 20 58 |t 4 set for an X| 00005280 20 64 69 72 65 63 74 69 6f 6e 20 6d 6f 76 65 6d | direction movem| 00005290 65 6e 74 0d 20 20 37 30 30 20 20 20 20 20 20 20 |ent. 700 | 000052a0 20 20 4c 44 41 20 64 72 62 20 20 20 20 20 20 20 | LDA drb | 000052b0 5c 20 59 20 64 69 72 65 63 74 69 6f 6e 2c 20 6c |\ Y direction, l| 000052c0 6f 61 64 20 64 61 74 61 20 72 65 67 69 73 74 65 |oad data registe| 000052d0 72 20 42 0d 20 20 37 31 30 20 20 20 20 20 20 20 |r B. 710 | 000052e0 20 20 41 4e 44 20 23 26 30 34 20 20 20 20 20 20 | AND #&04 | 000052f0 5c 20 41 4e 44 20 77 69 74 68 20 25 30 30 30 30 |\ AND with %0000| 00005300 30 31 30 30 2c 20 69 65 2e 20 74 65 73 74 20 62 |0100, ie. test b| 00005310 69 74 20 32 0d 20 20 37 32 30 20 20 20 20 20 20 |it 2. 720 | 00005320 20 20 20 42 4e 45 20 79 64 6f 77 6e 20 20 20 20 | BNE ydown | 00005330 20 5c 20 69 66 20 62 69 74 20 32 20 69 73 20 73 | \ if bit 2 is s| 00005340 65 74 20 74 68 65 6e 20 59 20 69 73 20 67 6f 69 |et then Y is goi| 00005350 6e 67 20 64 6f 77 6e 0d 20 20 37 33 30 20 20 20 |ng down. 730 | 00005360 20 20 20 20 20 20 49 4e 43 20 79 63 6f 6f 72 64 | INC ycoord| 00005370 20 20 20 20 5c 20 59 20 69 73 20 67 6f 69 6e 67 | \ Y is going| 00005380 20 75 70 20 73 6f 20 69 6e 63 72 65 6d 65 6e 74 | up so increment| 00005390 20 59 20 63 6f 6f 72 64 69 6e 61 74 65 0d 20 20 | Y coordinate. | 000053a0 37 34 30 20 20 20 20 20 20 20 20 20 42 4e 45 20 |740 BNE | 000053b0 65 78 69 74 20 20 20 20 20 20 5c 20 62 72 61 6e |exit \ bran| 000053c0 63 68 20 69 66 20 69 6e 20 74 68 65 20 72 61 6e |ch if in the ran| 000053d0 67 65 20 31 20 74 6f 20 32 35 35 0d 20 20 37 35 |ge 1 to 255. 75| 000053e0 30 20 20 20 20 20 20 20 20 20 42 45 51 20 64 65 |0 BEQ de| 000053f0 63 79 20 20 20 20 20 20 5c 20 69 66 20 7a 65 72 |cy \ if zer| 00005400 6f 20 74 68 65 6e 20 61 6c 74 65 72 20 74 6f 20 |o then alter to | 00005410 32 35 35 0d 20 20 37 36 30 20 2e 79 64 6f 77 6e |255. 760 .ydown| 00005420 0d 20 20 37 37 30 20 20 20 20 20 20 20 20 20 4c |. 770 L| 00005430 44 41 20 79 63 6f 6f 72 64 20 20 20 20 5c 20 6c |DA ycoord \ l| 00005440 6f 61 64 20 59 20 63 6f 6f 72 64 69 6e 61 74 65 |oad Y coordinate| 00005450 0d 20 20 37 38 30 20 20 20 20 20 20 20 20 20 42 |. 780 B| 00005460 45 51 20 65 78 69 74 20 20 20 20 20 20 5c 20 62 |EQ exit \ b| 00005470 72 61 6e 63 68 20 69 66 20 7a 65 72 6f 20 62 65 |ranch if zero be| 00005480 63 61 75 73 65 20 69 74 20 63 61 6e 27 74 20 67 |cause it can't g| 00005490 6f 20 61 6e 79 20 6c 6f 77 65 72 0d 20 20 37 39 |o any lower. 79| 000054a0 30 20 2e 64 65 63 79 0d 20 20 38 30 30 20 20 20 |0 .decy. 800 | 000054b0 20 20 20 20 20 20 44 45 43 20 79 63 6f 6f 72 64 | DEC ycoord| 000054c0 20 20 20 20 5c 20 72 65 64 75 63 65 20 59 20 63 | \ reduce Y c| 000054d0 6f 6f 72 64 69 6e 61 74 65 20 62 79 20 31 0d 20 |oordinate by 1. | 000054e0 20 38 31 30 20 20 20 20 20 20 20 20 20 4a 4d 50 | 810 JMP| 000054f0 20 65 78 69 74 20 20 20 20 20 20 5c 20 72 65 73 | exit \ res| 00005500 74 6f 72 65 20 69 6e 74 65 72 72 75 70 74 20 61 |tore interrupt a| 00005510 63 63 75 6d 75 6c 61 74 6f 72 20 73 61 76 65 20 |ccumulator save | 00005520 72 65 67 69 73 74 65 72 0d 20 20 20 20 20 20 20 |register. | 00005530 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00005540 20 20 20 20 20 5c 20 61 6e 64 20 52 54 49 0d 20 | \ and RTI. | 00005550 20 38 32 30 20 2e 78 70 75 6c 73 65 0d 20 20 38 | 820 .xpulse. 8| 00005560 33 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 64 |30 LDA d| 00005570 72 62 20 20 20 20 20 20 20 5c 20 6c 6f 61 64 20 |rb \ load | 00005580 64 61 74 61 20 72 65 67 69 73 74 65 72 20 42 0d |data register B.| 00005590 20 20 38 34 30 20 20 20 20 20 20 20 20 20 52 4f | 840 RO| 000055a0 52 20 41 20 20 20 20 20 20 20 20 20 5c 20 62 69 |R A \ bi| 000055b0 74 20 30 20 69 6e 74 6f 20 63 61 72 72 79 0d 20 |t 0 into carry. | 000055c0 20 38 35 30 20 20 20 20 20 20 20 20 20 42 43 53 | 850 BCS| 000055d0 20 78 64 6f 77 6e 20 20 20 20 20 5c 20 58 20 69 | xdown \ X i| 000055e0 73 20 67 6f 69 6e 67 20 64 6f 77 6e 20 69 66 20 |s going down if | 000055f0 62 69 74 20 30 20 69 73 20 73 65 74 0d 20 20 38 |bit 0 is set. 8| 00005600 36 30 20 20 20 20 20 20 20 20 20 49 4e 43 20 78 |60 INC x| 00005610 63 6f 6f 72 64 20 20 20 20 5c 20 58 20 69 73 20 |coord \ X is | 00005620 67 6f 69 6e 67 20 75 70 20 69 66 20 62 69 74 20 |going up if bit | 00005630 30 20 69 73 20 63 6c 65 61 72 0d 20 20 38 37 30 |0 is clear. 870| 00005640 20 20 20 20 20 20 20 20 20 42 4e 45 20 65 78 69 | BNE exi| 00005650 74 20 20 20 20 20 20 5c 20 65 78 69 74 20 69 66 |t \ exit if| 00005660 20 58 20 63 6f 6f 72 64 69 6e 61 74 65 20 69 73 | X coordinate is| 00005670 20 69 6e 20 74 68 65 20 72 61 6e 67 65 20 66 72 | in the range fr| 00005680 6f 6d 0d 20 20 20 20 20 20 20 20 20 20 20 20 20 |om. | 00005690 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c | \| 000056a0 20 31 20 74 6f 20 32 35 35 0d 20 20 38 38 30 20 | 1 to 255. 880 | 000056b0 20 20 20 20 20 20 20 20 42 45 51 20 64 65 63 78 | BEQ decx| 000056c0 20 20 20 20 20 20 5c 20 69 66 20 58 20 63 6f 6f | \ if X coo| 000056d0 72 64 69 6e 61 74 65 20 3d 20 30 20 74 68 65 6e |rdinate = 0 then| 000056e0 20 6d 61 6b 65 20 69 74 20 32 35 35 0d 20 20 38 | make it 255. 8| 000056f0 39 30 20 2e 78 64 6f 77 6e 0d 20 20 39 30 30 20 |90 .xdown. 900 | 00005700 20 20 20 20 20 20 20 20 4c 44 41 20 78 63 6f 6f | LDA xcoo| 00005710 72 64 20 20 20 20 5c 20 6c 6f 61 64 20 58 20 63 |rd \ load X c| 00005720 6f 6f 72 64 69 6e 61 74 65 0d 20 20 39 31 30 20 |oordinate. 910 | 00005730 20 20 20 20 20 20 20 20 42 45 51 20 65 78 69 74 | BEQ exit| 00005740 20 20 20 20 20 20 5c 20 69 66 20 69 74 20 69 73 | \ if it is| 00005750 20 7a 65 72 6f 20 69 74 20 63 61 6e 27 74 20 67 | zero it can't g| 00005760 6f 20 61 6e 79 20 6c 6f 77 65 72 0d 20 20 39 32 |o any lower. 92| 00005770 30 20 2e 64 65 63 78 0d 20 20 39 33 30 20 20 20 |0 .decx. 930 | 00005780 20 20 20 20 20 20 44 45 43 20 78 63 6f 6f 72 64 | DEC xcoord| 00005790 20 20 20 20 5c 20 64 65 63 72 65 61 73 65 20 58 | \ decrease X| 000057a0 20 63 6f 6f 72 64 69 6e 61 74 65 20 62 79 20 31 | coordinate by 1| 000057b0 0d 20 20 39 34 30 20 2e 65 78 69 74 0d 20 20 39 |. 940 .exit. 9| 000057c0 35 30 20 20 20 20 20 20 20 20 20 50 4c 41 20 20 |50 PLA | 000057d0 20 20 20 20 20 20 20 20 20 5c 20 70 75 6c 6c 20 | \ pull | 000057e0 69 6e 74 65 72 72 75 70 74 20 61 63 63 75 6d 75 |interrupt accumu| 000057f0 6c 61 74 6f 72 20 73 61 76 65 20 72 65 67 69 73 |lator save regis| 00005800 74 65 72 0d 20 20 20 20 20 20 20 20 20 20 20 20 |ter. | 00005810 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00005820 5c 20 6f 66 66 20 74 68 65 20 73 74 61 63 6b 0d |\ off the stack.| 00005830 20 20 39 36 30 20 20 20 20 20 20 20 20 20 53 54 | 960 ST| 00005840 41 20 73 61 76 65 72 65 67 20 20 20 5c 20 61 6e |A savereg \ an| 00005850 64 20 72 65 73 74 6f 72 65 20 7a 65 72 6f 20 70 |d restore zero p| 00005860 61 67 65 0d 20 20 39 37 30 20 20 20 20 20 20 20 |age. 970 | 00005870 20 20 52 54 49 20 20 20 20 20 20 20 20 20 20 20 | RTI | 00005880 5c 20 72 65 74 75 72 6e 20 66 72 6f 6d 20 69 6e |\ return from in| 00005890 74 65 72 72 75 70 74 0d 20 20 39 38 30 20 2e 6e |terrupt. 980 .n| 000058a0 6f 74 75 73 65 72 0d 20 20 39 39 30 20 20 20 20 |otuser. 990 | 000058b0 20 20 20 20 20 50 4c 41 20 20 20 20 20 20 20 20 | PLA | 000058c0 20 20 20 5c 20 70 75 6c 6c 20 74 68 65 20 69 6e | \ pull the in| 000058d0 74 65 72 72 75 70 74 20 61 63 63 75 6d 75 6c 61 |terrupt accumula| 000058e0 74 6f 72 20 73 61 76 65 0d 20 20 20 20 20 20 20 |tor save. | 000058f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00005900 20 20 20 20 20 5c 20 72 65 67 69 73 74 65 72 20 | \ register | 00005910 6f 66 66 20 74 68 65 20 73 74 61 63 6b 0d 20 31 |off the stack. 1| 00005920 30 30 30 20 20 20 20 20 20 20 20 20 53 54 41 20 |000 STA | 00005930 73 61 76 65 72 65 67 20 20 20 5c 20 72 65 73 74 |savereg \ rest| 00005940 6f 72 65 20 74 68 65 20 7a 65 72 6f 20 70 61 67 |ore the zero pag| 00005950 65 20 61 64 64 72 65 73 73 0d 20 31 30 31 30 20 |e address. 1010 | 00005960 20 20 20 20 20 20 20 20 4a 4d 50 20 28 6f 6c 64 | JMP (old| 00005970 69 72 71 31 76 29 20 5c 20 65 78 69 74 20 76 69 |irq1v) \ exit vi| 00005980 61 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 76 |a the original v| 00005990 65 63 74 6f 72 0d 20 31 30 32 30 20 2e 6e 65 77 |ector. 1020 .new| 000059a0 73 63 61 6e 0d 20 31 30 33 30 20 20 20 20 20 20 |scan. 1030 | 000059b0 20 20 20 50 48 50 20 20 20 20 20 20 20 20 20 20 | PHP | 000059c0 20 5c 20 70 75 73 68 20 73 74 61 74 75 73 20 72 | \ push status r| 000059d0 65 67 69 73 74 65 72 0d 20 31 30 34 30 20 20 20 |egister. 1040 | 000059e0 20 20 20 20 20 20 43 4d 50 20 23 26 37 39 20 20 | CMP #&79 | 000059f0 20 20 20 20 5c 20 69 73 20 74 68 69 73 20 4f 73 | \ is this Os| 00005a00 62 79 74 65 20 26 37 39 3f 0d 20 31 30 35 30 20 |byte &79?. 1050 | 00005a10 20 20 20 20 20 20 20 20 42 45 51 20 73 63 61 6e | BEQ scan| 00005a20 20 20 20 20 20 20 5c 20 69 66 20 69 74 20 69 73 | \ if it is| 00005a30 20 62 72 61 6e 63 68 20 74 6f 20 6e 65 77 20 6b | branch to new k| 00005a40 65 79 62 6f 61 72 64 20 73 63 61 6e 20 72 6f 75 |eyboard scan rou| 00005a50 74 69 6e 65 0d 20 31 30 36 30 20 20 20 20 20 20 |tine. 1060 | 00005a60 20 20 20 43 4d 50 20 23 26 37 41 20 20 20 20 20 | CMP #&7A | 00005a70 20 5c 20 69 73 20 74 68 69 73 20 4f 73 62 79 74 | \ is this Osbyt| 00005a80 65 20 26 37 41 3f 0d 20 31 30 37 30 20 20 20 20 |e &7A?. 1070 | 00005a90 20 20 20 20 20 42 45 51 20 73 63 61 6e 20 20 20 | BEQ scan | 00005aa0 20 20 20 5c 20 62 72 61 6e 63 68 20 69 66 20 4f | \ branch if O| 00005ab0 73 62 79 74 65 20 26 37 41 0d 20 31 30 38 30 20 |sbyte &7A. 1080 | 00005ac0 2e 6e 6f 74 73 63 61 6e 0d 20 31 30 39 30 20 20 |.notscan. 1090 | 00005ad0 20 20 20 20 20 20 20 50 4c 50 20 20 20 20 20 20 | PLP | 00005ae0 20 20 20 20 20 5c 20 72 65 73 74 6f 72 65 20 73 | \ restore s| 00005af0 74 61 74 75 73 20 72 65 67 69 73 74 65 72 20 61 |tatus register a| 00005b00 6e 64 20 72 65 74 75 72 6e 20 74 6f 20 42 41 53 |nd return to BAS| 00005b10 49 43 0d 20 31 31 30 30 20 2e 6f 6c 64 63 6f 64 |IC. 1100 .oldcod| 00005b20 65 0d 20 31 31 31 30 20 20 20 20 20 20 20 20 20 |e. 1110 | 00005b30 4a 4d 50 20 28 6f 6c 64 62 79 74 65 76 29 20 5c |JMP (oldbytev) \| 00005b40 20 65 78 69 74 20 76 69 61 20 6f 72 69 67 69 6e | exit via origin| 00005b50 61 6c 20 4f 73 62 79 74 65 20 76 65 63 74 6f 72 |al Osbyte vector| 00005b60 0d 20 31 31 32 30 20 2e 73 63 61 6e 0d 20 31 31 |. 1120 .scan. 11| 00005b70 33 30 20 20 20 20 20 20 20 20 20 50 48 41 20 20 |30 PHA | 00005b80 20 20 20 20 20 20 20 20 20 5c 20 70 75 73 68 20 | \ push | 00005b90 74 68 65 20 4f 73 62 79 74 65 20 63 6f 64 65 20 |the Osbyte code | 00005ba0 28 65 69 74 68 65 72 20 26 37 39 20 6f 72 20 26 |(either &79 or &| 00005bb0 37 41 29 0d 20 31 31 34 30 20 20 20 20 20 20 20 |7A). 1140 | 00005bc0 20 20 4a 53 52 20 6f 6c 64 63 6f 64 65 20 20 20 | JSR oldcode | 00005bd0 5c 20 70 65 72 66 6f 72 6d 20 74 68 65 20 6f 72 |\ perform the or| 00005be0 69 67 69 6e 61 6c 20 4f 73 62 79 74 65 20 63 61 |iginal Osbyte ca| 00005bf0 6c 6c 0d 20 31 31 35 30 20 20 20 20 20 20 20 20 |ll. 1150 | 00005c00 20 43 50 58 20 23 26 46 46 20 20 20 20 20 20 5c | CPX #&FF \| 00005c10 20 6b 65 79 20 70 72 65 73 73 65 64 20 69 66 20 | key pressed if | 00005c20 58 20 3c 3e 20 26 46 46 0d 20 31 31 36 30 20 20 |X <> &FF. 1160 | 00005c30 20 20 20 20 20 20 20 42 45 51 20 6e 6f 74 70 72 | BEQ notpr| 00005c40 65 73 73 65 64 20 5c 20 62 72 61 6e 63 68 20 69 |essed \ branch i| 00005c50 66 20 6b 65 79 20 6e 6f 74 20 70 72 65 73 73 65 |f key not presse| 00005c60 64 0d 20 31 31 37 30 20 2e 70 75 6c 6c 6f 75 74 |d. 1170 .pullout| 00005c70 0d 20 31 31 38 30 20 20 20 20 20 20 20 20 20 50 |. 1180 P| 00005c80 4c 41 20 20 20 20 20 20 20 20 20 20 20 5c 20 70 |LA \ p| 00005c90 75 6c 6c 20 4f 73 62 79 74 65 20 63 6f 64 65 20 |ull Osbyte code | 00005ca0 28 65 69 74 68 65 72 20 26 37 39 20 6f 72 20 26 |(either &79 or &| 00005cb0 37 41 29 0d 20 31 31 39 30 20 20 20 20 20 20 20 |7A). 1190 | 00005cc0 20 20 50 4c 50 20 20 20 20 20 20 20 20 20 20 20 | PLP | 00005cd0 5c 20 70 75 6c 6c 20 74 68 65 20 73 74 61 74 75 |\ pull the statu| 00005ce0 73 20 72 65 67 69 73 74 65 72 0d 20 31 32 30 30 |s register. 1200| 00005cf0 20 20 20 20 20 20 20 20 20 52 54 53 20 20 20 20 | RTS | 00005d00 20 20 20 20 20 20 20 5c 20 61 6e 64 20 72 65 74 | \ and ret| 00005d10 75 72 6e 20 74 6f 20 42 41 53 49 43 0d 20 31 32 |urn to BASIC. 12| 00005d20 31 30 20 2e 6e 6f 74 70 72 65 73 73 65 64 0d 20 |10 .notpressed. | 00005d30 31 32 32 30 20 20 20 20 20 20 20 20 20 4c 44 41 |1220 LDA| 00005d40 20 64 72 62 20 20 20 20 20 20 20 5c 20 6c 6f 61 | drb \ loa| 00005d50 64 20 64 61 74 61 20 72 65 67 69 73 74 65 72 20 |d data register | 00005d60 42 0d 20 31 32 33 30 20 20 20 20 20 20 20 20 20 |B. 1230 | 00005d70 52 4f 4c 20 41 20 20 20 20 20 20 20 20 20 5c 20 |ROL A \ | 00005d80 62 69 74 20 37 20 6f 66 20 72 65 67 69 73 74 65 |bit 7 of registe| 00005d90 72 20 42 20 69 6e 74 6f 20 63 61 72 72 79 0d 20 |r B into carry. | 00005da0 31 32 34 30 20 20 20 20 20 20 20 20 20 42 43 43 |1240 BCC| 00005db0 20 72 69 67 68 74 70 72 65 73 73 20 5c 20 63 61 | rightpress \ ca| 00005dc0 72 72 79 20 63 6c 65 61 72 20 69 66 20 72 69 67 |rry clear if rig| 00005dd0 68 74 20 62 75 74 74 6f 6e 20 70 72 65 73 73 65 |ht button presse| 00005de0 64 0d 20 31 32 35 30 20 20 20 20 20 20 20 20 20 |d. 1250 | 00005df0 52 4f 4c 20 41 20 20 20 20 20 20 20 20 20 5c 20 |ROL A \ | 00005e00 62 69 74 20 36 20 69 6e 74 6f 20 63 61 72 72 79 |bit 6 into carry| 00005e10 0d 20 31 32 36 30 20 20 20 20 20 20 20 20 20 42 |. 1260 B| 00005e20 43 43 20 63 65 6e 74 72 65 70 72 65 73 73 20 5c |CC centrepress \| 00005e30 20 62 69 74 20 36 20 63 6c 65 61 72 20 69 66 20 | bit 6 clear if | 00005e40 63 65 6e 74 72 65 20 62 75 74 74 6f 6e 20 70 72 |centre button pr| 00005e50 65 73 73 65 64 0d 20 31 32 37 30 20 20 20 20 20 |essed. 1270 | 00005e60 20 20 20 20 52 4f 4c 20 41 20 20 20 20 20 20 20 | ROL A | 00005e70 20 20 5c 20 62 69 74 20 35 20 69 6e 74 6f 20 63 | \ bit 5 into c| 00005e80 61 72 72 79 0d 20 31 32 38 30 20 20 20 20 20 20 |arry. 1280 | 00005e90 20 20 20 42 43 43 20 6c 65 66 74 70 72 65 73 73 | BCC leftpress| 00005ea0 20 5c 20 62 69 74 20 35 20 63 6c 65 61 72 20 69 | \ bit 5 clear i| 00005eb0 66 20 6c 65 66 74 20 62 75 74 74 6f 6e 20 70 72 |f left button pr| 00005ec0 65 73 73 65 64 0d 20 31 32 39 30 20 20 20 20 20 |essed. 1290 | 00005ed0 20 20 20 20 4c 44 41 20 78 63 6f 6f 72 64 20 20 | LDA xcoord | 00005ee0 20 20 5c 20 58 20 63 6f 6f 72 64 69 6e 61 74 65 | \ X coordinate| 00005ef0 20 66 72 6f 6d 20 6d 6f 75 73 65 20 6d 6f 76 65 | from mouse move| 00005f00 6d 65 6e 74 0d 20 31 33 30 30 20 20 20 20 20 20 |ment. 1300 | 00005f10 20 20 20 43 4d 50 20 23 26 38 38 20 20 20 20 20 | CMP #&88 | 00005f20 20 5c 20 69 73 20 74 68 65 20 58 20 63 6f 6f 72 | \ is the X coor| 00005f30 64 69 6e 61 74 65 20 3e 20 26 38 37 3f 0d 20 31 |dinate > &87?. 1| 00005f40 33 31 30 20 20 20 20 20 20 20 20 20 42 43 53 20 |310 BCS | 00005f50 72 69 67 68 74 61 72 72 6f 77 20 5c 20 62 72 61 |rightarrow \ bra| 00005f60 6e 63 68 20 69 66 20 58 20 63 6f 6f 72 64 69 6e |nch if X coordin| 00005f70 61 74 65 20 69 73 20 68 69 67 68 20 65 6e 6f 75 |ate is high enou| 00005f80 67 68 0d 20 31 33 32 30 20 20 20 20 20 20 20 20 |gh. 1320 | 00005f90 20 43 4d 50 20 23 26 37 38 20 20 20 20 20 20 5c | CMP #&78 \| 00005fa0 20 69 73 20 74 68 65 20 58 20 63 6f 6f 72 64 69 | is the X coordi| 00005fb0 6e 61 74 65 20 3c 20 26 37 38 3f 0d 20 31 33 33 |nate < &78?. 133| 00005fc0 30 20 20 20 20 20 20 20 20 20 42 43 43 20 6c 65 |0 BCC le| 00005fd0 66 74 61 72 72 6f 77 20 5c 20 62 72 61 6e 63 68 |ftarrow \ branch| 00005fe0 20 69 66 20 59 20 63 6f 6f 72 64 69 6e 61 74 65 | if Y coordinate| 00005ff0 20 69 73 20 6c 6f 77 20 65 6e 6f 75 67 68 0d 20 | is low enough. | 00006000 31 33 34 30 20 20 20 20 20 20 20 20 20 4c 44 41 |1340 LDA| 00006010 20 79 63 6f 6f 72 64 20 20 20 20 5c 20 59 20 63 | ycoord \ Y c| 00006020 6f 6f 72 64 69 6e 61 74 65 20 66 72 6f 6d 20 6d |oordinate from m| 00006030 6f 75 73 65 20 6d 6f 76 65 6d 65 6e 74 0d 20 31 |ouse movement. 1| 00006040 33 35 30 20 20 20 20 20 20 20 20 20 43 4d 50 20 |350 CMP | 00006050 23 26 38 38 20 20 20 20 20 20 5c 20 69 73 20 74 |#&88 \ is t| 00006060 68 65 20 59 20 63 6f 6f 72 64 69 6e 61 74 65 20 |he Y coordinate | 00006070 3e 20 26 38 37 3f 0d 20 31 33 36 30 20 20 20 20 |> &87?. 1360 | 00006080 20 20 20 20 20 42 43 53 20 75 70 61 72 72 6f 77 | BCS uparrow| 00006090 20 20 20 5c 20 62 72 61 6e 63 68 20 69 66 20 59 | \ branch if Y| 000060a0 20 63 6f 6f 72 64 69 6e 61 74 65 20 69 73 20 68 | coordinate is h| 000060b0 69 67 68 20 65 6e 6f 75 67 68 0d 20 31 33 37 30 |igh enough. 1370| 000060c0 20 20 20 20 20 20 20 20 20 43 4d 50 20 23 26 37 | CMP #&7| 000060d0 38 20 20 20 20 20 20 5c 20 69 73 20 74 68 65 20 |8 \ is the | 000060e0 59 20 63 6f 6f 72 64 69 6e 61 74 65 20 3c 20 26 |Y coordinate < &| 000060f0 37 38 3f 0d 20 31 33 38 30 20 20 20 20 20 20 20 |78?. 1380 | 00006100 20 20 42 43 53 20 70 75 6c 6c 6f 75 74 20 20 20 | BCS pullout | 00006110 5c 20 72 65 74 75 72 6e 20 74 6f 20 42 41 53 49 |\ return to BASI| 00006120 43 20 69 66 20 69 74 20 69 73 20 6e 6f 74 0d 20 |C if it is not. | 00006130 31 33 39 30 20 20 20 20 20 20 20 20 20 4c 44 58 |1390 LDX| 00006140 20 64 6f 77 6e 20 20 20 20 20 20 5c 20 73 69 6d | down \ sim| 00006150 75 6c 61 74 65 20 61 20 70 72 65 73 73 20 6f 6e |ulate a press on| 00006160 20 74 68 65 20 63 75 72 73 6f 72 20 64 6f 77 6e | the cursor down| 00006170 20 6b 65 79 0d 20 31 34 30 30 20 20 20 20 20 20 | key. 1400 | 00006180 20 20 20 42 4e 45 20 72 65 73 65 74 79 20 20 20 | BNE resety | 00006190 20 5c 20 75 6e 63 6f 6e 64 69 74 69 6f 6e 61 6c | \ unconditional| 000061a0 20 62 72 61 6e 63 68 20 74 6f 20 72 65 73 65 74 | branch to reset| 000061b0 20 59 20 63 6f 6f 72 64 69 6e 61 74 65 0d 20 31 | Y coordinate. 1| 000061c0 34 31 30 20 2e 75 70 61 72 72 6f 77 0d 20 31 34 |410 .uparrow. 14| 000061d0 32 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 75 |20 LDX u| 000061e0 70 20 20 20 20 20 20 20 20 5c 20 73 69 6d 75 6c |p \ simul| 000061f0 61 74 65 20 61 20 70 72 65 73 73 20 6f 6e 20 74 |ate a press on t| 00006200 68 65 20 63 75 72 73 6f 72 20 75 70 20 6b 65 79 |he cursor up key| 00006210 0d 20 31 34 33 30 20 2e 72 65 73 65 74 79 0d 20 |. 1430 .resety. | 00006220 31 34 34 30 20 20 20 20 20 20 20 20 20 4c 44 41 |1440 LDA| 00006230 20 23 26 38 30 20 20 20 20 20 20 5c 20 72 65 73 | #&80 \ res| 00006240 65 74 20 74 68 65 20 59 20 63 6f 6f 72 64 69 6e |et the Y coordin| 00006250 61 74 65 20 74 6f 20 26 38 30 0d 20 31 34 35 30 |ate to &80. 1450| 00006260 20 20 20 20 20 20 20 20 20 53 54 41 20 79 63 6f | STA yco| 00006270 6f 72 64 0d 20 31 34 36 30 20 20 20 20 20 20 20 |ord. 1460 | 00006280 20 20 42 4e 45 20 70 75 6c 6c 6f 75 74 20 20 20 | BNE pullout | 00006290 5c 20 75 6e 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 |\ unconditional | 000062a0 62 72 61 6e 63 68 20 74 6f 20 72 65 74 75 72 6e |branch to return| 000062b0 20 74 6f 20 42 41 53 49 43 0d 20 31 34 37 30 20 | to BASIC. 1470 | 000062c0 2e 72 69 67 68 74 61 72 72 6f 77 0d 20 31 34 38 |.rightarrow. 148| 000062d0 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 72 69 |0 LDX ri| 000062e0 67 68 74 20 20 20 20 20 5c 20 73 69 6d 75 6c 61 |ght \ simula| 000062f0 74 65 20 61 20 70 72 65 73 73 20 6f 6e 20 74 68 |te a press on th| 00006300 65 20 63 75 72 73 6f 72 20 72 69 67 68 74 20 6b |e cursor right k| 00006310 65 79 0d 20 31 34 39 30 20 20 20 20 20 20 20 20 |ey. 1490 | 00006320 20 42 4e 45 20 72 65 73 65 74 78 20 20 20 20 5c | BNE resetx \| 00006330 20 75 6e 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 62 | unconditional b| 00006340 72 61 6e 63 68 20 74 6f 20 72 65 73 65 74 20 58 |ranch to reset X| 00006350 20 63 6f 6f 72 64 69 6e 61 74 65 0d 20 31 35 30 | coordinate. 150| 00006360 30 20 2e 6c 65 66 74 61 72 72 6f 77 0d 20 31 35 |0 .leftarrow. 15| 00006370 31 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 6c |10 LDX l| 00006380 65 66 74 20 20 20 20 20 20 5c 20 73 69 6d 75 6c |eft \ simul| 00006390 61 74 65 20 61 20 70 72 65 73 73 20 6f 6e 20 74 |ate a press on t| 000063a0 68 65 20 63 75 72 73 6f 72 20 6c 65 66 74 20 6b |he cursor left k| 000063b0 65 79 0d 20 31 35 32 30 20 2e 72 65 73 65 74 78 |ey. 1520 .resetx| 000063c0 0d 20 31 35 33 30 20 20 20 20 20 20 20 20 20 4c |. 1530 L| 000063d0 44 41 20 23 26 38 30 20 20 20 20 20 20 5c 20 72 |DA #&80 \ r| 000063e0 65 73 65 74 20 59 20 63 6f 6f 72 64 69 6e 61 74 |eset Y coordinat| 000063f0 65 20 74 6f 20 26 38 30 0d 20 31 35 34 30 20 20 |e to &80. 1540 | 00006400 20 20 20 20 20 20 20 53 54 41 20 78 63 6f 6f 72 | STA xcoor| 00006410 64 0d 20 31 35 35 30 20 20 20 20 20 20 20 20 20 |d. 1550 | 00006420 42 4e 45 20 70 75 6c 6c 6f 75 74 20 20 20 5c 20 |BNE pullout \ | 00006430 75 6e 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 62 72 |unconditional br| 00006440 61 6e 63 68 20 74 6f 20 72 65 74 75 72 6e 20 74 |anch to return t| 00006450 6f 20 42 41 53 49 43 0d 20 31 35 36 30 20 2e 6c |o BASIC. 1560 .l| 00006460 65 66 74 70 72 65 73 73 0d 20 31 35 37 30 20 20 |eftpress. 1570 | 00006470 20 20 20 20 20 20 20 4c 44 58 20 6c 65 66 74 62 | LDX leftb| 00006480 75 74 74 6f 6e 20 5c 20 73 69 6d 75 6c 61 74 65 |utton \ simulate| 00006490 20 61 20 6b 65 79 20 70 72 65 73 73 20 66 72 6f | a key press fro| 000064a0 6d 20 6c 65 66 74 20 6d 6f 75 73 65 20 62 75 74 |m left mouse but| 000064b0 74 6f 6e 0d 20 31 35 38 30 20 20 20 20 20 20 20 |ton. 1580 | 000064c0 20 20 42 4e 45 20 70 75 6c 6c 6f 75 74 20 20 20 | BNE pullout | 000064d0 5c 20 75 6e 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 |\ unconditional | 000064e0 62 72 61 6e 63 68 20 74 6f 20 72 65 74 75 72 6e |branch to return| 000064f0 20 74 6f 20 42 41 53 49 43 0d 20 31 35 39 30 20 | to BASIC. 1590 | 00006500 2e 72 69 67 68 74 70 72 65 73 73 0d 20 31 36 30 |.rightpress. 160| 00006510 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 72 69 |0 LDX ri| 00006520 67 68 74 62 75 74 74 6f 6e 20 5c 20 73 69 6d 75 |ghtbutton \ simu| 00006530 6c 61 74 65 20 61 20 6b 65 79 20 70 72 65 73 73 |late a key press| 00006540 20 66 72 6f 6d 20 72 69 67 68 74 20 6d 6f 75 73 | from right mous| 00006550 65 0d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |e. | 00006560 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 00006570 62 75 74 74 6f 6e 0d 20 31 36 31 30 20 20 20 20 |button. 1610 | 00006580 20 20 20 20 20 42 4e 45 20 70 75 6c 6c 6f 75 74 | BNE pullout| 00006590 20 20 20 5c 20 75 6e 63 6f 6e 64 69 74 69 6f 6e | \ uncondition| 000065a0 61 6c 20 62 72 61 6e 63 68 20 74 6f 20 72 65 74 |al branch to ret| 000065b0 75 72 6e 20 74 6f 20 42 41 53 49 43 0d 20 31 36 |urn to BASIC. 16| 000065c0 32 30 20 2e 63 65 6e 74 72 65 70 72 65 73 73 0d |20 .centrepress.| 000065d0 20 31 36 33 30 20 20 20 20 20 20 20 20 20 4c 44 | 1630 LD| 000065e0 58 20 63 65 6e 74 72 65 62 75 74 74 6f 6e 20 5c |X centrebutton \| 000065f0 20 73 69 6d 75 6c 61 74 65 20 61 20 6b 65 79 20 | simulate a key | 00006600 70 72 65 73 73 20 66 72 6f 6d 20 63 65 6e 74 72 |press from centr| 00006610 65 20 6d 6f 75 73 65 0d 20 20 20 20 20 20 20 20 |e mouse. | 00006620 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00006630 20 20 20 20 5c 20 62 75 74 74 6f 6e 0d 20 31 36 | \ button. 16| 00006640 34 30 20 20 20 20 20 20 20 20 20 42 4e 45 20 70 |40 BNE p| 00006650 75 6c 6c 6f 75 74 20 20 20 5c 20 75 6e 63 6f 6e |ullout \ uncon| 00006660 64 69 74 69 6f 6e 61 6c 20 62 72 61 6e 63 68 20 |ditional branch | 00006670 74 6f 20 72 65 74 75 72 6e 20 74 6f 20 42 41 53 |to return to BAS| 00006680 49 43 0d 20 31 36 35 30 20 2e 72 69 67 68 74 62 |IC. 1650 .rightb| 00006690 75 74 74 6f 6e 0d 20 31 36 36 30 20 20 20 20 20 |utton. 1660 | 000066a0 20 20 20 20 45 51 55 42 20 26 35 39 20 20 20 20 | EQUB &59 | 000066b0 20 20 5c 20 64 65 6c 65 74 65 20 69 6e 74 65 72 | \ delete inter| 000066c0 6e 61 6c 20 6b 65 79 20 6e 75 6d 62 65 72 0d 20 |nal key number. | 000066d0 31 36 37 30 20 2e 63 65 6e 74 72 65 62 75 74 74 |1670 .centrebutt| 000066e0 6f 6e 0d 20 31 36 38 30 20 20 20 20 20 20 20 20 |on. 1680 | 000066f0 20 45 51 55 42 20 26 34 39 20 20 20 20 20 20 5c | EQUB &49 \| 00006700 20 72 65 74 75 72 6e 20 69 6e 74 65 72 6e 61 6c | return internal| 00006710 20 6b 65 79 20 6e 75 6d 62 65 72 0d 20 31 36 39 | key number. 169| 00006720 30 20 2e 6c 65 66 74 62 75 74 74 6f 6e 0d 20 31 |0 .leftbutton. 1| 00006730 37 30 30 20 20 20 20 20 20 20 20 20 45 51 55 42 |700 EQUB| 00006740 20 26 36 39 20 20 20 20 20 20 5c 20 63 6f 70 79 | &69 \ copy| 00006750 20 69 6e 74 65 72 6e 61 6c 20 6b 65 79 20 6e 75 | internal key nu| 00006760 6d 62 65 72 0d 20 31 37 31 30 20 2e 75 70 0d 20 |mber. 1710 .up. | 00006770 31 37 32 30 20 20 20 20 20 20 20 20 20 45 51 55 |1720 EQU| 00006780 42 20 26 33 39 20 20 20 20 20 20 5c 20 63 75 72 |B &39 \ cur| 00006790 73 6f 72 20 75 70 20 69 6e 74 65 72 6e 61 6c 20 |sor up internal | 000067a0 6b 65 79 20 6e 75 6d 62 65 72 0d 20 31 37 33 30 |key number. 1730| 000067b0 20 2e 64 6f 77 6e 0d 20 31 37 34 30 20 20 20 20 | .down. 1740 | 000067c0 20 20 20 20 20 45 51 55 42 20 26 32 39 20 20 20 | EQUB &29 | 000067d0 20 20 20 5c 20 63 75 72 73 6f 72 20 64 6f 77 6e | \ cursor down| 000067e0 20 69 6e 74 65 72 6e 61 6c 20 6b 65 79 20 6e 75 | internal key nu| 000067f0 6d 62 65 72 0d 20 31 37 35 30 20 2e 6c 65 66 74 |mber. 1750 .left| 00006800 0d 20 31 37 36 30 20 20 20 20 20 20 20 20 20 45 |. 1760 E| 00006810 51 55 42 20 26 31 39 20 20 20 20 20 20 5c 20 63 |QUB &19 \ c| 00006820 75 72 73 6f 72 20 6c 65 66 74 20 69 6e 74 65 72 |ursor left inter| 00006830 6e 61 6c 20 6b 65 79 20 6e 75 6d 62 65 72 0d 20 |nal key number. | 00006840 31 37 37 30 20 2e 72 69 67 68 74 0d 20 31 37 38 |1770 .right. 178| 00006850 30 20 20 20 20 20 20 20 20 20 45 51 55 42 20 26 |0 EQUB &| 00006860 37 39 20 20 20 20 20 20 5c 20 63 75 72 73 6f 72 |79 \ cursor| 00006870 20 72 69 67 68 74 20 69 6e 74 65 72 6e 61 6c 20 | right internal | 00006880 6b 65 79 20 6e 75 6d 62 65 72 0d 20 31 37 39 30 |key number. 1790| 00006890 20 2e 6f 6c 64 69 72 71 31 76 0d 20 31 38 30 30 | .oldirq1v. 1800| 000068a0 20 20 20 20 20 20 20 20 20 45 51 55 57 20 26 30 | EQUW &0| 000068b0 30 20 20 20 20 20 20 5c 20 6f 72 69 67 69 6e 61 |0 \ origina| 000068c0 6c 20 69 72 71 31 20 76 65 63 74 6f 72 0d 20 31 |l irq1 vector. 1| 000068d0 38 31 30 20 2e 6f 6c 64 62 79 74 65 76 0d 20 31 |810 .oldbytev. 1| 000068e0 38 32 30 20 20 20 20 20 20 20 20 20 45 51 55 57 |820 EQUW| 000068f0 20 26 30 30 20 20 20 20 20 20 5c 20 6f 72 69 67 | &00 \ orig| 00006900 69 6e 61 6c 20 4f 73 62 79 74 65 20 69 6e 64 69 |inal Osbyte indi| 00006910 72 65 63 74 69 6f 6e 20 76 65 63 74 6f 72 0d 20 |rection vector. | 00006920 31 38 33 30 20 2e 78 63 6f 6f 72 64 0d 20 31 38 |1830 .xcoord. 18| 00006930 34 30 20 20 20 20 20 20 20 20 20 45 51 55 42 20 |40 EQUB | 00006940 26 38 30 20 20 20 20 20 20 5c 20 6d 6f 75 73 65 |&80 \ mouse| 00006950 20 58 20 63 6f 6f 72 64 69 6e 61 74 65 20 30 2d | X coordinate 0-| 00006960 32 35 35 0d 20 31 38 35 30 20 2e 79 63 6f 6f 72 |255. 1850 .ycoor| 00006970 64 0d 20 31 38 36 30 20 20 20 20 20 20 20 20 20 |d. 1860 | 00006980 45 51 55 42 20 26 38 30 20 20 20 20 20 20 5c 20 |EQUB &80 \ | 00006990 6d 6f 75 73 65 20 59 20 63 6f 6f 72 64 69 6e 61 |mouse Y coordina| 000069a0 74 65 20 30 2d 32 35 35 0d 20 31 38 37 30 20 2e |te 0-255. 1870 .| 000069b0 6c 61 73 74 62 79 74 65 0d 20 31 38 38 30 20 5d |lastbyte. 1880 ]| 000069c0 0d 20 31 38 39 30 20 4e 45 58 54 0d 20 31 39 30 |. 1890 NEXT. 190| 000069d0 30 20 43 41 4c 4c 20 6d 63 6f 64 65 20 3a 52 45 |0 CALL mcode :RE| 000069e0 4d 3a 20 65 6e 61 62 6c 65 20 6e 65 77 20 63 6f |M: enable new co| 000069f0 64 65 0d 20 31 39 31 30 20 4d 4f 44 45 37 0d 20 |de. 1910 MODE7. | 00006a00 31 39 32 30 20 6d 6f 75 73 65 24 3d 43 48 52 24 |1920 mouse$=CHR$| 00006a10 31 34 31 2b 43 48 52 24 31 33 32 2b 43 48 52 24 |141+CHR$132+CHR$| 00006a20 31 35 37 2b 43 48 52 24 31 33 31 2b 0d 20 20 20 |157+CHR$131+. | 00006a30 20 20 20 22 50 72 65 73 73 20 6b 65 79 62 6f 61 | "Press keyboa| 00006a40 72 64 20 6f 72 20 6d 6f 76 65 20 74 68 65 20 6d |rd or move the m| 00006a50 6f 75 73 65 20 20 22 2b 43 48 52 24 31 35 36 0d |ouse "+CHR$156.| 00006a60 20 31 39 33 30 20 50 52 49 4e 54 54 41 42 28 30 | 1930 PRINTTAB(0| 00006a70 2c 31 29 6d 6f 75 73 65 24 0d 20 31 39 34 30 20 |,1)mouse$. 1940 | 00006a80 50 52 49 4e 54 54 41 42 28 30 2c 32 29 6d 6f 75 |PRINTTAB(0,2)mou| 00006a90 73 65 24 0d 20 31 39 35 30 20 50 52 49 4e 54 54 |se$. 1950 PRINTT| 00006aa0 41 42 28 31 30 2c 36 29 22 42 79 74 65 73 20 75 |AB(10,6)"Bytes u| 00006ab0 73 65 64 20 3d 20 26 22 3b 7e 28 6c 61 73 74 62 |sed = &";~(lastb| 00006ac0 79 74 65 2d 6d 63 6f 64 65 29 0d 20 31 39 36 30 |yte-mcode). 1960| 00006ad0 20 4f 4e 20 45 52 52 4f 52 20 47 4f 54 4f 20 32 | ON ERROR GOTO 2| 00006ae0 31 30 30 0d 20 31 39 37 30 20 56 44 55 32 33 2c |100. 1970 VDU23,| 00006af0 31 2c 30 3b 30 3b 30 3b 30 3b 0d 20 31 39 38 30 |1,0;0;0;0;. 1980| 00006b00 20 52 45 50 45 41 54 0d 20 31 39 39 30 20 50 52 | REPEAT. 1990 PR| 00006b10 49 4e 54 54 41 42 28 31 30 2c 31 30 29 22 58 20 |INTTAB(10,10)"X | 00006b20 3d 20 26 22 3b 7e 3f 48 25 3b 22 20 22 0d 20 32 |= &";~?H%;" ". 2| 00006b30 30 30 30 20 50 52 49 4e 54 54 41 42 28 32 30 2c |000 PRINTTAB(20,| 00006b40 31 30 29 22 59 20 3d 20 26 22 3b 7e 3f 56 25 3b |10)"Y = &";~?V%;| 00006b50 22 20 22 0d 20 32 30 31 30 20 41 25 3d 26 37 39 |" ". 2010 A%=&79| 00006b60 0d 20 32 30 32 30 20 58 25 3d 31 36 0d 20 32 30 |. 2020 X%=16. 20| 00006b70 33 30 20 61 6e 73 77 65 72 3d 28 55 53 52 28 6f |30 answer=(USR(o| 00006b80 73 62 79 74 65 29 20 41 4e 44 20 26 46 46 30 30 |sbyte) AND &FF00| 00006b90 29 44 49 56 20 26 31 30 30 0d 20 32 30 34 30 20 |)DIV &100. 2040 | 00006ba0 50 52 49 4e 54 54 41 42 28 39 2c 31 35 29 22 4f |PRINTTAB(9,15)"O| 00006bb0 73 62 79 74 65 20 26 37 39 2c 20 58 20 3d 20 26 |sbyte &79, X = &| 00006bc0 22 3b 7e 61 6e 73 77 65 72 3b 22 20 22 0d 20 32 |";~answer;" ". 2| 00006bd0 30 35 30 20 41 25 3d 26 37 41 0d 20 32 30 36 30 |050 A%=&7A. 2060| 00006be0 20 58 25 3d 30 0d 20 32 30 37 30 20 61 6e 73 77 | X%=0. 2070 answ| 00006bf0 65 72 3d 28 55 53 52 28 6f 73 62 79 74 65 29 20 |er=(USR(osbyte) | 00006c00 41 4e 44 20 26 46 46 30 30 29 44 49 56 20 26 31 |AND &FF00)DIV &1| 00006c10 30 30 0d 20 32 30 38 30 20 50 52 49 4e 54 54 41 |00. 2080 PRINTTA| 00006c20 42 28 39 2c 32 30 29 22 4f 73 62 79 74 65 20 26 |B(9,20)"Osbyte &| 00006c30 37 41 2c 20 58 20 3d 20 26 22 3b 7e 61 6e 73 77 |7A, X = &";~answ| 00006c40 65 72 3b 22 20 22 0d 20 32 30 39 30 20 55 4e 54 |er;" ". 2090 UNT| 00006c50 49 4c 20 46 41 4c 53 45 0d 20 32 31 30 30 20 43 |IL FALSE. 2100 C| 00006c60 41 4c 4c 20 6d 63 6f 64 65 20 3a 52 45 4d 3a 20 |ALL mcode :REM: | 00006c70 64 69 73 61 62 6c 65 20 6e 65 77 20 63 6f 64 65 |disable new code| 00006c80 0d 20 32 31 31 30 20 56 44 55 32 33 2c 31 2c 31 |. 2110 VDU23,1,1| 00006c90 3b 30 3b 30 3b 30 3b 33 31 2c 30 2c 32 33 0d 20 |;0;0;0;31,0,23. | 00006ca0 32 31 32 30 20 45 4e 44 0d 0d 0d |2120 END...| 00006cab