Home » CEEFAX disks » telesoftware12.adl » 04-02-89/T\Pen03

04-02-89/T\Pen03

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 » telesoftware12.adl
Filename: 04-02-89/T\Pen03
Read OK:
File size: 418D bytes
Load address: 0000
Exec address: FFFFFFFF
File contents
Using a light pen with the BBC microcomputer - by - Gordon Horsington
---------------------------------------------------------------------

Module 3. Tube compatible, interrupt driven, scrolling, light pen software
--------------------------------------------------------------------------

Interrupts generated by I/O processor hardware are not passed to a second
processor. The IRQ1V and IRQ2V vectors are not implemented by the second
processor operating system. For this reason interrupts generated by a
light pen must be dealt with by software in the I/O processor.

It is quite straightforward to assemble code in the second processor and
use Osword &06 to transfer the code from the second processor to the I/O
processor. The real problem is to change the I/O processor secondary
interrupt vector from a second processor. An interrupt vector should only
be altered with interrupts disabled but it is not possible to disable the
I/O processor interrupts from the second processor. One way round this
problem is to use either *CODE or *LINE to alter the vector for you. Both
*CODE and *LINE use the user vector and this vector can be altered with
the I/O processor interrupts enabled. The program SPINTER uses *CODE to
disable the I/O processor interrupts and alter IRQ2V. An alternative
method is available to disc users who can assemble the I/O processor
routine in the second processor, save it onto disc and then *RUN it in the
I/O processor. This would be too inconvenient to do with a tape storage
system.

After IRQ2V has been revectored to the new I/O processor routine the
calculation of the text coordinates can updated with every light pen
interrupt and the result of the calculation can be read at any time by a
second processor using Osword &05 (or simply peeked if the second
processor is not being used). The code used to calculate the coordinates
in the program SPINTER is slightly different to that used by IOINTER in
module 2. The new code is used to allow the screen to be scrolled and
still give the correct text coordinates. If you managed to scroll the
screen with any of the earlier demonstration programs you would have seen
the asterisk displaced vertically below the actual light pen position.
Although it is possible to prevent the screen scrolling it is also
possible to read the screen start address and take any scrolling into
account when making the calculation.

The calculation is very similar to the one used in the earlier modules
except that the offset depends on the screen start address. The table in
figure 1 shows the values of the variables used in the calculation of the
text coordinates but the values assigned to the screen start address in
this table can only be used if the screen has not been scrolled. If the
screen is scrolled the start address changes from the values shown in
figure 1. The current screen start address can be read from &350 (low
byte) and &351 (high byte) in the I/O processor.


       Mode  start addr  trim    width   scale   Text resolution
      -----+-----------+-------+-------+-------+------------------
        0  |   &3000   |  &06  |  &50  |  &00  | single character 
        1  |   &3000   |  &06  |  &50  |  &01  | half character   
        2  |   &3000   |  &06  |  &50  |  &02  | quarter character
        3  |   &4000   |  &06  |  &50  |  &00  | single character 
        4  |   &5800   |  &04  |  &28  |  &00  | single character 
        5  |   &5800   |  &04  |  &28  |  &01  | half character   
        6  |   &6000   |  &04  |  &28  |  &00  | single character 
        7  |   &7C00   |  &08  |  &28  |  &00  | single character 
      -----+-----------+-------+-------+-------+------------------

Figure 1. The start address, trim, width and scale for each screen mode
-----------------------------------------------------------------------


The light pen position can be calculated in terms of displayed text
coordinates by first calculating the value of the offset. In modes 0 to 6
the offset is given by:

  offset = trim + (screen start address DIV 8)

and in mode 7 by:

  offset = trim + screen start address - &5400

The X and Y text coordinates can be calculated as before using the
appropriate value of offset.

  Y coord = (light pen register - offset) DIV width

  X coord = ((light pen register - offset) MOD width) DIV (2^scale)

The values of trim, width and scale are those appropriate to the screen
mode in use at the time. The value of the screen start address must be
read from &350 and &351 and not taken from a table. The values used for
trim will, as the name suggests, need to be trimmed as described in module
1. The values of trim used in SPINTER are those I found to be most
suitable for my light pen. You might like to edit the program to use the
values best suited to your light pen but you can also trim the values I
have used with the left and right cursor keys when the program is running.
The label offsetlow is used for the table of values assigned to trim to
show how the idea has developed from the earlier programs.

The range of the X and Y text coordinates made available depends on the
screen mode and corresponds with the values of X and Y used by the BASIC
TAB(x,y) command. The range of values are shown in figure 2.


                    Mode   X (?&70)   Y (?&71)
                   ------+----------+----------
                      0  |  0 - 79  |  0 - 31
                      1  |  0 - 39  |  0 - 31
                      2  |  0 - 19  |  0 - 31
                      3  |  0 - 79  |  0 - 24
                      4  |  0 - 39  |  0 - 31
                      5  |  0 - 19  |  0 - 31
                      6  |  0 - 39  |  0 - 24
                      7  |  0 - 39  |  0 - 24
                   ------+----------+----------

Figure 2. The range of X and Y coordinates in the various screen modes
----------------------------------------------------------------------


Chain the program SPINTER which can be used with either a 6502 second
processor or with an I/O processor on its own. If it is used on a BBC B
without a second processor it should be loaded with PAGE = &1100.  It is
heavily commented and there is just not enough room for it to run in mode
0 in a BBC B with PAGE = &1900.

You can scroll the screen in any mode by pressing the Return key. If you
scroll the screen in mode 7 the background colour can be made to re-fill
the screen by pressing P to alter the background (Paper) colour. You can
trim the offset with the left and right cursor keys, change the screen
mode with the up and down cursor keys, change the background colour with P
(P for paper) and the foreground colour with I (I for ink). You should
find that the screen can be scrolled as much as you like and you will
still read the correct text coordinates. You will need to alter FNswitch
if you do not have an RH compatible light pen.


   10 REM> SPINTER
   20 osword=&FFF1
   30 osbyte=&FFF4
   40 A%=&EA
   50 X%=0
   60 Y%=&FF
   70 IF (USR(osbyte)AND&FF00)DIV&100=0 host=TRUE ELSE host=FALSE
   80 IF host IF PAGE>&1100 THEN PAGE=&1100:CHAIN"SPINTER"
   90 DIM param 4
  100 DIM mcode &100
  110 xcoord=&70
  120 ycoord=&71
  130 PROCmcode
  140 ONERROR OSCLI("CODE"):VDU23,1,1;0;0;0;:END
  150 mode=0
  160 paper=6
  170 ink=4
  180 MODE mode
  190 PROCnewmode
  200 REPEAT
  210 IF INKEY(-58) PROCup:MODE mode:PROCnewmode
  220 IF INKEY(-42) PROCdown:MODE mode:PROCnewmode
  230 IF INKEY(-56) PROCpaper
  240 IF INKEY(-38) PROCink
  250 IF INKEY(-26) PROCleft
  260 IF INKEY(-122) PROCright
  270 IF INKEY(-74) PROCscroll:PROCdelay
  280 PRINTTAB(13,1);FNread(xcoord);" "
  290 PRINTTAB(13,2);FNread(ycoord);" "
  300 IF FNswitch VDU31,FNread(xcoord),FNread(ycoord),42
  310 UNTIL FALSE
  320 :
  330 DEFPROCscroll
  340 IF (mode>5) OR (mode=3) PRINTTAB(0,24):ENDPROC
  350 PRINTTAB(0,31)
  360 ENDPROC
  370 :
  380 DEFPROCup
  390 mode=mode+1
  400 IF mode>7 mode=7
  410 ENDPROC
  420 :
  430 DEFPROCdown
  440 mode=mode-1
  450 IF mode<0 mode=0
  460 ENDPROC
  470 :
  480 DEFPROCleft
  490 offset=FNread(offsetlow+mode)
  500 IF offset=12 ENDPROC
  510 PROCwrite(offset+1,offsetlow+mode)
  520 PROCdelay
  530 ENDPROC
  540 :
  550 DEFPROCright
  560 offset=FNread(offsetlow+mode)
  570 IF offset=0 ENDPROC
  580 PROCwrite(offset-1,offsetlow+mode)
  590 PROCdelay
  600 ENDPROC
  610 :
  620 DEFPROCnewmode
  630 VDU23,1,0;0;0;0;
  640 IF mode=7 PROCseven:ENDPROC
  650 VDU19,0,paper;0;
  660 VDU19,1,ink;0;
  670 COLOUR1
  680 PROCdelay
  690 ENDPROC
  700 :
  710 DEFPROCdelay
  720 PRINTTAB(3,0)"Mode ";mode;SPC(8)
  730 PRINTTAB(3,1)"X coord = ";FNread(xcoord);SPC(3)
  740 PRINTTAB(3,2)"Y coord = ";FNread(ycoord);SPC(3)
  750 PRINTTAB(3,3)"offsetlow = ";FNread(offsetlow+mode)
  760 time=TIME+20
  770 REPEAT UNTIL time<TIME
  780 ENDPROC
  790 :
  800 DEFPROCink
  810 ink=ink+1
  820 IF ink=paper ink=ink+1
  830 IF ink>7 ink=0
  840 VDU19,1,ink;0;
  850 IF mode=7 PROCseven
  860 PROCdelay
  870 ENDPROC
  880 :
  890 DEFPROCpaper
  900 paper=paper+1
  910 IF paper=ink paper=paper+1
  920 IF paper>7 paper=1
  930 VDU19,0,paper;0;
  940 IF mode=7 PROCseven
  950 PROCdelay
  960 ENDPROC
  970 :
  980 DEFPROCseven
  990 IF ink=0 ink=1
 1000 FOR line=0 TO 24
 1010 IF paper=0 VDU31,0,line,128+ink,32,32
      ELSE VDU31,0,line,128+paper,157,128+ink
 1020 NEXT
 1030 PROCdelay
 1040 ENDPROC
 1050 :
 1060 DEFPROCwrite(data,addr)
 1070 IF host ?addr=data:ENDPROC
 1080 !param=addr OR &FFFF0000
 1090 param?4=data
 1100 A%=6
 1110 X%=param MOD 256
 1120 Y%=param DIV 256
 1130 CALL osword
 1140 ENDPROC
 1150 :
 1160 DEFFNread(addr)
 1170 IF host =?addr
 1180 !param=addr OR &FFFF0000
 1190 A%=5
 1200 X%=param MOD 256
 1210 Y%=param DIV 256
 1220 CALL osword
 1230 =param?4
 1240 :
 1250 DEFPROCmcode
 1260 fire=&72 :REM: fire button status
 1270 userv=&200 :REM: user vector
 1280 irq2v=&206 :REM: secondary interrupt vector
 1290 start=&350 :REM: screen start address
 1300 screen=&355 :REM: screen mode OS 1.2
 1310 ioaddr=&A00 :REM: assemble for &A00
 1320 sheila=&FE00
 1330 drb=&FE40 :REM: system 6522 input/output register B
 1340 ifr=&FE4D :REM: system 6522 interrupt flag register
 1350 ier=&FE4E :REM: system 6522 interrupt enable register
 1360 FOR pass=4 TO 6 STEP 2
 1370 O%=mcode
 1380 P%=ioaddr
 1390 [       OPT pass
 1400         CMP #&00      \ is this *CODE?
 1410         BEQ starcode
 1420         RTS           \ return if *LINE
 1430 .starcode
 1440         LDX irq2v     \ secondary interrupt vector, low byte
 1450         LDY irq2v+1   \ secondary interrupt vector, high byte
 1460         CPY #interrupt DIV 256 \ has the high byte been altered?
 1470         BEQ disable   \ restore original vector if altered
 1480         STX oldirq2v  \ store original vector, low byte
 1490         STY oldirq2v+1 \ store original vector, high byte
 1500         LDX #interrupt MOD 256 \ new interrupt code, low byte
 1510         LDY #interrupt DIV 256 \ new interrupt code, high byte
 1520         SEI           \ set interrupt disable flag
 1530         STX irq2v     \ alter vector, low byte
 1540         STY irq2v+1   \ alter vector, high byte
 1550         CLI           \ clear interrupt disable flag
 1560         LDA #&88      \ %10001000
 1570         STA ier       \ enable light pen interrupts
 1580         RTS
 1590 .disable
 1600         LDA #&08      \ %00001000 ready to disable light pen
                            \ interrupts
 1610         LDX oldirq2v  \ original irq2 vector, low byte
 1620         LDY oldirq2v+1 \ original irq2 vector, high byte
 1630         SEI           \ set interrupt disable flag
 1640         STA ier       \ disable light pen interrupt
 1650         STX irq2v     \ restore original vector, low byte
 1660         STY irq2v+1   \ restore original vector, high byte
 1670         CLI           \ clear interrupt disable flag
 1680         RTS
 1690 .exit
 1700         PLA           \ pull interrupt accumulator save register
 1710         STA &FC       \ restore interrupt accumulator save register
 1720         JMP (oldirq2v) \ exit via original vector
 1730 .interrupt
 1740         LDA &FC       \ load interrupt accumulator save register
 1750         PHA           \ and push it on the stack
 1760         LDA ifr       \ load system VIA interrupt status
 1770         BPL exit      \ exit if bit 7 clear
 1780         AND #&08      \ AND with %00001000
 1790         BEQ exit      \ exit if not light pen interrupt
 1800         TXA
 1810         PHA
 1820         TYA
 1830         PHA
 1840         LDA drb       \ clear interrupt
 1850         PHA           \ push data register B
 1860         CLD           \ clear decimal flag
 1870         LDY screen    \ screen mode into Y register
 1880         LDA start     \ screen start address, low byte
 1890         STA ycoord
 1900         LDA start+1   \ screen start address, high byte
 1910         STA ycoord+1
 1920         CPY #&07      \ is this mode 7?
 1930         BEQ mode7
 1940         LSR ycoord+1
 1950         ROR ycoord    \ start address DIV 2
 1960         LSR ycoord+1
 1970         ROR ycoord    \ start address DIV 4
 1980         LSR ycoord+1
 1990         ROR ycoord    \ start address DIV 8
 2000         JMP continue  \ skip mode 7 calculation
 2010 .mode7
 2020         SEC           \ prepare for subtraction
 2030         LDA ycoord+1
 2040         SBC #&54
 2050         STA ycoord+1  \ subtract &5400 from start address
 2060 .continue
 2070         LDA offsetlow,Y
 2080         CLC           \ prepare for addition
 2090         ADC ycoord    \ add trim to offset
 2100         STA ycoord
 2110         LDA #&00
 2120         ADC ycoord+1
 2130         STA ycoord+1
 2140         SEC           \ prepare to subtract offset from lp register
 2150         LDX #&11      \ light pen register, low byte
 2160         STX sheila    \ 6845 address register
 2170         LDA sheila+1  \ 6845 data register
 2180         SBC ycoord    \ subtract offset, low byte
 2190         STA ycoord    \ low byte - offset
 2200         DEX           \ X = &10, light pen register, high byte
 2210         STX sheila    \ 6845 address register
 2220         LDA sheila+1  \ 6845 data register
 2230         SBC ycoord+1  \ subtract offset, high byte
 2240         STA ycoord+1  \ high byte - offset
 2250         LDA #&00      \ prepare for 16 bit division
 2260         STA xcoord    \ clear low partial dividend
 2270 .next
 2280         ASL ycoord    \ shift dividend/quotient left
 2290         ROL ycoord+1  \ shift dividend/quotient left
 2300         ROL xcoord    \ shift bits into partial dividend
 2310         LDA xcoord    \ load partial dividend
 2320         SEC           \ prepare for subtraction
 2330         SBC width,Y   \ subtract divisor
 2340         BCC done      \ branch if dividend < divisor
 2350         INC ycoord    \ increment quotient
 2360         STA xcoord    \ save new partial dividend
 2370 .done
 2380         DEX           \ decrement bit counter
 2390         BNE next      \ branch for 16 bits
 2400         LDA scale,Y   \ screen mode scale
 2410         BEQ pullout   \ branch if modes 0, 3, 4, 6 or 7
 2420         TAX           \ in mode1 and mode5 X=1, in mode2 X=2
 2430         LDA xcoord
 2440 .reduce
 2450         LSR A         \ horizontal position / 2
 2460         DEX
 2470         BNE reduce
 2480         STA xcoord
 2490 .pullout
 2500         PLA           \ pull data register B
 2510         AND #&20      \ %00100000
 2520         STA fire      \ store fire button status
 2530         PLA
 2540         TAY
 2550         PLA
 2560         TAX
 2570         PLA
 2580         STA &FC
 2590         RTI           \ return from interrupt
 2600 .oldirq2v
 2610         EQUW &00      \ original irq2 vector
 2620 .offsetlow
 2630         EQUB &04      \ mode0, untrimmed = &06
 2640         EQUB &04      \ mode1, untrimmed = &06
 2650         EQUB &04      \ mode2, untrimmed = &06
 2660         EQUB &04      \ mode3, untrimmed = &06
 2670         EQUB &03      \ mode4, untrimmed = &04
 2680         EQUB &03      \ mode5, untrimmed = &04
 2690         EQUB &03      \ mode6, untrimmed = &04
 2700         EQUB &06      \ mode7, untrimmed = &08
 2710 .scale
 2720         EQUD &00020100 \ modes 3-0
 2730         EQUD &00000100 \ modes 7-4
 2740 .width
 2750         EQUD &50505050 \ modes 3-0
 2760         EQUD &28282828 \ modes 7-4
 2770 .lastbyte
 2780 ]
 2790 NEXT
 2800 end=mcode+(lastbyte-ioaddr)
 2810 addr=ioaddr
 2820 FOR byte=mcode TO end
 2830 PROCwrite(?byte,addr)
 2840 addr=addr+1
 2850 NEXT
 2860 PROCwrite((ioaddr MOD 256),userv)
 2870 PROCwrite((ioaddr DIV 256),userv+1)
 2880 PROCwrite(0,xcoord)
 2890 PROCwrite(0,ycoord)
 2900 *CODE
 2910 ENDPROC
 2920 : 
 2930 DEFFNswitch
 2940 IF (ADVAL(0)AND3)=0 =TRUE ELSE =FALSE
