Home » CEEFAX disks » telesoftware11.adl » 01-01-89/T\MOU05

01-01-89/T\MOU05

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: 01-01-89/T\MOU05
Read OK:
File size: 3B22 bytes
Load address: 0000
Exec address: 0000
File contents
Using a mouse with the BBC microcomputer - by - Gordon Horsington
-----------------------------------------------------------------

Module 5. Reading a mouse with the BASIC ADVAL command
------------------------------------------------------

The BBC computer uses a NEC uPD7002 analogue to digital converter. This is
a four channel integrating converter capable of converting to a resolution
of either 8 or 10 bits. The uPD7002 was originally intended to be a 12 bit
converter and in the 10 bit mode actually returns a 12 bit result. Osbyte
&BE uses values of X=8 or X=12 to select either 8 or 10 bit mode.
Presumably X=12 is used because the 10 bit mode gives a 12 bit answer.

The reference voltage supplied by the computer to the converter is 1.8
volts. This defines the maximum voltage that can be used for the
conversion and also limits the resolution of the device to 10 rather than
12 bits. In 10 bit mode the smallest recognisable step in voltage is
1.8/(2^10) ie. 1.75 millivolts. This is a very small voltage step and you
can expect noise on the analogue signal to exceed this level under many
practical situations, especially when using simple joystick controllers.
It seems quite common for the ADC to resolve only 8 bits when the 12 bit
mode is selected, the least significant 4 bits of the 12 bit result
varying with the noise on the analogue signal.

The least significant 4 bits of the 16 bit number returned by ADVAL(1-4)
are always clear - at least the 10 bit converter does not pretend to be a
16 bit converter. Because the least significant 4 bits of the 16 bit
result are always clear, the number returned is in the range from 0 to
65520 with increments of 16.

The demonstration program ANMOUSE uses a digital mouse to simulate the
analogue joystick controllers. It intercepts the ADVAL Osbyte call (number
&80) and returns a 16 bit number with the 4 least significant bits always
clear and 8 significant bits in a 12 bit result. This mimics the result
produced by real analogue joysticks but, because the mouse is digital
rather than analogue, the result appears to be far more stable than with
joysticks.

It is quite convenient to use an 8 bit resolution because only one byte
needs to be used to store each of the X and Y coordinates. An 8 bit
resolution may not seem very high but remember that this represents a step
of 0.4% of the full scale value and it is perfectly adequate for most
applications which use a joystick. The stability of the signal can be
subjectively more important than the accuracy, and the stability of the
mouse driven joystick simulation certainly makes it look more impressive
than a real joystick even though the resolution is about the same.

A problem which limits the use of the demonstrated technique is that there
are two joystick controllers but only one mouse. In ANMOUSE I have
allocated the mouse X coordinate to both channels 1 and 3, and the mouse Y
coordinate to both channels 2 and 4. This means that this type of program
cannot be used without modification for games which use both left and
right joysticks at the same time. You could modify the program so that one
joystick and one mouse are used or perhaps the cursor keys and a mouse if
more stability is required. The program ANMOUSE disables the analogue to
digital conversion and if you modify it to read both a joystick and a
mouse with ADVAL you will need to enable the appropriate joystick
channels. In these circumstances I would recomend using the left joystick
on channels 1 and 2 and the mouse on channels 3 and 4.

The mouse buttons have been allocated to the joystick fire buttons. The
left mouse button for the left joystick button, the right mouse button for
the right joystick button, and the centre mouse button for both joystick
buttons. The demonstration program simulates ADVAL(0)AND3=3 if the centre
mouse button is pressed but not if both the left and right mouse buttons
are pressed. It scans the joystick fire buttons as well as the mouse
buttons so that either can be used if both devices are connected to the
computer.

The Acorn joystick controllers are a bit unusual in that the X coordinates
are the reverse of the orientation I would expect to find. The graphics
screen defines the origin in the bottom left hand corner and I would
expect the joystick controller to return an X coordinate of zero with the
joystick to the left and 65520 with the joystick to the right. Instead it
does the opposite. The Y movement is not the reverse the expected
coordinates and ADVAL returns zero with the contoller towards the user and
65520 with the controller towards the screen. Most games software take
this reversal into account and for this reason the mouse analogue
simulation should do the same. In the program ANMOUSE the X coordinates
returned by ADVAL(1) and ADVAL(3) reduce as the mouse is moved to the left
and increase as it is moved to the right.


   10 REM> ANMOUSE
   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 Osbyte indirection vector, low byte
  240         STY oldbytev+1 \ save Osbyte indirection 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 #analogue MOD 256 \ new Osbyte indirection vector,
                            \ low byte
  320         LDY #analogue DIV 256 \ new Osbyte indirection vector,
                            \ high byte
  330         STX bytev     \ alter Osbyte indirection vector, low byte
  340         STY bytev+1   \ alter Osbyte indirection 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         LDA #&10      \ ADC channel select
  440         LDX #&00      \ sampling disabled
  450         JMP osbyte    \ Osbyte and return to BASIC
  460 .disable
  470         LDA #&18      \ %00011000, to clear bits 3 and 4 of ier
  480         LDX oldirq1v  \ original 1rq1 vector, low byte
  490         LDY oldirq1v+1 \ original irq1 vector, high byte
  500         SEI           \ set interrupt disable flag
  510         STA ier       \ interrupt enable register
  520         LDA pcr       \ peripheral control register
  530         AND #&0F      \ AND with %00001111, ie. clear bits 4-7
  540         STA pcr       \ peripheral control register
  550         STX irq1v     \ restore the original irq1 vector,
                            \ low byte
  560         STY irq1v+1   \ restore the original irq1 vector,
                            \ high byte
  570         CLI           \ clear interrupt disable flag
  580         LDX oldbytev  \ original Osbyte indirection vector,
                            \ low byte
  590         LDY oldbytev+1 \ original Osbyte indirection vector,
                            \ high byte
  600         STX bytev     \ restore the Osbyte vector, low byte
  610         STY bytev+1   \ restore the Osbyte vector, high byte
  620         LDA #&10      \ select ADC channel
  630         LDX #&04      \ 4 channels to be sampled
  640         JMP osbyte    \ Osbyte and return to BASIC
  650 .interrupt
  660         LDA savereg   \ interrupt accumulator save register
  670         PHA           \ and push it on the stack
  680         LDA ifr       \ interrupt flag register
  690         BPL notuser   \ bit 7 is set if VIA-B interrupt
  700         AND #&18      \ AND with %00011000, ie. test bits 3 and 4
  710         BEQ notuser   \ exit if not CB1 or CB2
  720         AND #&10      \ AND with %00010000, ie. test CB1
  730         BNE xpulse    \ bit 4 set for an X direction movement
  740         LDA drb       \ data register B
  750         AND #&04      \ AND with %00000100, ie. test bit 2
  760         BNE ydown     \ if bit 2 is set then Y is going down
  770         INC ycoord    \ Y is going up so increment Y coordinate
  780         BNE exit      \ branch if in the range 1 to 255
  790         BEQ decy      \ if zero then alter to 255
  800 .ydown
  810         LDA ycoord    \ load Y coordinate
  820         BEQ exit      \ branch if zero because it can't go any
                            \ lower
  830 .decy
  840         DEC ycoord    \ reduce Y coordinate by 1
  850         JMP exit      \ restore interrupt accumulator save
                            \ register and RTI
  860 .xpulse
  870         LDA drb       \ data register B
  880         ROR A         \ bit 0 into carry
  890         BCC xdown     \ X is going down if bit 0 is set -
                            \ but fudge for joystick simulation
  900         INC xcoord    \ X is going up if bit 0 is clear -
                            \ but fudge for joystick simulation
  910         BNE exit      \ exit if X coordinate is in the range
                            \ from 1 to 255
  920         BEQ decx      \ if X coordinate = 0 then make it 255
  930 .xdown
  940         LDA xcoord    \ load X coordinate
  950         BEQ exit      \ if it is zero it can't go any lower
  960 .decx
  970         DEC xcoord    \ decrease X coordinate by 1
  980 .exit
  990         PLA           \ pull interrupt accumulator save
                            \ register off the stack
 1000         STA savereg   \ and restore zero page
 1010         RTI           \ return from interrupt
 1020 .notuser
 1030         PLA           \ pull the interrupt accumulator save
                            \ register off the stack
 1040         STA savereg   \ restore the zero page address
 1050         JMP (oldirq1v) \ exit via the original vector
 1060 .analogue
 1070         PHP           \ push the status register
 1080         CMP #&80      \ Osbyte &80 is read ADC channel or get
                            \ buffer status
 1090         BNE oldadval  \ branch if not Osbyte &80
 1100         CPX #&00      \ is this ADVAL(0) ie. read fire buttons?
 1110         BEQ firebuttons \ branch to simulate read fire buttons
 1120         BPL newadval  \ if X = 1 to 4 then simulate ADC
                            \ conversion
 1130 .oldadval
 1140         PLP           \ pull status register
 1150 .original
 1160         JMP (oldbytev) \ exit via original Osbyte vector
 1170 .newadval
 1180         TXA           \ X contains channel number (1 to 4)
 1190         ROR A         \ bit 0 into carry
 1200         LDA ycoord    \ load Y coordinate
 1210         BCC skipxcoord \ branch if ADVAL(1) or ADVAL(3)
 1220         LDA xcoord    \ load X coordinate
 1230 .skipxcoord
 1240         TAY           \ Y = high byte of 16 bit simulated ADC
 1250         AND #&F0      \ AND with %11110000, ie. clear bits 0-3
 1260         TAX           \ X = low byte of 16 bit simulated ADC
 1270         LDA #&80      \ Osbyte &80
 1280         PLP           \ restore status register
 1290         RTS           \ return to BASIC
 1300 .firebuttons
 1310         JSR original  \ perform the original ADVAL(0)
 1320         TXA           \ result of reading fire buttons is in X
 1330         PHA           \ push X
 1340         LDA drb       \ data register B
 1350         ROL A         \ bit 7 into carry
 1360         BCC right     \ bit 7 clear = right button pressed
 1370         ROL A         \ bit 6 into carry
 1380         BCC centre    \ bit 6 clear = centre button pressed
 1390         ROL A         \ bit 5 into carry
 1400         BCS nopress   \ bit 5 set = no buttons pressed,
                            \ clear = left button pressed
 1410         PLA           \ pull the result of ADVAL(0)
 1420         ORA #&01      \ set bit 0
 1430         BNE getout    \ and return to BASIC
 1440 .right
 1450         PLA           \ pull the result of ADVAL(0)
 1460         ORA #&02      \ set bit 1
 1470         BNE getout    \ and return to BASIC
 1480 .centre
 1490         PLA           \ pull the result of ADVAL(0)
 1500         ORA #&03      \ set bits 0 and 1
 1510         BNE getout    \ and return to BASIC
 1520 .nopress
 1530         PLA           \ pull the result of ADVAL(0)
 1540 .getout
 1550         TAX           \ result bye into X register
 1560         LDA #&80      \ Osbyte &80
 1570         PLP           \ restore status register
 1580         RTS           \ return to BASIC
 1590 .oldirq1v
 1600         EQUW &00      \ original irq1 vector
 1610 .oldbytev
 1620         EQUW &00      \ original Osbyte vector
 1630 .xcoord
 1640         EQUB &80      \ X coordinate, range 0 to 255
 1650 .ycoord
 1660         EQUB &80      \ Y coordinate, range 0 to 255
 1670 .lastbyte
 1680 ]
 1690 NEXT
 1700 CALL mcode
 1710 MODE7
 1720 mouse$=CHR$141+CHR$132+CHR$157+CHR$131+
      "Mouse coordinates via ADVAL(0-4)  "+CHR$156
 1730 PRINTTAB(0,1)mouse$
 1740 PRINTTAB(0,2)mouse$
 1750 PRINTTAB(10,6)"Bytes used = &";~(lastbyte-mcode)
 1760 ONERROR GOTO 1890
 1770 VDU23,1,0;0;0;0;
 1780 REPEAT
 1790 PRINTTAB(10,10)"X = &";~?xcoord;" "
 1800 PRINTTAB(20,10)"Y = &";~?ycoord;" "
 1810 adval=ADVAL(0)AND3
 1820 PRINTTAB(10,14)"ADVAL(0)AND3 = ";adval
 1830 IF adval=2 PRINTTAB(22,17)"Right" ELSE PRINTTAB(22,17)"     "
 1840 IF adval=3  PRINTTAB(16,17)"Both" ELSE PRINTTAB(16,17)"    "
 1850 IF adval=1 PRINTTAB(10,17)"Left" ELSE PRINTTAB(10,17)"    "
 1860 PRINTTAB(2,20)"ADVAL(1) = ";ADVAL(1);"    "
      TAB(22,20)"ADVAL(2) = ";ADVAL(2);"    "
 1870 PRINTTAB(2,22)"ADVAL(3) = ";ADVAL(1);"    "
      TAB(22,22)"ADVAL(4) = ";ADVAL(4);"    "
 1880 UNTIL FALSE
 1890 CALL mcode
 1900 VDU23,1,1;0;0;0;31,0,23
 1910 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 35 2e 20 52  |---..Module 5. R|