00000000  55 73 69 6e 67 20 61 20  6c 69 67 68 74 20 70 65  |Using a light pe|
00000010  6e 20 77 69 74 68 20 74  68 65 20 42 42 43 20 6d  |n with the BBC m|
00000020  69 63 72 6f 63 6f 6d 70  75 74 65 72 20 2d 20 62  |icrocomputer - b|
00000030  79 20 2d 20 47 6f 72 64  6f 6e 20 48 6f 72 73 69  |y - Gordon Horsi|
00000040  6e 67 74 6f 6e 0d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ngton.----------|
00000050  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000080  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 0d 4d 6f 64  |-----------..Mod|
00000090  75 6c 65 20 33 2e 20 54  75 62 65 20 63 6f 6d 70  |ule 3. Tube comp|
000000a0  61 74 69 62 6c 65 2c 20  69 6e 74 65 72 72 75 70  |atible, interrup|
000000b0  74 20 64 72 69 76 65 6e  2c 20 73 63 72 6f 6c 6c  |t driven, scroll|
000000c0  69 6e 67 2c 20 6c 69 67  68 74 20 70 65 6e 20 73  |ing, light pen s|
000000d0  6f 66 74 77 61 72 65 0d  2d 2d 2d 2d 2d 2d 2d 2d  |oftware.--------|
000000e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000120  2d 2d 0d 0d 49 6e 74 65  72 72 75 70 74 73 20 67  |--..Interrupts g|
00000130  65 6e 65 72 61 74 65 64  20 62 79 20 49 2f 4f 20  |enerated by I/O |
00000140  70 72 6f 63 65 73 73 6f  72 20 68 61 72 64 77 61  |processor hardwa|
00000150  72 65 20 61 72 65 20 6e  6f 74 20 70 61 73 73 65  |re are not passe|
00000160  64 20 74 6f 20 61 20 73  65 63 6f 6e 64 0d 70 72  |d to a second.pr|
00000170  6f 63 65 73 73 6f 72 2e  20 54 68 65 20 49 52 51  |ocessor. The IRQ|
00000180  31 56 20 61 6e 64 20 49  52 51 32 56 20 76 65 63  |1V and IRQ2V vec|
00000190  74 6f 72 73 20 61 72 65  20 6e 6f 74 20 69 6d 70  |tors are not imp|
000001a0  6c 65 6d 65 6e 74 65 64  20 62 79 20 74 68 65 20  |lemented by the |
000001b0  73 65 63 6f 6e 64 0d 70  72 6f 63 65 73 73 6f 72  |second.processor|
000001c0  20 6f 70 65 72 61 74 69  6e 67 20 73 79 73 74 65  | operating syste|
000001d0  6d 2e 20 46 6f 72 20 74  68 69 73 20 72 65 61 73  |m. For this reas|
000001e0  6f 6e 20 69 6e 74 65 72  72 75 70 74 73 20 67 65  |on interrupts ge|
000001f0  6e 65 72 61 74 65 64 20  62 79 20 61 0d 6c 69 67  |nerated by a.lig|
00000200  68 74 20 70 65 6e 20 6d  75 73 74 20 62 65 20 64  |ht pen must be d|
00000210  65 61 6c 74 20 77 69 74  68 20 62 79 20 73 6f 66  |ealt with by sof|
00000220  74 77 61 72 65 20 69 6e  20 74 68 65 20 49 2f 4f  |tware in the I/O|
00000230  20 70 72 6f 63 65 73 73  6f 72 2e 0d 0d 49 74 20  | processor...It |
00000240  69 73 20 71 75 69 74 65  20 73 74 72 61 69 67 68  |is quite straigh|
00000250  74 66 6f 72 77 61 72 64  20 74 6f 20 61 73 73 65  |tforward to asse|
00000260  6d 62 6c 65 20 63 6f 64  65 20 69 6e 20 74 68 65  |mble code in the|
00000270  20 73 65 63 6f 6e 64 20  70 72 6f 63 65 73 73 6f  | second processo|
00000280  72 20 61 6e 64 0d 75 73  65 20 4f 73 77 6f 72 64  |r and.use Osword|
00000290  20 26 30 36 20 74 6f 20  74 72 61 6e 73 66 65 72  | &06 to transfer|
000002a0  20 74 68 65 20 63 6f 64  65 20 66 72 6f 6d 20 74  | the code from t|
000002b0  68 65 20 73 65 63 6f 6e  64 20 70 72 6f 63 65 73  |he second proces|
000002c0  73 6f 72 20 74 6f 20 74  68 65 20 49 2f 4f 0d 70  |sor to the I/O.p|
000002d0  72 6f 63 65 73 73 6f 72  2e 20 54 68 65 20 72 65  |rocessor. The re|
000002e0  61 6c 20 70 72 6f 62 6c  65 6d 20 69 73 20 74 6f  |al problem is to|
000002f0  20 63 68 61 6e 67 65 20  74 68 65 20 49 2f 4f 20  | change the I/O |
00000300  70 72 6f 63 65 73 73 6f  72 20 73 65 63 6f 6e 64  |processor second|
00000310  61 72 79 0d 69 6e 74 65  72 72 75 70 74 20 76 65  |ary.interrupt ve|
00000320  63 74 6f 72 20 66 72 6f  6d 20 61 20 73 65 63 6f  |ctor from a seco|
00000330  6e 64 20 70 72 6f 63 65  73 73 6f 72 2e 20 41 6e  |nd processor. An|
00000340  20 69 6e 74 65 72 72 75  70 74 20 76 65 63 74 6f  | interrupt vecto|
00000350  72 20 73 68 6f 75 6c 64  20 6f 6e 6c 79 0d 62 65  |r should only.be|
00000360  20 61 6c 74 65 72 65 64  20 77 69 74 68 20 69 6e  | altered with in|
00000370  74 65 72 72 75 70 74 73  20 64 69 73 61 62 6c 65  |terrupts disable|
00000380  64 20 62 75 74 20 69 74  20 69 73 20 6e 6f 74 20  |d but it is not |
00000390  70 6f 73 73 69 62 6c 65  20 74 6f 20 64 69 73 61  |possible to disa|
000003a0  62 6c 65 20 74 68 65 0d  49 2f 4f 20 70 72 6f 63  |ble the.I/O proc|
000003b0  65 73 73 6f 72 20 69 6e  74 65 72 72 75 70 74 73  |essor interrupts|
000003c0  20 66 72 6f 6d 20 74 68  65 20 73 65 63 6f 6e 64  | from the second|
000003d0  20 70 72 6f 63 65 73 73  6f 72 2e 20 4f 6e 65 20  | processor. One |
000003e0  77 61 79 20 72 6f 75 6e  64 20 74 68 69 73 0d 70  |way round this.p|
000003f0  72 6f 62 6c 65 6d 20 69  73 20 74 6f 20 75 73 65  |roblem is to use|
00000400  20 65 69 74 68 65 72 20  2a 43 4f 44 45 20 6f 72  | either *CODE or|
00000410  20 2a 4c 49 4e 45 20 74  6f 20 61 6c 74 65 72 20  | *LINE to alter |
00000420  74 68 65 20 76 65 63 74  6f 72 20 66 6f 72 20 79  |the vector for y|
00000430  6f 75 2e 20 42 6f 74 68  0d 2a 43 4f 44 45 20 61  |ou. Both.*CODE a|
00000440  6e 64 20 2a 4c 49 4e 45  20 75 73 65 20 74 68 65  |nd *LINE use the|
00000450  20 75 73 65 72 20 76 65  63 74 6f 72 20 61 6e 64  | user vector and|
00000460  20 74 68 69 73 20 76 65  63 74 6f 72 20 63 61 6e  | this vector can|
00000470  20 62 65 20 61 6c 74 65  72 65 64 20 77 69 74 68  | be altered with|
00000480  0d 74 68 65 20 49 2f 4f  20 70 72 6f 63 65 73 73  |.the I/O process|
00000490  6f 72 20 69 6e 74 65 72  72 75 70 74 73 20 65 6e  |or interrupts en|
000004a0  61 62 6c 65 64 2e 20 54  68 65 20 70 72 6f 67 72  |abled. The progr|
000004b0  61 6d 20 53 50 49 4e 54  45 52 20 75 73 65 73 20  |am SPINTER uses |
000004c0  2a 43 4f 44 45 20 74 6f  0d 64 69 73 61 62 6c 65  |*CODE to.disable|
000004d0  20 74 68 65 20 49 2f 4f  20 70 72 6f 63 65 73 73  | the I/O process|
000004e0  6f 72 20 69 6e 74 65 72  72 75 70 74 73 20 61 6e  |or interrupts an|
000004f0  64 20 61 6c 74 65 72 20  49 52 51 32 56 2e 20 41  |d alter IRQ2V. A|
00000500  6e 20 61 6c 74 65 72 6e  61 74 69 76 65 0d 6d 65  |n alternative.me|
00000510  74 68 6f 64 20 69 73 20  61 76 61 69 6c 61 62 6c  |thod is availabl|
00000520  65 20 74 6f 20 64 69 73  63 20 75 73 65 72 73 20  |e to disc users |
00000530  77 68 6f 20 63 61 6e 20  61 73 73 65 6d 62 6c 65  |who can assemble|
00000540  20 74 68 65 20 49 2f 4f  20 70 72 6f 63 65 73 73  | the I/O process|
00000550  6f 72 0d 72 6f 75 74 69  6e 65 20 69 6e 20 74 68  |or.routine in th|
00000560  65 20 73 65 63 6f 6e 64  20 70 72 6f 63 65 73 73  |e second process|
00000570  6f 72 2c 20 73 61 76 65  20 69 74 20 6f 6e 74 6f  |or, save it onto|
00000580  20 64 69 73 63 20 61 6e  64 20 74 68 65 6e 20 2a  | disc and then *|
00000590  52 55 4e 20 69 74 20 69  6e 20 74 68 65 0d 49 2f  |RUN it in the.I/|
000005a0  4f 20 70 72 6f 63 65 73  73 6f 72 2e 20 54 68 69  |O processor. Thi|
000005b0  73 20 77 6f 75 6c 64 20  62 65 20 74 6f 6f 20 69  |s would be too i|
000005c0  6e 63 6f 6e 76 65 6e 69  65 6e 74 20 74 6f 20 64  |nconvenient to d|
000005d0  6f 20 77 69 74 68 20 61  20 74 61 70 65 20 73 74  |o with a tape st|
000005e0  6f 72 61 67 65 0d 73 79  73 74 65 6d 2e 0d 0d 41  |orage.system...A|
000005f0  66 74 65 72 20 49 52 51  32 56 20 68 61 73 20 62  |fter IRQ2V has b|
00000600  65 65 6e 20 72 65 76 65  63 74 6f 72 65 64 20 74  |een revectored t|
00000610  6f 20 74 68 65 20 6e 65  77 20 49 2f 4f 20 70 72  |o the new I/O pr|
00000620  6f 63 65 73 73 6f 72 20  72 6f 75 74 69 6e 65 20  |ocessor routine |
00000630  74 68 65 0d 63 61 6c 63  75 6c 61 74 69 6f 6e 20  |the.calculation |
00000640  6f 66 20 74 68 65 20 74  65 78 74 20 63 6f 6f 72  |of the text coor|
00000650  64 69 6e 61 74 65 73 20  63 61 6e 20 75 70 64 61  |dinates can upda|
00000660  74 65 64 20 77 69 74 68  20 65 76 65 72 79 20 6c  |ted with every l|
00000670  69 67 68 74 20 70 65 6e  0d 69 6e 74 65 72 72 75  |ight pen.interru|
00000680  70 74 20 61 6e 64 20 74  68 65 20 72 65 73 75 6c  |pt and the resul|
00000690  74 20 6f 66 20 74 68 65  20 63 61 6c 63 75 6c 61  |t of the calcula|
000006a0  74 69 6f 6e 20 63 61 6e  20 62 65 20 72 65 61 64  |tion can be read|
000006b0  20 61 74 20 61 6e 79 20  74 69 6d 65 20 62 79 20  | at any time by |
000006c0  61 0d 73 65 63 6f 6e 64  20 70 72 6f 63 65 73 73  |a.second process|
000006d0  6f 72 20 75 73 69 6e 67  20 4f 73 77 6f 72 64 20  |or using Osword |
000006e0  26 30 35 20 28 6f 72 20  73 69 6d 70 6c 79 20 70  |&05 (or simply p|
000006f0  65 65 6b 65 64 20 69 66  20 74 68 65 20 73 65 63  |eeked if the sec|
00000700  6f 6e 64 0d 70 72 6f 63  65 73 73 6f 72 20 69 73  |ond.processor is|
00000710  20 6e 6f 74 20 62 65 69  6e 67 20 75 73 65 64 29  | not being used)|
00000720  2e 20 54 68 65 20 63 6f  64 65 20 75 73 65 64 20  |. The code used |
00000730  74 6f 20 63 61 6c 63 75  6c 61 74 65 20 74 68 65  |to calculate the|
00000740  20 63 6f 6f 72 64 69 6e  61 74 65 73 0d 69 6e 20  | coordinates.in |
00000750  74 68 65 20 70 72 6f 67  72 61 6d 20 53 50 49 4e  |the program SPIN|
00000760  54 45 52 20 69 73 20 73  6c 69 67 68 74 6c 79 20  |TER is slightly |
00000770  64 69 66 66 65 72 65 6e  74 20 74 6f 20 74 68 61  |different to tha|
00000780  74 20 75 73 65 64 20 62  79 20 49 4f 49 4e 54 45  |t used by IOINTE|
00000790  52 20 69 6e 0d 6d 6f 64  75 6c 65 20 32 2e 20 54  |R in.module 2. T|
000007a0  68 65 20 6e 65 77 20 63  6f 64 65 20 69 73 20 75  |he new code is u|
000007b0  73 65 64 20 74 6f 20 61  6c 6c 6f 77 20 74 68 65  |sed to allow the|
000007c0  20 73 63 72 65 65 6e 20  74 6f 20 62 65 20 73 63  | screen to be sc|
000007d0  72 6f 6c 6c 65 64 20 61  6e 64 0d 73 74 69 6c 6c  |rolled and.still|
000007e0  20 67 69 76 65 20 74 68  65 20 63 6f 72 72 65 63  | give the correc|
000007f0  74 20 74 65 78 74 20 63  6f 6f 72 64 69 6e 61 74  |t text coordinat|
00000800  65 73 2e 20 49 66 20 79  6f 75 20 6d 61 6e 61 67  |es. If you manag|
00000810  65 64 20 74 6f 20 73 63  72 6f 6c 6c 20 74 68 65  |ed to scroll the|
00000820  0d 73 63 72 65 65 6e 20  77 69 74 68 20 61 6e 79  |.screen with any|
00000830  20 6f 66 20 74 68 65 20  65 61 72 6c 69 65 72 20  | of the earlier |
00000840  64 65 6d 6f 6e 73 74 72  61 74 69 6f 6e 20 70 72  |demonstration pr|
00000850  6f 67 72 61 6d 73 20 79  6f 75 20 77 6f 75 6c 64  |ograms you would|
00000860  20 68 61 76 65 20 73 65  65 6e 0d 74 68 65 20 61  | have seen.the a|
00000870  73 74 65 72 69 73 6b 20  64 69 73 70 6c 61 63 65  |sterisk displace|
00000880  64 20 76 65 72 74 69 63  61 6c 6c 79 20 62 65 6c  |d vertically bel|
00000890  6f 77 20 74 68 65 20 61  63 74 75 61 6c 20 6c 69  |ow the actual li|
000008a0  67 68 74 20 70 65 6e 20  70 6f 73 69 74 69 6f 6e  |ght pen position|
000008b0  2e 0d 41 6c 74 68 6f 75  67 68 20 69 74 20 69 73  |..Although it is|
000008c0  20 70 6f 73 73 69 62 6c  65 20 74 6f 20 70 72 65  | possible to pre|
000008d0  76 65 6e 74 20 74 68 65  20 73 63 72 65 65 6e 20  |vent the screen |
000008e0  73 63 72 6f 6c 6c 69 6e  67 20 69 74 20 69 73 20  |scrolling it is |
000008f0  61 6c 73 6f 0d 70 6f 73  73 69 62 6c 65 20 74 6f  |also.possible to|
00000900  20 72 65 61 64 20 74 68  65 20 73 63 72 65 65 6e  | read the screen|
00000910  20 73 74 61 72 74 20 61  64 64 72 65 73 73 20 61  | start address a|
00000920  6e 64 20 74 61 6b 65 20  61 6e 79 20 73 63 72 6f  |nd take any scro|
00000930  6c 6c 69 6e 67 20 69 6e  74 6f 0d 61 63 63 6f 75  |lling into.accou|
00000940  6e 74 20 77 68 65 6e 20  6d 61 6b 69 6e 67 20 74  |nt when making t|
00000950  68 65 20 63 61 6c 63 75  6c 61 74 69 6f 6e 2e 0d  |he calculation..|
00000960  0d 54 68 65 20 63 61 6c  63 75 6c 61 74 69 6f 6e  |.The calculation|
00000970  20 69 73 20 76 65 72 79  20 73 69 6d 69 6c 61 72  | is very similar|
00000980  20 74 6f 20 74 68 65 20  6f 6e 65 20 75 73 65 64  | to the one used|
00000990  20 69 6e 20 74 68 65 20  65 61 72 6c 69 65 72 20  | in the earlier |
000009a0  6d 6f 64 75 6c 65 73 0d  65 78 63 65 70 74 20 74  |modules.except t|
000009b0  68 61 74 20 74 68 65 20  6f 66 66 73 65 74 20 64  |hat the offset d|
000009c0  65 70 65 6e 64 73 20 6f  6e 20 74 68 65 20 73 63  |epends on the sc|
000009d0  72 65 65 6e 20 73 74 61  72 74 20 61 64 64 72 65  |reen start addre|
000009e0  73 73 2e 20 54 68 65 20  74 61 62 6c 65 20 69 6e  |ss. The table in|
000009f0  0d 66 69 67 75 72 65 20  31 20 73 68 6f 77 73 20  |.figure 1 shows |
00000a00  74 68 65 20 76 61 6c 75  65 73 20 6f 66 20 74 68  |the values of th|
00000a10  65 20 76 61 72 69 61 62  6c 65 73 20 75 73 65 64  |e variables used|
00000a20  20 69 6e 20 74 68 65 20  63 61 6c 63 75 6c 61 74  | in the calculat|
00000a30  69 6f 6e 20 6f 66 20 74  68 65 0d 74 65 78 74 20  |ion of the.text |
00000a40  63 6f 6f 72 64 69 6e 61  74 65 73 20 62 75 74 20  |coordinates but |
00000a50  74 68 65 20 76 61 6c 75  65 73 20 61 73 73 69 67  |the values assig|
00000a60  6e 65 64 20 74 6f 20 74  68 65 20 73 63 72 65 65  |ned to the scree|
00000a70  6e 20 73 74 61 72 74 20  61 64 64 72 65 73 73 20  |n start address |
00000a80  69 6e 0d 74 68 69 73 20  74 61 62 6c 65 20 63 61  |in.this table ca|
00000a90  6e 20 6f 6e 6c 79 20 62  65 20 75 73 65 64 20 69  |n only be used i|
00000aa0  66 20 74 68 65 20 73 63  72 65 65 6e 20 68 61 73  |f the screen has|
00000ab0  20 6e 6f 74 20 62 65 65  6e 20 73 63 72 6f 6c 6c  | not been scroll|
00000ac0  65 64 2e 20 49 66 20 74  68 65 0d 73 63 72 65 65  |ed. If the.scree|
00000ad0  6e 20 69 73 20 73 63 72  6f 6c 6c 65 64 20 74 68  |n is scrolled th|
00000ae0  65 20 73 74 61 72 74 20  61 64 64 72 65 73 73 20  |e start address |
00000af0  63 68 61 6e 67 65 73 20  66 72 6f 6d 20 74 68 65  |changes from the|
00000b00  20 76 61 6c 75 65 73 20  73 68 6f 77 6e 20 69 6e  | values shown in|
00000b10  0d 66 69 67 75 72 65 20  31 2e 20 54 68 65 20 63  |.figure 1. The c|
00000b20  75 72 72 65 6e 74 20 73  63 72 65 65 6e 20 73 74  |urrent screen st|
00000b30  61 72 74 20 61 64 64 72  65 73 73 20 63 61 6e 20  |art address can |
00000b40  62 65 20 72 65 61 64 20  66 72 6f 6d 20 26 33 35  |be read from &35|
00000b50  30 20 28 6c 6f 77 0d 62  79 74 65 29 20 61 6e 64  |0 (low.byte) and|
00000b60  20 26 33 35 31 20 28 68  69 67 68 20 62 79 74 65  | &351 (high byte|
00000b70  29 20 69 6e 20 74 68 65  20 49 2f 4f 20 70 72 6f  |) in the I/O pro|
00000b80  63 65 73 73 6f 72 2e 0d  0d 0d 20 20 20 20 20 20  |cessor....      |
00000b90  20 4d 6f 64 65 20 20 73  74 61 72 74 20 61 64 64  | Mode  start add|
00000ba0  72 20 20 74 72 69 6d 20  20 20 20 77 69 64 74 68  |r  trim    width|
00000bb0  20 20 20 73 63 61 6c 65  20 20 20 54 65 78 74 20  |   scale   Text |
00000bc0  72 65 73 6f 6c 75 74 69  6f 6e 0d 20 20 20 20 20  |resolution.     |
00000bd0  20 2d 2d 2d 2d 2d 2b 2d  2d 2d 2d 2d 2d 2d 2d 2d  | -----+---------|
00000be0  2d 2d 2b 2d 2d 2d 2d 2d  2d 2d 2b 2d 2d 2d 2d 2d  |--+-------+-----|
*
00000c00  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0d 20 20  |-------------.  |
00000c10  20 20 20 20 20 20 30 20  20 7c 20 20 20 26 33 30  |      0  |   &30|
00000c20  30 30 20 20 20 7c 20 20  26 30 36 20 20 7c 20 20  |00   |  &06  |  |
00000c30  26 35 30 20 20 7c 20 20  26 30 30 20 20 7c 20 73  |&50  |  &00  | s|
00000c40  69 6e 67 6c 65 20 63 68  61 72 61 63 74 65 72 20  |ingle character |
00000c50  0d 20 20 20 20 20 20 20  20 31 20 20 7c 20 20 20  |.        1  |   |
00000c60  26 33 30 30 30 20 20 20  7c 20 20 26 30 36 20 20  |&3000   |  &06  |
00000c70  7c 20 20 26 35 30 20 20  7c 20 20 26 30 31 20 20  ||  &50  |  &01  |
00000c80  7c 20 68 61 6c 66 20 63  68 61 72 61 63 74 65 72  || half character|
00000c90  20 20 20 0d 20 20 20 20  20 20 20 20 32 20 20 7c  |   .        2  ||
00000ca0  20 20 20 26 33 30 30 30  20 20 20 7c 20 20 26 30  |   &3000   |  &0|
00000cb0  36 20 20 7c 20 20 26 35  30 20 20 7c 20 20 26 30  |6  |  &50  |  &0|
00000cc0  32 20 20 7c 20 71 75 61  72 74 65 72 20 63 68 61  |2  | quarter cha|
00000cd0  72 61 63 74 65 72 0d 20  20 20 20 20 20 20 20 33  |racter.        3|
00000ce0  20 20 7c 20 20 20 26 34  30 30 30 20 20 20 7c 20  |  |   &4000   | |
00000cf0  20 26 30 36 20 20 7c 20  20 26 35 30 20 20 7c 20  | &06  |  &50  | |
00000d00  20 26 30 30 20 20 7c 20  73 69 6e 67 6c 65 20 63  | &00  | single c|
00000d10  68 61 72 61 63 74 65 72  20 0d 20 20 20 20 20 20  |haracter .      |
00000d20  20 20 34 20 20 7c 20 20  20 26 35 38 30 30 20 20  |  4  |   &5800  |
00000d30  20 7c 20 20 26 30 34 20  20 7c 20 20 26 32 38 20  | |  &04  |  &28 |
00000d40  20 7c 20 20 26 30 30 20  20 7c 20 73 69 6e 67 6c  | |  &00  | singl|
00000d50  65 20 63 68 61 72 61 63  74 65 72 20 0d 20 20 20  |e character .   |
00000d60  20 20 20 20 20 35 20 20  7c 20 20 20 26 35 38 30  |     5  |   &580|
00000d70  30 20 20 20 7c 20 20 26  30 34 20 20 7c 20 20 26  |0   |  &04  |  &|
00000d80  32 38 20 20 7c 20 20 26  30 31 20 20 7c 20 68 61  |28  |  &01  | ha|
00000d90  6c 66 20 63 68 61 72 61  63 74 65 72 20 20 20 0d  |lf character   .|
00000da0  20 20 20 20 20 20 20 20  36 20 20 7c 20 20 20 26  |        6  |   &|
00000db0  36 30 30 30 20 20 20 7c  20 20 26 30 34 20 20 7c  |6000   |  &04  ||
00000dc0  20 20 26 32 38 20 20 7c  20 20 26 30 30 20 20 7c  |  &28  |  &00  ||
00000dd0  20 73 69 6e 67 6c 65 20  63 68 61 72 61 63 74 65  | single characte|
00000de0  72 20 0d 20 20 20 20 20  20 20 20 37 20 20 7c 20  |r .        7  | |
00000df0  20 20 26 37 43 30 30 20  20 20 7c 20 20 26 30 38  |  &7C00   |  &08|
00000e00  20 20 7c 20 20 26 32 38  20 20 7c 20 20 26 30 30  |  |  &28  |  &00|
00000e10  20 20 7c 20 73 69 6e 67  6c 65 20 63 68 61 72 61  |  | single chara|
00000e20  63 74 65 72 20 0d 20 20  20 20 20 20 2d 2d 2d 2d  |cter .      ----|
00000e30  2d 2b 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2b 2d 2d  |-+-----------+--|
00000e40  2d 2d 2d 2d 2d 2b 2d 2d  2d 2d 2d 2d 2d 2b 2d 2d  |-----+-------+--|
00000e50  2d 2d 2d 2d 2d 2b 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |-----+----------|
00000e60  2d 2d 2d 2d 2d 2d 2d 2d  0d 0d 46 69 67 75 72 65  |--------..Figure|
00000e70  20 31 2e 20 54 68 65 20  73 74 61 72 74 20 61 64  | 1. The start ad|
00000e80  64 72 65 73 73 2c 20 74  72 69 6d 2c 20 77 69 64  |dress, trim, wid|
00000e90  74 68 20 61 6e 64 20 73  63 61 6c 65 20 66 6f 72  |th and scale for|
00000ea0  20 65 61 63 68 20 73 63  72 65 65 6e 20 6d 6f 64  | each screen mod|
00000eb0  65 0d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |e.--------------|
00000ec0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000ef0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 0d 0d 54 68 65 20  |---------...The |
00000f00  6c 69 67 68 74 20 70 65  6e 20 70 6f 73 69 74 69  |light pen positi|
00000f10  6f 6e 20 63 61 6e 20 62  65 20 63 61 6c 63 75 6c  |on can be calcul|
00000f20  61 74 65 64 20 69 6e 20  74 65 72 6d 73 20 6f 66  |ated in terms of|
00000f30  20 64 69 73 70 6c 61 79  65 64 20 74 65 78 74 0d  | displayed text.|
00000f40  63 6f 6f 72 64 69 6e 61  74 65 73 20 62 79 20 66  |coordinates by f|
00000f50  69 72 73 74 20 63 61 6c  63 75 6c 61 74 69 6e 67  |irst calculating|
00000f60  20 74 68 65 20 76 61 6c  75 65 20 6f 66 20 74 68  | the value of th|
00000f70  65 20 6f 66 66 73 65 74  2e 20 49 6e 20 6d 6f 64  |e offset. In mod|
00000f80  65 73 20 30 20 74 6f 20  36 0d 74 68 65 20 6f 66  |es 0 to 6.the of|
00000f90  66 73 65 74 20 69 73 20  67 69 76 65 6e 20 62 79  |fset is given by|
00000fa0  3a 0d 0d 20 20 6f 66 66  73 65 74 20 3d 20 74 72  |:..  offset = tr|
00000fb0  69 6d 20 2b 20 28 73 63  72 65 65 6e 20 73 74 61  |im + (screen sta|
00000fc0  72 74 20 61 64 64 72 65  73 73 20 44 49 56 20 38  |rt address DIV 8|
00000fd0  29 0d 0d 61 6e 64 20 69  6e 20 6d 6f 64 65 20 37  |)..and in mode 7|
00000fe0  20 62 79 3a 0d 0d 20 20  6f 66 66 73 65 74 20 3d  | by:..  offset =|
00000ff0  20 74 72 69 6d 20 2b 20  73 63 72 65 65 6e 20 73  | trim + screen s|
00001000  74 61 72 74 20 61 64 64  72 65 73 73 20 2d 20 26  |tart address - &|
00001010  35 34 30 30 0d 0d 54 68  65 20 58 20 61 6e 64 20  |5400..The X and |
00001020  59 20 74 65 78 74 20 63  6f 6f 72 64 69 6e 61 74  |Y text coordinat|
00001030  65 73 20 63 61 6e 20 62  65 20 63 61 6c 63 75 6c  |es can be calcul|
00001040  61 74 65 64 20 61 73 20  62 65 66 6f 72 65 20 75  |ated as before u|
00001050  73 69 6e 67 20 74 68 65  0d 61 70 70 72 6f 70 72  |sing the.appropr|
00001060  69 61 74 65 20 76 61 6c  75 65 20 6f 66 20 6f 66  |iate value of of|
00001070  66 73 65 74 2e 0d 0d 20  20 59 20 63 6f 6f 72 64  |fset...  Y coord|
00001080  20 3d 20 28 6c 69 67 68  74 20 70 65 6e 20 72 65  | = (light pen re|
00001090  67 69 73 74 65 72 20 2d  20 6f 66 66 73 65 74 29  |gister - offset)|
000010a0  20 44 49 56 20 77 69 64  74 68 0d 0d 20 20 58 20  | DIV width..  X |
000010b0  63 6f 6f 72 64 20 3d 20  28 28 6c 69 67 68 74 20  |coord = ((light |
000010c0  70 65 6e 20 72 65 67 69  73 74 65 72 20 2d 20 6f  |pen register - o|
000010d0  66 66 73 65 74 29 20 4d  4f 44 20 77 69 64 74 68  |ffset) MOD width|
000010e0  29 20 44 49 56 20 28 32  5e 73 63 61 6c 65 29 0d  |) DIV (2^scale).|
000010f0  0d 54 68 65 20 76 61 6c  75 65 73 20 6f 66 20 74  |.The values of t|
00001100  72 69 6d 2c 20 77 69 64  74 68 20 61 6e 64 20 73  |rim, width and s|
00001110  63 61 6c 65 20 61 72 65  20 74 68 6f 73 65 20 61  |cale are those a|
00001120  70 70 72 6f 70 72 69 61  74 65 20 74 6f 20 74 68  |ppropriate to th|
00001130  65 20 73 63 72 65 65 6e  0d 6d 6f 64 65 20 69 6e  |e screen.mode in|
00001140  20 75 73 65 20 61 74 20  74 68 65 20 74 69 6d 65  | use at the time|
00001150  2e 20 54 68 65 20 76 61  6c 75 65 20 6f 66 20 74  |. The value of t|
00001160  68 65 20 73 63 72 65 65  6e 20 73 74 61 72 74 20  |he screen start |
00001170  61 64 64 72 65 73 73 20  6d 75 73 74 20 62 65 0d  |address must be.|
00001180  72 65 61 64 20 66 72 6f  6d 20 26 33 35 30 20 61  |read from &350 a|
00001190  6e 64 20 26 33 35 31 20  61 6e 64 20 6e 6f 74 20  |nd &351 and not |
000011a0  74 61 6b 65 6e 20 66 72  6f 6d 20 61 20 74 61 62  |taken from a tab|
000011b0  6c 65 2e 20 54 68 65 20  76 61 6c 75 65 73 20 75  |le. The values u|
000011c0  73 65 64 20 66 6f 72 0d  74 72 69 6d 20 77 69 6c  |sed for.trim wil|
000011d0  6c 2c 20 61 73 20 74 68  65 20 6e 61 6d 65 20 73  |l, as the name s|
000011e0  75 67 67 65 73 74 73 2c  20 6e 65 65 64 20 74 6f  |uggests, need to|
000011f0  20 62 65 20 74 72 69 6d  6d 65 64 20 61 73 20 64  | be trimmed as d|
00001200  65 73 63 72 69 62 65 64  20 69 6e 20 6d 6f 64 75  |escribed in modu|
00001210  6c 65 0d 31 2e 20 54 68  65 20 76 61 6c 75 65 73  |le.1. The values|
00001220  20 6f 66 20 74 72 69 6d  20 75 73 65 64 20 69 6e  | of trim used in|
00001230  20 53 50 49 4e 54 45 52  20 61 72 65 20 74 68 6f  | SPINTER are tho|
00001240  73 65 20 49 20 66 6f 75  6e 64 20 74 6f 20 62 65  |se I found to be|
00001250  20 6d 6f 73 74 0d 73 75  69 74 61 62 6c 65 20 66  | most.suitable f|
00001260  6f 72 20 6d 79 20 6c 69  67 68 74 20 70 65 6e 2e  |or my light pen.|
00001270  20 59 6f 75 20 6d 69 67  68 74 20 6c 69 6b 65 20  | You might like |
00001280  74 6f 20 65 64 69 74 20  74 68 65 20 70 72 6f 67  |to edit the prog|
00001290  72 61 6d 20 74 6f 20 75  73 65 20 74 68 65 0d 76  |ram to use the.v|
000012a0  61 6c 75 65 73 20 62 65  73 74 20 73 75 69 74 65  |alues best suite|
000012b0  64 20 74 6f 20 79 6f 75  72 20 6c 69 67 68 74 20  |d to your light |
000012c0  70 65 6e 20 62 75 74 20  79 6f 75 20 63 61 6e 20  |pen but you can |
000012d0  61 6c 73 6f 20 74 72 69  6d 20 74 68 65 20 76 61  |also trim the va|
000012e0  6c 75 65 73 20 49 0d 68  61 76 65 20 75 73 65 64  |lues I.have used|
000012f0  20 77 69 74 68 20 74 68  65 20 6c 65 66 74 20 61  | with the left a|
00001300  6e 64 20 72 69 67 68 74  20 63 75 72 73 6f 72 20  |nd right cursor |
00001310  6b 65 79 73 20 77 68 65  6e 20 74 68 65 20 70 72  |keys when the pr|
00001320  6f 67 72 61 6d 20 69 73  20 72 75 6e 6e 69 6e 67  |ogram is running|
00001330  2e 0d 54 68 65 20 6c 61  62 65 6c 20 6f 66 66 73  |..The label offs|
00001340  65 74 6c 6f 77 20 69 73  20 75 73 65 64 20 66 6f  |etlow is used fo|
00001350  72 20 74 68 65 20 74 61  62 6c 65 20 6f 66 20 76  |r the table of v|
00001360  61 6c 75 65 73 20 61 73  73 69 67 6e 65 64 20 74  |alues assigned t|
00001370  6f 20 74 72 69 6d 20 74  6f 0d 73 68 6f 77 20 68  |o trim to.show h|
00001380  6f 77 20 74 68 65 20 69  64 65 61 20 68 61 73 20  |ow the idea has |
00001390  64 65 76 65 6c 6f 70 65  64 20 66 72 6f 6d 20 74  |developed from t|
000013a0  68 65 20 65 61 72 6c 69  65 72 20 70 72 6f 67 72  |he earlier progr|
000013b0  61 6d 73 2e 0d 0d 54 68  65 20 72 61 6e 67 65 20  |ams...The range |
000013c0  6f 66 20 74 68 65 20 58  20 61 6e 64 20 59 20 74  |of the X and Y t|
000013d0  65 78 74 20 63 6f 6f 72  64 69 6e 61 74 65 73 20  |ext coordinates |
000013e0  6d 61 64 65 20 61 76 61  69 6c 61 62 6c 65 20 64  |made available d|
000013f0  65 70 65 6e 64 73 20 6f  6e 20 74 68 65 0d 73 63  |epends on the.sc|
00001400  72 65 65 6e 20 6d 6f 64  65 20 61 6e 64 20 63 6f  |reen mode and co|
00001410  72 72 65 73 70 6f 6e 64  73 20 77 69 74 68 20 74  |rresponds with t|
00001420  68 65 20 76 61 6c 75 65  73 20 6f 66 20 58 20 61  |he values of X a|
00001430  6e 64 20 59 20 75 73 65  64 20 62 79 20 74 68 65  |nd Y used by the|
00001440  20 42 41 53 49 43 0d 54  41 42 28 78 2c 79 29 20  | BASIC.TAB(x,y) |
00001450  63 6f 6d 6d 61 6e 64 2e  20 54 68 65 20 72 61 6e  |command. The ran|
00001460  67 65 20 6f 66 20 76 61  6c 75 65 73 20 61 72 65  |ge of values are|
00001470  20 73 68 6f 77 6e 20 69  6e 20 66 69 67 75 72 65  | shown in figure|
00001480  20 32 2e 0d 0d 0d 20 20  20 20 20 20 20 20 20 20  | 2....          |
00001490  20 20 20 20 20 20 20 20  20 20 4d 6f 64 65 20 20  |          Mode  |
000014a0  20 58 20 28 3f 26 37 30  29 20 20 20 59 20 28 3f  | X (?&70)   Y (?|
000014b0  26 37 31 29 0d 20 20 20  20 20 20 20 20 20 20 20  |&71).           |
000014c0  20 20 20 20 20 20 20 20  2d 2d 2d 2d 2d 2d 2b 2d  |        ------+-|
000014d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2b 2d 2d 2d 2d 2d 2d  |---------+------|
000014e0  2d 2d 2d 2d 0d 20 20 20  20 20 20 20 20 20 20 20  |----.           |
000014f0  20 20 20 20 20 20 20 20  20 20 20 30 20 20 7c 20  |           0  | |
00001500  20 30 20 2d 20 37 39 20  20 7c 20 20 30 20 2d 20  | 0 - 79  |  0 - |
00001510  33 31 0d 20 20 20 20 20  20 20 20 20 20 20 20 20  |31.             |
00001520  20 20 20 20 20 20 20 20  20 31 20 20 7c 20 20 30  |         1  |  0|
00001530  20 2d 20 33 39 20 20 7c  20 20 30 20 2d 20 33 31  | - 39  |  0 - 31|
00001540  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00001550  20 20 20 20 20 20 20 32  20 20 7c 20 20 30 20 2d  |       2  |  0 -|
00001560  20 31 39 20 20 7c 20 20  30 20 2d 20 33 31 0d 20  | 19  |  0 - 31. |
00001570  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001580  20 20 20 20 20 33 20 20  7c 20 20 30 20 2d 20 37  |     3  |  0 - 7|
00001590  39 20 20 7c 20 20 30 20  2d 20 32 34 0d 20 20 20  |9  |  0 - 24.   |
000015a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000015b0  20 20 20 34 20 20 7c 20  20 30 20 2d 20 33 39 20  |   4  |  0 - 39 |
000015c0  20 7c 20 20 30 20 2d 20  33 31 0d 20 20 20 20 20  | |  0 - 31.     |
000015d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000015e0  20 35 20 20 7c 20 20 30  20 2d 20 31 39 20 20 7c  | 5  |  0 - 19  ||
000015f0  20 20 30 20 2d 20 33 31  0d 20 20 20 20 20 20 20  |  0 - 31.       |
00001600  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 36  |               6|
00001610  20 20 7c 20 20 30 20 2d  20 33 39 20 20 7c 20 20  |  |  0 - 39  |  |
00001620  30 20 2d 20 32 34 0d 20  20 20 20 20 20 20 20 20  |0 - 24.         |
00001630  20 20 20 20 20 20 20 20  20 20 20 20 20 37 20 20  |             7  |
00001640  7c 20 20 30 20 2d 20 33  39 20 20 7c 20 20 30 20  ||  0 - 39  |  0 |
00001650  2d 20 32 34 0d 20 20 20  20 20 20 20 20 20 20 20  |- 24.           |
00001660  20 20 20 20 20 20 20 20  2d 2d 2d 2d 2d 2d 2b 2d  |        ------+-|
00001670  2d 2d 2d 2d 2d 2d 2d 2d  2d 2b 2d 2d 2d 2d 2d 2d  |---------+------|
00001680  2d 2d 2d 2d 0d 0d 46 69  67 75 72 65 20 32 2e 20  |----..Figure 2. |
00001690  54 68 65 20 72 61 6e 67  65 20 6f 66 20 58 20 61  |The range of X a|
000016a0  6e 64 20 59 20 63 6f 6f  72 64 69 6e 61 74 65 73  |nd Y coordinates|
000016b0  20 69 6e 20 74 68 65 20  76 61 72 69 6f 75 73 20  | in the various |
000016c0  73 63 72 65 65 6e 20 6d  6f 64 65 73 0d 2d 2d 2d  |screen modes.---|
000016d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001710  2d 2d 2d 0d 0d 0d 43 68  61 69 6e 20 74 68 65 20  |---...Chain the |
00001720  70 72 6f 67 72 61 6d 20  53 50 49 4e 54 45 52 20  |program SPINTER |
00001730  77 68 69 63 68 20 63 61  6e 20 62 65 20 75 73 65  |which can be use|
00001740  64 20 77 69 74 68 20 65  69 74 68 65 72 20 61 20  |d with either a |
00001750  36 35 30 32 20 73 65 63  6f 6e 64 0d 70 72 6f 63  |6502 second.proc|
00001760  65 73 73 6f 72 20 6f 72  20 77 69 74 68 20 61 6e  |essor or with an|
00001770  20 49 2f 4f 20 70 72 6f  63 65 73 73 6f 72 20 6f  | I/O processor o|
00001780  6e 20 69 74 73 20 6f 77  6e 2e 20 49 66 20 69 74  |n its own. If it|
00001790  20 69 73 20 75 73 65 64  20 6f 6e 20 61 20 42 42  | is used on a BB|
000017a0  43 20 42 0d 77 69 74 68  6f 75 74 20 61 20 73 65  |C B.without a se|
000017b0  63 6f 6e 64 20 70 72 6f  63 65 73 73 6f 72 20 69  |cond processor i|
000017c0  74 20 73 68 6f 75 6c 64  20 62 65 20 6c 6f 61 64  |t should be load|
000017d0  65 64 20 77 69 74 68 20  50 41 47 45 20 3d 20 26  |ed with PAGE = &|
000017e0  31 31 30 30 2e 20 20 49  74 20 69 73 0d 68 65 61  |1100.  It is.hea|
000017f0  76 69 6c 79 20 63 6f 6d  6d 65 6e 74 65 64 20 61  |vily commented a|
00001800  6e 64 20 74 68 65 72 65  20 69 73 20 6a 75 73 74  |nd there is just|
00001810  20 6e 6f 74 20 65 6e 6f  75 67 68 20 72 6f 6f 6d  | not enough room|
00001820  20 66 6f 72 20 69 74 20  74 6f 20 72 75 6e 20 69  | for it to run i|
00001830  6e 20 6d 6f 64 65 0d 30  20 69 6e 20 61 20 42 42  |n mode.0 in a BB|
00001840  43 20 42 20 77 69 74 68  20 50 41 47 45 20 3d 20  |C B with PAGE = |
00001850  26 31 39 30 30 2e 0d 0d  59 6f 75 20 63 61 6e 20  |&1900...You can |
00001860  73 63 72 6f 6c 6c 20 74  68 65 20 73 63 72 65 65  |scroll the scree|
00001870  6e 20 69 6e 20 61 6e 79  20 6d 6f 64 65 20 62 79  |n in any mode by|
00001880  20 70 72 65 73 73 69 6e  67 20 74 68 65 20 52 65  | pressing the Re|
00001890  74 75 72 6e 20 6b 65 79  2e 20 49 66 20 79 6f 75  |turn key. If you|
000018a0  0d 73 63 72 6f 6c 6c 20  74 68 65 20 73 63 72 65  |.scroll the scre|
000018b0  65 6e 20 69 6e 20 6d 6f  64 65 20 37 20 74 68 65  |en in mode 7 the|
000018c0  20 62 61 63 6b 67 72 6f  75 6e 64 20 63 6f 6c 6f  | background colo|
000018d0  75 72 20 63 61 6e 20 62  65 20 6d 61 64 65 20 74  |ur can be made t|
000018e0  6f 20 72 65 2d 66 69 6c  6c 0d 74 68 65 20 73 63  |o re-fill.the sc|
000018f0  72 65 65 6e 20 62 79 20  70 72 65 73 73 69 6e 67  |reen by pressing|
00001900  20 50 20 74 6f 20 61 6c  74 65 72 20 74 68 65 20  | P to alter the |
00001910  62 61 63 6b 67 72 6f 75  6e 64 20 28 50 61 70 65  |background (Pape|
00001920  72 29 20 63 6f 6c 6f 75  72 2e 20 59 6f 75 20 63  |r) colour. You c|
00001930  61 6e 0d 74 72 69 6d 20  74 68 65 20 6f 66 66 73  |an.trim the offs|
00001940  65 74 20 77 69 74 68 20  74 68 65 20 6c 65 66 74  |et with the left|
00001950  20 61 6e 64 20 72 69 67  68 74 20 63 75 72 73 6f  | and right curso|
00001960  72 20 6b 65 79 73 2c 20  63 68 61 6e 67 65 20 74  |r keys, change t|
00001970  68 65 20 73 63 72 65 65  6e 0d 6d 6f 64 65 20 77  |he screen.mode w|
00001980  69 74 68 20 74 68 65 20  75 70 20 61 6e 64 20 64  |ith the up and d|
00001990  6f 77 6e 20 63 75 72 73  6f 72 20 6b 65 79 73 2c  |own cursor keys,|
000019a0  20 63 68 61 6e 67 65 20  74 68 65 20 62 61 63 6b  | change the back|
000019b0  67 72 6f 75 6e 64 20 63  6f 6c 6f 75 72 20 77 69  |ground colour wi|
000019c0  74 68 20 50 0d 28 50 20  66 6f 72 20 70 61 70 65  |th P.(P for pape|
000019d0  72 29 20 61 6e 64 20 74  68 65 20 66 6f 72 65 67  |r) and the foreg|
000019e0  72 6f 75 6e 64 20 63 6f  6c 6f 75 72 20 77 69 74  |round colour wit|
000019f0  68 20 49 20 28 49 20 66  6f 72 20 69 6e 6b 29 2e  |h I (I for ink).|
00001a00  20 59 6f 75 20 73 68 6f  75 6c 64 0d 66 69 6e 64  | You should.find|
00001a10  20 74 68 61 74 20 74 68  65 20 73 63 72 65 65 6e  | that the screen|
00001a20  20 63 61 6e 20 62 65 20  73 63 72 6f 6c 6c 65 64  | can be scrolled|
00001a30  20 61 73 20 6d 75 63 68  20 61 73 20 79 6f 75 20  | as much as you |
00001a40  6c 69 6b 65 20 61 6e 64  20 79 6f 75 20 77 69 6c  |like and you wil|
00001a50  6c 0d 73 74 69 6c 6c 20  72 65 61 64 20 74 68 65  |l.still read the|
00001a60  20 63 6f 72 72 65 63 74  20 74 65 78 74 20 63 6f  | correct text co|
00001a70  6f 72 64 69 6e 61 74 65  73 2e 20 59 6f 75 20 77  |ordinates. You w|
00001a80  69 6c 6c 20 6e 65 65 64  20 74 6f 20 61 6c 74 65  |ill need to alte|
00001a90  72 20 46 4e 73 77 69 74  63 68 0d 69 66 20 79 6f  |r FNswitch.if yo|
00001aa0  75 20 64 6f 20 6e 6f 74  20 68 61 76 65 20 61 6e  |u do not have an|
00001ab0  20 52 48 20 63 6f 6d 70  61 74 69 62 6c 65 20 6c  | RH compatible l|
00001ac0  69 67 68 74 20 70 65 6e  2e 0d 0d 0d 20 20 20 31  |ight pen....   1|
00001ad0  30 20 52 45 4d 3e 20 53  50 49 4e 54 45 52 0d 20  |0 REM> SPINTER. |
00001ae0  20 20 32 30 20 6f 73 77  6f 72 64 3d 26 46 46 46  |  20 osword=&FFF|
00001af0  31 0d 20 20 20 33 30 20  6f 73 62 79 74 65 3d 26  |1.   30 osbyte=&|
00001b00  46 46 46 34 0d 20 20 20  34 30 20 41 25 3d 26 45  |FFF4.   40 A%=&E|
00001b10  41 0d 20 20 20 35 30 20  58 25 3d 30 0d 20 20 20  |A.   50 X%=0.   |
00001b20  36 30 20 59 25 3d 26 46  46 0d 20 20 20 37 30 20  |60 Y%=&FF.   70 |
00001b30  49 46 20 28 55 53 52 28  6f 73 62 79 74 65 29 41  |IF (USR(osbyte)A|
00001b40  4e 44 26 46 46 30 30 29  44 49 56 26 31 30 30 3d  |ND&FF00)DIV&100=|
00001b50  30 20 68 6f 73 74 3d 54  52 55 45 20 45 4c 53 45  |0 host=TRUE ELSE|
00001b60  20 68 6f 73 74 3d 46 41  4c 53 45 0d 20 20 20 38  | host=FALSE.   8|
00001b70  30 20 49 46 20 68 6f 73  74 20 49 46 20 50 41 47  |0 IF host IF PAG|
00001b80  45 3e 26 31 31 30 30 20  54 48 45 4e 20 50 41 47  |E>&1100 THEN PAG|
00001b90  45 3d 26 31 31 30 30 3a  43 48 41 49 4e 22 53 50  |E=&1100:CHAIN"SP|
00001ba0  49 4e 54 45 52 22 0d 20  20 20 39 30 20 44 49 4d  |INTER".   90 DIM|
00001bb0  20 70 61 72 61 6d 20 34  0d 20 20 31 30 30 20 44  | param 4.  100 D|
00001bc0  49 4d 20 6d 63 6f 64 65  20 26 31 30 30 0d 20 20  |IM mcode &100.  |
00001bd0  31 31 30 20 78 63 6f 6f  72 64 3d 26 37 30 0d 20  |110 xcoord=&70. |
00001be0  20 31 32 30 20 79 63 6f  6f 72 64 3d 26 37 31 0d  | 120 ycoord=&71.|
00001bf0  20 20 31 33 30 20 50 52  4f 43 6d 63 6f 64 65 0d  |  130 PROCmcode.|
00001c00  20 20 31 34 30 20 4f 4e  45 52 52 4f 52 20 4f 53  |  140 ONERROR OS|
00001c10  43 4c 49 28 22 43 4f 44  45 22 29 3a 56 44 55 32  |CLI("CODE"):VDU2|
00001c20  33 2c 31 2c 31 3b 30 3b  30 3b 30 3b 3a 45 4e 44  |3,1,1;0;0;0;:END|
00001c30  0d 20 20 31 35 30 20 6d  6f 64 65 3d 30 0d 20 20  |.  150 mode=0.  |
00001c40  31 36 30 20 70 61 70 65  72 3d 36 0d 20 20 31 37  |160 paper=6.  17|
00001c50  30 20 69 6e 6b 3d 34 0d  20 20 31 38 30 20 4d 4f  |0 ink=4.  180 MO|
00001c60  44 45 20 6d 6f 64 65 0d  20 20 31 39 30 20 50 52  |DE mode.  190 PR|
00001c70  4f 43 6e 65 77 6d 6f 64  65 0d 20 20 32 30 30 20  |OCnewmode.  200 |
00001c80  52 45 50 45 41 54 0d 20  20 32 31 30 20 49 46 20  |REPEAT.  210 IF |
00001c90  49 4e 4b 45 59 28 2d 35  38 29 20 50 52 4f 43 75  |INKEY(-58) PROCu|
00001ca0  70 3a 4d 4f 44 45 20 6d  6f 64 65 3a 50 52 4f 43  |p:MODE mode:PROC|
00001cb0  6e 65 77 6d 6f 64 65 0d  20 20 32 32 30 20 49 46  |newmode.  220 IF|
00001cc0  20 49 4e 4b 45 59 28 2d  34 32 29 20 50 52 4f 43  | INKEY(-42) PROC|
00001cd0  64 6f 77 6e 3a 4d 4f 44  45 20 6d 6f 64 65 3a 50  |down:MODE mode:P|
00001ce0  52 4f 43 6e 65 77 6d 6f  64 65 0d 20 20 32 33 30  |ROCnewmode.  230|
00001cf0  20 49 46 20 49 4e 4b 45  59 28 2d 35 36 29 20 50  | IF INKEY(-56) P|
00001d00  52 4f 43 70 61 70 65 72  0d 20 20 32 34 30 20 49  |ROCpaper.  240 I|
00001d10  46 20 49 4e 4b 45 59 28  2d 33 38 29 20 50 52 4f  |F INKEY(-38) PRO|
00001d20  43 69 6e 6b 0d 20 20 32  35 30 20 49 46 20 49 4e  |Cink.  250 IF IN|
00001d30  4b 45 59 28 2d 32 36 29  20 50 52 4f 43 6c 65 66  |KEY(-26) PROClef|
00001d40  74 0d 20 20 32 36 30 20  49 46 20 49 4e 4b 45 59  |t.  260 IF INKEY|
00001d50  28 2d 31 32 32 29 20 50  52 4f 43 72 69 67 68 74  |(-122) PROCright|
00001d60  0d 20 20 32 37 30 20 49  46 20 49 4e 4b 45 59 28  |.  270 IF INKEY(|
00001d70  2d 37 34 29 20 50 52 4f  43 73 63 72 6f 6c 6c 3a  |-74) PROCscroll:|
00001d80  50 52 4f 43 64 65 6c 61  79 0d 20 20 32 38 30 20  |PROCdelay.  280 |
00001d90  50 52 49 4e 54 54 41 42  28 31 33 2c 31 29 3b 46  |PRINTTAB(13,1);F|
00001da0  4e 72 65 61 64 28 78 63  6f 6f 72 64 29 3b 22 20  |Nread(xcoord);" |
00001db0  22 0d 20 20 32 39 30 20  50 52 49 4e 54 54 41 42  |".  290 PRINTTAB|
00001dc0  28 31 33 2c 32 29 3b 46  4e 72 65 61 64 28 79 63  |(13,2);FNread(yc|
00001dd0  6f 6f 72 64 29 3b 22 20  22 0d 20 20 33 30 30 20  |oord);" ".  300 |
00001de0  49 46 20 46 4e 73 77 69  74 63 68 20 56 44 55 33  |IF FNswitch VDU3|
00001df0  31 2c 46 4e 72 65 61 64  28 78 63 6f 6f 72 64 29  |1,FNread(xcoord)|
00001e00  2c 46 4e 72 65 61 64 28  79 63 6f 6f 72 64 29 2c  |,FNread(ycoord),|
00001e10  34 32 0d 20 20 33 31 30  20 55 4e 54 49 4c 20 46  |42.  310 UNTIL F|
00001e20  41 4c 53 45 0d 20 20 33  32 30 20 3a 0d 20 20 33  |ALSE.  320 :.  3|
00001e30  33 30 20 44 45 46 50 52  4f 43 73 63 72 6f 6c 6c  |30 DEFPROCscroll|
00001e40  0d 20 20 33 34 30 20 49  46 20 28 6d 6f 64 65 3e  |.  340 IF (mode>|
00001e50  35 29 20 4f 52 20 28 6d  6f 64 65 3d 33 29 20 50  |5) OR (mode=3) P|
00001e60  52 49 4e 54 54 41 42 28  30 2c 32 34 29 3a 45 4e  |RINTTAB(0,24):EN|
00001e70  44 50 52 4f 43 0d 20 20  33 35 30 20 50 52 49 4e  |DPROC.  350 PRIN|
00001e80  54 54 41 42 28 30 2c 33  31 29 0d 20 20 33 36 30  |TTAB(0,31).  360|
00001e90  20 45 4e 44 50 52 4f 43  0d 20 20 33 37 30 20 3a  | ENDPROC.  370 :|
00001ea0  0d 20 20 33 38 30 20 44  45 46 50 52 4f 43 75 70  |.  380 DEFPROCup|
00001eb0  0d 20 20 33 39 30 20 6d  6f 64 65 3d 6d 6f 64 65  |.  390 mode=mode|
00001ec0  2b 31 0d 20 20 34 30 30  20 49 46 20 6d 6f 64 65  |+1.  400 IF mode|
00001ed0  3e 37 20 6d 6f 64 65 3d  37 0d 20 20 34 31 30 20  |>7 mode=7.  410 |
00001ee0  45 4e 44 50 52 4f 43 0d  20 20 34 32 30 20 3a 0d  |ENDPROC.  420 :.|
00001ef0  20 20 34 33 30 20 44 45  46 50 52 4f 43 64 6f 77  |  430 DEFPROCdow|
00001f00  6e 0d 20 20 34 34 30 20  6d 6f 64 65 3d 6d 6f 64  |n.  440 mode=mod|
00001f10  65 2d 31 0d 20 20 34 35  30 20 49 46 20 6d 6f 64  |e-1.  450 IF mod|
00001f20  65 3c 30 20 6d 6f 64 65  3d 30 0d 20 20 34 36 30  |e<0 mode=0.  460|
00001f30  20 45 4e 44 50 52 4f 43  0d 20 20 34 37 30 20 3a  | ENDPROC.  470 :|
00001f40  0d 20 20 34 38 30 20 44  45 46 50 52 4f 43 6c 65  |.  480 DEFPROCle|
00001f50  66 74 0d 20 20 34 39 30  20 6f 66 66 73 65 74 3d  |ft.  490 offset=|
00001f60  46 4e 72 65 61 64 28 6f  66 66 73 65 74 6c 6f 77  |FNread(offsetlow|
00001f70  2b 6d 6f 64 65 29 0d 20  20 35 30 30 20 49 46 20  |+mode).  500 IF |
00001f80  6f 66 66 73 65 74 3d 31  32 20 45 4e 44 50 52 4f  |offset=12 ENDPRO|
00001f90  43 0d 20 20 35 31 30 20  50 52 4f 43 77 72 69 74  |C.  510 PROCwrit|
00001fa0  65 28 6f 66 66 73 65 74  2b 31 2c 6f 66 66 73 65  |e(offset+1,offse|
00001fb0  74 6c 6f 77 2b 6d 6f 64  65 29 0d 20 20 35 32 30  |tlow+mode).  520|
00001fc0  20 50 52 4f 43 64 65 6c  61 79 0d 20 20 35 33 30  | PROCdelay.  530|
00001fd0  20 45 4e 44 50 52 4f 43  0d 20 20 35 34 30 20 3a  | ENDPROC.  540 :|
00001fe0  0d 20 20 35 35 30 20 44  45 46 50 52 4f 43 72 69  |.  550 DEFPROCri|
00001ff0  67 68 74 0d 20 20 35 36  30 20 6f 66 66 73 65 74  |ght.  560 offset|
00002000  3d 46 4e 72 65 61 64 28  6f 66 66 73 65 74 6c 6f  |=FNread(offsetlo|
00002010  77 2b 6d 6f 64 65 29 0d  20 20 35 37 30 20 49 46  |w+mode).  570 IF|
00002020  20 6f 66 66 73 65 74 3d  30 20 45 4e 44 50 52 4f  | offset=0 ENDPRO|
00002030  43 0d 20 20 35 38 30 20  50 52 4f 43 77 72 69 74  |C.  580 PROCwrit|
00002040  65 28 6f 66 66 73 65 74  2d 31 2c 6f 66 66 73 65  |e(offset-1,offse|
00002050  74 6c 6f 77 2b 6d 6f 64  65 29 0d 20 20 35 39 30  |tlow+mode).  590|
00002060  20 50 52 4f 43 64 65 6c  61 79 0d 20 20 36 30 30  | PROCdelay.  600|
00002070  20 45 4e 44 50 52 4f 43  0d 20 20 36 31 30 20 3a  | ENDPROC.  610 :|
00002080  0d 20 20 36 32 30 20 44  45 46 50 52 4f 43 6e 65  |.  620 DEFPROCne|
00002090  77 6d 6f 64 65 0d 20 20  36 33 30 20 56 44 55 32  |wmode.  630 VDU2|
000020a0  33 2c 31 2c 30 3b 30 3b  30 3b 30 3b 0d 20 20 36  |3,1,0;0;0;0;.  6|
000020b0  34 30 20 49 46 20 6d 6f  64 65 3d 37 20 50 52 4f  |40 IF mode=7 PRO|
000020c0  43 73 65 76 65 6e 3a 45  4e 44 50 52 4f 43 0d 20  |Cseven:ENDPROC. |
000020d0  20 36 35 30 20 56 44 55  31 39 2c 30 2c 70 61 70  | 650 VDU19,0,pap|
000020e0  65 72 3b 30 3b 0d 20 20  36 36 30 20 56 44 55 31  |er;0;.  660 VDU1|
000020f0  39 2c 31 2c 69 6e 6b 3b  30 3b 0d 20 20 36 37 30  |9,1,ink;0;.  670|
00002100  20 43 4f 4c 4f 55 52 31  0d 20 20 36 38 30 20 50  | COLOUR1.  680 P|
00002110  52 4f 43 64 65 6c 61 79  0d 20 20 36 39 30 20 45  |ROCdelay.  690 E|
00002120  4e 44 50 52 4f 43 0d 20  20 37 30 30 20 3a 0d 20  |NDPROC.  700 :. |
00002130  20 37 31 30 20 44 45 46  50 52 4f 43 64 65 6c 61  | 710 DEFPROCdela|
00002140  79 0d 20 20 37 32 30 20  50 52 49 4e 54 54 41 42  |y.  720 PRINTTAB|
00002150  28 33 2c 30 29 22 4d 6f  64 65 20 22 3b 6d 6f 64  |(3,0)"Mode ";mod|
00002160  65 3b 53 50 43 28 38 29  0d 20 20 37 33 30 20 50  |e;SPC(8).  730 P|
00002170  52 49 4e 54 54 41 42 28  33 2c 31 29 22 58 20 63  |RINTTAB(3,1)"X c|
00002180  6f 6f 72 64 20 3d 20 22  3b 46 4e 72 65 61 64 28  |oord = ";FNread(|
00002190  78 63 6f 6f 72 64 29 3b  53 50 43 28 33 29 0d 20  |xcoord);SPC(3). |
000021a0  20 37 34 30 20 50 52 49  4e 54 54 41 42 28 33 2c  | 740 PRINTTAB(3,|
000021b0  32 29 22 59 20 63 6f 6f  72 64 20 3d 20 22 3b 46  |2)"Y coord = ";F|
000021c0  4e 72 65 61 64 28 79 63  6f 6f 72 64 29 3b 53 50  |Nread(ycoord);SP|
000021d0  43 28 33 29 0d 20 20 37  35 30 20 50 52 49 4e 54  |C(3).  750 PRINT|
000021e0  54 41 42 28 33 2c 33 29  22 6f 66 66 73 65 74 6c  |TAB(3,3)"offsetl|
000021f0  6f 77 20 3d 20 22 3b 46  4e 72 65 61 64 28 6f 66  |ow = ";FNread(of|
00002200  66 73 65 74 6c 6f 77 2b  6d 6f 64 65 29 0d 20 20  |fsetlow+mode).  |
00002210  37 36 30 20 74 69 6d 65  3d 54 49 4d 45 2b 32 30  |760 time=TIME+20|
00002220  0d 20 20 37 37 30 20 52  45 50 45 41 54 20 55 4e  |.  770 REPEAT UN|
00002230  54 49 4c 20 74 69 6d 65  3c 54 49 4d 45 0d 20 20  |TIL time<TIME.  |
00002240  37 38 30 20 45 4e 44 50  52 4f 43 0d 20 20 37 39  |780 ENDPROC.  79|
00002250  30 20 3a 0d 20 20 38 30  30 20 44 45 46 50 52 4f  |0 :.  800 DEFPRO|
00002260  43 69 6e 6b 0d 20 20 38  31 30 20 69 6e 6b 3d 69  |Cink.  810 ink=i|
00002270  6e 6b 2b 31 0d 20 20 38  32 30 20 49 46 20 69 6e  |nk+1.  820 IF in|
00002280  6b 3d 70 61 70 65 72 20  69 6e 6b 3d 69 6e 6b 2b  |k=paper ink=ink+|
00002290  31 0d 20 20 38 33 30 20  49 46 20 69 6e 6b 3e 37  |1.  830 IF ink>7|
000022a0  20 69 6e 6b 3d 30 0d 20  20 38 34 30 20 56 44 55  | ink=0.  840 VDU|
000022b0  31 39 2c 31 2c 69 6e 6b  3b 30 3b 0d 20 20 38 35  |19,1,ink;0;.  85|
000022c0  30 20 49 46 20 6d 6f 64  65 3d 37 20 50 52 4f 43  |0 IF mode=7 PROC|
000022d0  73 65 76 65 6e 0d 20 20  38 36 30 20 50 52 4f 43  |seven.  860 PROC|
000022e0  64 65 6c 61 79 0d 20 20  38 37 30 20 45 4e 44 50  |delay.  870 ENDP|
000022f0  52 4f 43 0d 20 20 38 38  30 20 3a 0d 20 20 38 39  |ROC.  880 :.  89|
00002300  30 20 44 45 46 50 52 4f  43 70 61 70 65 72 0d 20  |0 DEFPROCpaper. |
00002310  20 39 30 30 20 70 61 70  65 72 3d 70 61 70 65 72  | 900 paper=paper|
00002320  2b 31 0d 20 20 39 31 30  20 49 46 20 70 61 70 65  |+1.  910 IF pape|
00002330  72 3d 69 6e 6b 20 70 61  70 65 72 3d 70 61 70 65  |r=ink paper=pape|
00002340  72 2b 31 0d 20 20 39 32  30 20 49 46 20 70 61 70  |r+1.  920 IF pap|
00002350  65 72 3e 37 20 70 61 70  65 72 3d 31 0d 20 20 39  |er>7 paper=1.  9|
00002360  33 30 20 56 44 55 31 39  2c 30 2c 70 61 70 65 72  |30 VDU19,0,paper|
00002370  3b 30 3b 0d 20 20 39 34  30 20 49 46 20 6d 6f 64  |;0;.  940 IF mod|
00002380  65 3d 37 20 50 52 4f 43  73 65 76 65 6e 0d 20 20  |e=7 PROCseven.  |
00002390  39 35 30 20 50 52 4f 43  64 65 6c 61 79 0d 20 20  |950 PROCdelay.  |
000023a0  39 36 30 20 45 4e 44 50  52 4f 43 0d 20 20 39 37  |960 ENDPROC.  97|
000023b0  30 20 3a 0d 20 20 39 38  30 20 44 45 46 50 52 4f  |0 :.  980 DEFPRO|
000023c0  43 73 65 76 65 6e 0d 20  20 39 39 30 20 49 46 20  |Cseven.  990 IF |
000023d0  69 6e 6b 3d 30 20 69 6e  6b 3d 31 0d 20 31 30 30  |ink=0 ink=1. 100|
000023e0  30 20 46 4f 52 20 6c 69  6e 65 3d 30 20 54 4f 20  |0 FOR line=0 TO |
000023f0  32 34 0d 20 31 30 31 30  20 49 46 20 70 61 70 65  |24. 1010 IF pape|
00002400  72 3d 30 20 56 44 55 33  31 2c 30 2c 6c 69 6e 65  |r=0 VDU31,0,line|
00002410  2c 31 32 38 2b 69 6e 6b  2c 33 32 2c 33 32 0d 20  |,128+ink,32,32. |
00002420  20 20 20 20 20 45 4c 53  45 20 56 44 55 33 31 2c  |     ELSE VDU31,|
00002430  30 2c 6c 69 6e 65 2c 31  32 38 2b 70 61 70 65 72  |0,line,128+paper|
00002440  2c 31 35 37 2c 31 32 38  2b 69 6e 6b 0d 20 31 30  |,157,128+ink. 10|
00002450  32 30 20 4e 45 58 54 0d  20 31 30 33 30 20 50 52  |20 NEXT. 1030 PR|
00002460  4f 43 64 65 6c 61 79 0d  20 31 30 34 30 20 45 4e  |OCdelay. 1040 EN|
00002470  44 50 52 4f 43 0d 20 31  30 35 30 20 3a 0d 20 31  |DPROC. 1050 :. 1|
00002480  30 36 30 20 44 45 46 50  52 4f 43 77 72 69 74 65  |060 DEFPROCwrite|
00002490  28 64 61 74 61 2c 61 64  64 72 29 0d 20 31 30 37  |(data,addr). 107|
000024a0  30 20 49 46 20 68 6f 73  74 20 3f 61 64 64 72 3d  |0 IF host ?addr=|
000024b0  64 61 74 61 3a 45 4e 44  50 52 4f 43 0d 20 31 30  |data:ENDPROC. 10|
000024c0  38 30 20 21 70 61 72 61  6d 3d 61 64 64 72 20 4f  |80 !param=addr O|
000024d0  52 20 26 46 46 46 46 30  30 30 30 0d 20 31 30 39  |R &FFFF0000. 109|
000024e0  30 20 70 61 72 61 6d 3f  34 3d 64 61 74 61 0d 20  |0 param?4=data. |
000024f0  31 31 30 30 20 41 25 3d  36 0d 20 31 31 31 30 20  |1100 A%=6. 1110 |
00002500  58 25 3d 70 61 72 61 6d  20 4d 4f 44 20 32 35 36  |X%=param MOD 256|
00002510  0d 20 31 31 32 30 20 59  25 3d 70 61 72 61 6d 20  |. 1120 Y%=param |
00002520  44 49 56 20 32 35 36 0d  20 31 31 33 30 20 43 41  |DIV 256. 1130 CA|
00002530  4c 4c 20 6f 73 77 6f 72  64 0d 20 31 31 34 30 20  |LL osword. 1140 |
00002540  45 4e 44 50 52 4f 43 0d  20 31 31 35 30 20 3a 0d  |ENDPROC. 1150 :.|
00002550  20 31 31 36 30 20 44 45  46 46 4e 72 65 61 64 28  | 1160 DEFFNread(|
00002560  61 64 64 72 29 0d 20 31  31 37 30 20 49 46 20 68  |addr). 1170 IF h|
00002570  6f 73 74 20 3d 3f 61 64  64 72 0d 20 31 31 38 30  |ost =?addr. 1180|
00002580  20 21 70 61 72 61 6d 3d  61 64 64 72 20 4f 52 20  | !param=addr OR |
00002590  26 46 46 46 46 30 30 30  30 0d 20 31 31 39 30 20  |&FFFF0000. 1190 |
000025a0  41 25 3d 35 0d 20 31 32  30 30 20 58 25 3d 70 61  |A%=5. 1200 X%=pa|
000025b0  72 61 6d 20 4d 4f 44 20  32 35 36 0d 20 31 32 31  |ram MOD 256. 121|
000025c0  30 20 59 25 3d 70 61 72  61 6d 20 44 49 56 20 32  |0 Y%=param DIV 2|
000025d0  35 36 0d 20 31 32 32 30  20 43 41 4c 4c 20 6f 73  |56. 1220 CALL os|
000025e0  77 6f 72 64 0d 20 31 32  33 30 20 3d 70 61 72 61  |word. 1230 =para|
000025f0  6d 3f 34 0d 20 31 32 34  30 20 3a 0d 20 31 32 35  |m?4. 1240 :. 125|
00002600  30 20 44 45 46 50 52 4f  43 6d 63 6f 64 65 0d 20  |0 DEFPROCmcode. |
00002610  31 32 36 30 20 66 69 72  65 3d 26 37 32 20 3a 52  |1260 fire=&72 :R|
00002620  45 4d 3a 20 66 69 72 65  20 62 75 74 74 6f 6e 20  |EM: fire button |
00002630  73 74 61 74 75 73 0d 20  31 32 37 30 20 75 73 65  |status. 1270 use|
00002640  72 76 3d 26 32 30 30 20  3a 52 45 4d 3a 20 75 73  |rv=&200 :REM: us|
00002650  65 72 20 76 65 63 74 6f  72 0d 20 31 32 38 30 20  |er vector. 1280 |
00002660  69 72 71 32 76 3d 26 32  30 36 20 3a 52 45 4d 3a  |irq2v=&206 :REM:|
00002670  20 73 65 63 6f 6e 64 61  72 79 20 69 6e 74 65 72  | secondary inter|
00002680  72 75 70 74 20 76 65 63  74 6f 72 0d 20 31 32 39  |rupt vector. 129|
00002690  30 20 73 74 61 72 74 3d  26 33 35 30 20 3a 52 45  |0 start=&350 :RE|
000026a0  4d 3a 20 73 63 72 65 65  6e 20 73 74 61 72 74 20  |M: screen start |
000026b0  61 64 64 72 65 73 73 0d  20 31 33 30 30 20 73 63  |address. 1300 sc|
000026c0  72 65 65 6e 3d 26 33 35  35 20 3a 52 45 4d 3a 20  |reen=&355 :REM: |
000026d0  73 63 72 65 65 6e 20 6d  6f 64 65 20 4f 53 20 31  |screen mode OS 1|
000026e0  2e 32 0d 20 31 33 31 30  20 69 6f 61 64 64 72 3d  |.2. 1310 ioaddr=|
000026f0  26 41 30 30 20 3a 52 45  4d 3a 20 61 73 73 65 6d  |&A00 :REM: assem|
00002700  62 6c 65 20 66 6f 72 20  26 41 30 30 0d 20 31 33  |ble for &A00. 13|
00002710  32 30 20 73 68 65 69 6c  61 3d 26 46 45 30 30 0d  |20 sheila=&FE00.|
00002720  20 31 33 33 30 20 64 72  62 3d 26 46 45 34 30 20  | 1330 drb=&FE40 |
00002730  3a 52 45 4d 3a 20 73 79  73 74 65 6d 20 36 35 32  |:REM: system 652|
00002740  32 20 69 6e 70 75 74 2f  6f 75 74 70 75 74 20 72  |2 input/output r|
00002750  65 67 69 73 74 65 72 20  42 0d 20 31 33 34 30 20  |egister B. 1340 |
00002760  69 66 72 3d 26 46 45 34  44 20 3a 52 45 4d 3a 20  |ifr=&FE4D :REM: |
00002770  73 79 73 74 65 6d 20 36  35 32 32 20 69 6e 74 65  |system 6522 inte|
00002780  72 72 75 70 74 20 66 6c  61 67 20 72 65 67 69 73  |rrupt flag regis|
00002790  74 65 72 0d 20 31 33 35  30 20 69 65 72 3d 26 46  |ter. 1350 ier=&F|
000027a0  45 34 45 20 3a 52 45 4d  3a 20 73 79 73 74 65 6d  |E4E :REM: system|
000027b0  20 36 35 32 32 20 69 6e  74 65 72 72 75 70 74 20  | 6522 interrupt |
000027c0  65 6e 61 62 6c 65 20 72  65 67 69 73 74 65 72 0d  |enable register.|
000027d0  20 31 33 36 30 20 46 4f  52 20 70 61 73 73 3d 34  | 1360 FOR pass=4|
000027e0  20 54 4f 20 36 20 53 54  45 50 20 32 0d 20 31 33  | TO 6 STEP 2. 13|
000027f0  37 30 20 4f 25 3d 6d 63  6f 64 65 0d 20 31 33 38  |70 O%=mcode. 138|
00002800  30 20 50 25 3d 69 6f 61  64 64 72 0d 20 31 33 39  |0 P%=ioaddr. 139|
00002810  30 20 5b 20 20 20 20 20  20 20 4f 50 54 20 70 61  |0 [       OPT pa|
00002820  73 73 0d 20 31 34 30 30  20 20 20 20 20 20 20 20  |ss. 1400        |
00002830  20 43 4d 50 20 23 26 30  30 20 20 20 20 20 20 5c  | CMP #&00      \|
00002840  20 69 73 20 74 68 69 73  20 2a 43 4f 44 45 3f 0d  | is this *CODE?.|
00002850  20 31 34 31 30 20 20 20  20 20 20 20 20 20 42 45  | 1410         BE|
00002860  51 20 73 74 61 72 63 6f  64 65 0d 20 31 34 32 30  |Q starcode. 1420|
00002870  20 20 20 20 20 20 20 20  20 52 54 53 20 20 20 20  |         RTS    |
00002880  20 20 20 20 20 20 20 5c  20 72 65 74 75 72 6e 20  |       \ return |
00002890  69 66 20 2a 4c 49 4e 45  0d 20 31 34 33 30 20 2e  |if *LINE. 1430 .|
000028a0  73 74 61 72 63 6f 64 65  0d 20 31 34 34 30 20 20  |starcode. 1440  |
000028b0  20 20 20 20 20 20 20 4c  44 58 20 69 72 71 32 76  |       LDX irq2v|
000028c0  20 20 20 20 20 5c 20 73  65 63 6f 6e 64 61 72 79  |     \ secondary|
000028d0  20 69 6e 74 65 72 72 75  70 74 20 76 65 63 74 6f  | interrupt vecto|
000028e0  72 2c 20 6c 6f 77 20 62  79 74 65 0d 20 31 34 35  |r, low byte. 145|
000028f0  30 20 20 20 20 20 20 20  20 20 4c 44 59 20 69 72  |0         LDY ir|
00002900  71 32 76 2b 31 20 20 20  5c 20 73 65 63 6f 6e 64  |q2v+1   \ second|
00002910  61 72 79 20 69 6e 74 65  72 72 75 70 74 20 76 65  |ary interrupt ve|
00002920  63 74 6f 72 2c 20 68 69  67 68 20 62 79 74 65 0d  |ctor, high byte.|
00002930  20 31 34 36 30 20 20 20  20 20 20 20 20 20 43 50  | 1460         CP|
00002940  59 20 23 69 6e 74 65 72  72 75 70 74 20 44 49 56  |Y #interrupt DIV|
00002950  20 32 35 36 20 5c 20 68  61 73 20 74 68 65 20 68  | 256 \ has the h|
00002960  69 67 68 20 62 79 74 65  20 62 65 65 6e 20 61 6c  |igh byte been al|
00002970  74 65 72 65 64 3f 0d 20  31 34 37 30 20 20 20 20  |tered?. 1470    |
00002980  20 20 20 20 20 42 45 51  20 64 69 73 61 62 6c 65  |     BEQ disable|
00002990  20 20 20 5c 20 72 65 73  74 6f 72 65 20 6f 72 69  |   \ restore ori|
000029a0  67 69 6e 61 6c 20 76 65  63 74 6f 72 20 69 66 20  |ginal vector if |
000029b0  61 6c 74 65 72 65 64 0d  20 31 34 38 30 20 20 20  |altered. 1480   |
000029c0  20 20 20 20 20 20 53 54  58 20 6f 6c 64 69 72 71  |      STX oldirq|
000029d0  32 76 20 20 5c 20 73 74  6f 72 65 20 6f 72 69 67  |2v  \ store orig|
000029e0  69 6e 61 6c 20 76 65 63  74 6f 72 2c 20 6c 6f 77  |inal vector, low|
000029f0  20 62 79 74 65 0d 20 31  34 39 30 20 20 20 20 20  | byte. 1490     |
00002a00  20 20 20 20 53 54 59 20  6f 6c 64 69 72 71 32 76  |    STY oldirq2v|
00002a10  2b 31 20 5c 20 73 74 6f  72 65 20 6f 72 69 67 69  |+1 \ store origi|
00002a20  6e 61 6c 20 76 65 63 74  6f 72 2c 20 68 69 67 68  |nal vector, high|
00002a30  20 62 79 74 65 0d 20 31  35 30 30 20 20 20 20 20  | byte. 1500     |
00002a40  20 20 20 20 4c 44 58 20  23 69 6e 74 65 72 72 75  |    LDX #interru|
00002a50  70 74 20 4d 4f 44 20 32  35 36 20 5c 20 6e 65 77  |pt MOD 256 \ new|
00002a60  20 69 6e 74 65 72 72 75  70 74 20 63 6f 64 65 2c  | interrupt code,|
00002a70  20 6c 6f 77 20 62 79 74  65 0d 20 31 35 31 30 20  | low byte. 1510 |
00002a80  20 20 20 20 20 20 20 20  4c 44 59 20 23 69 6e 74  |        LDY #int|
00002a90  65 72 72 75 70 74 20 44  49 56 20 32 35 36 20 5c  |errupt DIV 256 \|
00002aa0  20 6e 65 77 20 69 6e 74  65 72 72 75 70 74 20 63  | new interrupt c|
00002ab0  6f 64 65 2c 20 68 69 67  68 20 62 79 74 65 0d 20  |ode, high byte. |
00002ac0  31 35 32 30 20 20 20 20  20 20 20 20 20 53 45 49  |1520         SEI|
00002ad0  20 20 20 20 20 20 20 20  20 20 20 5c 20 73 65 74  |           \ set|
00002ae0  20 69 6e 74 65 72 72 75  70 74 20 64 69 73 61 62  | interrupt disab|
00002af0  6c 65 20 66 6c 61 67 0d  20 31 35 33 30 20 20 20  |le flag. 1530   |
00002b00  20 20 20 20 20 20 53 54  58 20 69 72 71 32 76 20  |      STX irq2v |
00002b10  20 20 20 20 5c 20 61 6c  74 65 72 20 76 65 63 74  |    \ alter vect|
00002b20  6f 72 2c 20 6c 6f 77 20  62 79 74 65 0d 20 31 35  |or, low byte. 15|
00002b30  34 30 20 20 20 20 20 20  20 20 20 53 54 59 20 69  |40         STY i|
00002b40  72 71 32 76 2b 31 20 20  20 5c 20 61 6c 74 65 72  |rq2v+1   \ alter|
00002b50  20 76 65 63 74 6f 72 2c  20 68 69 67 68 20 62 79  | vector, high by|
00002b60  74 65 0d 20 31 35 35 30  20 20 20 20 20 20 20 20  |te. 1550        |
00002b70  20 43 4c 49 20 20 20 20  20 20 20 20 20 20 20 5c  | CLI           \|
00002b80  20 63 6c 65 61 72 20 69  6e 74 65 72 72 75 70 74  | clear interrupt|
00002b90  20 64 69 73 61 62 6c 65  20 66 6c 61 67 0d 20 31  | disable flag. 1|
00002ba0  35 36 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |560         LDA |
00002bb0  23 26 38 38 20 20 20 20  20 20 5c 20 25 31 30 30  |#&88      \ %100|
00002bc0  30 31 30 30 30 0d 20 31  35 37 30 20 20 20 20 20  |01000. 1570     |
00002bd0  20 20 20 20 53 54 41 20  69 65 72 20 20 20 20 20  |    STA ier     |
00002be0  20 20 5c 20 65 6e 61 62  6c 65 20 6c 69 67 68 74  |  \ enable light|
00002bf0  20 70 65 6e 20 69 6e 74  65 72 72 75 70 74 73 0d  | pen interrupts.|
00002c00  20 31 35 38 30 20 20 20  20 20 20 20 20 20 52 54  | 1580         RT|
00002c10  53 0d 20 31 35 39 30 20  2e 64 69 73 61 62 6c 65  |S. 1590 .disable|
00002c20  0d 20 31 36 30 30 20 20  20 20 20 20 20 20 20 4c  |. 1600         L|
00002c30  44 41 20 23 26 30 38 20  20 20 20 20 20 5c 20 25  |DA #&08      \ %|
00002c40  30 30 30 30 31 30 30 30  20 72 65 61 64 79 20 74  |00001000 ready t|
00002c50  6f 20 64 69 73 61 62 6c  65 20 6c 69 67 68 74 20  |o disable light |
00002c60  70 65 6e 0d 20 20 20 20  20 20 20 20 20 20 20 20  |pen.            |
00002c70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002c80  5c 20 69 6e 74 65 72 72  75 70 74 73 0d 20 31 36  |\ interrupts. 16|
00002c90  31 30 20 20 20 20 20 20  20 20 20 4c 44 58 20 6f  |10         LDX o|
00002ca0  6c 64 69 72 71 32 76 20  20 5c 20 6f 72 69 67 69  |ldirq2v  \ origi|
00002cb0  6e 61 6c 20 69 72 71 32  20 76 65 63 74 6f 72 2c  |nal irq2 vector,|
00002cc0  20 6c 6f 77 20 62 79 74  65 0d 20 31 36 32 30 20  | low byte. 1620 |
00002cd0  20 20 20 20 20 20 20 20  4c 44 59 20 6f 6c 64 69  |        LDY oldi|
00002ce0  72 71 32 76 2b 31 20 5c  20 6f 72 69 67 69 6e 61  |rq2v+1 \ origina|
00002cf0  6c 20 69 72 71 32 20 76  65 63 74 6f 72 2c 20 68  |l irq2 vector, h|
00002d00  69 67 68 20 62 79 74 65  0d 20 31 36 33 30 20 20  |igh byte. 1630  |
00002d10  20 20 20 20 20 20 20 53  45 49 20 20 20 20 20 20  |       SEI      |
00002d20  20 20 20 20 20 5c 20 73  65 74 20 69 6e 74 65 72  |     \ set inter|
00002d30  72 75 70 74 20 64 69 73  61 62 6c 65 20 66 6c 61  |rupt disable fla|
00002d40  67 0d 20 31 36 34 30 20  20 20 20 20 20 20 20 20  |g. 1640         |
00002d50  53 54 41 20 69 65 72 20  20 20 20 20 20 20 5c 20  |STA ier       \ |
00002d60  64 69 73 61 62 6c 65 20  6c 69 67 68 74 20 70 65  |disable light pe|
00002d70  6e 20 69 6e 74 65 72 72  75 70 74 0d 20 31 36 35  |n interrupt. 165|
00002d80  30 20 20 20 20 20 20 20  20 20 53 54 58 20 69 72  |0         STX ir|
00002d90  71 32 76 20 20 20 20 20  5c 20 72 65 73 74 6f 72  |q2v     \ restor|
00002da0  65 20 6f 72 69 67 69 6e  61 6c 20 76 65 63 74 6f  |e original vecto|
00002db0  72 2c 20 6c 6f 77 20 62  79 74 65 0d 20 31 36 36  |r, low byte. 166|
00002dc0  30 20 20 20 20 20 20 20  20 20 53 54 59 20 69 72  |0         STY ir|
00002dd0  71 32 76 2b 31 20 20 20  5c 20 72 65 73 74 6f 72  |q2v+1   \ restor|
00002de0  65 20 6f 72 69 67 69 6e  61 6c 20 76 65 63 74 6f  |e original vecto|
00002df0  72 2c 20 68 69 67 68 20  62 79 74 65 0d 20 31 36  |r, high byte. 16|
00002e00  37 30 20 20 20 20 20 20  20 20 20 43 4c 49 20 20  |70         CLI  |
00002e10  20 20 20 20 20 20 20 20  20 5c 20 63 6c 65 61 72  |         \ clear|
00002e20  20 69 6e 74 65 72 72 75  70 74 20 64 69 73 61 62  | interrupt disab|
00002e30  6c 65 20 66 6c 61 67 0d  20 31 36 38 30 20 20 20  |le flag. 1680   |
00002e40  20 20 20 20 20 20 52 54  53 0d 20 31 36 39 30 20  |      RTS. 1690 |
00002e50  2e 65 78 69 74 0d 20 31  37 30 30 20 20 20 20 20  |.exit. 1700     |
00002e60  20 20 20 20 50 4c 41 20  20 20 20 20 20 20 20 20  |    PLA         |
00002e70  20 20 5c 20 70 75 6c 6c  20 69 6e 74 65 72 72 75  |  \ pull interru|
00002e80  70 74 20 61 63 63 75 6d  75 6c 61 74 6f 72 20 73  |pt accumulator s|
00002e90  61 76 65 20 72 65 67 69  73 74 65 72 0d 20 31 37  |ave register. 17|
00002ea0  31 30 20 20 20 20 20 20  20 20 20 53 54 41 20 26  |10         STA &|
00002eb0  46 43 20 20 20 20 20 20  20 5c 20 72 65 73 74 6f  |FC       \ resto|
00002ec0  72 65 20 69 6e 74 65 72  72 75 70 74 20 61 63 63  |re interrupt acc|
00002ed0  75 6d 75 6c 61 74 6f 72  20 73 61 76 65 20 72 65  |umulator save re|
00002ee0  67 69 73 74 65 72 0d 20  31 37 32 30 20 20 20 20  |gister. 1720    |
00002ef0  20 20 20 20 20 4a 4d 50  20 28 6f 6c 64 69 72 71  |     JMP (oldirq|
00002f00  32 76 29 20 5c 20 65 78  69 74 20 76 69 61 20 6f  |2v) \ exit via o|
00002f10  72 69 67 69 6e 61 6c 20  76 65 63 74 6f 72 0d 20  |riginal vector. |
00002f20  31 37 33 30 20 2e 69 6e  74 65 72 72 75 70 74 0d  |1730 .interrupt.|
00002f30  20 31 37 34 30 20 20 20  20 20 20 20 20 20 4c 44  | 1740         LD|
00002f40  41 20 26 46 43 20 20 20  20 20 20 20 5c 20 6c 6f  |A &FC       \ lo|
00002f50  61 64 20 69 6e 74 65 72  72 75 70 74 20 61 63 63  |ad interrupt acc|
00002f60  75 6d 75 6c 61 74 6f 72  20 73 61 76 65 20 72 65  |umulator save re|
00002f70  67 69 73 74 65 72 0d 20  31 37 35 30 20 20 20 20  |gister. 1750    |
00002f80  20 20 20 20 20 50 48 41  20 20 20 20 20 20 20 20  |     PHA        |
00002f90  20 20 20 5c 20 61 6e 64  20 70 75 73 68 20 69 74  |   \ and push it|
00002fa0  20 6f 6e 20 74 68 65 20  73 74 61 63 6b 0d 20 31  | on the stack. 1|
00002fb0  37 36 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |760         LDA |
00002fc0  69 66 72 20 20 20 20 20  20 20 5c 20 6c 6f 61 64  |ifr       \ load|
00002fd0  20 73 79 73 74 65 6d 20  56 49 41 20 69 6e 74 65  | system VIA inte|
00002fe0  72 72 75 70 74 20 73 74  61 74 75 73 0d 20 31 37  |rrupt status. 17|
00002ff0  37 30 20 20 20 20 20 20  20 20 20 42 50 4c 20 65  |70         BPL e|
00003000  78 69 74 20 20 20 20 20  20 5c 20 65 78 69 74 20  |xit      \ exit |
00003010  69 66 20 62 69 74 20 37  20 63 6c 65 61 72 0d 20  |if bit 7 clear. |
00003020  31 37 38 30 20 20 20 20  20 20 20 20 20 41 4e 44  |1780         AND|
00003030  20 23 26 30 38 20 20 20  20 20 20 5c 20 41 4e 44  | #&08      \ AND|
00003040  20 77 69 74 68 20 25 30  30 30 30 31 30 30 30 0d  | with %00001000.|
00003050  20 31 37 39 30 20 20 20  20 20 20 20 20 20 42 45  | 1790         BE|
00003060  51 20 65 78 69 74 20 20  20 20 20 20 5c 20 65 78  |Q exit      \ ex|
00003070  69 74 20 69 66 20 6e 6f  74 20 6c 69 67 68 74 20  |it if not light |
00003080  70 65 6e 20 69 6e 74 65  72 72 75 70 74 0d 20 31  |pen interrupt. 1|
00003090  38 30 30 20 20 20 20 20  20 20 20 20 54 58 41 0d  |800         TXA.|
000030a0  20 31 38 31 30 20 20 20  20 20 20 20 20 20 50 48  | 1810         PH|
000030b0  41 0d 20 31 38 32 30 20  20 20 20 20 20 20 20 20  |A. 1820         |
000030c0  54 59 41 0d 20 31 38 33  30 20 20 20 20 20 20 20  |TYA. 1830       |
000030d0  20 20 50 48 41 0d 20 31  38 34 30 20 20 20 20 20  |  PHA. 1840     |
000030e0  20 20 20 20 4c 44 41 20  64 72 62 20 20 20 20 20  |    LDA drb     |
000030f0  20 20 5c 20 63 6c 65 61  72 20 69 6e 74 65 72 72  |  \ clear interr|
00003100  75 70 74 0d 20 31 38 35  30 20 20 20 20 20 20 20  |upt. 1850       |
00003110  20 20 50 48 41 20 20 20  20 20 20 20 20 20 20 20  |  PHA           |
00003120  5c 20 70 75 73 68 20 64  61 74 61 20 72 65 67 69  |\ push data regi|
00003130  73 74 65 72 20 42 0d 20  31 38 36 30 20 20 20 20  |ster B. 1860    |
00003140  20 20 20 20 20 43 4c 44  20 20 20 20 20 20 20 20  |     CLD        |
00003150  20 20 20 5c 20 63 6c 65  61 72 20 64 65 63 69 6d  |   \ clear decim|
00003160  61 6c 20 66 6c 61 67 0d  20 31 38 37 30 20 20 20  |al flag. 1870   |
00003170  20 20 20 20 20 20 4c 44  59 20 73 63 72 65 65 6e  |      LDY screen|
00003180  20 20 20 20 5c 20 73 63  72 65 65 6e 20 6d 6f 64  |    \ screen mod|
00003190  65 20 69 6e 74 6f 20 59  20 72 65 67 69 73 74 65  |e into Y registe|
000031a0  72 0d 20 31 38 38 30 20  20 20 20 20 20 20 20 20  |r. 1880         |
000031b0  4c 44 41 20 73 74 61 72  74 20 20 20 20 20 5c 20  |LDA start     \ |
000031c0  73 63 72 65 65 6e 20 73  74 61 72 74 20 61 64 64  |screen start add|
000031d0  72 65 73 73 2c 20 6c 6f  77 20 62 79 74 65 0d 20  |ress, low byte. |
000031e0  31 38 39 30 20 20 20 20  20 20 20 20 20 53 54 41  |1890         STA|
000031f0  20 79 63 6f 6f 72 64 0d  20 31 39 30 30 20 20 20  | ycoord. 1900   |
00003200  20 20 20 20 20 20 4c 44  41 20 73 74 61 72 74 2b  |      LDA start+|
00003210  31 20 20 20 5c 20 73 63  72 65 65 6e 20 73 74 61  |1   \ screen sta|
00003220  72 74 20 61 64 64 72 65  73 73 2c 20 68 69 67 68  |rt address, high|
00003230  20 62 79 74 65 0d 20 31  39 31 30 20 20 20 20 20  | byte. 1910     |
00003240  20 20 20 20 53 54 41 20  79 63 6f 6f 72 64 2b 31  |    STA ycoord+1|
00003250  0d 20 31 39 32 30 20 20  20 20 20 20 20 20 20 43  |. 1920         C|
00003260  50 59 20 23 26 30 37 20  20 20 20 20 20 5c 20 69  |PY #&07      \ i|
00003270  73 20 74 68 69 73 20 6d  6f 64 65 20 37 3f 0d 20  |s this mode 7?. |
00003280  31 39 33 30 20 20 20 20  20 20 20 20 20 42 45 51  |1930         BEQ|
00003290  20 6d 6f 64 65 37 0d 20  31 39 34 30 20 20 20 20  | mode7. 1940    |
000032a0  20 20 20 20 20 4c 53 52  20 79 63 6f 6f 72 64 2b  |     LSR ycoord+|
000032b0  31 0d 20 31 39 35 30 20  20 20 20 20 20 20 20 20  |1. 1950         |
000032c0  52 4f 52 20 79 63 6f 6f  72 64 20 20 20 20 5c 20  |ROR ycoord    \ |
000032d0  73 74 61 72 74 20 61 64  64 72 65 73 73 20 44 49  |start address DI|
000032e0  56 20 32 0d 20 31 39 36  30 20 20 20 20 20 20 20  |V 2. 1960       |
000032f0  20 20 4c 53 52 20 79 63  6f 6f 72 64 2b 31 0d 20  |  LSR ycoord+1. |
00003300  31 39 37 30 20 20 20 20  20 20 20 20 20 52 4f 52  |1970         ROR|
00003310  20 79 63 6f 6f 72 64 20  20 20 20 5c 20 73 74 61  | ycoord    \ sta|
00003320  72 74 20 61 64 64 72 65  73 73 20 44 49 56 20 34  |rt address DIV 4|
00003330  0d 20 31 39 38 30 20 20  20 20 20 20 20 20 20 4c  |. 1980         L|
00003340  53 52 20 79 63 6f 6f 72  64 2b 31 0d 20 31 39 39  |SR ycoord+1. 199|
00003350  30 20 20 20 20 20 20 20  20 20 52 4f 52 20 79 63  |0         ROR yc|
00003360  6f 6f 72 64 20 20 20 20  5c 20 73 74 61 72 74 20  |oord    \ start |
00003370  61 64 64 72 65 73 73 20  44 49 56 20 38 0d 20 32  |address DIV 8. 2|
00003380  30 30 30 20 20 20 20 20  20 20 20 20 4a 4d 50 20  |000         JMP |
00003390  63 6f 6e 74 69 6e 75 65  20 20 5c 20 73 6b 69 70  |continue  \ skip|
000033a0  20 6d 6f 64 65 20 37 20  63 61 6c 63 75 6c 61 74  | mode 7 calculat|
000033b0  69 6f 6e 0d 20 32 30 31  30 20 2e 6d 6f 64 65 37  |ion. 2010 .mode7|
000033c0  0d 20 32 30 32 30 20 20  20 20 20 20 20 20 20 53  |. 2020         S|
000033d0  45 43 20 20 20 20 20 20  20 20 20 20 20 5c 20 70  |EC           \ p|
000033e0  72 65 70 61 72 65 20 66  6f 72 20 73 75 62 74 72  |repare for subtr|
000033f0  61 63 74 69 6f 6e 0d 20  32 30 33 30 20 20 20 20  |action. 2030    |
00003400  20 20 20 20 20 4c 44 41  20 79 63 6f 6f 72 64 2b  |     LDA ycoord+|
00003410  31 0d 20 32 30 34 30 20  20 20 20 20 20 20 20 20  |1. 2040         |
00003420  53 42 43 20 23 26 35 34  0d 20 32 30 35 30 20 20  |SBC #&54. 2050  |
00003430  20 20 20 20 20 20 20 53  54 41 20 79 63 6f 6f 72  |       STA ycoor|
00003440  64 2b 31 20 20 5c 20 73  75 62 74 72 61 63 74 20  |d+1  \ subtract |
00003450  26 35 34 30 30 20 66 72  6f 6d 20 73 74 61 72 74  |&5400 from start|
00003460  20 61 64 64 72 65 73 73  0d 20 32 30 36 30 20 2e  | address. 2060 .|
00003470  63 6f 6e 74 69 6e 75 65  0d 20 32 30 37 30 20 20  |continue. 2070  |
00003480  20 20 20 20 20 20 20 4c  44 41 20 6f 66 66 73 65  |       LDA offse|
00003490  74 6c 6f 77 2c 59 0d 20  32 30 38 30 20 20 20 20  |tlow,Y. 2080    |
000034a0  20 20 20 20 20 43 4c 43  20 20 20 20 20 20 20 20  |     CLC        |
000034b0  20 20 20 5c 20 70 72 65  70 61 72 65 20 66 6f 72  |   \ prepare for|
000034c0  20 61 64 64 69 74 69 6f  6e 0d 20 32 30 39 30 20  | addition. 2090 |
000034d0  20 20 20 20 20 20 20 20  41 44 43 20 79 63 6f 6f  |        ADC ycoo|
000034e0  72 64 20 20 20 20 5c 20  61 64 64 20 74 72 69 6d  |rd    \ add trim|
000034f0  20 74 6f 20 6f 66 66 73  65 74 0d 20 32 31 30 30  | to offset. 2100|
00003500  20 20 20 20 20 20 20 20  20 53 54 41 20 79 63 6f  |         STA yco|
00003510  6f 72 64 0d 20 32 31 31  30 20 20 20 20 20 20 20  |ord. 2110       |
00003520  20 20 4c 44 41 20 23 26  30 30 0d 20 32 31 32 30  |  LDA #&00. 2120|
00003530  20 20 20 20 20 20 20 20  20 41 44 43 20 79 63 6f  |         ADC yco|
00003540  6f 72 64 2b 31 0d 20 32  31 33 30 20 20 20 20 20  |ord+1. 2130     |
00003550  20 20 20 20 53 54 41 20  79 63 6f 6f 72 64 2b 31  |    STA ycoord+1|
00003560  0d 20 32 31 34 30 20 20  20 20 20 20 20 20 20 53  |. 2140         S|
00003570  45 43 20 20 20 20 20 20  20 20 20 20 20 5c 20 70  |EC           \ p|
00003580  72 65 70 61 72 65 20 74  6f 20 73 75 62 74 72 61  |repare to subtra|
00003590  63 74 20 6f 66 66 73 65  74 20 66 72 6f 6d 20 6c  |ct offset from l|
000035a0  70 20 72 65 67 69 73 74  65 72 0d 20 32 31 35 30  |p register. 2150|
000035b0  20 20 20 20 20 20 20 20  20 4c 44 58 20 23 26 31  |         LDX #&1|
000035c0  31 20 20 20 20 20 20 5c  20 6c 69 67 68 74 20 70  |1      \ light p|
000035d0  65 6e 20 72 65 67 69 73  74 65 72 2c 20 6c 6f 77  |en register, low|
000035e0  20 62 79 74 65 0d 20 32  31 36 30 20 20 20 20 20  | byte. 2160     |
000035f0  20 20 20 20 53 54 58 20  73 68 65 69 6c 61 20 20  |    STX sheila  |
00003600  20 20 5c 20 36 38 34 35  20 61 64 64 72 65 73 73  |  \ 6845 address|
00003610  20 72 65 67 69 73 74 65  72 0d 20 32 31 37 30 20  | register. 2170 |
00003620  20 20 20 20 20 20 20 20  4c 44 41 20 73 68 65 69  |        LDA shei|
00003630  6c 61 2b 31 20 20 5c 20  36 38 34 35 20 64 61 74  |la+1  \ 6845 dat|
00003640  61 20 72 65 67 69 73 74  65 72 0d 20 32 31 38 30  |a register. 2180|
00003650  20 20 20 20 20 20 20 20  20 53 42 43 20 79 63 6f  |         SBC yco|
00003660  6f 72 64 20 20 20 20 5c  20 73 75 62 74 72 61 63  |ord    \ subtrac|
00003670  74 20 6f 66 66 73 65 74  2c 20 6c 6f 77 20 62 79  |t offset, low by|
00003680  74 65 0d 20 32 31 39 30  20 20 20 20 20 20 20 20  |te. 2190        |
00003690  20 53 54 41 20 79 63 6f  6f 72 64 20 20 20 20 5c  | STA ycoord    \|
000036a0  20 6c 6f 77 20 62 79 74  65 20 2d 20 6f 66 66 73  | low byte - offs|
000036b0  65 74 0d 20 32 32 30 30  20 20 20 20 20 20 20 20  |et. 2200        |
000036c0  20 44 45 58 20 20 20 20  20 20 20 20 20 20 20 5c  | DEX           \|
000036d0  20 58 20 3d 20 26 31 30  2c 20 6c 69 67 68 74 20  | X = &10, light |
000036e0  70 65 6e 20 72 65 67 69  73 74 65 72 2c 20 68 69  |pen register, hi|
000036f0  67 68 20 62 79 74 65 0d  20 32 32 31 30 20 20 20  |gh byte. 2210   |
00003700  20 20 20 20 20 20 53 54  58 20 73 68 65 69 6c 61  |      STX sheila|
00003710  20 20 20 20 5c 20 36 38  34 35 20 61 64 64 72 65  |    \ 6845 addre|
00003720  73 73 20 72 65 67 69 73  74 65 72 0d 20 32 32 32  |ss register. 222|
00003730  30 20 20 20 20 20 20 20  20 20 4c 44 41 20 73 68  |0         LDA sh|
00003740  65 69 6c 61 2b 31 20 20  5c 20 36 38 34 35 20 64  |eila+1  \ 6845 d|
00003750  61 74 61 20 72 65 67 69  73 74 65 72 0d 20 32 32  |ata register. 22|
00003760  33 30 20 20 20 20 20 20  20 20 20 53 42 43 20 79  |30         SBC y|
00003770  63 6f 6f 72 64 2b 31 20  20 5c 20 73 75 62 74 72  |coord+1  \ subtr|
00003780  61 63 74 20 6f 66 66 73  65 74 2c 20 68 69 67 68  |act offset, high|
00003790  20 62 79 74 65 0d 20 32  32 34 30 20 20 20 20 20  | byte. 2240     |
000037a0  20 20 20 20 53 54 41 20  79 63 6f 6f 72 64 2b 31  |    STA ycoord+1|
000037b0  20 20 5c 20 68 69 67 68  20 62 79 74 65 20 2d 20  |  \ high byte - |
000037c0  6f 66 66 73 65 74 0d 20  32 32 35 30 20 20 20 20  |offset. 2250    |
000037d0  20 20 20 20 20 4c 44 41  20 23 26 30 30 20 20 20  |     LDA #&00   |
000037e0  20 20 20 5c 20 70 72 65  70 61 72 65 20 66 6f 72  |   \ prepare for|
000037f0  20 31 36 20 62 69 74 20  64 69 76 69 73 69 6f 6e  | 16 bit division|
00003800  0d 20 32 32 36 30 20 20  20 20 20 20 20 20 20 53  |. 2260         S|
00003810  54 41 20 78 63 6f 6f 72  64 20 20 20 20 5c 20 63  |TA xcoord    \ c|
00003820  6c 65 61 72 20 6c 6f 77  20 70 61 72 74 69 61 6c  |lear low partial|
00003830  20 64 69 76 69 64 65 6e  64 0d 20 32 32 37 30 20  | dividend. 2270 |
00003840  2e 6e 65 78 74 0d 20 32  32 38 30 20 20 20 20 20  |.next. 2280     |
00003850  20 20 20 20 41 53 4c 20  79 63 6f 6f 72 64 20 20  |    ASL ycoord  |
00003860  20 20 5c 20 73 68 69 66  74 20 64 69 76 69 64 65  |  \ shift divide|
00003870  6e 64 2f 71 75 6f 74 69  65 6e 74 20 6c 65 66 74  |nd/quotient left|
00003880  0d 20 32 32 39 30 20 20  20 20 20 20 20 20 20 52  |. 2290         R|
00003890  4f 4c 20 79 63 6f 6f 72  64 2b 31 20 20 5c 20 73  |OL ycoord+1  \ s|
000038a0  68 69 66 74 20 64 69 76  69 64 65 6e 64 2f 71 75  |hift dividend/qu|
000038b0  6f 74 69 65 6e 74 20 6c  65 66 74 0d 20 32 33 30  |otient left. 230|
000038c0  30 20 20 20 20 20 20 20  20 20 52 4f 4c 20 78 63  |0         ROL xc|
000038d0  6f 6f 72 64 20 20 20 20  5c 20 73 68 69 66 74 20  |oord    \ shift |
000038e0  62 69 74 73 20 69 6e 74  6f 20 70 61 72 74 69 61  |bits into partia|
000038f0  6c 20 64 69 76 69 64 65  6e 64 0d 20 32 33 31 30  |l dividend. 2310|
00003900  20 20 20 20 20 20 20 20  20 4c 44 41 20 78 63 6f  |         LDA xco|
00003910  6f 72 64 20 20 20 20 5c  20 6c 6f 61 64 20 70 61  |ord    \ load pa|
00003920  72 74 69 61 6c 20 64 69  76 69 64 65 6e 64 0d 20  |rtial dividend. |
00003930  32 33 32 30 20 20 20 20  20 20 20 20 20 53 45 43  |2320         SEC|
00003940  20 20 20 20 20 20 20 20  20 20 20 5c 20 70 72 65  |           \ pre|
00003950  70 61 72 65 20 66 6f 72  20 73 75 62 74 72 61 63  |pare for subtrac|
00003960  74 69 6f 6e 0d 20 32 33  33 30 20 20 20 20 20 20  |tion. 2330      |
00003970  20 20 20 53 42 43 20 77  69 64 74 68 2c 59 20 20  |   SBC width,Y  |
00003980  20 5c 20 73 75 62 74 72  61 63 74 20 64 69 76 69  | \ subtract divi|
00003990  73 6f 72 0d 20 32 33 34  30 20 20 20 20 20 20 20  |sor. 2340       |
000039a0  20 20 42 43 43 20 64 6f  6e 65 20 20 20 20 20 20  |  BCC done      |
000039b0  5c 20 62 72 61 6e 63 68  20 69 66 20 64 69 76 69  |\ branch if divi|
000039c0  64 65 6e 64 20 3c 20 64  69 76 69 73 6f 72 0d 20  |dend < divisor. |
000039d0  32 33 35 30 20 20 20 20  20 20 20 20 20 49 4e 43  |2350         INC|
000039e0  20 79 63 6f 6f 72 64 20  20 20 20 5c 20 69 6e 63  | ycoord    \ inc|
000039f0  72 65 6d 65 6e 74 20 71  75 6f 74 69 65 6e 74 0d  |rement quotient.|
00003a00  20 32 33 36 30 20 20 20  20 20 20 20 20 20 53 54  | 2360         ST|
00003a10  41 20 78 63 6f 6f 72 64  20 20 20 20 5c 20 73 61  |A xcoord    \ sa|
00003a20  76 65 20 6e 65 77 20 70  61 72 74 69 61 6c 20 64  |ve new partial d|
00003a30  69 76 69 64 65 6e 64 0d  20 32 33 37 30 20 2e 64  |ividend. 2370 .d|
00003a40  6f 6e 65 0d 20 32 33 38  30 20 20 20 20 20 20 20  |one. 2380       |
00003a50  20 20 44 45 58 20 20 20  20 20 20 20 20 20 20 20  |  DEX           |
00003a60  5c 20 64 65 63 72 65 6d  65 6e 74 20 62 69 74 20  |\ decrement bit |
00003a70  63 6f 75 6e 74 65 72 0d  20 32 33 39 30 20 20 20  |counter. 2390   |
00003a80  20 20 20 20 20 20 42 4e  45 20 6e 65 78 74 20 20  |      BNE next  |
00003a90  20 20 20 20 5c 20 62 72  61 6e 63 68 20 66 6f 72  |    \ branch for|
00003aa0  20 31 36 20 62 69 74 73  0d 20 32 34 30 30 20 20  | 16 bits. 2400  |
00003ab0  20 20 20 20 20 20 20 4c  44 41 20 73 63 61 6c 65  |       LDA scale|
00003ac0  2c 59 20 20 20 5c 20 73  63 72 65 65 6e 20 6d 6f  |,Y   \ screen mo|
00003ad0  64 65 20 73 63 61 6c 65  0d 20 32 34 31 30 20 20  |de scale. 2410  |
00003ae0  20 20 20 20 20 20 20 42  45 51 20 70 75 6c 6c 6f  |       BEQ pullo|
00003af0  75 74 20 20 20 5c 20 62  72 61 6e 63 68 20 69 66  |ut   \ branch if|
00003b00  20 6d 6f 64 65 73 20 30  2c 20 33 2c 20 34 2c 20  | modes 0, 3, 4, |
00003b10  36 20 6f 72 20 37 0d 20  32 34 32 30 20 20 20 20  |6 or 7. 2420    |
00003b20  20 20 20 20 20 54 41 58  20 20 20 20 20 20 20 20  |     TAX        |
00003b30  20 20 20 5c 20 69 6e 20  6d 6f 64 65 31 20 61 6e  |   \ in mode1 an|
00003b40  64 20 6d 6f 64 65 35 20  58 3d 31 2c 20 69 6e 20  |d mode5 X=1, in |
00003b50  6d 6f 64 65 32 20 58 3d  32 0d 20 32 34 33 30 20  |mode2 X=2. 2430 |
00003b60  20 20 20 20 20 20 20 20  4c 44 41 20 78 63 6f 6f  |        LDA xcoo|
00003b70  72 64 0d 20 32 34 34 30  20 2e 72 65 64 75 63 65  |rd. 2440 .reduce|
00003b80  0d 20 32 34 35 30 20 20  20 20 20 20 20 20 20 4c  |. 2450         L|
00003b90  53 52 20 41 20 20 20 20  20 20 20 20 20 5c 20 68  |SR A         \ h|
00003ba0  6f 72 69 7a 6f 6e 74 61  6c 20 70 6f 73 69 74 69  |orizontal positi|
00003bb0  6f 6e 20 2f 20 32 0d 20  32 34 36 30 20 20 20 20  |on / 2. 2460    |
00003bc0  20 20 20 20 20 44 45 58  0d 20 32 34 37 30 20 20  |     DEX. 2470  |
00003bd0  20 20 20 20 20 20 20 42  4e 45 20 72 65 64 75 63  |       BNE reduc|
00003be0  65 0d 20 32 34 38 30 20  20 20 20 20 20 20 20 20  |e. 2480         |
00003bf0  53 54 41 20 78 63 6f 6f  72 64 0d 20 32 34 39 30  |STA xcoord. 2490|
00003c00  20 2e 70 75 6c 6c 6f 75  74 0d 20 32 35 30 30 20  | .pullout. 2500 |
00003c10  20 20 20 20 20 20 20 20  50 4c 41 20 20 20 20 20  |        PLA     |
00003c20  20 20 20 20 20 20 5c 20  70 75 6c 6c 20 64 61 74  |      \ pull dat|
00003c30  61 20 72 65 67 69 73 74  65 72 20 42 0d 20 32 35  |a register B. 25|
00003c40  31 30 20 20 20 20 20 20  20 20 20 41 4e 44 20 23  |10         AND #|
00003c50  26 32 30 20 20 20 20 20  20 5c 20 25 30 30 31 30  |&20      \ %0010|
00003c60  30 30 30 30 0d 20 32 35  32 30 20 20 20 20 20 20  |0000. 2520      |
00003c70  20 20 20 53 54 41 20 66  69 72 65 20 20 20 20 20  |   STA fire     |
00003c80  20 5c 20 73 74 6f 72 65  20 66 69 72 65 20 62 75  | \ store fire bu|
00003c90  74 74 6f 6e 20 73 74 61  74 75 73 0d 20 32 35 33  |tton status. 253|
00003ca0  30 20 20 20 20 20 20 20  20 20 50 4c 41 0d 20 32  |0         PLA. 2|
00003cb0  35 34 30 20 20 20 20 20  20 20 20 20 54 41 59 0d  |540         TAY.|
00003cc0  20 32 35 35 30 20 20 20  20 20 20 20 20 20 50 4c  | 2550         PL|
00003cd0  41 0d 20 32 35 36 30 20  20 20 20 20 20 20 20 20  |A. 2560         |
00003ce0  54 41 58 0d 20 32 35 37  30 20 20 20 20 20 20 20  |TAX. 2570       |
00003cf0  20 20 50 4c 41 0d 20 32  35 38 30 20 20 20 20 20  |  PLA. 2580     |
00003d00  20 20 20 20 53 54 41 20  26 46 43 0d 20 32 35 39  |    STA &FC. 259|
00003d10  30 20 20 20 20 20 20 20  20 20 52 54 49 20 20 20  |0         RTI   |
00003d20  20 20 20 20 20 20 20 20  5c 20 72 65 74 75 72 6e  |        \ return|
00003d30  20 66 72 6f 6d 20 69 6e  74 65 72 72 75 70 74 0d  | from interrupt.|
00003d40  20 32 36 30 30 20 2e 6f  6c 64 69 72 71 32 76 0d  | 2600 .oldirq2v.|
00003d50  20 32 36 31 30 20 20 20  20 20 20 20 20 20 45 51  | 2610         EQ|
00003d60  55 57 20 26 30 30 20 20  20 20 20 20 5c 20 6f 72  |UW &00      \ or|
00003d70  69 67 69 6e 61 6c 20 69  72 71 32 20 76 65 63 74  |iginal irq2 vect|
00003d80  6f 72 0d 20 32 36 32 30  20 2e 6f 66 66 73 65 74  |or. 2620 .offset|
00003d90  6c 6f 77 0d 20 32 36 33  30 20 20 20 20 20 20 20  |low. 2630       |
00003da0  20 20 45 51 55 42 20 26  30 34 20 20 20 20 20 20  |  EQUB &04      |
00003db0  5c 20 6d 6f 64 65 30 2c  20 75 6e 74 72 69 6d 6d  |\ mode0, untrimm|
00003dc0  65 64 20 3d 20 26 30 36  0d 20 32 36 34 30 20 20  |ed = &06. 2640  |
00003dd0  20 20 20 20 20 20 20 45  51 55 42 20 26 30 34 20  |       EQUB &04 |
00003de0  20 20 20 20 20 5c 20 6d  6f 64 65 31 2c 20 75 6e  |     \ mode1, un|
00003df0  74 72 69 6d 6d 65 64 20  3d 20 26 30 36 0d 20 32  |trimmed = &06. 2|
00003e00  36 35 30 20 20 20 20 20  20 20 20 20 45 51 55 42  |650         EQUB|
00003e10  20 26 30 34 20 20 20 20  20 20 5c 20 6d 6f 64 65  | &04      \ mode|
00003e20  32 2c 20 75 6e 74 72 69  6d 6d 65 64 20 3d 20 26  |2, untrimmed = &|
00003e30  30 36 0d 20 32 36 36 30  20 20 20 20 20 20 20 20  |06. 2660        |
00003e40  20 45 51 55 42 20 26 30  34 20 20 20 20 20 20 5c  | EQUB &04      \|
00003e50  20 6d 6f 64 65 33 2c 20  75 6e 74 72 69 6d 6d 65  | mode3, untrimme|
00003e60  64 20 3d 20 26 30 36 0d  20 32 36 37 30 20 20 20  |d = &06. 2670   |
00003e70  20 20 20 20 20 20 45 51  55 42 20 26 30 33 20 20  |      EQUB &03  |
00003e80  20 20 20 20 5c 20 6d 6f  64 65 34 2c 20 75 6e 74  |    \ mode4, unt|
00003e90  72 69 6d 6d 65 64 20 3d  20 26 30 34 0d 20 32 36  |rimmed = &04. 26|
00003ea0  38 30 20 20 20 20 20 20  20 20 20 45 51 55 42 20  |80         EQUB |
00003eb0  26 30 33 20 20 20 20 20  20 5c 20 6d 6f 64 65 35  |&03      \ mode5|
00003ec0  2c 20 75 6e 74 72 69 6d  6d 65 64 20 3d 20 26 30  |, untrimmed = &0|
00003ed0  34 0d 20 32 36 39 30 20  20 20 20 20 20 20 20 20  |4. 2690         |
00003ee0  45 51 55 42 20 26 30 33  20 20 20 20 20 20 5c 20  |EQUB &03      \ |
00003ef0  6d 6f 64 65 36 2c 20 75  6e 74 72 69 6d 6d 65 64  |mode6, untrimmed|
00003f00  20 3d 20 26 30 34 0d 20  32 37 30 30 20 20 20 20  | = &04. 2700    |
00003f10  20 20 20 20 20 45 51 55  42 20 26 30 36 20 20 20  |     EQUB &06   |
00003f20  20 20 20 5c 20 6d 6f 64  65 37 2c 20 75 6e 74 72  |   \ mode7, untr|
00003f30  69 6d 6d 65 64 20 3d 20  26 30 38 0d 20 32 37 31  |immed = &08. 271|
00003f40  30 20 2e 73 63 61 6c 65  0d 20 32 37 32 30 20 20  |0 .scale. 2720  |
00003f50  20 20 20 20 20 20 20 45  51 55 44 20 26 30 30 30  |       EQUD &000|
00003f60  32 30 31 30 30 20 5c 20  6d 6f 64 65 73 20 33 2d  |20100 \ modes 3-|
00003f70  30 0d 20 32 37 33 30 20  20 20 20 20 20 20 20 20  |0. 2730         |
00003f80  45 51 55 44 20 26 30 30  30 30 30 31 30 30 20 5c  |EQUD &00000100 \|
00003f90  20 6d 6f 64 65 73 20 37  2d 34 0d 20 32 37 34 30  | modes 7-4. 2740|
00003fa0  20 2e 77 69 64 74 68 0d  20 32 37 35 30 20 20 20  | .width. 2750   |
00003fb0  20 20 20 20 20 20 45 51  55 44 20 26 35 30 35 30  |      EQUD &5050|
00003fc0  35 30 35 30 20 5c 20 6d  6f 64 65 73 20 33 2d 30  |5050 \ modes 3-0|
00003fd0  0d 20 32 37 36 30 20 20  20 20 20 20 20 20 20 45  |. 2760         E|
00003fe0  51 55 44 20 26 32 38 32  38 32 38 32 38 20 5c 20  |QUD &28282828 \ |
00003ff0  6d 6f 64 65 73 20 37 2d  34 0d 20 32 37 37 30 20  |modes 7-4. 2770 |
00004000  2e 6c 61 73 74 62 79 74  65 0d 20 32 37 38 30 20  |.lastbyte. 2780 |
00004010  5d 0d 20 32 37 39 30 20  4e 45 58 54 0d 20 32 38  |]. 2790 NEXT. 28|
00004020  30 30 20 65 6e 64 3d 6d  63 6f 64 65 2b 28 6c 61  |00 end=mcode+(la|
00004030  73 74 62 79 74 65 2d 69  6f 61 64 64 72 29 0d 20  |stbyte-ioaddr). |
00004040  32 38 31 30 20 61 64 64  72 3d 69 6f 61 64 64 72  |2810 addr=ioaddr|
00004050  0d 20 32 38 32 30 20 46  4f 52 20 62 79 74 65 3d  |. 2820 FOR byte=|
00004060  6d 63 6f 64 65 20 54 4f  20 65 6e 64 0d 20 32 38  |mcode TO end. 28|
00004070  33 30 20 50 52 4f 43 77  72 69 74 65 28 3f 62 79  |30 PROCwrite(?by|
00004080  74 65 2c 61 64 64 72 29  0d 20 32 38 34 30 20 61  |te,addr). 2840 a|
00004090  64 64 72 3d 61 64 64 72  2b 31 0d 20 32 38 35 30  |ddr=addr+1. 2850|
000040a0  20 4e 45 58 54 0d 20 32  38 36 30 20 50 52 4f 43  | NEXT. 2860 PROC|
000040b0  77 72 69 74 65 28 28 69  6f 61 64 64 72 20 4d 4f  |write((ioaddr MO|
000040c0  44 20 32 35 36 29 2c 75  73 65 72 76 29 0d 20 32  |D 256),userv). 2|
000040d0  38 37 30 20 50 52 4f 43  77 72 69 74 65 28 28 69  |870 PROCwrite((i|
000040e0  6f 61 64 64 72 20 44 49  56 20 32 35 36 29 2c 75  |oaddr DIV 256),u|
000040f0  73 65 72 76 2b 31 29 0d  20 32 38 38 30 20 50 52  |serv+1). 2880 PR|
00004100  4f 43 77 72 69 74 65 28  30 2c 78 63 6f 6f 72 64  |OCwrite(0,xcoord|
00004110  29 0d 20 32 38 39 30 20  50 52 4f 43 77 72 69 74  |). 2890 PROCwrit|
00004120  65 28 30 2c 79 63 6f 6f  72 64 29 0d 20 32 39 30  |e(0,ycoord). 290|
00004130  30 20 2a 43 4f 44 45 0d  20 32 39 31 30 20 45 4e  |0 *CODE. 2910 EN|
00004140  44 50 52 4f 43 0d 20 32  39 32 30 20 3a 20 0d 20  |DPROC. 2920 : . |
00004150  32 39 33 30 20 44 45 46  46 4e 73 77 69 74 63 68  |2930 DEFFNswitch|
00004160  0d 20 32 39 34 30 20 49  46 20 28 41 44 56 41 4c  |. 2940 IF (ADVAL|
00004170  28 30 29 41 4e 44 33 29  3d 30 20 3d 54 52 55 45  |(0)AND3)=0 =TRUE|
00004180  20 45 4c 53 45 20 3d 46  41 4c 53 45 0d           | ELSE =FALSE.|
0000418d
04-02-89/T\Pen03.m0
04-02-89/T\Pen03.m1
04-02-89/T\Pen03.m2
04-02-89/T\Pen03.m4
04-02-89/T\Pen03.m5