00000090  65 61 64 69 6e 67 20 61  20 6d 6f 75 73 65 20 77  |eading a mouse w|
000000a0  69 74 68 20 74 68 65 20  42 41 53 49 43 20 41 44  |ith the BASIC AD|
000000b0  56 41 4c 20 63 6f 6d 6d  61 6e 64 0d 2d 2d 2d 2d  |VAL command.----|
000000c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000000f0  2d 2d 0d 0d 54 68 65 20  42 42 43 20 63 6f 6d 70  |--..The BBC comp|
00000100  75 74 65 72 20 75 73 65  73 20 61 20 4e 45 43 20  |uter uses a NEC |
00000110  75 50 44 37 30 30 32 20  61 6e 61 6c 6f 67 75 65  |uPD7002 analogue|
00000120  20 74 6f 20 64 69 67 69  74 61 6c 20 63 6f 6e 76  | to digital conv|
00000130  65 72 74 65 72 2e 20 54  68 69 73 20 69 73 0d 61  |erter. This is.a|
00000140  20 66 6f 75 72 20 63 68  61 6e 6e 65 6c 20 69 6e  | four channel in|
00000150  74 65 67 72 61 74 69 6e  67 20 63 6f 6e 76 65 72  |tegrating conver|
00000160  74 65 72 20 63 61 70 61  62 6c 65 20 6f 66 20 63  |ter capable of c|
00000170  6f 6e 76 65 72 74 69 6e  67 20 74 6f 20 61 20 72  |onverting to a r|
00000180  65 73 6f 6c 75 74 69 6f  6e 0d 6f 66 20 65 69 74  |esolution.of eit|
00000190  68 65 72 20 38 20 6f 72  20 31 30 20 62 69 74 73  |her 8 or 10 bits|
000001a0  2e 20 54 68 65 20 75 50  44 37 30 30 32 20 77 61  |. The uPD7002 wa|
000001b0  73 20 6f 72 69 67 69 6e  61 6c 6c 79 20 69 6e 74  |s originally int|
000001c0  65 6e 64 65 64 20 74 6f  20 62 65 20 61 20 31 32  |ended to be a 12|
000001d0  20 62 69 74 0d 63 6f 6e  76 65 72 74 65 72 20 61  | bit.converter a|
000001e0  6e 64 20 69 6e 20 74 68  65 20 31 30 20 62 69 74  |nd in the 10 bit|
000001f0  20 6d 6f 64 65 20 61 63  74 75 61 6c 6c 79 20 72  | mode actually r|
00000200  65 74 75 72 6e 73 20 61  20 31 32 20 62 69 74 20  |eturns a 12 bit |
00000210  72 65 73 75 6c 74 2e 20  4f 73 62 79 74 65 0d 26  |result. Osbyte.&|
00000220  42 45 20 75 73 65 73 20  76 61 6c 75 65 73 20 6f  |BE uses values o|
00000230  66 20 58 3d 38 20 6f 72  20 58 3d 31 32 20 74 6f  |f X=8 or X=12 to|
00000240  20 73 65 6c 65 63 74 20  65 69 74 68 65 72 20 38  | select either 8|
00000250  20 6f 72 20 31 30 20 62  69 74 20 6d 6f 64 65 2e  | or 10 bit mode.|
00000260  0d 50 72 65 73 75 6d 61  62 6c 79 20 58 3d 31 32  |.Presumably X=12|
00000270  20 69 73 20 75 73 65 64  20 62 65 63 61 75 73 65  | is used because|
00000280  20 74 68 65 20 31 30 20  62 69 74 20 6d 6f 64 65  | the 10 bit mode|
00000290  20 67 69 76 65 73 20 61  20 31 32 20 62 69 74 20  | gives a 12 bit |
000002a0  61 6e 73 77 65 72 2e 0d  0d 54 68 65 20 72 65 66  |answer...The ref|
000002b0  65 72 65 6e 63 65 20 76  6f 6c 74 61 67 65 20 73  |erence voltage s|
000002c0  75 70 70 6c 69 65 64 20  62 79 20 74 68 65 20 63  |upplied by the c|
000002d0  6f 6d 70 75 74 65 72 20  74 6f 20 74 68 65 20 63  |omputer to the c|
000002e0  6f 6e 76 65 72 74 65 72  20 69 73 20 31 2e 38 0d  |onverter is 1.8.|
000002f0  76 6f 6c 74 73 2e 20 54  68 69 73 20 64 65 66 69  |volts. This defi|
00000300  6e 65 73 20 74 68 65 20  6d 61 78 69 6d 75 6d 20  |nes the maximum |
00000310  76 6f 6c 74 61 67 65 20  74 68 61 74 20 63 61 6e  |voltage that can|
00000320  20 62 65 20 75 73 65 64  20 66 6f 72 20 74 68 65  | be used for the|
00000330  0d 63 6f 6e 76 65 72 73  69 6f 6e 20 61 6e 64 20  |.conversion and |
00000340  61 6c 73 6f 20 6c 69 6d  69 74 73 20 74 68 65 20  |also limits the |
00000350  72 65 73 6f 6c 75 74 69  6f 6e 20 6f 66 20 74 68  |resolution of th|
00000360  65 20 64 65 76 69 63 65  20 74 6f 20 31 30 20 72  |e device to 10 r|
00000370  61 74 68 65 72 20 74 68  61 6e 0d 31 32 20 62 69  |ather than.12 bi|
00000380  74 73 2e 20 49 6e 20 31  30 20 62 69 74 20 6d 6f  |ts. In 10 bit mo|
00000390  64 65 20 74 68 65 20 73  6d 61 6c 6c 65 73 74 20  |de the smallest |
000003a0  72 65 63 6f 67 6e 69 73  61 62 6c 65 20 73 74 65  |recognisable ste|
000003b0  70 20 69 6e 20 76 6f 6c  74 61 67 65 20 69 73 0d  |p in voltage is.|
000003c0  31 2e 38 2f 28 32 5e 31  30 29 20 69 65 2e 20 31  |1.8/(2^10) ie. 1|
000003d0  2e 37 35 20 6d 69 6c 6c  69 76 6f 6c 74 73 2e 20  |.75 millivolts. |
000003e0  54 68 69 73 20 69 73 20  61 20 76 65 72 79 20 73  |This is a very s|
000003f0  6d 61 6c 6c 20 76 6f 6c  74 61 67 65 20 73 74 65  |mall voltage ste|
00000400  70 20 61 6e 64 20 79 6f  75 0d 63 61 6e 20 65 78  |p and you.can ex|
00000410  70 65 63 74 20 6e 6f 69  73 65 20 6f 6e 20 74 68  |pect noise on th|
00000420  65 20 61 6e 61 6c 6f 67  75 65 20 73 69 67 6e 61  |e analogue signa|
00000430  6c 20 74 6f 20 65 78 63  65 65 64 20 74 68 69 73  |l to exceed this|
00000440  20 6c 65 76 65 6c 20 75  6e 64 65 72 20 6d 61 6e  | level under man|
00000450  79 0d 70 72 61 63 74 69  63 61 6c 20 73 69 74 75  |y.practical situ|
00000460  61 74 69 6f 6e 73 2c 20  65 73 70 65 63 69 61 6c  |ations, especial|
00000470  6c 79 20 77 68 65 6e 20  75 73 69 6e 67 20 73 69  |ly when using si|
00000480  6d 70 6c 65 20 6a 6f 79  73 74 69 63 6b 20 63 6f  |mple joystick co|
00000490  6e 74 72 6f 6c 6c 65 72  73 2e 0d 49 74 20 73 65  |ntrollers..It se|
000004a0  65 6d 73 20 71 75 69 74  65 20 63 6f 6d 6d 6f 6e  |ems quite common|
000004b0  20 66 6f 72 20 74 68 65  20 41 44 43 20 74 6f 20  | for the ADC to |
000004c0  72 65 73 6f 6c 76 65 20  6f 6e 6c 79 20 38 20 62  |resolve only 8 b|
000004d0  69 74 73 20 77 68 65 6e  20 74 68 65 20 31 32 20  |its when the 12 |
000004e0  62 69 74 0d 6d 6f 64 65  20 69 73 20 73 65 6c 65  |bit.mode is sele|
000004f0  63 74 65 64 2c 20 74 68  65 20 6c 65 61 73 74 20  |cted, the least |
00000500  73 69 67 6e 69 66 69 63  61 6e 74 20 34 20 62 69  |significant 4 bi|
00000510  74 73 20 6f 66 20 74 68  65 20 31 32 20 62 69 74  |ts of the 12 bit|
00000520  20 72 65 73 75 6c 74 0d  76 61 72 79 69 6e 67 20  | result.varying |
00000530  77 69 74 68 20 74 68 65  20 6e 6f 69 73 65 20 6f  |with the noise o|
00000540  6e 20 74 68 65 20 61 6e  61 6c 6f 67 75 65 20 73  |n the analogue s|
00000550  69 67 6e 61 6c 2e 0d 0d  54 68 65 20 6c 65 61 73  |ignal...The leas|
00000560  74 20 73 69 67 6e 69 66  69 63 61 6e 74 20 34 20  |t significant 4 |
00000570  62 69 74 73 20 6f 66 20  74 68 65 20 31 36 20 62  |bits of the 16 b|
00000580  69 74 20 6e 75 6d 62 65  72 20 72 65 74 75 72 6e  |it number return|
00000590  65 64 20 62 79 20 41 44  56 41 4c 28 31 2d 34 29  |ed by ADVAL(1-4)|
000005a0  0d 61 72 65 20 61 6c 77  61 79 73 20 63 6c 65 61  |.are always clea|
000005b0  72 20 2d 20 61 74 20 6c  65 61 73 74 20 74 68 65  |r - at least the|
000005c0  20 31 30 20 62 69 74 20  63 6f 6e 76 65 72 74 65  | 10 bit converte|
000005d0  72 20 64 6f 65 73 20 6e  6f 74 20 70 72 65 74 65  |r does not prete|
000005e0  6e 64 20 74 6f 20 62 65  20 61 0d 31 36 20 62 69  |nd to be a.16 bi|
000005f0  74 20 63 6f 6e 76 65 72  74 65 72 2e 20 42 65 63  |t converter. Bec|
00000600  61 75 73 65 20 74 68 65  20 6c 65 61 73 74 20 73  |ause the least s|
00000610  69 67 6e 69 66 69 63 61  6e 74 20 34 20 62 69 74  |ignificant 4 bit|
00000620  73 20 6f 66 20 74 68 65  20 31 36 20 62 69 74 0d  |s of the 16 bit.|
00000630  72 65 73 75 6c 74 20 61  72 65 20 61 6c 77 61 79  |result are alway|
00000640  73 20 63 6c 65 61 72 2c  20 74 68 65 20 6e 75 6d  |s clear, the num|
00000650  62 65 72 20 72 65 74 75  72 6e 65 64 20 69 73 20  |ber returned is |
00000660  69 6e 20 74 68 65 20 72  61 6e 67 65 20 66 72 6f  |in the range fro|
00000670  6d 20 30 20 74 6f 0d 36  35 35 32 30 20 77 69 74  |m 0 to.65520 wit|
00000680  68 20 69 6e 63 72 65 6d  65 6e 74 73 20 6f 66 20  |h increments of |
00000690  31 36 2e 0d 0d 54 68 65  20 64 65 6d 6f 6e 73 74  |16...The demonst|
000006a0  72 61 74 69 6f 6e 20 70  72 6f 67 72 61 6d 20 41  |ration program A|
000006b0  4e 4d 4f 55 53 45 20 75  73 65 73 20 61 20 64 69  |NMOUSE uses a di|
000006c0  67 69 74 61 6c 20 6d 6f  75 73 65 20 74 6f 20 73  |gital mouse to s|
000006d0  69 6d 75 6c 61 74 65 20  74 68 65 0d 61 6e 61 6c  |imulate the.anal|
000006e0  6f 67 75 65 20 6a 6f 79  73 74 69 63 6b 20 63 6f  |ogue joystick co|
000006f0  6e 74 72 6f 6c 6c 65 72  73 2e 20 49 74 20 69 6e  |ntrollers. It in|
00000700  74 65 72 63 65 70 74 73  20 74 68 65 20 41 44 56  |tercepts the ADV|
00000710  41 4c 20 4f 73 62 79 74  65 20 63 61 6c 6c 20 28  |AL Osbyte call (|
00000720  6e 75 6d 62 65 72 0d 26  38 30 29 20 61 6e 64 20  |number.&80) and |
00000730  72 65 74 75 72 6e 73 20  61 20 31 36 20 62 69 74  |returns a 16 bit|
00000740  20 6e 75 6d 62 65 72 20  77 69 74 68 20 74 68 65  | number with the|
00000750  20 34 20 6c 65 61 73 74  20 73 69 67 6e 69 66 69  | 4 least signifi|
00000760  63 61 6e 74 20 62 69 74  73 20 61 6c 77 61 79 73  |cant bits always|
00000770  0d 63 6c 65 61 72 20 61  6e 64 20 38 20 73 69 67  |.clear and 8 sig|
00000780  6e 69 66 69 63 61 6e 74  20 62 69 74 73 20 69 6e  |nificant bits in|
00000790  20 61 20 31 32 20 62 69  74 20 72 65 73 75 6c 74  | a 12 bit result|
000007a0  2e 20 54 68 69 73 20 6d  69 6d 69 63 73 20 74 68  |. This mimics th|
000007b0  65 20 72 65 73 75 6c 74  0d 70 72 6f 64 75 63 65  |e result.produce|
000007c0  64 20 62 79 20 72 65 61  6c 20 61 6e 61 6c 6f 67  |d by real analog|
000007d0  75 65 20 6a 6f 79 73 74  69 63 6b 73 20 62 75 74  |ue joysticks but|
000007e0  2c 20 62 65 63 61 75 73  65 20 74 68 65 20 6d 6f  |, because the mo|
000007f0  75 73 65 20 69 73 20 64  69 67 69 74 61 6c 0d 72  |use is digital.r|
00000800  61 74 68 65 72 20 74 68  61 6e 20 61 6e 61 6c 6f  |ather than analo|
00000810  67 75 65 2c 20 74 68 65  20 72 65 73 75 6c 74 20  |gue, the result |
00000820  61 70 70 65 61 72 73 20  74 6f 20 62 65 20 66 61  |appears to be fa|
00000830  72 20 6d 6f 72 65 20 73  74 61 62 6c 65 20 74 68  |r more stable th|
00000840  61 6e 20 77 69 74 68 0d  6a 6f 79 73 74 69 63 6b  |an with.joystick|
00000850  73 2e 0d 0d 49 74 20 69  73 20 71 75 69 74 65 20  |s...It is quite |
00000860  63 6f 6e 76 65 6e 69 65  6e 74 20 74 6f 20 75 73  |convenient to us|
00000870  65 20 61 6e 20 38 20 62  69 74 20 72 65 73 6f 6c  |e an 8 bit resol|
00000880  75 74 69 6f 6e 20 62 65  63 61 75 73 65 20 6f 6e  |ution because on|
00000890  6c 79 20 6f 6e 65 20 62  79 74 65 0d 6e 65 65 64  |ly one byte.need|
000008a0  73 20 74 6f 20 62 65 20  75 73 65 64 20 74 6f 20  |s to be used to |
000008b0  73 74 6f 72 65 20 65 61  63 68 20 6f 66 20 74 68  |store each of th|
000008c0  65 20 58 20 61 6e 64 20  59 20 63 6f 6f 72 64 69  |e X and Y coordi|
000008d0  6e 61 74 65 73 2e 20 41  6e 20 38 20 62 69 74 0d  |nates. An 8 bit.|
000008e0  72 65 73 6f 6c 75 74 69  6f 6e 20 6d 61 79 20 6e  |resolution may n|
000008f0  6f 74 20 73 65 65 6d 20  76 65 72 79 20 68 69 67  |ot seem very hig|
00000900  68 20 62 75 74 20 72 65  6d 65 6d 62 65 72 20 74  |h but remember t|
00000910  68 61 74 20 74 68 69 73  20 72 65 70 72 65 73 65  |hat this represe|
00000920  6e 74 73 20 61 20 73 74  65 70 0d 6f 66 20 30 2e  |nts a step.of 0.|
00000930  34 25 20 6f 66 20 74 68  65 20 66 75 6c 6c 20 73  |4% of the full s|
00000940  63 61 6c 65 20 76 61 6c  75 65 20 61 6e 64 20 69  |cale value and i|
00000950  74 20 69 73 20 70 65 72  66 65 63 74 6c 79 20 61  |t is perfectly a|
00000960  64 65 71 75 61 74 65 20  66 6f 72 20 6d 6f 73 74  |dequate for most|
00000970  0d 61 70 70 6c 69 63 61  74 69 6f 6e 73 20 77 68  |.applications wh|
00000980  69 63 68 20 75 73 65 20  61 20 6a 6f 79 73 74 69  |ich use a joysti|
00000990  63 6b 2e 20 54 68 65 20  73 74 61 62 69 6c 69 74  |ck. The stabilit|
000009a0  79 20 6f 66 20 74 68 65  20 73 69 67 6e 61 6c 20  |y of the signal |
000009b0  63 61 6e 20 62 65 0d 73  75 62 6a 65 63 74 69 76  |can be.subjectiv|
000009c0  65 6c 79 20 6d 6f 72 65  20 69 6d 70 6f 72 74 61  |ely more importa|
000009d0  6e 74 20 74 68 61 6e 20  74 68 65 20 61 63 63 75  |nt than the accu|
000009e0  72 61 63 79 2c 20 61 6e  64 20 74 68 65 20 73 74  |racy, and the st|
000009f0  61 62 69 6c 69 74 79 20  6f 66 20 74 68 65 0d 6d  |ability of the.m|
00000a00  6f 75 73 65 20 64 72 69  76 65 6e 20 6a 6f 79 73  |ouse driven joys|
00000a10  74 69 63 6b 20 73 69 6d  75 6c 61 74 69 6f 6e 20  |tick simulation |
00000a20  63 65 72 74 61 69 6e 6c  79 20 6d 61 6b 65 73 20  |certainly makes |
00000a30  69 74 20 6c 6f 6f 6b 20  6d 6f 72 65 20 69 6d 70  |it look more imp|
00000a40  72 65 73 73 69 76 65 0d  74 68 61 6e 20 61 20 72  |ressive.than a r|
00000a50  65 61 6c 20 6a 6f 79 73  74 69 63 6b 20 65 76 65  |eal joystick eve|
00000a60  6e 20 74 68 6f 75 67 68  20 74 68 65 20 72 65 73  |n though the res|
00000a70  6f 6c 75 74 69 6f 6e 20  69 73 20 61 62 6f 75 74  |olution is about|
00000a80  20 74 68 65 20 73 61 6d  65 2e 0d 0d 41 20 70 72  | the same...A pr|
00000a90  6f 62 6c 65 6d 20 77 68  69 63 68 20 6c 69 6d 69  |oblem which limi|
00000aa0  74 73 20 74 68 65 20 75  73 65 20 6f 66 20 74 68  |ts the use of th|
00000ab0  65 20 64 65 6d 6f 6e 73  74 72 61 74 65 64 20 74  |e demonstrated t|
00000ac0  65 63 68 6e 69 71 75 65  20 69 73 20 74 68 61 74  |echnique is that|
00000ad0  20 74 68 65 72 65 0d 61  72 65 20 74 77 6f 20 6a  | there.are two j|
00000ae0  6f 79 73 74 69 63 6b 20  63 6f 6e 74 72 6f 6c 6c  |oystick controll|
00000af0  65 72 73 20 62 75 74 20  6f 6e 6c 79 20 6f 6e 65  |ers but only one|
00000b00  20 6d 6f 75 73 65 2e 20  49 6e 20 41 4e 4d 4f 55  | mouse. In ANMOU|
00000b10  53 45 20 49 20 68 61 76  65 0d 61 6c 6c 6f 63 61  |SE I have.alloca|
00000b20  74 65 64 20 74 68 65 20  6d 6f 75 73 65 20 58 20  |ted the mouse X |
00000b30  63 6f 6f 72 64 69 6e 61  74 65 20 74 6f 20 62 6f  |coordinate to bo|
00000b40  74 68 20 63 68 61 6e 6e  65 6c 73 20 31 20 61 6e  |th channels 1 an|
00000b50  64 20 33 2c 20 61 6e 64  20 74 68 65 20 6d 6f 75  |d 3, and the mou|
00000b60  73 65 20 59 0d 63 6f 6f  72 64 69 6e 61 74 65 20  |se Y.coordinate |
00000b70  74 6f 20 62 6f 74 68 20  63 68 61 6e 6e 65 6c 73  |to both channels|
00000b80  20 32 20 61 6e 64 20 34  2e 20 54 68 69 73 20 6d  | 2 and 4. This m|
00000b90  65 61 6e 73 20 74 68 61  74 20 74 68 69 73 20 74  |eans that this t|
00000ba0  79 70 65 20 6f 66 20 70  72 6f 67 72 61 6d 0d 63  |ype of program.c|
00000bb0  61 6e 6e 6f 74 20 62 65  20 75 73 65 64 20 77 69  |annot be used wi|
00000bc0  74 68 6f 75 74 20 6d 6f  64 69 66 69 63 61 74 69  |thout modificati|
00000bd0  6f 6e 20 66 6f 72 20 67  61 6d 65 73 20 77 68 69  |on for games whi|
00000be0  63 68 20 75 73 65 20 62  6f 74 68 20 6c 65 66 74  |ch use both left|
00000bf0  20 61 6e 64 0d 72 69 67  68 74 20 6a 6f 79 73 74  | and.right joyst|
00000c00  69 63 6b 73 20 61 74 20  74 68 65 20 73 61 6d 65  |icks at the same|
00000c10  20 74 69 6d 65 2e 20 59  6f 75 20 63 6f 75 6c 64  | time. You could|
00000c20  20 6d 6f 64 69 66 79 20  74 68 65 20 70 72 6f 67  | modify the prog|
00000c30  72 61 6d 20 73 6f 20 74  68 61 74 20 6f 6e 65 0d  |ram so that one.|
00000c40  6a 6f 79 73 74 69 63 6b  20 61 6e 64 20 6f 6e 65  |joystick and one|
00000c50  20 6d 6f 75 73 65 20 61  72 65 20 75 73 65 64 20  | mouse are used |
00000c60  6f 72 20 70 65 72 68 61  70 73 20 74 68 65 20 63  |or perhaps the c|
00000c70  75 72 73 6f 72 20 6b 65  79 73 20 61 6e 64 20 61  |ursor keys and a|
00000c80  20 6d 6f 75 73 65 20 69  66 0d 6d 6f 72 65 20 73  | mouse if.more s|
00000c90  74 61 62 69 6c 69 74 79  20 69 73 20 72 65 71 75  |tability is requ|
00000ca0  69 72 65 64 2e 20 54 68  65 20 70 72 6f 67 72 61  |ired. The progra|
00000cb0  6d 20 41 4e 4d 4f 55 53  45 20 64 69 73 61 62 6c  |m ANMOUSE disabl|
00000cc0  65 73 20 74 68 65 20 61  6e 61 6c 6f 67 75 65 20  |es the analogue |
00000cd0  74 6f 0d 64 69 67 69 74  61 6c 20 63 6f 6e 76 65  |to.digital conve|
00000ce0  72 73 69 6f 6e 20 61 6e  64 20 69 66 20 79 6f 75  |rsion and if you|
00000cf0  20 6d 6f 64 69 66 79 20  69 74 20 74 6f 20 72 65  | modify it to re|
00000d00  61 64 20 62 6f 74 68 20  61 20 6a 6f 79 73 74 69  |ad both a joysti|
00000d10  63 6b 20 61 6e 64 20 61  0d 6d 6f 75 73 65 20 77  |ck and a.mouse w|
00000d20  69 74 68 20 41 44 56 41  4c 20 79 6f 75 20 77 69  |ith ADVAL you wi|
00000d30  6c 6c 20 6e 65 65 64 20  74 6f 20 65 6e 61 62 6c  |ll need to enabl|
00000d40  65 20 74 68 65 20 61 70  70 72 6f 70 72 69 61 74  |e the appropriat|
00000d50  65 20 6a 6f 79 73 74 69  63 6b 0d 63 68 61 6e 6e  |e joystick.chann|
00000d60  65 6c 73 2e 20 49 6e 20  74 68 65 73 65 20 63 69  |els. In these ci|
00000d70  72 63 75 6d 73 74 61 6e  63 65 73 20 49 20 77 6f  |rcumstances I wo|
00000d80  75 6c 64 20 72 65 63 6f  6d 65 6e 64 20 75 73 69  |uld recomend usi|
00000d90  6e 67 20 74 68 65 20 6c  65 66 74 20 6a 6f 79 73  |ng the left joys|
00000da0  74 69 63 6b 0d 6f 6e 20  63 68 61 6e 6e 65 6c 73  |tick.on channels|
00000db0  20 31 20 61 6e 64 20 32  20 61 6e 64 20 74 68 65  | 1 and 2 and the|
00000dc0  20 6d 6f 75 73 65 20 6f  6e 20 63 68 61 6e 6e 65  | mouse on channe|
00000dd0  6c 73 20 33 20 61 6e 64  20 34 2e 0d 0d 54 68 65  |ls 3 and 4...The|
00000de0  20 6d 6f 75 73 65 20 62  75 74 74 6f 6e 73 20 68  | mouse buttons h|
00000df0  61 76 65 20 62 65 65 6e  20 61 6c 6c 6f 63 61 74  |ave been allocat|
00000e00  65 64 20 74 6f 20 74 68  65 20 6a 6f 79 73 74 69  |ed to the joysti|
00000e10  63 6b 20 66 69 72 65 20  62 75 74 74 6f 6e 73 2e  |ck fire buttons.|
00000e20  20 54 68 65 0d 6c 65 66  74 20 6d 6f 75 73 65 20  | The.left mouse |
00000e30  62 75 74 74 6f 6e 20 66  6f 72 20 74 68 65 20 6c  |button for the l|
00000e40  65 66 74 20 6a 6f 79 73  74 69 63 6b 20 62 75 74  |eft joystick but|
00000e50  74 6f 6e 2c 20 74 68 65  20 72 69 67 68 74 20 6d  |ton, the right m|
00000e60  6f 75 73 65 20 62 75 74  74 6f 6e 20 66 6f 72 0d  |ouse button for.|
00000e70  74 68 65 20 72 69 67 68  74 20 6a 6f 79 73 74 69  |the right joysti|
00000e80  63 6b 20 62 75 74 74 6f  6e 2c 20 61 6e 64 20 74  |ck button, and t|
00000e90  68 65 20 63 65 6e 74 72  65 20 6d 6f 75 73 65 20  |he centre mouse |
00000ea0  62 75 74 74 6f 6e 20 66  6f 72 20 62 6f 74 68 20  |button for both |
00000eb0  6a 6f 79 73 74 69 63 6b  0d 62 75 74 74 6f 6e 73  |joystick.buttons|
00000ec0  2e 20 54 68 65 20 64 65  6d 6f 6e 73 74 72 61 74  |. The demonstrat|
00000ed0  69 6f 6e 20 70 72 6f 67  72 61 6d 20 73 69 6d 75  |ion program simu|
00000ee0  6c 61 74 65 73 20 41 44  56 41 4c 28 30 29 41 4e  |lates ADVAL(0)AN|
00000ef0  44 33 3d 33 20 69 66 20  74 68 65 20 63 65 6e 74  |D3=3 if the cent|
00000f00  72 65 0d 6d 6f 75 73 65  20 62 75 74 74 6f 6e 20  |re.mouse button |
00000f10  69 73 20 70 72 65 73 73  65 64 20 62 75 74 20 6e  |is pressed but n|
00000f20  6f 74 20 69 66 20 62 6f  74 68 20 74 68 65 20 6c  |ot if both the l|
00000f30  65 66 74 20 61 6e 64 20  72 69 67 68 74 20 6d 6f  |eft and right mo|
00000f40  75 73 65 20 62 75 74 74  6f 6e 73 0d 61 72 65 20  |use buttons.are |
00000f50  70 72 65 73 73 65 64 2e  20 49 74 20 73 63 61 6e  |pressed. It scan|
00000f60  73 20 74 68 65 20 6a 6f  79 73 74 69 63 6b 20 66  |s the joystick f|
00000f70  69 72 65 20 62 75 74 74  6f 6e 73 20 61 73 20 77  |ire buttons as w|
00000f80  65 6c 6c 20 61 73 20 74  68 65 20 6d 6f 75 73 65  |ell as the mouse|
00000f90  0d 62 75 74 74 6f 6e 73  20 73 6f 20 74 68 61 74  |.buttons so that|
00000fa0  20 65 69 74 68 65 72 20  63 61 6e 20 62 65 20 75  | either can be u|
00000fb0  73 65 64 20 69 66 20 62  6f 74 68 20 64 65 76 69  |sed if both devi|
00000fc0  63 65 73 20 61 72 65 20  63 6f 6e 6e 65 63 74 65  |ces are connecte|
00000fd0  64 20 74 6f 20 74 68 65  0d 63 6f 6d 70 75 74 65  |d to the.compute|
00000fe0  72 2e 0d 0d 54 68 65 20  41 63 6f 72 6e 20 6a 6f  |r...The Acorn jo|
00000ff0  79 73 74 69 63 6b 20 63  6f 6e 74 72 6f 6c 6c 65  |ystick controlle|
00001000  72 73 20 61 72 65 20 61  20 62 69 74 20 75 6e 75  |rs are a bit unu|
00001010  73 75 61 6c 20 69 6e 20  74 68 61 74 20 74 68 65  |sual in that the|
00001020  20 58 20 63 6f 6f 72 64  69 6e 61 74 65 73 0d 61  | X coordinates.a|
00001030  72 65 20 74 68 65 20 72  65 76 65 72 73 65 20 6f  |re the reverse o|
00001040  66 20 74 68 65 20 6f 72  69 65 6e 74 61 74 69 6f  |f the orientatio|
00001050  6e 20 49 20 77 6f 75 6c  64 20 65 78 70 65 63 74  |n I would expect|
00001060  20 74 6f 20 66 69 6e 64  2e 20 54 68 65 20 67 72  | to find. The gr|
00001070  61 70 68 69 63 73 0d 73  63 72 65 65 6e 20 64 65  |aphics.screen de|
00001080  66 69 6e 65 73 20 74 68  65 20 6f 72 69 67 69 6e  |fines the origin|
00001090  20 69 6e 20 74 68 65 20  62 6f 74 74 6f 6d 20 6c  | in the bottom l|
000010a0  65 66 74 20 68 61 6e 64  20 63 6f 72 6e 65 72 20  |eft hand corner |
000010b0  61 6e 64 20 49 20 77 6f  75 6c 64 0d 65 78 70 65  |and I would.expe|
000010c0  63 74 20 74 68 65 20 6a  6f 79 73 74 69 63 6b 20  |ct the joystick |
000010d0  63 6f 6e 74 72 6f 6c 6c  65 72 20 74 6f 20 72 65  |controller to re|
000010e0  74 75 72 6e 20 61 6e 20  58 20 63 6f 6f 72 64 69  |turn an X coordi|
000010f0  6e 61 74 65 20 6f 66 20  7a 65 72 6f 20 77 69 74  |nate of zero wit|
00001100  68 20 74 68 65 0d 6a 6f  79 73 74 69 63 6b 20 74  |h the.joystick t|
00001110  6f 20 74 68 65 20 6c 65  66 74 20 61 6e 64 20 36  |o the left and 6|
00001120  35 35 32 30 20 77 69 74  68 20 74 68 65 20 6a 6f  |5520 with the jo|
00001130  79 73 74 69 63 6b 20 74  6f 20 74 68 65 20 72 69  |ystick to the ri|
00001140  67 68 74 2e 20 49 6e 73  74 65 61 64 20 69 74 0d  |ght. Instead it.|
00001150  64 6f 65 73 20 74 68 65  20 6f 70 70 6f 73 69 74  |does the opposit|
00001160  65 2e 20 54 68 65 20 59  20 6d 6f 76 65 6d 65 6e  |e. The Y movemen|
00001170  74 20 69 73 20 6e 6f 74  20 74 68 65 20 72 65 76  |t is not the rev|
00001180  65 72 73 65 20 74 68 65  20 65 78 70 65 63 74 65  |erse the expecte|
00001190  64 0d 63 6f 6f 72 64 69  6e 61 74 65 73 20 61 6e  |d.coordinates an|
000011a0  64 20 41 44 56 41 4c 20  72 65 74 75 72 6e 73 20  |d ADVAL returns |
000011b0  7a 65 72 6f 20 77 69 74  68 20 74 68 65 20 63 6f  |zero with the co|
000011c0  6e 74 6f 6c 6c 65 72 20  74 6f 77 61 72 64 73 20  |ntoller towards |
000011d0  74 68 65 20 75 73 65 72  20 61 6e 64 0d 36 35 35  |the user and.655|
000011e0  32 30 20 77 69 74 68 20  74 68 65 20 63 6f 6e 74  |20 with the cont|
000011f0  72 6f 6c 6c 65 72 20 74  6f 77 61 72 64 73 20 74  |roller towards t|
00001200  68 65 20 73 63 72 65 65  6e 2e 20 4d 6f 73 74 20  |he screen. Most |
00001210  67 61 6d 65 73 20 73 6f  66 74 77 61 72 65 20 74  |games software t|
00001220  61 6b 65 0d 74 68 69 73  20 72 65 76 65 72 73 61  |ake.this reversa|
00001230  6c 20 69 6e 74 6f 20 61  63 63 6f 75 6e 74 20 61  |l into account a|
00001240  6e 64 20 66 6f 72 20 74  68 69 73 20 72 65 61 73  |nd for this reas|
00001250  6f 6e 20 74 68 65 20 6d  6f 75 73 65 20 61 6e 61  |on the mouse ana|
00001260  6c 6f 67 75 65 0d 73 69  6d 75 6c 61 74 69 6f 6e  |logue.simulation|
00001270  20 73 68 6f 75 6c 64 20  64 6f 20 74 68 65 20 73  | should do the s|
00001280  61 6d 65 2e 20 49 6e 20  74 68 65 20 70 72 6f 67  |ame. In the prog|
00001290  72 61 6d 20 41 4e 4d 4f  55 53 45 20 74 68 65 20  |ram ANMOUSE the |
000012a0  58 20 63 6f 6f 72 64 69  6e 61 74 65 73 0d 72 65  |X coordinates.re|
000012b0  74 75 72 6e 65 64 20 62  79 20 41 44 56 41 4c 28  |turned by ADVAL(|
000012c0  31 29 20 61 6e 64 20 41  44 56 41 4c 28 33 29 20  |1) and ADVAL(3) |
000012d0  72 65 64 75 63 65 20 61  73 20 74 68 65 20 6d 6f  |reduce as the mo|
000012e0  75 73 65 20 69 73 20 6d  6f 76 65 64 20 74 6f 20  |use is moved to |
000012f0  74 68 65 20 6c 65 66 74  0d 61 6e 64 20 69 6e 63  |the left.and inc|
00001300  72 65 61 73 65 20 61 73  20 69 74 20 69 73 20 6d  |rease as it is m|
00001310  6f 76 65 64 20 74 6f 20  74 68 65 20 72 69 67 68  |oved to the righ|
00001320  74 2e 0d 0d 0d 20 20 20  31 30 20 52 45 4d 3e 20  |t....   10 REM> |
00001330  41 4e 4d 4f 55 53 45 0d  20 20 20 32 30 20 44 49  |ANMOUSE.   20 DI|
00001340  4d 20 6d 63 6f 64 65 20  26 32 30 30 20 3a 52 45  |M mcode &200 :RE|
00001350  4d 3a 20 6d 61 63 68 69  6e 65 20 63 6f 64 65 20  |M: machine code |
00001360  61 74 20 6d 63 6f 64 65  0d 20 20 20 33 30 20 73  |at mcode.   30 s|
00001370  61 76 65 72 65 67 3d 26  46 43 20 3a 52 45 4d 3a  |avereg=&FC :REM:|
00001380  20 69 6e 74 65 72 72 75  70 74 20 61 63 63 75 6d  | interrupt accum|
00001390  75 6c 61 74 6f 72 20 73  61 76 65 20 72 65 67 69  |ulator save regi|
000013a0  73 74 65 72 0d 20 20 20  34 30 20 69 72 71 31 76  |ster.   40 irq1v|
000013b0  3d 26 32 30 34 20 3a 52  45 4d 3a 20 70 72 69 6d  |=&204 :REM: prim|
000013c0  61 72 79 20 69 6e 74 65  72 72 75 70 74 20 76 65  |ary interrupt ve|
000013d0  63 74 6f 72 0d 20 20 20  35 30 20 62 79 74 65 76  |ctor.   50 bytev|
000013e0  3d 26 32 30 41 20 3a 52  45 4d 3a 20 4f 73 62 79  |=&20A :REM: Osby|
000013f0  74 65 20 69 6e 64 69 72  65 63 74 69 6f 6e 20 76  |te indirection v|
00001400  65 63 74 6f 72 0d 20 20  20 36 30 20 64 72 62 3d  |ector.   60 drb=|
00001410  26 46 45 36 30 20 3a 52  45 4d 3a 20 64 61 74 61  |&FE60 :REM: data|
00001420  20 72 65 67 69 73 74 65  72 20 42 0d 20 20 20 37  | register B.   7|
00001430  30 20 64 64 72 62 3d 26  46 45 36 32 20 3a 52 45  |0 ddrb=&FE62 :RE|
00001440  4d 3a 20 64 61 74 61 20  64 69 72 65 63 74 69 6f  |M: data directio|
00001450  6e 20 72 65 67 69 73 74  65 72 20 42 0d 20 20 20  |n register B.   |
00001460  38 30 20 70 63 72 3d 26  46 45 36 43 20 3a 52 45  |80 pcr=&FE6C :RE|
00001470  4d 3a 20 70 65 72 69 70  68 65 72 61 6c 20 63 6f  |M: peripheral co|
00001480  6e 74 72 6f 6c 20 72 65  67 69 73 74 65 72 0d 20  |ntrol register. |
00001490  20 20 39 30 20 69 66 72  3d 26 46 45 36 44 20 3a  |  90 ifr=&FE6D :|
000014a0  52 45 4d 3a 20 69 6e 74  65 72 72 75 70 74 20 66  |REM: interrupt f|
000014b0  6c 61 67 20 72 65 67 69  73 74 65 72 0d 20 20 31  |lag register.  1|
000014c0  30 30 20 69 65 72 3d 26  46 45 36 45 20 3a 52 45  |00 ier=&FE6E :RE|
000014d0  4d 3a 20 69 6e 74 65 72  72 75 70 74 20 65 6e 61  |M: interrupt ena|
000014e0  62 6c 65 20 72 65 67 69  73 74 65 72 0d 20 20 31  |ble register.  1|
000014f0  31 30 20 6f 73 62 79 74  65 3d 26 46 46 46 34 0d  |10 osbyte=&FFF4.|
00001500  20 20 31 32 30 20 46 4f  52 20 70 61 73 73 3d 30  |  120 FOR pass=0|
00001510  20 54 4f 20 32 20 53 54  45 50 20 32 0d 20 20 31  | TO 2 STEP 2.  1|
00001520  33 30 20 50 25 3d 6d 63  6f 64 65 0d 20 20 31 34  |30 P%=mcode.  14|
00001530  30 20 5b 20 20 20 20 20  20 20 4f 50 54 20 70 61  |0 [       OPT pa|
00001540  73 73 0d 20 20 31 35 30  20 20 20 20 20 20 20 20  |ss.  150        |
00001550  20 4c 44 58 20 69 72 71  31 76 20 20 20 20 20 5c  | LDX irq1v     \|
00001560  20 63 75 72 72 65 6e 74  20 70 72 69 6d 61 72 79  | current primary|
00001570  20 69 6e 74 65 72 72 75  70 74 20 76 65 63 74 6f  | interrupt vecto|
00001580  72 2c 20 6c 6f 77 20 62  79 74 65 0d 20 20 31 36  |r, low byte.  16|
00001590  30 20 20 20 20 20 20 20  20 20 4c 44 59 20 69 72  |0         LDY ir|
000015a0  71 31 76 2b 31 20 20 20  5c 20 63 75 72 72 65 6e  |q1v+1   \ curren|
000015b0  74 20 70 72 69 6d 61 72  79 20 69 6e 74 65 72 72  |t primary interr|
000015c0  75 70 74 20 76 65 63 74  6f 72 2c 20 68 69 67 68  |upt vector, high|
000015d0  20 62 79 74 65 0d 20 20  31 37 30 20 20 20 20 20  | byte.  170     |
000015e0  20 20 20 20 43 50 59 20  23 69 6e 74 65 72 72 75  |    CPY #interru|
000015f0  70 74 20 44 49 56 20 32  35 36 20 5c 20 63 6f 6d  |pt DIV 256 \ com|
00001600  70 61 72 65 20 68 69 67  68 20 62 79 74 65 0d 20  |pare high byte. |
00001610  20 31 38 30 20 20 20 20  20 20 20 20 20 42 45 51  | 180         BEQ|
00001620  20 64 69 73 61 62 6c 65  20 20 20 5c 20 72 65 73  | disable   \ res|
00001630  74 6f 72 65 20 6f 6c 64  20 76 65 63 74 6f 72 20  |tore old vector |
00001640  69 66 20 61 6c 74 65 72  65 64 0d 20 20 31 39 30  |if altered.  190|
00001650  20 20 20 20 20 20 20 20  20 53 54 58 20 6f 6c 64  |         STX old|
00001660  69 72 71 31 76 20 20 5c  20 73 61 76 65 20 6f 72  |irq1v  \ save or|
00001670  69 67 69 6e 61 6c 20 69  72 71 31 20 76 65 63 74  |iginal irq1 vect|
00001680  6f 72 2c 20 6c 6f 77 20  62 79 74 65 0d 20 20 32  |or, low byte.  2|
00001690  30 30 20 20 20 20 20 20  20 20 20 53 54 59 20 6f  |00         STY o|
000016a0  6c 64 69 72 71 31 76 2b  31 20 5c 20 73 61 76 65  |ldirq1v+1 \ save|
000016b0  20 6f 72 69 67 69 6e 61  6c 20 69 72 71 31 20 76  | original irq1 v|
000016c0  65 63 74 6f 72 2c 20 68  69 67 68 20 62 79 74 65  |ector, high byte|
000016d0  0d 20 20 32 31 30 20 20  20 20 20 20 20 20 20 4c  |.  210         L|
000016e0  44 58 20 62 79 74 65 76  20 20 20 20 20 5c 20 4f  |DX bytev     \ O|
000016f0  73 62 79 74 65 20 69 6e  64 69 72 65 63 74 69 6f  |sbyte indirectio|
00001700  6e 20 76 65 63 74 6f 72  2c 20 6c 6f 77 20 62 79  |n vector, low by|
00001710  74 65 0d 20 20 32 32 30  20 20 20 20 20 20 20 20  |te.  220        |
00001720  20 4c 44 59 20 62 79 74  65 76 2b 31 20 20 20 5c  | LDY bytev+1   \|
00001730  20 4f 73 62 79 74 65 20  69 6e 64 69 72 65 63 74  | Osbyte indirect|
00001740  69 6f 6e 20 76 65 63 74  6f 72 2c 20 68 69 67 68  |ion vector, high|
00001750  20 62 79 74 65 0d 20 20  32 33 30 20 20 20 20 20  | byte.  230     |
00001760  20 20 20 20 53 54 58 20  6f 6c 64 62 79 74 65 76  |    STX oldbytev|
00001770  20 20 5c 20 73 61 76 65  20 4f 73 62 79 74 65 20  |  \ save Osbyte |
00001780  69 6e 64 69 72 65 63 74  69 6f 6e 20 76 65 63 74  |indirection vect|
00001790  6f 72 2c 20 6c 6f 77 20  62 79 74 65 0d 20 20 32  |or, low byte.  2|
000017a0  34 30 20 20 20 20 20 20  20 20 20 53 54 59 20 6f  |40         STY o|
000017b0  6c 64 62 79 74 65 76 2b  31 20 5c 20 73 61 76 65  |ldbytev+1 \ save|
000017c0  20 4f 73 62 79 74 65 20  69 6e 64 69 72 65 63 74  | Osbyte indirect|
000017d0  69 6f 6e 20 76 65 63 74  6f 72 2c 20 68 69 67 68  |ion vector, high|
000017e0  20 62 79 74 65 0d 20 20  32 35 30 20 20 20 20 20  | byte.  250     |
000017f0  20 20 20 20 4c 44 58 20  23 69 6e 74 65 72 72 75  |    LDX #interru|
00001800  70 74 20 4d 4f 44 20 32  35 36 20 5c 20 6e 65 77  |pt MOD 256 \ new|
00001810  20 69 72 71 31 20 76 65  63 74 6f 72 2c 20 6c 6f  | irq1 vector, lo|
00001820  77 20 62 79 74 65 0d 20  20 32 36 30 20 20 20 20  |w byte.  260    |
00001830  20 20 20 20 20 4c 44 59  20 23 69 6e 74 65 72 72  |     LDY #interr|
00001840  75 70 74 20 44 49 56 20  32 35 36 20 5c 20 6e 65  |upt DIV 256 \ ne|
00001850  77 20 69 72 71 31 20 76  65 63 74 6f 72 2c 20 68  |w irq1 vector, h|
00001860  69 67 68 20 62 79 74 65  0d 20 20 32 37 30 20 20  |igh byte.  270  |
00001870  20 20 20 20 20 20 20 53  45 49 20 20 20 20 20 20  |       SEI      |
00001880  20 20 20 20 20 5c 20 73  65 74 20 69 6e 74 65 72  |     \ set inter|
00001890  72 75 70 74 20 64 69 73  61 62 6c 65 20 66 6c 61  |rupt disable fla|
000018a0  67 0d 20 20 32 38 30 20  20 20 20 20 20 20 20 20  |g.  280         |
000018b0  53 54 58 20 69 72 71 31  76 20 20 20 20 20 5c 20  |STX irq1v     \ |
000018c0  61 6c 74 65 72 20 69 72  71 31 20 76 65 63 74 6f  |alter irq1 vecto|
000018d0  72 2c 20 6c 6f 77 20 62  79 74 65 0d 20 20 32 39  |r, low byte.  29|
000018e0  30 20 20 20 20 20 20 20  20 20 53 54 59 20 69 72  |0         STY ir|
000018f0  71 31 76 2b 31 20 20 20  5c 20 61 6c 74 65 72 20  |q1v+1   \ alter |
00001900  69 72 71 31 20 76 65 63  74 6f 72 2c 20 68 69 67  |irq1 vector, hig|
00001910  68 20 62 79 74 65 0d 20  20 33 30 30 20 20 20 20  |h byte.  300    |
00001920  20 20 20 20 20 43 4c 49  20 20 20 20 20 20 20 20  |     CLI        |
00001930  20 20 20 5c 20 63 6c 65  61 72 20 69 6e 74 65 72  |   \ clear inter|
00001940  72 75 70 74 20 64 69 73  61 62 6c 65 20 66 6c 61  |rupt disable fla|
00001950  67 0d 20 20 33 31 30 20  20 20 20 20 20 20 20 20  |g.  310         |
00001960  4c 44 58 20 23 61 6e 61  6c 6f 67 75 65 20 4d 4f  |LDX #analogue MO|
00001970  44 20 32 35 36 20 5c 20  6e 65 77 20 4f 73 62 79  |D 256 \ new Osby|
00001980  74 65 20 69 6e 64 69 72  65 63 74 69 6f 6e 20 76  |te indirection v|
00001990  65 63 74 6f 72 2c 0d 20  20 20 20 20 20 20 20 20  |ector,.         |
000019a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000019b0  20 20 20 5c 20 6c 6f 77  20 62 79 74 65 0d 20 20  |   \ low byte.  |
000019c0  33 32 30 20 20 20 20 20  20 20 20 20 4c 44 59 20  |320         LDY |
000019d0  23 61 6e 61 6c 6f 67 75  65 20 44 49 56 20 32 35  |#analogue DIV 25|
000019e0  36 20 5c 20 6e 65 77 20  4f 73 62 79 74 65 20 69  |6 \ new Osbyte i|
000019f0  6e 64 69 72 65 63 74 69  6f 6e 20 76 65 63 74 6f  |ndirection vecto|
00001a00  72 2c 0d 20 20 20 20 20  20 20 20 20 20 20 20 20  |r,.             |
00001a10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00001a20  20 68 69 67 68 20 62 79  74 65 0d 20 20 33 33 30  | high byte.  330|
00001a30  20 20 20 20 20 20 20 20  20 53 54 58 20 62 79 74  |         STX byt|
00001a40  65 76 20 20 20 20 20 5c  20 61 6c 74 65 72 20 4f  |ev     \ alter O|
00001a50  73 62 79 74 65 20 69 6e  64 69 72 65 63 74 69 6f  |sbyte indirectio|
00001a60  6e 20 76 65 63 74 6f 72  2c 20 6c 6f 77 20 62 79  |n vector, low by|
00001a70  74 65 0d 20 20 33 34 30  20 20 20 20 20 20 20 20  |te.  340        |
00001a80  20 53 54 59 20 62 79 74  65 76 2b 31 20 20 20 5c  | STY bytev+1   \|
00001a90  20 61 6c 74 65 72 20 4f  73 62 79 74 65 20 69 6e  | alter Osbyte in|
00001aa0  64 69 72 65 63 74 69 6f  6e 20 76 65 63 74 6f 72  |direction vector|
00001ab0  2c 20 68 69 67 68 20 62  79 74 65 0d 20 20 33 35  |, high byte.  35|
00001ac0  30 20 20 20 20 20 20 20  20 20 4c 44 41 20 23 26  |0         LDA #&|
00001ad0  39 38 20 20 20 20 20 20  5c 20 25 31 30 30 31 31  |98      \ %10011|
00001ae0  30 30 30 2c 20 69 65 2e  20 65 6e 61 62 6c 65 20  |000, ie. enable |
00001af0  43 42 31 2f 32 0d 20 20  33 36 30 20 20 20 20 20  |CB1/2.  360     |
00001b00  20 20 20 20 53 54 41 20  69 65 72 20 20 20 20 20  |    STA ier     |
00001b10  20 20 5c 20 69 6e 74 65  72 72 75 70 74 20 65 6e  |  \ interrupt en|
00001b20  61 62 6c 65 20 72 65 67  69 73 74 65 72 0d 20 20  |able register.  |
00001b30  33 37 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |370         LDA |
00001b40  70 63 72 20 20 20 20 20  20 20 5c 20 70 65 72 69  |pcr       \ peri|
00001b50  70 68 65 72 61 6c 20 63  6f 6e 74 72 6f 6c 20 72  |pheral control r|
00001b60  65 67 69 73 74 65 72 0d  20 20 33 38 30 20 20 20  |egister.  380   |
00001b70  20 20 20 20 20 20 41 4e  44 20 23 26 30 46 20 20  |      AND #&0F  |
00001b80  20 20 20 20 5c 20 41 4e  44 20 77 69 74 68 20 25  |    \ AND with %|
00001b90  30 30 30 30 31 31 31 31  2c 20 69 65 20 63 6c 65  |00001111, ie cle|
00001ba0  61 72 20 62 69 74 73 20  34 2d 37 0d 20 20 33 39  |ar bits 4-7.  39|
00001bb0  30 20 20 20 20 20 20 20  20 20 4f 52 41 20 23 26  |0         ORA #&|
00001bc0  35 30 20 20 20 20 20 20  5c 20 4f 52 20 77 69 74  |50      \ OR wit|
00001bd0  68 20 25 30 31 30 31 30  30 30 30 2c 20 69 65 2e  |h %01010000, ie.|
00001be0  20 73 65 74 20 62 69 74  73 20 34 20 61 6e 64 20  | set bits 4 and |
00001bf0  36 0d 20 20 34 30 30 20  20 20 20 20 20 20 20 20  |6.  400         |
00001c00  53 54 41 20 70 63 72 20  20 20 20 20 20 20 5c 20  |STA pcr       \ |
00001c10  69 6e 74 65 72 72 75 70  74 20 6f 6e 20 2b 76 65  |interrupt on +ve|
00001c20  20 74 72 61 6e 73 69 74  69 6f 6e 2c 20 43 42 32  | transition, CB2|
00001c30  20 69 6e 70 75 74 2c 0d  20 20 20 20 20 20 20 20  | input,.        |
00001c40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001c50  20 20 20 20 5c 20 44 52  42 20 74 6f 20 63 6c 65  |    \ DRB to cle|
00001c60  61 72 0d 20 20 34 31 30  20 20 20 20 20 20 20 20  |ar.  410        |
00001c70  20 4c 44 41 20 23 26 30  30 20 20 20 20 20 20 5c  | LDA #&00      \|
00001c80  20 75 73 65 72 20 70 6f  72 74 20 69 6e 70 75 74  | user port input|
00001c90  0d 20 20 34 32 30 20 20  20 20 20 20 20 20 20 53  |.  420         S|
00001ca0  54 41 20 64 64 72 62 20  20 20 20 20 20 5c 20 64  |TA ddrb      \ d|
00001cb0  61 74 61 20 64 69 72 65  63 74 69 6f 6e 20 72 65  |ata direction re|
00001cc0  67 69 73 74 65 72 20 42  0d 20 20 34 33 30 20 20  |gister B.  430  |
00001cd0  20 20 20 20 20 20 20 4c  44 41 20 23 26 31 30 20  |       LDA #&10 |
00001ce0  20 20 20 20 20 5c 20 41  44 43 20 63 68 61 6e 6e  |     \ ADC chann|
00001cf0  65 6c 20 73 65 6c 65 63  74 0d 20 20 34 34 30 20  |el select.  440 |
00001d00  20 20 20 20 20 20 20 20  4c 44 58 20 23 26 30 30  |        LDX #&00|
00001d10  20 20 20 20 20 20 5c 20  73 61 6d 70 6c 69 6e 67  |      \ sampling|
00001d20  20 64 69 73 61 62 6c 65  64 0d 20 20 34 35 30 20  | disabled.  450 |
00001d30  20 20 20 20 20 20 20 20  4a 4d 50 20 6f 73 62 79  |        JMP osby|
00001d40  74 65 20 20 20 20 5c 20  4f 73 62 79 74 65 20 61  |te    \ Osbyte a|
00001d50  6e 64 20 72 65 74 75 72  6e 20 74 6f 20 42 41 53  |nd return to BAS|
00001d60  49 43 0d 20 20 34 36 30  20 2e 64 69 73 61 62 6c  |IC.  460 .disabl|
00001d70  65 0d 20 20 34 37 30 20  20 20 20 20 20 20 20 20  |e.  470         |
00001d80  4c 44 41 20 23 26 31 38  20 20 20 20 20 20 5c 20  |LDA #&18      \ |
00001d90  25 30 30 30 31 31 30 30  30 2c 20 74 6f 20 63 6c  |%00011000, to cl|
00001da0  65 61 72 20 62 69 74 73  20 33 20 61 6e 64 20 34  |ear bits 3 and 4|
00001db0  20 6f 66 20 69 65 72 0d  20 20 34 38 30 20 20 20  | of ier.  480   |
00001dc0  20 20 20 20 20 20 4c 44  58 20 6f 6c 64 69 72 71  |      LDX oldirq|
00001dd0  31 76 20 20 5c 20 6f 72  69 67 69 6e 61 6c 20 31  |1v  \ original 1|
00001de0  72 71 31 20 76 65 63 74  6f 72 2c 20 6c 6f 77 20  |rq1 vector, low |
00001df0  62 79 74 65 0d 20 20 34  39 30 20 20 20 20 20 20  |byte.  490      |
00001e00  20 20 20 4c 44 59 20 6f  6c 64 69 72 71 31 76 2b  |   LDY oldirq1v+|
00001e10  31 20 5c 20 6f 72 69 67  69 6e 61 6c 20 69 72 71  |1 \ original irq|
00001e20  31 20 76 65 63 74 6f 72  2c 20 68 69 67 68 20 62  |1 vector, high b|
00001e30  79 74 65 0d 20 20 35 30  30 20 20 20 20 20 20 20  |yte.  500       |
00001e40  20 20 53 45 49 20 20 20  20 20 20 20 20 20 20 20  |  SEI           |
00001e50  5c 20 73 65 74 20 69 6e  74 65 72 72 75 70 74 20  |\ set interrupt |
00001e60  64 69 73 61 62 6c 65 20  66 6c 61 67 0d 20 20 35  |disable flag.  5|
00001e70  31 30 20 20 20 20 20 20  20 20 20 53 54 41 20 69  |10         STA i|
00001e80  65 72 20 20 20 20 20 20  20 5c 20 69 6e 74 65 72  |er       \ inter|
00001e90  72 75 70 74 20 65 6e 61  62 6c 65 20 72 65 67 69  |rupt enable regi|
00001ea0  73 74 65 72 0d 20 20 35  32 30 20 20 20 20 20 20  |ster.  520      |
00001eb0  20 20 20 4c 44 41 20 70  63 72 20 20 20 20 20 20  |   LDA pcr      |
00001ec0  20 5c 20 70 65 72 69 70  68 65 72 61 6c 20 63 6f  | \ peripheral co|
00001ed0  6e 74 72 6f 6c 20 72 65  67 69 73 74 65 72 0d 20  |ntrol register. |
00001ee0  20 35 33 30 20 20 20 20  20 20 20 20 20 41 4e 44  | 530         AND|
00001ef0  20 23 26 30 46 20 20 20  20 20 20 5c 20 41 4e 44  | #&0F      \ AND|
00001f00  20 77 69 74 68 20 25 30  30 30 30 31 31 31 31 2c  | with %00001111,|
00001f10  20 69 65 2e 20 63 6c 65  61 72 20 62 69 74 73 20  | ie. clear bits |
00001f20  34 2d 37 0d 20 20 35 34  30 20 20 20 20 20 20 20  |4-7.  540       |
00001f30  20 20 53 54 41 20 70 63  72 20 20 20 20 20 20 20  |  STA pcr       |
00001f40  5c 20 70 65 72 69 70 68  65 72 61 6c 20 63 6f 6e  |\ peripheral con|
00001f50  74 72 6f 6c 20 72 65 67  69 73 74 65 72 0d 20 20  |trol register.  |
00001f60  35 35 30 20 20 20 20 20  20 20 20 20 53 54 58 20  |550         STX |
00001f70  69 72 71 31 76 20 20 20  20 20 5c 20 72 65 73 74  |irq1v     \ rest|
00001f80  6f 72 65 20 74 68 65 20  6f 72 69 67 69 6e 61 6c  |ore the original|
00001f90  20 69 72 71 31 20 76 65  63 74 6f 72 2c 0d 20 20  | irq1 vector,.  |
00001fa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001fb0  20 20 20 20 20 20 20 20  20 20 5c 20 6c 6f 77 20  |          \ low |
00001fc0  62 79 74 65 0d 20 20 35  36 30 20 20 20 20 20 20  |byte.  560      |
00001fd0  20 20 20 53 54 59 20 69  72 71 31 76 2b 31 20 20  |   STY irq1v+1  |
00001fe0  20 5c 20 72 65 73 74 6f  72 65 20 74 68 65 20 6f  | \ restore the o|
00001ff0  72 69 67 69 6e 61 6c 20  69 72 71 31 20 76 65 63  |riginal irq1 vec|
00002000  74 6f 72 2c 0d 20 20 20  20 20 20 20 20 20 20 20  |tor,.           |
00002010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002020  20 5c 20 68 69 67 68 20  62 79 74 65 0d 20 20 35  | \ high byte.  5|
00002030  37 30 20 20 20 20 20 20  20 20 20 43 4c 49 20 20  |70         CLI  |
00002040  20 20 20 20 20 20 20 20  20 5c 20 63 6c 65 61 72  |         \ clear|
00002050  20 69 6e 74 65 72 72 75  70 74 20 64 69 73 61 62  | interrupt disab|
00002060  6c 65 20 66 6c 61 67 0d  20 20 35 38 30 20 20 20  |le flag.  580   |
00002070  20 20 20 20 20 20 4c 44  58 20 6f 6c 64 62 79 74  |      LDX oldbyt|
00002080  65 76 20 20 5c 20 6f 72  69 67 69 6e 61 6c 20 4f  |ev  \ original O|
00002090  73 62 79 74 65 20 69 6e  64 69 72 65 63 74 69 6f  |sbyte indirectio|
000020a0  6e 20 76 65 63 74 6f 72  2c 0d 20 20 20 20 20 20  |n vector,.      |
000020b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000020c0  20 20 20 20 20 20 5c 20  6c 6f 77 20 62 79 74 65  |      \ low byte|
000020d0  0d 20 20 35 39 30 20 20  20 20 20 20 20 20 20 4c  |.  590         L|
000020e0  44 59 20 6f 6c 64 62 79  74 65 76 2b 31 20 5c 20  |DY oldbytev+1 \ |
000020f0  6f 72 69 67 69 6e 61 6c  20 4f 73 62 79 74 65 20  |original Osbyte |
00002100  69 6e 64 69 72 65 63 74  69 6f 6e 20 76 65 63 74  |indirection vect|
00002110  6f 72 2c 0d 20 20 20 20  20 20 20 20 20 20 20 20  |or,.            |
00002120  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002130  5c 20 68 69 67 68 20 62  79 74 65 0d 20 20 36 30  |\ high byte.  60|
00002140  30 20 20 20 20 20 20 20  20 20 53 54 58 20 62 79  |0         STX by|
00002150  74 65 76 20 20 20 20 20  5c 20 72 65 73 74 6f 72  |tev     \ restor|
00002160  65 20 74 68 65 20 4f 73  62 79 74 65 20 76 65 63  |e the Osbyte vec|
00002170  74 6f 72 2c 20 6c 6f 77  20 62 79 74 65 0d 20 20  |tor, low byte.  |
00002180  36 31 30 20 20 20 20 20  20 20 20 20 53 54 59 20  |610         STY |
00002190  62 79 74 65 76 2b 31 20  20 20 5c 20 72 65 73 74  |bytev+1   \ rest|
000021a0  6f 72 65 20 74 68 65 20  4f 73 62 79 74 65 20 76  |ore the Osbyte v|
000021b0  65 63 74 6f 72 2c 20 68  69 67 68 20 62 79 74 65  |ector, high byte|
000021c0  0d 20 20 36 32 30 20 20  20 20 20 20 20 20 20 4c  |.  620         L|
000021d0  44 41 20 23 26 31 30 20  20 20 20 20 20 5c 20 73  |DA #&10      \ s|
000021e0  65 6c 65 63 74 20 41 44  43 20 63 68 61 6e 6e 65  |elect ADC channe|
000021f0  6c 0d 20 20 36 33 30 20  20 20 20 20 20 20 20 20  |l.  630         |
00002200  4c 44 58 20 23 26 30 34  20 20 20 20 20 20 5c 20  |LDX #&04      \ |
00002210  34 20 63 68 61 6e 6e 65  6c 73 20 74 6f 20 62 65  |4 channels to be|
00002220  20 73 61 6d 70 6c 65 64  0d 20 20 36 34 30 20 20  | sampled.  640  |
00002230  20 20 20 20 20 20 20 4a  4d 50 20 6f 73 62 79 74  |       JMP osbyt|
00002240  65 20 20 20 20 5c 20 4f  73 62 79 74 65 20 61 6e  |e    \ Osbyte an|
00002250  64 20 72 65 74 75 72 6e  20 74 6f 20 42 41 53 49  |d return to BASI|
00002260  43 0d 20 20 36 35 30 20  2e 69 6e 74 65 72 72 75  |C.  650 .interru|
00002270  70 74 0d 20 20 36 36 30  20 20 20 20 20 20 20 20  |pt.  660        |
00002280  20 4c 44 41 20 73 61 76  65 72 65 67 20 20 20 5c  | LDA savereg   \|
00002290  20 69 6e 74 65 72 72 75  70 74 20 61 63 63 75 6d  | interrupt accum|
000022a0  75 6c 61 74 6f 72 20 73  61 76 65 20 72 65 67 69  |ulator save regi|
000022b0  73 74 65 72 0d 20 20 36  37 30 20 20 20 20 20 20  |ster.  670      |
000022c0  20 20 20 50 48 41 20 20  20 20 20 20 20 20 20 20  |   PHA          |
000022d0  20 5c 20 61 6e 64 20 70  75 73 68 20 69 74 20 6f  | \ and push it o|
000022e0  6e 20 74 68 65 20 73 74  61 63 6b 0d 20 20 36 38  |n the stack.  68|
000022f0  30 20 20 20 20 20 20 20  20 20 4c 44 41 20 69 66  |0         LDA if|
00002300  72 20 20 20 20 20 20 20  5c 20 69 6e 74 65 72 72  |r       \ interr|
00002310  75 70 74 20 66 6c 61 67  20 72 65 67 69 73 74 65  |upt flag registe|
00002320  72 0d 20 20 36 39 30 20  20 20 20 20 20 20 20 20  |r.  690         |
00002330  42 50 4c 20 6e 6f 74 75  73 65 72 20 20 20 5c 20  |BPL notuser   \ |
00002340  62 69 74 20 37 20 69 73  20 73 65 74 20 69 66 20  |bit 7 is set if |
00002350  56 49 41 2d 42 20 69 6e  74 65 72 72 75 70 74 0d  |VIA-B interrupt.|
00002360  20 20 37 30 30 20 20 20  20 20 20 20 20 20 41 4e  |  700         AN|
00002370  44 20 23 26 31 38 20 20  20 20 20 20 5c 20 41 4e  |D #&18      \ AN|
00002380  44 20 77 69 74 68 20 25  30 30 30 31 31 30 30 30  |D with %00011000|
00002390  2c 20 69 65 2e 20 74 65  73 74 20 62 69 74 73 20  |, ie. test bits |
000023a0  33 20 61 6e 64 20 34 0d  20 20 37 31 30 20 20 20  |3 and 4.  710   |
000023b0  20 20 20 20 20 20 42 45  51 20 6e 6f 74 75 73 65  |      BEQ notuse|
000023c0  72 20 20 20 5c 20 65 78  69 74 20 69 66 20 6e 6f  |r   \ exit if no|
000023d0  74 20 43 42 31 20 6f 72  20 43 42 32 0d 20 20 37  |t CB1 or CB2.  7|
000023e0  32 30 20 20 20 20 20 20  20 20 20 41 4e 44 20 23  |20         AND #|
000023f0  26 31 30 20 20 20 20 20  20 5c 20 41 4e 44 20 77  |&10      \ AND w|
00002400  69 74 68 20 25 30 30 30  31 30 30 30 30 2c 20 69  |ith %00010000, i|
00002410  65 2e 20 74 65 73 74 20  43 42 31 0d 20 20 37 33  |e. test CB1.  73|
00002420  30 20 20 20 20 20 20 20  20 20 42 4e 45 20 78 70  |0         BNE xp|
00002430  75 6c 73 65 20 20 20 20  5c 20 62 69 74 20 34 20  |ulse    \ bit 4 |
00002440  73 65 74 20 66 6f 72 20  61 6e 20 58 20 64 69 72  |set for an X dir|
00002450  65 63 74 69 6f 6e 20 6d  6f 76 65 6d 65 6e 74 0d  |ection movement.|
00002460  20 20 37 34 30 20 20 20  20 20 20 20 20 20 4c 44  |  740         LD|
00002470  41 20 64 72 62 20 20 20  20 20 20 20 5c 20 64 61  |A drb       \ da|
00002480  74 61 20 72 65 67 69 73  74 65 72 20 42 0d 20 20  |ta register B.  |
00002490  37 35 30 20 20 20 20 20  20 20 20 20 41 4e 44 20  |750         AND |
000024a0  23 26 30 34 20 20 20 20  20 20 5c 20 41 4e 44 20  |#&04      \ AND |
000024b0  77 69 74 68 20 25 30 30  30 30 30 31 30 30 2c 20  |with %00000100, |
000024c0  69 65 2e 20 74 65 73 74  20 62 69 74 20 32 0d 20  |ie. test bit 2. |
000024d0  20 37 36 30 20 20 20 20  20 20 20 20 20 42 4e 45  | 760         BNE|
000024e0  20 79 64 6f 77 6e 20 20  20 20 20 5c 20 69 66 20  | ydown     \ if |
000024f0  62 69 74 20 32 20 69 73  20 73 65 74 20 74 68 65  |bit 2 is set the|
00002500  6e 20 59 20 69 73 20 67  6f 69 6e 67 20 64 6f 77  |n Y is going dow|
00002510  6e 0d 20 20 37 37 30 20  20 20 20 20 20 20 20 20  |n.  770         |
00002520  49 4e 43 20 79 63 6f 6f  72 64 20 20 20 20 5c 20  |INC ycoord    \ |
00002530  59 20 69 73 20 67 6f 69  6e 67 20 75 70 20 73 6f  |Y is going up so|
00002540  20 69 6e 63 72 65 6d 65  6e 74 20 59 20 63 6f 6f  | increment Y coo|
00002550  72 64 69 6e 61 74 65 0d  20 20 37 38 30 20 20 20  |rdinate.  780   |
00002560  20 20 20 20 20 20 42 4e  45 20 65 78 69 74 20 20  |      BNE exit  |
00002570  20 20 20 20 5c 20 62 72  61 6e 63 68 20 69 66 20  |    \ branch if |
00002580  69 6e 20 74 68 65 20 72  61 6e 67 65 20 31 20 74  |in the range 1 t|
00002590  6f 20 32 35 35 0d 20 20  37 39 30 20 20 20 20 20  |o 255.  790     |
000025a0  20 20 20 20 42 45 51 20  64 65 63 79 20 20 20 20  |    BEQ decy    |
000025b0  20 20 5c 20 69 66 20 7a  65 72 6f 20 74 68 65 6e  |  \ if zero then|
000025c0  20 61 6c 74 65 72 20 74  6f 20 32 35 35 0d 20 20  | alter to 255.  |
000025d0  38 30 30 20 2e 79 64 6f  77 6e 0d 20 20 38 31 30  |800 .ydown.  810|
000025e0  20 20 20 20 20 20 20 20  20 4c 44 41 20 79 63 6f  |         LDA yco|
000025f0  6f 72 64 20 20 20 20 5c  20 6c 6f 61 64 20 59 20  |ord    \ load Y |
00002600  63 6f 6f 72 64 69 6e 61  74 65 0d 20 20 38 32 30  |coordinate.  820|
00002610  20 20 20 20 20 20 20 20  20 42 45 51 20 65 78 69  |         BEQ exi|
00002620  74 20 20 20 20 20 20 5c  20 62 72 61 6e 63 68 20  |t      \ branch |
00002630  69 66 20 7a 65 72 6f 20  62 65 63 61 75 73 65 20  |if zero because |
00002640  69 74 20 63 61 6e 27 74  20 67 6f 20 61 6e 79 0d  |it can't go any.|
00002650  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002660  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 6c 6f  |            \ lo|
00002670  77 65 72 0d 20 20 38 33  30 20 2e 64 65 63 79 0d  |wer.  830 .decy.|
00002680  20 20 38 34 30 20 20 20  20 20 20 20 20 20 44 45  |  840         DE|
00002690  43 20 79 63 6f 6f 72 64  20 20 20 20 5c 20 72 65  |C ycoord    \ re|
000026a0  64 75 63 65 20 59 20 63  6f 6f 72 64 69 6e 61 74  |duce Y coordinat|
000026b0  65 20 62 79 20 31 0d 20  20 38 35 30 20 20 20 20  |e by 1.  850    |
000026c0  20 20 20 20 20 4a 4d 50  20 65 78 69 74 20 20 20  |     JMP exit   |
000026d0  20 20 20 5c 20 72 65 73  74 6f 72 65 20 69 6e 74  |   \ restore int|
000026e0  65 72 72 75 70 74 20 61  63 63 75 6d 75 6c 61 74  |errupt accumulat|
000026f0  6f 72 20 73 61 76 65 0d  20 20 20 20 20 20 20 20  |or save.        |
00002700  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002710  20 20 20 20 5c 20 72 65  67 69 73 74 65 72 20 61  |    \ register a|
00002720  6e 64 20 52 54 49 0d 20  20 38 36 30 20 2e 78 70  |nd RTI.  860 .xp|
00002730  75 6c 73 65 0d 20 20 38  37 30 20 20 20 20 20 20  |ulse.  870      |
00002740  20 20 20 4c 44 41 20 64  72 62 20 20 20 20 20 20  |   LDA drb      |
00002750  20 5c 20 64 61 74 61 20  72 65 67 69 73 74 65 72  | \ data register|
00002760  20 42 0d 20 20 38 38 30  20 20 20 20 20 20 20 20  | B.  880        |
00002770  20 52 4f 52 20 41 20 20  20 20 20 20 20 20 20 5c  | ROR A         \|
00002780  20 62 69 74 20 30 20 69  6e 74 6f 20 63 61 72 72  | bit 0 into carr|
00002790  79 0d 20 20 38 39 30 20  20 20 20 20 20 20 20 20  |y.  890         |
000027a0  42 43 43 20 78 64 6f 77  6e 20 20 20 20 20 5c 20  |BCC xdown     \ |
000027b0  58 20 69 73 20 67 6f 69  6e 67 20 64 6f 77 6e 20  |X is going down |
000027c0  69 66 20 62 69 74 20 30  20 69 73 20 73 65 74 20  |if bit 0 is set |
000027d0  2d 0d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |-.              |
000027e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
000027f0  62 75 74 20 66 75 64 67  65 20 66 6f 72 20 6a 6f  |but fudge for jo|
00002800  79 73 74 69 63 6b 20 73  69 6d 75 6c 61 74 69 6f  |ystick simulatio|
00002810  6e 0d 20 20 39 30 30 20  20 20 20 20 20 20 20 20  |n.  900         |
00002820  49 4e 43 20 78 63 6f 6f  72 64 20 20 20 20 5c 20  |INC xcoord    \ |
00002830  58 20 69 73 20 67 6f 69  6e 67 20 75 70 20 69 66  |X is going up if|
00002840  20 62 69 74 20 30 20 69  73 20 63 6c 65 61 72 20  | bit 0 is clear |
00002850  2d 0d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |-.              |
00002860  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00002870  62 75 74 20 66 75 64 67  65 20 66 6f 72 20 6a 6f  |but fudge for jo|
00002880  79 73 74 69 63 6b 20 73  69 6d 75 6c 61 74 69 6f  |ystick simulatio|
00002890  6e 0d 20 20 39 31 30 20  20 20 20 20 20 20 20 20  |n.  910         |
000028a0  42 4e 45 20 65 78 69 74  20 20 20 20 20 20 5c 20  |BNE exit      \ |
000028b0  65 78 69 74 20 69 66 20  58 20 63 6f 6f 72 64 69  |exit if X coordi|
000028c0  6e 61 74 65 20 69 73 20  69 6e 20 74 68 65 20 72  |nate is in the r|
000028d0  61 6e 67 65 0d 20 20 20  20 20 20 20 20 20 20 20  |ange.           |
000028e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000028f0  20 5c 20 66 72 6f 6d 20  31 20 74 6f 20 32 35 35  | \ from 1 to 255|
00002900  0d 20 20 39 32 30 20 20  20 20 20 20 20 20 20 42  |.  920         B|
00002910  45 51 20 64 65 63 78 20  20 20 20 20 20 5c 20 69  |EQ decx      \ i|
00002920  66 20 58 20 63 6f 6f 72  64 69 6e 61 74 65 20 3d  |f X coordinate =|
00002930  20 30 20 74 68 65 6e 20  6d 61 6b 65 20 69 74 20  | 0 then make it |
00002940  32 35 35 0d 20 20 39 33  30 20 2e 78 64 6f 77 6e  |255.  930 .xdown|
00002950  0d 20 20 39 34 30 20 20  20 20 20 20 20 20 20 4c  |.  940         L|
00002960  44 41 20 78 63 6f 6f 72  64 20 20 20 20 5c 20 6c  |DA xcoord    \ l|
00002970  6f 61 64 20 58 20 63 6f  6f 72 64 69 6e 61 74 65  |oad X coordinate|
00002980  0d 20 20 39 35 30 20 20  20 20 20 20 20 20 20 42  |.  950         B|
00002990  45 51 20 65 78 69 74 20  20 20 20 20 20 5c 20 69  |EQ exit      \ i|
000029a0  66 20 69 74 20 69 73 20  7a 65 72 6f 20 69 74 20  |f it is zero it |
000029b0  63 61 6e 27 74 20 67 6f  20 61 6e 79 20 6c 6f 77  |can't go any low|
000029c0  65 72 0d 20 20 39 36 30  20 2e 64 65 63 78 0d 20  |er.  960 .decx. |
000029d0  20 39 37 30 20 20 20 20  20 20 20 20 20 44 45 43  | 970         DEC|
000029e0  20 78 63 6f 6f 72 64 20  20 20 20 5c 20 64 65 63  | xcoord    \ dec|
000029f0  72 65 61 73 65 20 58 20  63 6f 6f 72 64 69 6e 61  |rease X coordina|
00002a00  74 65 20 62 79 20 31 0d  20 20 39 38 30 20 2e 65  |te by 1.  980 .e|
00002a10  78 69 74 0d 20 20 39 39  30 20 20 20 20 20 20 20  |xit.  990       |
00002a20  20 20 50 4c 41 20 20 20  20 20 20 20 20 20 20 20  |  PLA           |
00002a30  5c 20 70 75 6c 6c 20 69  6e 74 65 72 72 75 70 74  |\ pull interrupt|
00002a40  20 61 63 63 75 6d 75 6c  61 74 6f 72 20 73 61 76  | accumulator sav|
00002a50  65 0d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e.              |
00002a60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 5c 20  |              \ |
00002a70  72 65 67 69 73 74 65 72  20 6f 66 66 20 74 68 65  |register off the|
00002a80  20 73 74 61 63 6b 0d 20  31 30 30 30 20 20 20 20  | stack. 1000    |
00002a90  20 20 20 20 20 53 54 41  20 73 61 76 65 72 65 67  |     STA savereg|
00002aa0  20 20 20 5c 20 61 6e 64  20 72 65 73 74 6f 72 65  |   \ and restore|
00002ab0  20 7a 65 72 6f 20 70 61  67 65 0d 20 31 30 31 30  | zero page. 1010|
00002ac0  20 20 20 20 20 20 20 20  20 52 54 49 20 20 20 20  |         RTI    |
00002ad0  20 20 20 20 20 20 20 5c  20 72 65 74 75 72 6e 20  |       \ return |
00002ae0  66 72 6f 6d 20 69 6e 74  65 72 72 75 70 74 0d 20  |from interrupt. |
00002af0  31 30 32 30 20 2e 6e 6f  74 75 73 65 72 0d 20 31  |1020 .notuser. 1|
00002b00  30 33 30 20 20 20 20 20  20 20 20 20 50 4c 41 20  |030         PLA |
00002b10  20 20 20 20 20 20 20 20  20 20 5c 20 70 75 6c 6c  |          \ pull|
00002b20  20 74 68 65 20 69 6e 74  65 72 72 75 70 74 20 61  | the interrupt a|
00002b30  63 63 75 6d 75 6c 61 74  6f 72 20 73 61 76 65 0d  |ccumulator save.|
00002b40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002b50  20 20 20 20 20 20 20 20  20 20 20 20 5c 20 72 65  |            \ re|
00002b60  67 69 73 74 65 72 20 6f  66 66 20 74 68 65 20 73  |gister off the s|
00002b70  74 61 63 6b 0d 20 31 30  34 30 20 20 20 20 20 20  |tack. 1040      |
00002b80  20 20 20 53 54 41 20 73  61 76 65 72 65 67 20 20  |   STA savereg  |
00002b90  20 5c 20 72 65 73 74 6f  72 65 20 74 68 65 20 7a  | \ restore the z|
00002ba0  65 72 6f 20 70 61 67 65  20 61 64 64 72 65 73 73  |ero page address|
00002bb0  0d 20 31 30 35 30 20 20  20 20 20 20 20 20 20 4a  |. 1050         J|
00002bc0  4d 50 20 28 6f 6c 64 69  72 71 31 76 29 20 5c 20  |MP (oldirq1v) \ |
00002bd0  65 78 69 74 20 76 69 61  20 74 68 65 20 6f 72 69  |exit via the ori|
00002be0  67 69 6e 61 6c 20 76 65  63 74 6f 72 0d 20 31 30  |ginal vector. 10|
00002bf0  36 30 20 2e 61 6e 61 6c  6f 67 75 65 0d 20 31 30  |60 .analogue. 10|
00002c00  37 30 20 20 20 20 20 20  20 20 20 50 48 50 20 20  |70         PHP  |
00002c10  20 20 20 20 20 20 20 20  20 5c 20 70 75 73 68 20  |         \ push |
00002c20  74 68 65 20 73 74 61 74  75 73 20 72 65 67 69 73  |the status regis|
00002c30  74 65 72 0d 20 31 30 38  30 20 20 20 20 20 20 20  |ter. 1080       |
00002c40  20 20 43 4d 50 20 23 26  38 30 20 20 20 20 20 20  |  CMP #&80      |
00002c50  5c 20 4f 73 62 79 74 65  20 26 38 30 20 69 73 20  |\ Osbyte &80 is |
00002c60  72 65 61 64 20 41 44 43  20 63 68 61 6e 6e 65 6c  |read ADC channel|
00002c70  20 6f 72 20 67 65 74 0d  20 20 20 20 20 20 20 20  | or get.        |
00002c80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002c90  20 20 20 20 5c 20 62 75  66 66 65 72 20 73 74 61  |    \ buffer sta|
00002ca0  74 75 73 0d 20 31 30 39  30 20 20 20 20 20 20 20  |tus. 1090       |
00002cb0  20 20 42 4e 45 20 6f 6c  64 61 64 76 61 6c 20 20  |  BNE oldadval  |
00002cc0  5c 20 62 72 61 6e 63 68  20 69 66 20 6e 6f 74 20  |\ branch if not |
00002cd0  4f 73 62 79 74 65 20 26  38 30 0d 20 31 31 30 30  |Osbyte &80. 1100|
00002ce0  20 20 20 20 20 20 20 20  20 43 50 58 20 23 26 30  |         CPX #&0|
00002cf0  30 20 20 20 20 20 20 5c  20 69 73 20 74 68 69 73  |0      \ is this|
00002d00  20 41 44 56 41 4c 28 30  29 20 69 65 2e 20 72 65  | ADVAL(0) ie. re|
00002d10  61 64 20 66 69 72 65 20  62 75 74 74 6f 6e 73 3f  |ad fire buttons?|
00002d20  0d 20 31 31 31 30 20 20  20 20 20 20 20 20 20 42  |. 1110         B|
00002d30  45 51 20 66 69 72 65 62  75 74 74 6f 6e 73 20 5c  |EQ firebuttons \|
00002d40  20 62 72 61 6e 63 68 20  74 6f 20 73 69 6d 75 6c  | branch to simul|
00002d50  61 74 65 20 72 65 61 64  20 66 69 72 65 20 62 75  |ate read fire bu|
00002d60  74 74 6f 6e 73 0d 20 31  31 32 30 20 20 20 20 20  |ttons. 1120     |
00002d70  20 20 20 20 42 50 4c 20  6e 65 77 61 64 76 61 6c  |    BPL newadval|
00002d80  20 20 5c 20 69 66 20 58  20 3d 20 31 20 74 6f 20  |  \ if X = 1 to |
00002d90  34 20 74 68 65 6e 20 73  69 6d 75 6c 61 74 65 20  |4 then simulate |
00002da0  41 44 43 0d 20 20 20 20  20 20 20 20 20 20 20 20  |ADC.            |
00002db0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002dc0  5c 20 63 6f 6e 76 65 72  73 69 6f 6e 0d 20 31 31  |\ conversion. 11|
00002dd0  33 30 20 2e 6f 6c 64 61  64 76 61 6c 0d 20 31 31  |30 .oldadval. 11|
00002de0  34 30 20 20 20 20 20 20  20 20 20 50 4c 50 20 20  |40         PLP  |
00002df0  20 20 20 20 20 20 20 20  20 5c 20 70 75 6c 6c 20  |         \ pull |
00002e00  73 74 61 74 75 73 20 72  65 67 69 73 74 65 72 0d  |status register.|
00002e10  20 31 31 35 30 20 2e 6f  72 69 67 69 6e 61 6c 0d  | 1150 .original.|
00002e20  20 31 31 36 30 20 20 20  20 20 20 20 20 20 4a 4d  | 1160         JM|
00002e30  50 20 28 6f 6c 64 62 79  74 65 76 29 20 5c 20 65  |P (oldbytev) \ e|
00002e40  78 69 74 20 76 69 61 20  6f 72 69 67 69 6e 61 6c  |xit via original|
00002e50  20 4f 73 62 79 74 65 20  76 65 63 74 6f 72 0d 20  | Osbyte vector. |
00002e60  31 31 37 30 20 2e 6e 65  77 61 64 76 61 6c 0d 20  |1170 .newadval. |
00002e70  31 31 38 30 20 20 20 20  20 20 20 20 20 54 58 41  |1180         TXA|
00002e80  20 20 20 20 20 20 20 20  20 20 20 5c 20 58 20 63  |           \ X c|
00002e90  6f 6e 74 61 69 6e 73 20  63 68 61 6e 6e 65 6c 20  |ontains channel |
00002ea0  6e 75 6d 62 65 72 20 28  31 20 74 6f 20 34 29 0d  |number (1 to 4).|
00002eb0  20 31 31 39 30 20 20 20  20 20 20 20 20 20 52 4f  | 1190         RO|
00002ec0  52 20 41 20 20 20 20 20  20 20 20 20 5c 20 62 69  |R A         \ bi|
00002ed0  74 20 30 20 69 6e 74 6f  20 63 61 72 72 79 0d 20  |t 0 into carry. |
00002ee0  31 32 30 30 20 20 20 20  20 20 20 20 20 4c 44 41  |1200         LDA|
00002ef0  20 79 63 6f 6f 72 64 20  20 20 20 5c 20 6c 6f 61  | ycoord    \ loa|
00002f00  64 20 59 20 63 6f 6f 72  64 69 6e 61 74 65 0d 20  |d Y coordinate. |
00002f10  31 32 31 30 20 20 20 20  20 20 20 20 20 42 43 43  |1210         BCC|
00002f20  20 73 6b 69 70 78 63 6f  6f 72 64 20 5c 20 62 72  | skipxcoord \ br|
00002f30  61 6e 63 68 20 69 66 20  41 44 56 41 4c 28 31 29  |anch if ADVAL(1)|
00002f40  20 6f 72 20 41 44 56 41  4c 28 33 29 0d 20 31 32  | or ADVAL(3). 12|
00002f50  32 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 78  |20         LDA x|
00002f60  63 6f 6f 72 64 20 20 20  20 5c 20 6c 6f 61 64 20  |coord    \ load |
00002f70  58 20 63 6f 6f 72 64 69  6e 61 74 65 0d 20 31 32  |X coordinate. 12|
00002f80  33 30 20 2e 73 6b 69 70  78 63 6f 6f 72 64 0d 20  |30 .skipxcoord. |
00002f90  31 32 34 30 20 20 20 20  20 20 20 20 20 54 41 59  |1240         TAY|
00002fa0  20 20 20 20 20 20 20 20  20 20 20 5c 20 59 20 3d  |           \ Y =|
00002fb0  20 68 69 67 68 20 62 79  74 65 20 6f 66 20 31 36  | high byte of 16|
00002fc0  20 62 69 74 20 73 69 6d  75 6c 61 74 65 64 20 41  | bit simulated A|
00002fd0  44 43 0d 20 31 32 35 30  20 20 20 20 20 20 20 20  |DC. 1250        |
00002fe0  20 41 4e 44 20 23 26 46  30 20 20 20 20 20 20 5c  | AND #&F0      \|
00002ff0  20 41 4e 44 20 77 69 74  68 20 25 31 31 31 31 30  | AND with %11110|
00003000  30 30 30 2c 20 69 65 2e  20 63 6c 65 61 72 20 62  |000, ie. clear b|
00003010  69 74 73 20 30 2d 33 0d  20 31 32 36 30 20 20 20  |its 0-3. 1260   |
00003020  20 20 20 20 20 20 54 41  58 20 20 20 20 20 20 20  |      TAX       |
00003030  20 20 20 20 5c 20 58 20  3d 20 6c 6f 77 20 62 79  |    \ X = low by|
00003040  74 65 20 6f 66 20 31 36  20 62 69 74 20 73 69 6d  |te of 16 bit sim|
00003050  75 6c 61 74 65 64 20 41  44 43 0d 20 31 32 37 30  |ulated ADC. 1270|
00003060  20 20 20 20 20 20 20 20  20 4c 44 41 20 23 26 38  |         LDA #&8|
00003070  30 20 20 20 20 20 20 5c  20 4f 73 62 79 74 65 20  |0      \ Osbyte |
00003080  26 38 30 0d 20 31 32 38  30 20 20 20 20 20 20 20  |&80. 1280       |
00003090  20 20 50 4c 50 20 20 20  20 20 20 20 20 20 20 20  |  PLP           |
000030a0  5c 20 72 65 73 74 6f 72  65 20 73 74 61 74 75 73  |\ restore status|
000030b0  20 72 65 67 69 73 74 65  72 0d 20 31 32 39 30 20  | register. 1290 |
000030c0  20 20 20 20 20 20 20 20  52 54 53 20 20 20 20 20  |        RTS     |
000030d0  20 20 20 20 20 20 5c 20  72 65 74 75 72 6e 20 74  |      \ return t|
000030e0  6f 20 42 41 53 49 43 0d  20 31 33 30 30 20 2e 66  |o BASIC. 1300 .f|
000030f0  69 72 65 62 75 74 74 6f  6e 73 0d 20 31 33 31 30  |irebuttons. 1310|
00003100  20 20 20 20 20 20 20 20  20 4a 53 52 20 6f 72 69  |         JSR ori|
00003110  67 69 6e 61 6c 20 20 5c  20 70 65 72 66 6f 72 6d  |ginal  \ perform|
00003120  20 74 68 65 20 6f 72 69  67 69 6e 61 6c 20 41 44  | the original AD|
00003130  56 41 4c 28 30 29 0d 20  31 33 32 30 20 20 20 20  |VAL(0). 1320    |
00003140  20 20 20 20 20 54 58 41  20 20 20 20 20 20 20 20  |     TXA        |
00003150  20 20 20 5c 20 72 65 73  75 6c 74 20 6f 66 20 72  |   \ result of r|
00003160  65 61 64 69 6e 67 20 66  69 72 65 20 62 75 74 74  |eading fire butt|
00003170  6f 6e 73 20 69 73 20 69  6e 20 58 0d 20 31 33 33  |ons is in X. 133|
00003180  30 20 20 20 20 20 20 20  20 20 50 48 41 20 20 20  |0         PHA   |
00003190  20 20 20 20 20 20 20 20  5c 20 70 75 73 68 20 58  |        \ push X|
000031a0  0d 20 31 33 34 30 20 20  20 20 20 20 20 20 20 4c  |. 1340         L|
000031b0  44 41 20 64 72 62 20 20  20 20 20 20 20 5c 20 64  |DA drb       \ d|
000031c0  61 74 61 20 72 65 67 69  73 74 65 72 20 42 0d 20  |ata register B. |
000031d0  31 33 35 30 20 20 20 20  20 20 20 20 20 52 4f 4c  |1350         ROL|
000031e0  20 41 20 20 20 20 20 20  20 20 20 5c 20 62 69 74  | A         \ bit|
000031f0  20 37 20 69 6e 74 6f 20  63 61 72 72 79 0d 20 31  | 7 into carry. 1|
00003200  33 36 30 20 20 20 20 20  20 20 20 20 42 43 43 20  |360         BCC |
00003210  72 69 67 68 74 20 20 20  20 20 5c 20 62 69 74 20  |right     \ bit |
00003220  37 20 63 6c 65 61 72 20  3d 20 72 69 67 68 74 20  |7 clear = right |
00003230  62 75 74 74 6f 6e 20 70  72 65 73 73 65 64 0d 20  |button pressed. |
00003240  31 33 37 30 20 20 20 20  20 20 20 20 20 52 4f 4c  |1370         ROL|
00003250  20 41 20 20 20 20 20 20  20 20 20 5c 20 62 69 74  | A         \ bit|
00003260  20 36 20 69 6e 74 6f 20  63 61 72 72 79 0d 20 31  | 6 into carry. 1|
00003270  33 38 30 20 20 20 20 20  20 20 20 20 42 43 43 20  |380         BCC |
00003280  63 65 6e 74 72 65 20 20  20 20 5c 20 62 69 74 20  |centre    \ bit |
00003290  36 20 63 6c 65 61 72 20  3d 20 63 65 6e 74 72 65  |6 clear = centre|
000032a0  20 62 75 74 74 6f 6e 20  70 72 65 73 73 65 64 0d  | button pressed.|
000032b0  20 31 33 39 30 20 20 20  20 20 20 20 20 20 52 4f  | 1390         RO|
000032c0  4c 20 41 20 20 20 20 20  20 20 20 20 5c 20 62 69  |L A         \ bi|
000032d0  74 20 35 20 69 6e 74 6f  20 63 61 72 72 79 0d 20  |t 5 into carry. |
000032e0  31 34 30 30 20 20 20 20  20 20 20 20 20 42 43 53  |1400         BCS|
000032f0  20 6e 6f 70 72 65 73 73  20 20 20 5c 20 62 69 74  | nopress   \ bit|
00003300  20 35 20 73 65 74 20 3d  20 6e 6f 20 62 75 74 74  | 5 set = no butt|
00003310  6f 6e 73 20 70 72 65 73  73 65 64 2c 0d 20 20 20  |ons pressed,.   |
00003320  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003330  20 20 20 20 20 20 20 20  20 5c 20 63 6c 65 61 72  |         \ clear|
00003340  20 3d 20 6c 65 66 74 20  62 75 74 74 6f 6e 20 70  | = left button p|
00003350  72 65 73 73 65 64 0d 20  31 34 31 30 20 20 20 20  |ressed. 1410    |
00003360  20 20 20 20 20 50 4c 41  20 20 20 20 20 20 20 20  |     PLA        |
00003370  20 20 20 5c 20 70 75 6c  6c 20 74 68 65 20 72 65  |   \ pull the re|
00003380  73 75 6c 74 20 6f 66 20  41 44 56 41 4c 28 30 29  |sult of ADVAL(0)|
00003390  0d 20 31 34 32 30 20 20  20 20 20 20 20 20 20 4f  |. 1420         O|
000033a0  52 41 20 23 26 30 31 20  20 20 20 20 20 5c 20 73  |RA #&01      \ s|
000033b0  65 74 20 62 69 74 20 30  0d 20 31 34 33 30 20 20  |et bit 0. 1430  |
000033c0  20 20 20 20 20 20 20 42  4e 45 20 67 65 74 6f 75  |       BNE getou|
000033d0  74 20 20 20 20 5c 20 61  6e 64 20 72 65 74 75 72  |t    \ and retur|
000033e0  6e 20 74 6f 20 42 41 53  49 43 0d 20 31 34 34 30  |n to BASIC. 1440|
000033f0  20 2e 72 69 67 68 74 0d  20 31 34 35 30 20 20 20  | .right. 1450   |
00003400  20 20 20 20 20 20 50 4c  41 20 20 20 20 20 20 20  |      PLA       |
00003410  20 20 20 20 5c 20 70 75  6c 6c 20 74 68 65 20 72  |    \ pull the r|
00003420  65 73 75 6c 74 20 6f 66  20 41 44 56 41 4c 28 30  |esult of ADVAL(0|
00003430  29 0d 20 31 34 36 30 20  20 20 20 20 20 20 20 20  |). 1460         |
00003440  4f 52 41 20 23 26 30 32  20 20 20 20 20 20 5c 20  |ORA #&02      \ |
00003450  73 65 74 20 62 69 74 20  31 0d 20 31 34 37 30 20  |set bit 1. 1470 |
00003460  20 20 20 20 20 20 20 20  42 4e 45 20 67 65 74 6f  |        BNE geto|
00003470  75 74 20 20 20 20 5c 20  61 6e 64 20 72 65 74 75  |ut    \ and retu|
00003480  72 6e 20 74 6f 20 42 41  53 49 43 0d 20 31 34 38  |rn to BASIC. 148|
00003490  30 20 2e 63 65 6e 74 72  65 0d 20 31 34 39 30 20  |0 .centre. 1490 |
000034a0  20 20 20 20 20 20 20 20  50 4c 41 20 20 20 20 20  |        PLA     |
000034b0  20 20 20 20 20 20 5c 20  70 75 6c 6c 20 74 68 65  |      \ pull the|
000034c0  20 72 65 73 75 6c 74 20  6f 66 20 41 44 56 41 4c  | result of ADVAL|
000034d0  28 30 29 0d 20 31 35 30  30 20 20 20 20 20 20 20  |(0). 1500       |
000034e0  20 20 4f 52 41 20 23 26  30 33 20 20 20 20 20 20  |  ORA #&03      |
000034f0  5c 20 73 65 74 20 62 69  74 73 20 30 20 61 6e 64  |\ set bits 0 and|
00003500  20 31 0d 20 31 35 31 30  20 20 20 20 20 20 20 20  | 1. 1510        |
00003510  20 42 4e 45 20 67 65 74  6f 75 74 20 20 20 20 5c  | BNE getout    \|
00003520  20 61 6e 64 20 72 65 74  75 72 6e 20 74 6f 20 42  | and return to B|
00003530  41 53 49 43 0d 20 31 35  32 30 20 2e 6e 6f 70 72  |ASIC. 1520 .nopr|
00003540  65 73 73 0d 20 31 35 33  30 20 20 20 20 20 20 20  |ess. 1530       |
00003550  20 20 50 4c 41 20 20 20  20 20 20 20 20 20 20 20  |  PLA           |
00003560  5c 20 70 75 6c 6c 20 74  68 65 20 72 65 73 75 6c  |\ pull the resul|
00003570  74 20 6f 66 20 41 44 56  41 4c 28 30 29 0d 20 31  |t of ADVAL(0). 1|
00003580  35 34 30 20 2e 67 65 74  6f 75 74 0d 20 31 35 35  |540 .getout. 155|
00003590  30 20 20 20 20 20 20 20  20 20 54 41 58 20 20 20  |0         TAX   |
000035a0  20 20 20 20 20 20 20 20  5c 20 72 65 73 75 6c 74  |        \ result|
000035b0  20 62 79 65 20 69 6e 74  6f 20 58 20 72 65 67 69  | bye into X regi|
000035c0  73 74 65 72 0d 20 31 35  36 30 20 20 20 20 20 20  |ster. 1560      |
000035d0  20 20 20 4c 44 41 20 23  26 38 30 20 20 20 20 20  |   LDA #&80     |
000035e0  20 5c 20 4f 73 62 79 74  65 20 26 38 30 0d 20 31  | \ Osbyte &80. 1|
000035f0  35 37 30 20 20 20 20 20  20 20 20 20 50 4c 50 20  |570         PLP |
00003600  20 20 20 20 20 20 20 20  20 20 5c 20 72 65 73 74  |          \ rest|
00003610  6f 72 65 20 73 74 61 74  75 73 20 72 65 67 69 73  |ore status regis|
00003620  74 65 72 0d 20 31 35 38  30 20 20 20 20 20 20 20  |ter. 1580       |
00003630  20 20 52 54 53 20 20 20  20 20 20 20 20 20 20 20  |  RTS           |
00003640  5c 20 72 65 74 75 72 6e  20 74 6f 20 42 41 53 49  |\ return to BASI|
00003650  43 0d 20 31 35 39 30 20  2e 6f 6c 64 69 72 71 31  |C. 1590 .oldirq1|
00003660  76 0d 20 31 36 30 30 20  20 20 20 20 20 20 20 20  |v. 1600         |
00003670  45 51 55 57 20 26 30 30  20 20 20 20 20 20 5c 20  |EQUW &00      \ |
00003680  6f 72 69 67 69 6e 61 6c  20 69 72 71 31 20 76 65  |original irq1 ve|
00003690  63 74 6f 72 0d 20 31 36  31 30 20 2e 6f 6c 64 62  |ctor. 1610 .oldb|
000036a0  79 74 65 76 0d 20 31 36  32 30 20 20 20 20 20 20  |ytev. 1620      |
000036b0  20 20 20 45 51 55 57 20  26 30 30 20 20 20 20 20  |   EQUW &00     |
000036c0  20 5c 20 6f 72 69 67 69  6e 61 6c 20 4f 73 62 79  | \ original Osby|
000036d0  74 65 20 76 65 63 74 6f  72 0d 20 31 36 33 30 20  |te vector. 1630 |
000036e0  2e 78 63 6f 6f 72 64 0d  20 31 36 34 30 20 20 20  |.xcoord. 1640   |
000036f0  20 20 20 20 20 20 45 51  55 42 20 26 38 30 20 20  |      EQUB &80  |
00003700  20 20 20 20 5c 20 58 20  63 6f 6f 72 64 69 6e 61  |    \ X coordina|
00003710  74 65 2c 20 72 61 6e 67  65 20 30 20 74 6f 20 32  |te, range 0 to 2|
00003720  35 35 0d 20 31 36 35 30  20 2e 79 63 6f 6f 72 64  |55. 1650 .ycoord|
00003730  0d 20 31 36 36 30 20 20  20 20 20 20 20 20 20 45  |. 1660         E|
00003740  51 55 42 20 26 38 30 20  20 20 20 20 20 5c 20 59  |QUB &80      \ Y|
00003750  20 63 6f 6f 72 64 69 6e  61 74 65 2c 20 72 61 6e  | coordinate, ran|
00003760  67 65 20 30 20 74 6f 20  32 35 35 0d 20 31 36 37  |ge 0 to 255. 167|
00003770  30 20 2e 6c 61 73 74 62  79 74 65 0d 20 31 36 38  |0 .lastbyte. 168|
00003780  30 20 5d 0d 20 31 36 39  30 20 4e 45 58 54 0d 20  |0 ]. 1690 NEXT. |
00003790  31 37 30 30 20 43 41 4c  4c 20 6d 63 6f 64 65 0d  |1700 CALL mcode.|
000037a0  20 31 37 31 30 20 4d 4f  44 45 37 0d 20 31 37 32  | 1710 MODE7. 172|
000037b0  30 20 6d 6f 75 73 65 24  3d 43 48 52 24 31 34 31  |0 mouse$=CHR$141|
000037c0  2b 43 48 52 24 31 33 32  2b 43 48 52 24 31 35 37  |+CHR$132+CHR$157|
000037d0  2b 43 48 52 24 31 33 31  2b 0d 20 20 20 20 20 20  |+CHR$131+.      |
000037e0  22 4d 6f 75 73 65 20 63  6f 6f 72 64 69 6e 61 74  |"Mouse coordinat|
000037f0  65 73 20 76 69 61 20 41  44 56 41 4c 28 30 2d 34  |es via ADVAL(0-4|
00003800  29 20 20 22 2b 43 48 52  24 31 35 36 0d 20 31 37  |)  "+CHR$156. 17|
00003810  33 30 20 50 52 49 4e 54  54 41 42 28 30 2c 31 29  |30 PRINTTAB(0,1)|
00003820  6d 6f 75 73 65 24 0d 20  31 37 34 30 20 50 52 49  |mouse$. 1740 PRI|
00003830  4e 54 54 41 42 28 30 2c  32 29 6d 6f 75 73 65 24  |NTTAB(0,2)mouse$|
00003840  0d 20 31 37 35 30 20 50  52 49 4e 54 54 41 42 28  |. 1750 PRINTTAB(|
00003850  31 30 2c 36 29 22 42 79  74 65 73 20 75 73 65 64  |10,6)"Bytes used|
00003860  20 3d 20 26 22 3b 7e 28  6c 61 73 74 62 79 74 65  | = &";~(lastbyte|
00003870  2d 6d 63 6f 64 65 29 0d  20 31 37 36 30 20 4f 4e  |-mcode). 1760 ON|
00003880  45 52 52 4f 52 20 47 4f  54 4f 20 31 38 39 30 0d  |ERROR GOTO 1890.|
00003890  20 31 37 37 30 20 56 44  55 32 33 2c 31 2c 30 3b  | 1770 VDU23,1,0;|
000038a0  30 3b 30 3b 30 3b 0d 20  31 37 38 30 20 52 45 50  |0;0;0;. 1780 REP|
000038b0  45 41 54 0d 20 31 37 39  30 20 50 52 49 4e 54 54  |EAT. 1790 PRINTT|
000038c0  41 42 28 31 30 2c 31 30  29 22 58 20 3d 20 26 22  |AB(10,10)"X = &"|
000038d0  3b 7e 3f 78 63 6f 6f 72  64 3b 22 20 22 0d 20 31  |;~?xcoord;" ". 1|
000038e0  38 30 30 20 50 52 49 4e  54 54 41 42 28 32 30 2c  |800 PRINTTAB(20,|
000038f0  31 30 29 22 59 20 3d 20  26 22 3b 7e 3f 79 63 6f  |10)"Y = &";~?yco|
00003900  6f 72 64 3b 22 20 22 0d  20 31 38 31 30 20 61 64  |ord;" ". 1810 ad|
00003910  76 61 6c 3d 41 44 56 41  4c 28 30 29 41 4e 44 33  |val=ADVAL(0)AND3|
00003920  0d 20 31 38 32 30 20 50  52 49 4e 54 54 41 42 28  |. 1820 PRINTTAB(|
00003930  31 30 2c 31 34 29 22 41  44 56 41 4c 28 30 29 41  |10,14)"ADVAL(0)A|
00003940  4e 44 33 20 3d 20 22 3b  61 64 76 61 6c 0d 20 31  |ND3 = ";adval. 1|
00003950  38 33 30 20 49 46 20 61  64 76 61 6c 3d 32 20 50  |830 IF adval=2 P|
00003960  52 49 4e 54 54 41 42 28  32 32 2c 31 37 29 22 52  |RINTTAB(22,17)"R|
00003970  69 67 68 74 22 20 45 4c  53 45 20 50 52 49 4e 54  |ight" ELSE PRINT|
00003980  54 41 42 28 32 32 2c 31  37 29 22 20 20 20 20 20  |TAB(22,17)"     |
00003990  22 0d 20 31 38 34 30 20  49 46 20 61 64 76 61 6c  |". 1840 IF adval|
000039a0  3d 33 20 20 50 52 49 4e  54 54 41 42 28 31 36 2c  |=3  PRINTTAB(16,|
000039b0  31 37 29 22 42 6f 74 68  22 20 45 4c 53 45 20 50  |17)"Both" ELSE P|
000039c0  52 49 4e 54 54 41 42 28  31 36 2c 31 37 29 22 20  |RINTTAB(16,17)" |
000039d0  20 20 20 22 0d 20 31 38  35 30 20 49 46 20 61 64  |   ". 1850 IF ad|
000039e0  76 61 6c 3d 31 20 50 52  49 4e 54 54 41 42 28 31  |val=1 PRINTTAB(1|
000039f0  30 2c 31 37 29 22 4c 65  66 74 22 20 45 4c 53 45  |0,17)"Left" ELSE|
00003a00  20 50 52 49 4e 54 54 41  42 28 31 30 2c 31 37 29  | PRINTTAB(10,17)|
00003a10  22 20 20 20 20 22 0d 20  31 38 36 30 20 50 52 49  |"    ". 1860 PRI|
00003a20  4e 54 54 41 42 28 32 2c  32 30 29 22 41 44 56 41  |NTTAB(2,20)"ADVA|
00003a30  4c 28 31 29 20 3d 20 22  3b 41 44 56 41 4c 28 31  |L(1) = ";ADVAL(1|
00003a40  29 3b 22 20 20 20 20 22  0d 20 20 20 20 20 20 54  |);"    ".      T|
00003a50  41 42 28 32 32 2c 32 30  29 22 41 44 56 41 4c 28  |AB(22,20)"ADVAL(|
00003a60  32 29 20 3d 20 22 3b 41  44 56 41 4c 28 32 29 3b  |2) = ";ADVAL(2);|
00003a70  22 20 20 20 20 22 0d 20  31 38 37 30 20 50 52 49  |"    ". 1870 PRI|
00003a80  4e 54 54 41 42 28 32 2c  32 32 29 22 41 44 56 41  |NTTAB(2,22)"ADVA|
00003a90  4c 28 33 29 20 3d 20 22  3b 41 44 56 41 4c 28 31  |L(3) = ";ADVAL(1|
00003aa0  29 3b 22 20 20 20 20 22  0d 20 20 20 20 20 20 54  |);"    ".      T|
00003ab0  41 42 28 32 32 2c 32 32  29 22 41 44 56 41 4c 28  |AB(22,22)"ADVAL(|
00003ac0  34 29 20 3d 20 22 3b 41  44 56 41 4c 28 34 29 3b  |4) = ";ADVAL(4);|
00003ad0  22 20 20 20 20 22 0d 20  31 38 38 30 20 55 4e 54  |"    ". 1880 UNT|
00003ae0  49 4c 20 46 41 4c 53 45  0d 20 31 38 39 30 20 43  |IL FALSE. 1890 C|
00003af0  41 4c 4c 20 6d 63 6f 64  65 0d 20 31 39 30 30 20  |ALL mcode. 1900 |
00003b00  56 44 55 32 33 2c 31 2c  31 3b 30 3b 30 3b 30 3b  |VDU23,1,1;0;0;0;|
00003b10  33 31 2c 30 2c 32 33 0d  20 31 39 31 30 20 45 4e  |31,0,23. 1910 EN|
00003b20  44 0d                                             |D.|
00003b22
01-01-89/T\MOU05.m0
01-01-89/T\MOU05.m1
01-01-89/T\MOU05.m2
01-01-89/T\MOU05.m4
01-01-89/T\MOU05.m5