Home » CEEFAX disks » telesoftware12.adl » 17-02-89/T\Pen05

17-02-89/T\Pen05

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: 17-02-89/T\Pen05
Read OK:
File size: 555B bytes
Load address: 0000
Exec address: FFFFFFFF
File contents
Using a light pen with the BBC microcomputer - by - Gordon Horsington
---------------------------------------------------------------------

Module 5. Sideways RAM (SWR) light pen drivers.
-----------------------------------------------


It was explained in module 2 that light pen interupts are not processed by
the operating system but are first offered to the paged ROMs and then to
the user via the IRQ2 vector. An unprocessed light pen interrupt will
always be offered to the paged ROMs and it can therefore be processed in
SWR without having to revector IRQ2V, or any other vector. This reduces
the amount of code needed to set up the light pen driver because all that
your program needs to do is to intercept all the interrupts offered to SWR
and poll the light pen hardware to find out if it is the source of an
interrupt.

Service call 5 is used to offer unrecognised interupts to the paged ROMs.
A SWR light pen driver should intercept service call 5 and poll the system
VIA interrupt flag register to see if a light pen was responsible for the
unrecognised interrupt. If a light pen is the source of the interrupt then
the interrupt must be cleared by reading the system VIA data register B.
The interrupt should then be processed and a return made to the operating
system. After processing an interrupt it is essential to return from SWR
with an RTS instruction (not an RTI) and with the accumulator containing
zero.

When you use SWR in this way the light pen interrupts can be enabled and
disabled from a program running in user memory. Use *FX 151,78,136
(?&FE4E=&88) to enable and *FX 151,78,8 (?&FE4E=&08) to disable. If you
want to modify the demonstration programs so that new OSCLI commands are
used to enable and disable the light pen interrupts then I recommend that
you first read the BBC Telesoftware series "Mastering Sideways ROM and
RAM" which will give you detailed information on the types of
modifications that can be made to SWR interpreters.

The source code program SWGRAPH saves an object code file LPGRAPH onto the
current filing system and the program SWTEXT saves an object code file
LPTEXT. The object code will need to be loaded into SWR or blown onto an
EPROM before it can be used. If you decide to blow a version of either of
these files into an EPROM there are a few modifications you might like to
consider making to the source code. First of all it will be useful if the
table labeled offsetlow is transfered into user memory when the utility is
in use so that any program using the light pen driver can trim the offset.
If the table is permanently in an EPROM it will not be possible to trim
the offset. The second modification I would consider making would be to
combine both the graphics and text calculations into one algorithm. I
would also want to use OSCLI commands to switch the interrupts on and off.

I have found that these two SWR programs are by far the most useful light
pen drivers to use when converting programs to work with a light pen. The
easiest programs to convert are board games such as draughts and chess and
these are probably the most natural type of program to use with a light
pen. If a program uses the integer variables A% to Z% then the graphics
driver can be modified to store its results directly into the appropriate
integer variable memory locations.

The object code file LPTEXT can be used as a substitute for the light pen
driver in any of the text demonstrations used earlier in the series. The
file LPGRAPH can be used as the light pen driver for the freehand drawing
demonstration program ARTIST.

To use the program ARTIST you should first load the object code file
LPGRAPH into SWR and press the Break key. Then chain ARTIST which must run
in the I/O processor. The following keys are used to select various
options in ARTIST:


I      Select a new foreground colour (Ink). The colour is indicated by an
       asterisk in the bottom left hand corner.

P      Select a new background colour (Paper).

L      Draw a line. You need to enter a point at either end of the line
       with your light pen.

C      Draw a circle. You need to enter two points with your light pen.
       First the centre of the circle, and then a point on the
       circumference.

S      Draw a square. You need to enter a point at the either end of the
       base of the square with your light pen. If you enter the left
       corner and then the right corner, the square will be drawn above
       the base. If you enter the right corner and then the left corner,
       the square will be drawn below the base.

T      Draw and fill a triangle. You need to enter the three apicies of
       the triangle with your light pen.

F      Fill an enclosed area with the foreground colour. You need to enter
       one point with the light pen and the area will fill up and down
       from that point until any foreground colour. You may need to use
       this option a number of times to fill a 'difficult' area.

Delete Clear the screen.


The program ARTIST is only a demonstration of the capabilities of the
light pen as a drawing tool. There is plenty of scope and plenty of memory
left for improvement.


   10 REM> SWTEXT
   20 DIM mcode &200
   30 xcoord=&70
   40 ycoord=&71
   50 fire=&72
   60 savereg=&FC
   70 start=&350 :REM: screen start address
   80 screen=&355 :REM: screen mode OS 1.2
   90 sheila=&FE00
  100 drb=&FE40 :REM: system 6522 input/output register B
  110 ifr=&FE4D :REM: system 6522 interrupt flag register
  120 ier=&FE4E :REM: system 6522 interrupt enable register
  130 FOR pass=4 TO 6 STEP 2
  140 O%=mcode
  150 P%=&8000
  160 [       OPT pass
  170         BRK
  180         BRK
  190         BRK
  200         JMP service   \ service entry to ROM
  210         EQUB &82      \ ROM type byte indicates a service entry
  220         EQUB copyright MOD 256 \ copyright offset pointer
  230         BRK           \ BRK serves as binary version number
  240         EQUS"Light pen Text" \ title string
  250 .copyright
  260         BRK           \ start of copyright/end of title
  270         EQUS "(C) Gordon Horsington 1987"
  280         BRK           \ copyright terminator
  290 .exit
  300         PLA
  310         STA savereg
  320         LDA #&05      \ unrecognised interrupt service call
  330 .return
  340         RTS
  350 .service
  360         CMP #&05      \ is this an unrecognised interrupt?
  370         BNE return    \ branch if not interrupt
  380         LDA savereg   \ load interrupt accumulator save register
  390         PHA           \ and push it on the stack
  400         LDA ifr       \ load system VIA interrupt status
  410         BPL exit      \ exit if bit 7 clear
  420         AND #&08      \ AND with %00001000
  430         BEQ exit      \ exit if not light pen interrupt
  440         TXA
  450         PHA
  460         TYA
  470         PHA
  480         LDA drb       \ clear interrupt
  490         PHA           \ push data register B
  500         CLD           \ clear decimal flag
  510         LDY screen    \ screen mode into Y register
  520         LDA start     \ screen start address, low byte
  530         STA ycoord
  540         LDA start+1   \ screen start address, high byte
  550         STA ycoord+1
  560         CPY #&07      \ is this mode 7?
  570         BEQ mode7
  580         LSR ycoord+1
  590         ROR ycoord    \ start address DIV 2
  600         LSR ycoord+1
  610         ROR ycoord    \ start address DIV 4
  620         LSR ycoord+1
  630         ROR ycoord    \ start address DIV 8
  640         JMP continue  \ skip mode 7 calculation
  650 .mode7
  660         SEC           \ prepare for subtraction
  670         LDA ycoord+1
  680         SBC #&54
  690         STA ycoord+1  \ subtract &5400 from start address
  700 .continue
  710         LDA offsetlow,Y
  720         CLC           \ prepare for addition
  730         ADC ycoord    \ add trim to offset
  740         STA ycoord
  750         LDA #&00
  760         ADC ycoord+1
  770         STA ycoord+1
  780         SEC           \ prepare to subtract offset from lp register
  790         LDX #&11      \ light pen register, low byte
  800         STX sheila    \ 6845 address register
  810         LDA sheila+1  \ 6845 data register
  820         SBC ycoord    \ subtract offset, low byte
  830         STA ycoord    \ low byte - offset
  840         DEX           \ X = &10, light pen register, high byte
  850         STX sheila    \ 6845 address register
  860         LDA sheila+1  \ 6845 data register
  870         SBC ycoord+1  \ subtract offset, high byte
  880         STA ycoord+1  \ high byte - offset
  890         LDA #&00      \ prepare for 16 bit division
  900         STA xcoord    \ clear low partial dividend
  910 .next
  920         ASL ycoord    \ shift dividend/quotient left
  930         ROL ycoord+1  \ shift dividend/quotient left
  940         ROL xcoord    \ shift bits into partial dividend
  950         LDA xcoord    \ load partial dividend
  960         SEC           \ prepare for subtraction
  970         SBC width,Y   \ subtract divisor
  980         BCC done      \ branch if dividend < divisor
  990         INC ycoord    \ increment quotient
 1000         STA xcoord    \ save new partial dividend
 1010 .done
 1020         DEX           \ decrement bit counter
 1030         BNE next      \ branch for 16 bits
 1040         LDA scale,Y   \ screen mode scale
 1050         BEQ pullout   \ branch if modes 0, 3, 4, 6 or 7
 1060         TAX           \ in mode1 and mode5 X=1, in mode2 X=2
 1070         LDA xcoord
 1080 .reduce
 1090         LSR A         \ horizontal position DIV 2
 1100         DEX
 1110         BNE reduce
 1120         STA xcoord
 1130 .pullout
 1140         PLA           \ pull data register B
 1150         AND #&20      \ %00100000
 1160         STA fire      \ store fire button status
 1170         PLA
 1180         TAY
 1190         PLA
 1200         TAX
 1210         PLA
 1220         STA savereg
 1230         LDA #&00      \ interrupt serviced
 1240         RTS           \ return to operating system
 1250 .offsetlow
 1260         EQUB &04      \ mode0, untrimmed = &06
 1270         EQUB &04      \ mode1, untrimmed = &06
 1280         EQUB &04      \ mode2, untrimmed = &06
 1290         EQUB &04      \ mode3, untrimmed = &06
 1300         EQUB &03      \ mode4, untrimmed = &04
 1310         EQUB &03      \ mode5, untrimmed = &04
 1320         EQUB &03      \ mode6, untrimmed = &04
 1330         EQUB &06      \ mode7, untrimmed = &08
 1340 .scale
 1350         EQUD &00020100 \ modes 3-0
 1360         EQUD &00000100 \ modes 7-4
 1370 .width
 1380         EQUD &50505050 \ modes 3-0
 1390         EQUD &28282828 \ modes 7-4
 1400 .lastbyte
 1410 ]
 1420 NEXT
 1430 *OPT1,2
 1440 OSCLI("SAVE LPTEXT "+STR$~(mcode)+" + "
      +STR$~(lastbyte-&8000)+" FFFF8000 FFFF8000")
 1450 *OPT0,0


   10 REM> SWGRAPH
   20 DIM mcode &200
   30 xcoord=&70 :REM: &70-&73
   40 ycoord=&74 :REM: &74-&77
   50 fire=&78 :REM: fire button status
   60 savereg=&FC :REM: interrupt accumulator save register
   70 start=&350 :REM: screen start address
   80 screen=&355 :REM: screen mode OS 1.2
   90 sheila=&FE00
  100 drb=&FE40 :REM: system 6522 data register B
  110 ifr=&FE4D :REM: system 6522 interrupt flag register
  120 ier=&FE4E :REM: system 6522 interrupt enable register
  130 FOR pass=4 TO 6 STEP 2
  140 O%=mcode
  150 P%=&8000
  160 [       OPT pass
  170         BRK
  180         BRK
  190         BRK
  200         JMP service   \ service entry to ROM
  210         EQUB &82      \ ROM type byte indicates a service entry
  220         EQUB copyright MOD 256 \ copyright offset pointer
  230         BRK
  240         EQUS "Light pen Graphics" \ title string
  250 .copyright
  260         BRK           \ start of copyright
  270         EQUS "(C) Gordon Horsington 1987" \ copyright string
  280         BRK           \ copyright terminator
  290 .out
  300         JMP pullout
  310 .exit
  320         PLA
  330         STA savereg
  340         LDA #&05      \ unrecognised interrupt service call
  350 .return
  360         RTS
  370 .service
  380         CMP #&05      \ is this an unrecognised interrupt?
  390         BNE return    \ branch if not interrupt
  400         LDA savereg   \ load interrupt accumulator save register
  410         PHA           \ and push it on the stack
  420         LDA ifr       \ load system VIA interrupt flag register
  430         BPL exit      \ exit if bit 7 clear
  440         AND #&08      \ AND with %00001000
  450         BEQ exit      \ exit if not light pen interrupt
  460         TXA
  470         PHA
  480         TYA
  490         PHA
  500         LDA drb       \ clear interrupt
  510         PHA           \ push data register B
  520         CLD           \ clear decimal flag
  530         LDA #&00
  540         LDX #&07
  550 .initloop
  560         STA xcoord,X  \ &70-&77 = #&00
  570         DEX
  580         BPL initloop
  590         LDY screen    \ screen mode into Y register
  600         CPY #&06      \ is this mode 6 or 7?
  610         BCS out       \ exit if non-graphics mode
  620         CPY #&03      \ is this mode 3?
  630         BEQ out       \ exit if non-graphics mode
  640         LDA start     \ screen start address, low byte
  650         STA ycoord
  660         LDA start+1   \ screen start address, high byte
  670         STA ycoord+1
  680         LSR ycoord+1
  690         ROR ycoord    \ start address DIV 2
  700         LSR ycoord+1
  710         ROR ycoord    \ start address DIV 4
  720         LSR ycoord+1
  730         ROR ycoord    \ start address DIV 8
  740         LDA offsetlow,Y \ trim the offset
  750         CLC           \ prepare for addition
  760         ADC ycoord    \ add trim to offset
  770         STA ycoord
  780         LDA #&00
  790         ADC ycoord+1
  800         STA ycoord+1
  810         SEC           \ prepare to subtract offset from light pen
                            \ register
  820         LDX #&11      \ light pen register, low byte
  830         STX sheila    \ 6845 address register
  840         LDA sheila+1  \ 6845 data register
  850         SBC ycoord    \ subtract offset, low byte
  860         STA ycoord    \ low byte - offset
  870         DEX           \ X = #&10
  880         STX sheila    \ 6845 address register
  890         LDA sheila+1  \ 6845 data register
  900         SBC ycoord+1  \ subtract offset, high byte
  910         STA ycoord+1  \ high byte - offset
  920 .next
  930         ASL ycoord    \ shift dividend/quotient left
  940         ROL ycoord+1  \ shift dividend/quotient left
  950         ROL xcoord    \ shift bits into partial dividend
  960         LDA xcoord    \ load partial dividend
  970         SEC           \ prepare for subtraction
  980         SBC width,Y   \ subtract divisor
  990         BCC done      \ branch if dividend < divisor
 1000         INC ycoord    \ increment quotient
 1010         STA xcoord    \ save new partial dividend
 1020 .done
 1030         DEX           \ decrement bit counter
 1040         BNE next      \ branch for 16 bits
 1050         LDA xloop,Y   \ prepare for multiplication
 1060         TAX           \ X=4 modes 0-3, X=5 modes 4-7
 1070 .multx
 1080         ASL xcoord    \ low byte * 2
 1090         ROL xcoord+1  \ high byte * 2
 1100         DEX           \ count number of multiplications
 1110         BNE multx     \ go back if not finished
 1120         LDA xadd,Y    \ A=8 modes 0-3, A=16 modes 4-7
 1130         CLC           \ prepare for addition
 1140         ADC xcoord
 1150         STA xcoord
 1160         LDA #&00
 1170         ADC xcoord+1
 1180         STA xcoord+1
 1190         LDX #&05      \ prepare for y coordinate multiplication
 1200 .multy
 1210         ASL ycoord    \ low byte * 2
 1220         ROL ycoord+1  \ high byte * 2
 1230         DEX           \ count number of multiplications
 1240         BNE multy     \ go back if not finished
 1250         SEC           \ prepare for subtraction
 1260         LDA #&F0      \ low byte of decimal 1008
 1270         SBC ycoord    \ ycoord-#&F0
 1280         STA ycoord
 1290         LDA #&03      \ high byte of decimal 1008
 1300         SBC ycoord+1  \ (ycoord+1)-#&03
 1310         STA ycoord+1
 1320 .pullout
 1330         PLA           \ pull data register B
 1340         AND #&20      \ %00100000
 1350         STA fire      \ store fire button status
 1360         PLA
 1370         TAY           \ restore Y
 1380         PLA
 1390         TAX           \ restore X
 1400         PLA
 1410         STA savereg   \ restore zero page
 1420         LDA #&00      \ interrupt serviced
 1430         RTS           \ return to operating system
 1440 .offsetlow
 1450         EQUB &04      \ mode0, untrimmed = &06
 1460         EQUB &04      \ mode1, untrimmed = &06
 1470         EQUB &04      \ mode2, untrimmed = &06
 1480         EQUB &00      \ mode3, dummy value
 1490         EQUB &03      \ mode4, untrimmed = &04
 1500         EQUB &03      \ mode5, untrimmed = &04
 1510 .xloop
 1520         EQUD &00040404 \ modes 3-0
 1530         EQUW &0505    \ modes 5-4
 1540 .xadd
 1550         EQUD &00080808 \ modes 3-0
 1560         EQUW &1010    \ modes 5-4
 1570 .width
 1580         EQUD &00505050 \ modes 3-0
 1590         EQUW &2828    \ modes 5-4
 1600 .lastbyte
 1610 ]
 1620 NEXT
 1630 *OPT1,2
 1640 OSCLI("SAVE LPGRAPH "+STR$~(mcode)+" + "
      +STR$~(lastbyte-&8000)+" FFFF8000 FFFF8000")
 1650 *OPT0,0


   10 REM> ARTIST
   20 REM uses SWR graphics light pen driver
   30 ONERROR OSCLI("FX151,78,8"):VDU23,1,1;0;0;0;:END
   40 A%=&EA
   50 X%=0
   60 Y%=&FF
   70 IF FNosbyte<>0 PRINT"Not Tube compatible":END
   80 *FX151,78,136
   90 A%=&EB
  100 IF FNosbyte=0 speech=FALSE ELSE speech=TRUE
  110 MODE 2
  120 VDU23,1,0;0;0;0;
  130 xcoord=&70 :REM: &70-&73
  140 ycoord=&74 :REM: &74-&77
  150 !xcoord=0
  160 !ycoord=0
  170 paper=6
  180 ink=4
  190 VDU 19,0,paper;0;
  200 GCOL 0,ink
  210 COLOUR ink
  220 PRINTTAB(0,31)"*";
  230 PROCreset
  240 REPEAT
  250 REPEAT
  260 PROCxy
  270 IF FNswitch PROCwander ELSE PLOT 13,newx,newy
  280 UNTIL FNswitch
  290 IF INKEY(-36) PROCtriangle
  300 IF INKEY(-38) PROCink
  310 IF INKEY(-56) PROCpaper
  320 IF INKEY(-68) PROCfill
  330 IF INKEY(-82) PROCsquare
  340 IF INKEY(-83) PROCcircle
  350 IF INKEY(-87) PROCline
  360 IF INKEY(-90) PROCdelete
  370 UNTIL FALSE
  380 :
  390 DEFPROCtriangle
  400 PROCpoints(3)
  410 PROCinput(198)
  420 x=newx
  430 y=newy
  440 PROCinput(258)
  450 PROCinput(269)
  460 MOVE x,y
  470 MOVE lastx,lasty
  480 PLOT 85,newx,newy
  490 ENDPROC
  500 :
  510 DEF PROCink
  520 PROCcursor(newx,newy)
  530 ink=ink+1
  540 IF ink>7 ink=1
  550 PROCcursor(newx,newy)
  560 IF speech SOUND-1,ink+48,0,0 ELSE PROCbeep
  570 COLOUR ink
  580 PRINTTAB(0,31)"*";
  590 PROCdelay
  600 ENDPROC
  610 :
  620 DEFPROCpaper
  630 paper=paper+1
  640 IF paper>7 paper=0
  650 VDU 19,0,paper;0;
  660 IF speech SOUND-1,paper+48,0,0 ELSE PROCbeep
  670 PROCdelay
  680 ENDPROC
  690 :
  700 DEFPROCfill
  710 PROCpoints(1)
  720 PROCinput(142)
  730 high=TRUE
  740 low=TRUE
  750 lowy=newy-4
  760 highy=newy
  770 REPEAT
  780 IF high PROChigh(newx,highy)
  790 IF low PROClow(newx,lowy)
  800 highy=highy+4
  810 lowy=lowy-4
  820 UNTIL (low=FALSE) AND (high=FALSE)
  830 PROCreset
  840 ENDPROC
  850 :
  860 DEFPROClow(x,y)
  870 IF y<0 low=FALSE:ENDPROC
  880 colour=POINT(x,y)
  890 IF colour<>0 low=FALSE:ENDPROC
  900 PLOT 77,x,y
  910 ENDPROC
  920 :
  930 DEFPROChigh(x,y)
  940 IF y>1023 high=FALSE:ENDPROC
  950 colour=POINT(x,y)
  960 IF colour<>0 high=FALSE:ENDPROC
  970 PLOT 77,x,y
  980 ENDPROC
  990 :
 1000 DEFPROCsquare
 1010 PROCpoints(2)
 1020 PROCinput(198)
 1030 PROCinput(258)
 1040 PROCcursor(newx,newy)
 1050 PLOT 5,newx-(newy-lasty),newy+(newx-lastx)
 1060 PLOT 5,lastx-(newy-lasty),lasty+(newx-lastx)
 1070 PLOT 5,lastx,lasty
 1080 PLOT 5,newx,newy
 1090 PROCreset
 1100 ENDPROC
 1110 :
 1120 DEFPROCcircle
 1130 PROCpoints(2)
 1140 PROCinput(198)
 1150 PROCinput(258)
 1160 PROCcursor(lastx,lasty)
 1170 radius=SQR(((ABS(newx-lastx))^2)+((ABS(newy-lasty))^2))
 1180 PROCreset
 1190 MOVE lastx+radius,lasty
 1200 FOR angle=10 TO 360 STEP 10
 1210 x=radius*COS(RAD(angle))
 1220 y=radius*SIN(RAD(angle))
 1230 PLOT 5,lastx+x,lasty+y
 1240 NEXT
 1250 ENDPROC
 1260 :
 1270 DEFPROCline
 1280 PROCpoints(2)
 1290 PROCinput(198)
 1300 PROCinput(258)
 1310 PLOT 5,lastx,lasty
 1320 ENDPROC
 1330 :
 1340 DEFPROCxy
 1350 oldx=newx
 1360 oldy=newy
 1370 newx=newx+((!xcoord-newx)DIV4)
 1380 newy=newy+((!ycoord-newy)DIV4)
 1390 ENDPROC
 1400 :
 1410 DEFPROCdelay
 1420 time=TIME+20
 1430 REPEAT UNTIL time<TIME
 1440 REPEAT UNTIL FNswitch
 1450 ENDPROC
 1460 :
 1470 DEFPROCcursor(x,y)
 1480 GCOL 3,ink
 1490 PLOT 69,x,y
 1500 GCOL 0,ink
 1510 ENDPROC
 1520 :
 1530 DEFPROCinput(say)
 1540 lastx=newx
 1550 lasty=newy
 1560 REPEAT
 1570 PROCxy
 1580 PROCwander
 1590 UNTIL NOT FNswitch
 1600 IF speech SOUND-1,say,0,0 ELSE PROCbeep
 1610 PROCcursor(newx,newy)
 1620 PROCdelay
 1630 ENDPROC
 1640 :
 1650 DEFPROCwander
 1660 PROCcursor(oldx,oldy)
 1670 PROCcursor(newx,newy)
 1680 ENDPROC
 1690 :
 1700 DEFPROCdelete
 1710 PROCreset
 1720 CLG
 1730 COLOUR ink
 1740 PRINTTAB(0,31)"*";
 1750 ENDPROC
 1760 :
 1770 DEFPROCreset
 1780 newx=-1
 1790 newy=-1
 1800 ENDPROC
 1810 :
 1820 DEFPROCpoints(say)
 1830 IF NOT speech PROCbeep:ENDPROC
 1840 SOUND-1,192,0,0
 1850 SOUND-1,say+48,0,0
 1860 SOUND-1,243,0,0
 1870 IF say>1 SOUND-1,138,0,0
 1880 ENDPROC
 1890 :
 1900 DEFPROCbeep
 1910 SOUND1,-10,100,1
 1920 ENDPROC
 1930 :
 1940 DEFFNosbyte
 1950 =(USR(&FFF4)AND&FF00)DIV&100
 1960 :
 1970 DEFFNswitch
 1980 IF (ADVAL(0)AND3)=0 IF !xcoord>8 IF !xcoord<1256 =FALSE
 1990 =TRUE
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 35 2e 20 53  69 64 65 77 61 79 73 20  |ule 5. Sideways |
000000a0  52 41 4d 20 28 53 57 52  29 20 6c 69 67 68 74 20  |RAM (SWR) light |
000000b0  70 65 6e 20 64 72 69 76  65 72 73 2e 0d 2d 2d 2d  |pen drivers..---|
000000c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000000e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0d 0d 0d 49  |------------...I|
000000f0  74 20 77 61 73 20 65 78  70 6c 61 69 6e 65 64 20  |t was explained |
00000100  69 6e 20 6d 6f 64 75 6c  65 20 32 20 74 68 61 74  |in module 2 that|
00000110  20 6c 69 67 68 74 20 70  65 6e 20 69 6e 74 65 72  | light pen inter|
00000120  75 70 74 73 20 61 72 65  20 6e 6f 74 20 70 72 6f  |upts are not pro|
00000130  63 65 73 73 65 64 20 62  79 0d 74 68 65 20 6f 70  |cessed by.the op|
00000140  65 72 61 74 69 6e 67 20  73 79 73 74 65 6d 20 62  |erating system b|
00000150  75 74 20 61 72 65 20 66  69 72 73 74 20 6f 66 66  |ut are first off|
00000160  65 72 65 64 20 74 6f 20  74 68 65 20 70 61 67 65  |ered to the page|
00000170  64 20 52 4f 4d 73 20 61  6e 64 20 74 68 65 6e 20  |d ROMs and then |
00000180  74 6f 0d 74 68 65 20 75  73 65 72 20 76 69 61 20  |to.the user via |
00000190  74 68 65 20 49 52 51 32  20 76 65 63 74 6f 72 2e  |the IRQ2 vector.|
000001a0  20 41 6e 20 75 6e 70 72  6f 63 65 73 73 65 64 20  | An unprocessed |
000001b0  6c 69 67 68 74 20 70 65  6e 20 69 6e 74 65 72 72  |light pen interr|
000001c0  75 70 74 20 77 69 6c 6c  0d 61 6c 77 61 79 73 20  |upt will.always |
000001d0  62 65 20 6f 66 66 65 72  65 64 20 74 6f 20 74 68  |be offered to th|
000001e0  65 20 70 61 67 65 64 20  52 4f 4d 73 20 61 6e 64  |e paged ROMs and|
000001f0  20 69 74 20 63 61 6e 20  74 68 65 72 65 66 6f 72  | it can therefor|
00000200  65 20 62 65 20 70 72 6f  63 65 73 73 65 64 20 69  |e be processed i|
00000210  6e 0d 53 57 52 20 77 69  74 68 6f 75 74 20 68 61  |n.SWR without ha|
00000220  76 69 6e 67 20 74 6f 20  72 65 76 65 63 74 6f 72  |ving to revector|
00000230  20 49 52 51 32 56 2c 20  6f 72 20 61 6e 79 20 6f  | IRQ2V, or any o|
00000240  74 68 65 72 20 76 65 63  74 6f 72 2e 20 54 68 69  |ther vector. Thi|
00000250  73 20 72 65 64 75 63 65  73 0d 74 68 65 20 61 6d  |s reduces.the am|
00000260  6f 75 6e 74 20 6f 66 20  63 6f 64 65 20 6e 65 65  |ount of code nee|
00000270  64 65 64 20 74 6f 20 73  65 74 20 75 70 20 74 68  |ded to set up th|
00000280  65 20 6c 69 67 68 74 20  70 65 6e 20 64 72 69 76  |e light pen driv|
00000290  65 72 20 62 65 63 61 75  73 65 20 61 6c 6c 20 74  |er because all t|
000002a0  68 61 74 0d 79 6f 75 72  20 70 72 6f 67 72 61 6d  |hat.your program|
000002b0  20 6e 65 65 64 73 20 74  6f 20 64 6f 20 69 73 20  | needs to do is |
000002c0  74 6f 20 69 6e 74 65 72  63 65 70 74 20 61 6c 6c  |to intercept all|
000002d0  20 74 68 65 20 69 6e 74  65 72 72 75 70 74 73 20  | the interrupts |
000002e0  6f 66 66 65 72 65 64 20  74 6f 20 53 57 52 0d 61  |offered to SWR.a|
000002f0  6e 64 20 70 6f 6c 6c 20  74 68 65 20 6c 69 67 68  |nd poll the ligh|
00000300  74 20 70 65 6e 20 68 61  72 64 77 61 72 65 20 74  |t pen hardware t|
00000310  6f 20 66 69 6e 64 20 6f  75 74 20 69 66 20 69 74  |o find out if it|
00000320  20 69 73 20 74 68 65 20  73 6f 75 72 63 65 20 6f  | is the source o|
00000330  66 20 61 6e 0d 69 6e 74  65 72 72 75 70 74 2e 0d  |f an.interrupt..|
00000340  0d 53 65 72 76 69 63 65  20 63 61 6c 6c 20 35 20  |.Service call 5 |
00000350  69 73 20 75 73 65 64 20  74 6f 20 6f 66 66 65 72  |is used to offer|
00000360  20 75 6e 72 65 63 6f 67  6e 69 73 65 64 20 69 6e  | unrecognised in|
00000370  74 65 72 75 70 74 73 20  74 6f 20 74 68 65 20 70  |terupts to the p|
00000380  61 67 65 64 20 52 4f 4d  73 2e 0d 41 20 53 57 52  |aged ROMs..A SWR|
00000390  20 6c 69 67 68 74 20 70  65 6e 20 64 72 69 76 65  | light pen drive|
000003a0  72 20 73 68 6f 75 6c 64  20 69 6e 74 65 72 63 65  |r should interce|
000003b0  70 74 20 73 65 72 76 69  63 65 20 63 61 6c 6c 20  |pt service call |
000003c0  35 20 61 6e 64 20 70 6f  6c 6c 20 74 68 65 20 73  |5 and poll the s|
000003d0  79 73 74 65 6d 0d 56 49  41 20 69 6e 74 65 72 72  |ystem.VIA interr|
000003e0  75 70 74 20 66 6c 61 67  20 72 65 67 69 73 74 65  |upt flag registe|
000003f0  72 20 74 6f 20 73 65 65  20 69 66 20 61 20 6c 69  |r to see if a li|
00000400  67 68 74 20 70 65 6e 20  77 61 73 20 72 65 73 70  |ght pen was resp|
00000410  6f 6e 73 69 62 6c 65 20  66 6f 72 20 74 68 65 0d  |onsible for the.|
00000420  75 6e 72 65 63 6f 67 6e  69 73 65 64 20 69 6e 74  |unrecognised int|
00000430  65 72 72 75 70 74 2e 20  49 66 20 61 20 6c 69 67  |errupt. If a lig|
00000440  68 74 20 70 65 6e 20 69  73 20 74 68 65 20 73 6f  |ht pen is the so|
00000450  75 72 63 65 20 6f 66 20  74 68 65 20 69 6e 74 65  |urce of the inte|
00000460  72 72 75 70 74 20 74 68  65 6e 0d 74 68 65 20 69  |rrupt then.the i|
00000470  6e 74 65 72 72 75 70 74  20 6d 75 73 74 20 62 65  |nterrupt must be|
00000480  20 63 6c 65 61 72 65 64  20 62 79 20 72 65 61 64  | cleared by read|
00000490  69 6e 67 20 74 68 65 20  73 79 73 74 65 6d 20 56  |ing the system V|
000004a0  49 41 20 64 61 74 61 20  72 65 67 69 73 74 65 72  |IA data register|
000004b0  20 42 2e 0d 54 68 65 20  69 6e 74 65 72 72 75 70  | B..The interrup|
000004c0  74 20 73 68 6f 75 6c 64  20 74 68 65 6e 20 62 65  |t should then be|
000004d0  20 70 72 6f 63 65 73 73  65 64 20 61 6e 64 20 61  | processed and a|
000004e0  20 72 65 74 75 72 6e 20  6d 61 64 65 20 74 6f 20  | return made to |
000004f0  74 68 65 20 6f 70 65 72  61 74 69 6e 67 0d 73 79  |the operating.sy|
00000500  73 74 65 6d 2e 20 41 66  74 65 72 20 70 72 6f 63  |stem. After proc|
00000510  65 73 73 69 6e 67 20 61  6e 20 69 6e 74 65 72 72  |essing an interr|
00000520  75 70 74 20 69 74 20 69  73 20 65 73 73 65 6e 74  |upt it is essent|
00000530  69 61 6c 20 74 6f 20 72  65 74 75 72 6e 20 66 72  |ial to return fr|
00000540  6f 6d 20 53 57 52 0d 77  69 74 68 20 61 6e 20 52  |om SWR.with an R|
00000550  54 53 20 69 6e 73 74 72  75 63 74 69 6f 6e 20 28  |TS instruction (|
00000560  6e 6f 74 20 61 6e 20 52  54 49 29 20 61 6e 64 20  |not an RTI) and |
00000570  77 69 74 68 20 74 68 65  20 61 63 63 75 6d 75 6c  |with the accumul|
00000580  61 74 6f 72 20 63 6f 6e  74 61 69 6e 69 6e 67 0d  |ator containing.|
00000590  7a 65 72 6f 2e 0d 0d 57  68 65 6e 20 79 6f 75 20  |zero...When you |
000005a0  75 73 65 20 53 57 52 20  69 6e 20 74 68 69 73 20  |use SWR in this |
000005b0  77 61 79 20 74 68 65 20  6c 69 67 68 74 20 70 65  |way the light pe|
000005c0  6e 20 69 6e 74 65 72 72  75 70 74 73 20 63 61 6e  |n interrupts can|
000005d0  20 62 65 20 65 6e 61 62  6c 65 64 20 61 6e 64 0d  | be enabled and.|
000005e0  64 69 73 61 62 6c 65 64  20 66 72 6f 6d 20 61 20  |disabled from a |
000005f0  70 72 6f 67 72 61 6d 20  72 75 6e 6e 69 6e 67 20  |program running |
00000600  69 6e 20 75 73 65 72 20  6d 65 6d 6f 72 79 2e 20  |in user memory. |
00000610  55 73 65 20 2a 46 58 20  31 35 31 2c 37 38 2c 31  |Use *FX 151,78,1|
00000620  33 36 0d 28 3f 26 46 45  34 45 3d 26 38 38 29 20  |36.(?&FE4E=&88) |
00000630  74 6f 20 65 6e 61 62 6c  65 20 61 6e 64 20 2a 46  |to enable and *F|
00000640  58 20 31 35 31 2c 37 38  2c 38 20 28 3f 26 46 45  |X 151,78,8 (?&FE|
00000650  34 45 3d 26 30 38 29 20  74 6f 20 64 69 73 61 62  |4E=&08) to disab|
00000660  6c 65 2e 20 49 66 20 79  6f 75 0d 77 61 6e 74 20  |le. If you.want |
00000670  74 6f 20 6d 6f 64 69 66  79 20 74 68 65 20 64 65  |to modify the de|
00000680  6d 6f 6e 73 74 72 61 74  69 6f 6e 20 70 72 6f 67  |monstration prog|
00000690  72 61 6d 73 20 73 6f 20  74 68 61 74 20 6e 65 77  |rams so that new|
000006a0  20 4f 53 43 4c 49 20 63  6f 6d 6d 61 6e 64 73 20  | OSCLI commands |
000006b0  61 72 65 0d 75 73 65 64  20 74 6f 20 65 6e 61 62  |are.used to enab|
000006c0  6c 65 20 61 6e 64 20 64  69 73 61 62 6c 65 20 74  |le and disable t|
000006d0  68 65 20 6c 69 67 68 74  20 70 65 6e 20 69 6e 74  |he light pen int|
000006e0  65 72 72 75 70 74 73 20  74 68 65 6e 20 49 20 72  |errupts then I r|
000006f0  65 63 6f 6d 6d 65 6e 64  20 74 68 61 74 0d 79 6f  |ecommend that.yo|
00000700  75 20 66 69 72 73 74 20  72 65 61 64 20 74 68 65  |u first read the|
00000710  20 42 42 43 20 54 65 6c  65 73 6f 66 74 77 61 72  | BBC Telesoftwar|
00000720  65 20 73 65 72 69 65 73  20 22 4d 61 73 74 65 72  |e series "Master|
00000730  69 6e 67 20 53 69 64 65  77 61 79 73 20 52 4f 4d  |ing Sideways ROM|
00000740  20 61 6e 64 0d 52 41 4d  22 20 77 68 69 63 68 20  | and.RAM" which |
00000750  77 69 6c 6c 20 67 69 76  65 20 79 6f 75 20 64 65  |will give you de|
00000760  74 61 69 6c 65 64 20 69  6e 66 6f 72 6d 61 74 69  |tailed informati|
00000770  6f 6e 20 6f 6e 20 74 68  65 20 74 79 70 65 73 20  |on on the types |
00000780  6f 66 0d 6d 6f 64 69 66  69 63 61 74 69 6f 6e 73  |of.modifications|
00000790  20 74 68 61 74 20 63 61  6e 20 62 65 20 6d 61 64  | that can be mad|
000007a0  65 20 74 6f 20 53 57 52  20 69 6e 74 65 72 70 72  |e to SWR interpr|
000007b0  65 74 65 72 73 2e 0d 0d  54 68 65 20 73 6f 75 72  |eters...The sour|
000007c0  63 65 20 63 6f 64 65 20  70 72 6f 67 72 61 6d 20  |ce code program |
000007d0  53 57 47 52 41 50 48 20  73 61 76 65 73 20 61 6e  |SWGRAPH saves an|
000007e0  20 6f 62 6a 65 63 74 20  63 6f 64 65 20 66 69 6c  | object code fil|
000007f0  65 20 4c 50 47 52 41 50  48 20 6f 6e 74 6f 20 74  |e LPGRAPH onto t|
00000800  68 65 0d 63 75 72 72 65  6e 74 20 66 69 6c 69 6e  |he.current filin|
00000810  67 20 73 79 73 74 65 6d  20 61 6e 64 20 74 68 65  |g system and the|
00000820  20 70 72 6f 67 72 61 6d  20 53 57 54 45 58 54 20  | program SWTEXT |
00000830  73 61 76 65 73 20 61 6e  20 6f 62 6a 65 63 74 20  |saves an object |
00000840  63 6f 64 65 20 66 69 6c  65 0d 4c 50 54 45 58 54  |code file.LPTEXT|
00000850  2e 20 54 68 65 20 6f 62  6a 65 63 74 20 63 6f 64  |. The object cod|
00000860  65 20 77 69 6c 6c 20 6e  65 65 64 20 74 6f 20 62  |e will need to b|
00000870  65 20 6c 6f 61 64 65 64  20 69 6e 74 6f 20 53 57  |e loaded into SW|
00000880  52 20 6f 72 20 62 6c 6f  77 6e 20 6f 6e 74 6f 20  |R or blown onto |
00000890  61 6e 0d 45 50 52 4f 4d  20 62 65 66 6f 72 65 20  |an.EPROM before |
000008a0  69 74 20 63 61 6e 20 62  65 20 75 73 65 64 2e 20  |it can be used. |
000008b0  49 66 20 79 6f 75 20 64  65 63 69 64 65 20 74 6f  |If you decide to|
000008c0  20 62 6c 6f 77 20 61 20  76 65 72 73 69 6f 6e 20  | blow a version |
000008d0  6f 66 20 65 69 74 68 65  72 20 6f 66 0d 74 68 65  |of either of.the|
000008e0  73 65 20 66 69 6c 65 73  20 69 6e 74 6f 20 61 6e  |se files into an|
000008f0  20 45 50 52 4f 4d 20 74  68 65 72 65 20 61 72 65  | EPROM there are|
00000900  20 61 20 66 65 77 20 6d  6f 64 69 66 69 63 61 74  | a few modificat|
00000910  69 6f 6e 73 20 79 6f 75  20 6d 69 67 68 74 20 6c  |ions you might l|
00000920  69 6b 65 20 74 6f 0d 63  6f 6e 73 69 64 65 72 20  |ike to.consider |
00000930  6d 61 6b 69 6e 67 20 74  6f 20 74 68 65 20 73 6f  |making to the so|
00000940  75 72 63 65 20 63 6f 64  65 2e 20 46 69 72 73 74  |urce code. First|
00000950  20 6f 66 20 61 6c 6c 20  69 74 20 77 69 6c 6c 20  | of all it will |
00000960  62 65 20 75 73 65 66 75  6c 20 69 66 20 74 68 65  |be useful if the|
00000970  0d 74 61 62 6c 65 20 6c  61 62 65 6c 65 64 20 6f  |.table labeled o|
00000980  66 66 73 65 74 6c 6f 77  20 69 73 20 74 72 61 6e  |ffsetlow is tran|
00000990  73 66 65 72 65 64 20 69  6e 74 6f 20 75 73 65 72  |sfered into user|
000009a0  20 6d 65 6d 6f 72 79 20  77 68 65 6e 20 74 68 65  | memory when the|
000009b0  20 75 74 69 6c 69 74 79  20 69 73 0d 69 6e 20 75  | utility is.in u|
000009c0  73 65 20 73 6f 20 74 68  61 74 20 61 6e 79 20 70  |se so that any p|
000009d0  72 6f 67 72 61 6d 20 75  73 69 6e 67 20 74 68 65  |rogram using the|
000009e0  20 6c 69 67 68 74 20 70  65 6e 20 64 72 69 76 65  | light pen drive|
000009f0  72 20 63 61 6e 20 74 72  69 6d 20 74 68 65 20 6f  |r can trim the o|
00000a00  66 66 73 65 74 2e 0d 49  66 20 74 68 65 20 74 61  |ffset..If the ta|
00000a10  62 6c 65 20 69 73 20 70  65 72 6d 61 6e 65 6e 74  |ble is permanent|
00000a20  6c 79 20 69 6e 20 61 6e  20 45 50 52 4f 4d 20 69  |ly in an EPROM i|
00000a30  74 20 77 69 6c 6c 20 6e  6f 74 20 62 65 20 70 6f  |t will not be po|
00000a40  73 73 69 62 6c 65 20 74  6f 20 74 72 69 6d 0d 74  |ssible to trim.t|
00000a50  68 65 20 6f 66 66 73 65  74 2e 20 54 68 65 20 73  |he offset. The s|
00000a60  65 63 6f 6e 64 20 6d 6f  64 69 66 69 63 61 74 69  |econd modificati|
00000a70  6f 6e 20 49 20 77 6f 75  6c 64 20 63 6f 6e 73 69  |on I would consi|
00000a80  64 65 72 20 6d 61 6b 69  6e 67 20 77 6f 75 6c 64  |der making would|
00000a90  20 62 65 20 74 6f 0d 63  6f 6d 62 69 6e 65 20 62  | be to.combine b|
00000aa0  6f 74 68 20 74 68 65 20  67 72 61 70 68 69 63 73  |oth the graphics|
00000ab0  20 61 6e 64 20 74 65 78  74 20 63 61 6c 63 75 6c  | and text calcul|
00000ac0  61 74 69 6f 6e 73 20 69  6e 74 6f 20 6f 6e 65 20  |ations into one |
00000ad0  61 6c 67 6f 72 69 74 68  6d 2e 20 49 0d 77 6f 75  |algorithm. I.wou|
00000ae0  6c 64 20 61 6c 73 6f 20  77 61 6e 74 20 74 6f 20  |ld also want to |
00000af0  75 73 65 20 4f 53 43 4c  49 20 63 6f 6d 6d 61 6e  |use OSCLI comman|
00000b00  64 73 20 74 6f 20 73 77  69 74 63 68 20 74 68 65  |ds to switch the|
00000b10  20 69 6e 74 65 72 72 75  70 74 73 20 6f 6e 20 61  | interrupts on a|
00000b20  6e 64 20 6f 66 66 2e 0d  0d 49 20 68 61 76 65 20  |nd off...I have |
00000b30  66 6f 75 6e 64 20 74 68  61 74 20 74 68 65 73 65  |found that these|
00000b40  20 74 77 6f 20 53 57 52  20 70 72 6f 67 72 61 6d  | two SWR program|
00000b50  73 20 61 72 65 20 62 79  20 66 61 72 20 74 68 65  |s are by far the|
00000b60  20 6d 6f 73 74 20 75 73  65 66 75 6c 20 6c 69 67  | most useful lig|
00000b70  68 74 0d 70 65 6e 20 64  72 69 76 65 72 73 20 74  |ht.pen drivers t|
00000b80  6f 20 75 73 65 20 77 68  65 6e 20 63 6f 6e 76 65  |o use when conve|
00000b90  72 74 69 6e 67 20 70 72  6f 67 72 61 6d 73 20 74  |rting programs t|
00000ba0  6f 20 77 6f 72 6b 20 77  69 74 68 20 61 20 6c 69  |o work with a li|
00000bb0  67 68 74 20 70 65 6e 2e  20 54 68 65 0d 65 61 73  |ght pen. The.eas|
00000bc0  69 65 73 74 20 70 72 6f  67 72 61 6d 73 20 74 6f  |iest programs to|
00000bd0  20 63 6f 6e 76 65 72 74  20 61 72 65 20 62 6f 61  | convert are boa|
00000be0  72 64 20 67 61 6d 65 73  20 73 75 63 68 20 61 73  |rd games such as|
00000bf0  20 64 72 61 75 67 68 74  73 20 61 6e 64 20 63 68  | draughts and ch|
00000c00  65 73 73 20 61 6e 64 0d  74 68 65 73 65 20 61 72  |ess and.these ar|
00000c10  65 20 70 72 6f 62 61 62  6c 79 20 74 68 65 20 6d  |e probably the m|
00000c20  6f 73 74 20 6e 61 74 75  72 61 6c 20 74 79 70 65  |ost natural type|
00000c30  20 6f 66 20 70 72 6f 67  72 61 6d 20 74 6f 20 75  | of program to u|
00000c40  73 65 20 77 69 74 68 20  61 20 6c 69 67 68 74 0d  |se with a light.|
00000c50  70 65 6e 2e 20 49 66 20  61 20 70 72 6f 67 72 61  |pen. If a progra|
00000c60  6d 20 75 73 65 73 20 74  68 65 20 69 6e 74 65 67  |m uses the integ|
00000c70  65 72 20 76 61 72 69 61  62 6c 65 73 20 41 25 20  |er variables A% |
00000c80  74 6f 20 5a 25 20 74 68  65 6e 20 74 68 65 20 67  |to Z% then the g|
00000c90  72 61 70 68 69 63 73 0d  64 72 69 76 65 72 20 63  |raphics.driver c|
00000ca0  61 6e 20 62 65 20 6d 6f  64 69 66 69 65 64 20 74  |an be modified t|
00000cb0  6f 20 73 74 6f 72 65 20  69 74 73 20 72 65 73 75  |o store its resu|
00000cc0  6c 74 73 20 64 69 72 65  63 74 6c 79 20 69 6e 74  |lts directly int|
00000cd0  6f 20 74 68 65 20 61 70  70 72 6f 70 72 69 61 74  |o the appropriat|
00000ce0  65 0d 69 6e 74 65 67 65  72 20 76 61 72 69 61 62  |e.integer variab|
00000cf0  6c 65 20 6d 65 6d 6f 72  79 20 6c 6f 63 61 74 69  |le memory locati|
00000d00  6f 6e 73 2e 0d 0d 54 68  65 20 6f 62 6a 65 63 74  |ons...The object|
00000d10  20 63 6f 64 65 20 66 69  6c 65 20 4c 50 54 45 58  | code file LPTEX|
00000d20  54 20 63 61 6e 20 62 65  20 75 73 65 64 20 61 73  |T can be used as|
00000d30  20 61 20 73 75 62 73 74  69 74 75 74 65 20 66 6f  | a substitute fo|
00000d40  72 20 74 68 65 20 6c 69  67 68 74 20 70 65 6e 0d  |r the light pen.|
00000d50  64 72 69 76 65 72 20 69  6e 20 61 6e 79 20 6f 66  |driver in any of|
00000d60  20 74 68 65 20 74 65 78  74 20 64 65 6d 6f 6e 73  | the text demons|
00000d70  74 72 61 74 69 6f 6e 73  20 75 73 65 64 20 65 61  |trations used ea|
00000d80  72 6c 69 65 72 20 69 6e  20 74 68 65 20 73 65 72  |rlier in the ser|
00000d90  69 65 73 2e 20 54 68 65  0d 66 69 6c 65 20 4c 50  |ies. The.file LP|
00000da0  47 52 41 50 48 20 63 61  6e 20 62 65 20 75 73 65  |GRAPH can be use|
00000db0  64 20 61 73 20 74 68 65  20 6c 69 67 68 74 20 70  |d as the light p|
00000dc0  65 6e 20 64 72 69 76 65  72 20 66 6f 72 20 74 68  |en driver for th|
00000dd0  65 20 66 72 65 65 68 61  6e 64 20 64 72 61 77 69  |e freehand drawi|
00000de0  6e 67 0d 64 65 6d 6f 6e  73 74 72 61 74 69 6f 6e  |ng.demonstration|
00000df0  20 70 72 6f 67 72 61 6d  20 41 52 54 49 53 54 2e  | program ARTIST.|
00000e00  0d 0d 54 6f 20 75 73 65  20 74 68 65 20 70 72 6f  |..To use the pro|
00000e10  67 72 61 6d 20 41 52 54  49 53 54 20 79 6f 75 20  |gram ARTIST you |
00000e20  73 68 6f 75 6c 64 20 66  69 72 73 74 20 6c 6f 61  |should first loa|
00000e30  64 20 74 68 65 20 6f 62  6a 65 63 74 20 63 6f 64  |d the object cod|
00000e40  65 20 66 69 6c 65 0d 4c  50 47 52 41 50 48 20 69  |e file.LPGRAPH i|
00000e50  6e 74 6f 20 53 57 52 20  61 6e 64 20 70 72 65 73  |nto SWR and pres|
00000e60  73 20 74 68 65 20 42 72  65 61 6b 20 6b 65 79 2e  |s the Break key.|
00000e70  20 54 68 65 6e 20 63 68  61 69 6e 20 41 52 54 49  | Then chain ARTI|
00000e80  53 54 20 77 68 69 63 68  20 6d 75 73 74 20 72 75  |ST which must ru|
00000e90  6e 0d 69 6e 20 74 68 65  20 49 2f 4f 20 70 72 6f  |n.in the I/O pro|
00000ea0  63 65 73 73 6f 72 2e 20  54 68 65 20 66 6f 6c 6c  |cessor. The foll|
00000eb0  6f 77 69 6e 67 20 6b 65  79 73 20 61 72 65 20 75  |owing keys are u|
00000ec0  73 65 64 20 74 6f 20 73  65 6c 65 63 74 20 76 61  |sed to select va|
00000ed0  72 69 6f 75 73 0d 6f 70  74 69 6f 6e 73 20 69 6e  |rious.options in|
00000ee0  20 41 52 54 49 53 54 3a  0d 0d 0d 49 20 20 20 20  | ARTIST:...I    |
00000ef0  20 20 53 65 6c 65 63 74  20 61 20 6e 65 77 20 66  |  Select a new f|
00000f00  6f 72 65 67 72 6f 75 6e  64 20 63 6f 6c 6f 75 72  |oreground colour|
00000f10  20 28 49 6e 6b 29 2e 20  54 68 65 20 63 6f 6c 6f  | (Ink). The colo|
00000f20  75 72 20 69 73 20 69 6e  64 69 63 61 74 65 64 20  |ur is indicated |
00000f30  62 79 20 61 6e 0d 20 20  20 20 20 20 20 61 73 74  |by an.       ast|
00000f40  65 72 69 73 6b 20 69 6e  20 74 68 65 20 62 6f 74  |erisk in the bot|
00000f50  74 6f 6d 20 6c 65 66 74  20 68 61 6e 64 20 63 6f  |tom left hand co|
00000f60  72 6e 65 72 2e 0d 0d 50  20 20 20 20 20 20 53 65  |rner...P      Se|
00000f70  6c 65 63 74 20 61 20 6e  65 77 20 62 61 63 6b 67  |lect a new backg|
00000f80  72 6f 75 6e 64 20 63 6f  6c 6f 75 72 20 28 50 61  |round colour (Pa|
00000f90  70 65 72 29 2e 0d 0d 4c  20 20 20 20 20 20 44 72  |per)...L      Dr|
00000fa0  61 77 20 61 20 6c 69 6e  65 2e 20 59 6f 75 20 6e  |aw a line. You n|
00000fb0  65 65 64 20 74 6f 20 65  6e 74 65 72 20 61 20 70  |eed to enter a p|
00000fc0  6f 69 6e 74 20 61 74 20  65 69 74 68 65 72 20 65  |oint at either e|
00000fd0  6e 64 20 6f 66 20 74 68  65 20 6c 69 6e 65 0d 20  |nd of the line. |
00000fe0  20 20 20 20 20 20 77 69  74 68 20 79 6f 75 72 20  |      with your |
00000ff0  6c 69 67 68 74 20 70 65  6e 2e 0d 0d 43 20 20 20  |light pen...C   |
00001000  20 20 20 44 72 61 77 20  61 20 63 69 72 63 6c 65  |   Draw a circle|
00001010  2e 20 59 6f 75 20 6e 65  65 64 20 74 6f 20 65 6e  |. You need to en|
00001020  74 65 72 20 74 77 6f 20  70 6f 69 6e 74 73 20 77  |ter two points w|
00001030  69 74 68 20 79 6f 75 72  20 6c 69 67 68 74 20 70  |ith your light p|
00001040  65 6e 2e 0d 20 20 20 20  20 20 20 46 69 72 73 74  |en..       First|
00001050  20 74 68 65 20 63 65 6e  74 72 65 20 6f 66 20 74  | the centre of t|
00001060  68 65 20 63 69 72 63 6c  65 2c 20 61 6e 64 20 74  |he circle, and t|
00001070  68 65 6e 20 61 20 70 6f  69 6e 74 20 6f 6e 20 74  |hen a point on t|
00001080  68 65 0d 20 20 20 20 20  20 20 63 69 72 63 75 6d  |he.       circum|
00001090  66 65 72 65 6e 63 65 2e  0d 0d 53 20 20 20 20 20  |ference...S     |
000010a0  20 44 72 61 77 20 61 20  73 71 75 61 72 65 2e 20  | Draw a square. |
000010b0  59 6f 75 20 6e 65 65 64  20 74 6f 20 65 6e 74 65  |You need to ente|
000010c0  72 20 61 20 70 6f 69 6e  74 20 61 74 20 74 68 65  |r a point at the|
000010d0  20 65 69 74 68 65 72 20  65 6e 64 20 6f 66 20 74  | either end of t|
000010e0  68 65 0d 20 20 20 20 20  20 20 62 61 73 65 20 6f  |he.       base o|
000010f0  66 20 74 68 65 20 73 71  75 61 72 65 20 77 69 74  |f the square wit|
00001100  68 20 79 6f 75 72 20 6c  69 67 68 74 20 70 65 6e  |h your light pen|
00001110  2e 20 49 66 20 79 6f 75  20 65 6e 74 65 72 20 74  |. If you enter t|
00001120  68 65 20 6c 65 66 74 0d  20 20 20 20 20 20 20 63  |he left.       c|
00001130  6f 72 6e 65 72 20 61 6e  64 20 74 68 65 6e 20 74  |orner and then t|
00001140  68 65 20 72 69 67 68 74  20 63 6f 72 6e 65 72 2c  |he right corner,|
00001150  20 74 68 65 20 73 71 75  61 72 65 20 77 69 6c 6c  | the square will|
00001160  20 62 65 20 64 72 61 77  6e 20 61 62 6f 76 65 0d  | be drawn above.|
00001170  20 20 20 20 20 20 20 74  68 65 20 62 61 73 65 2e  |       the base.|
00001180  20 49 66 20 79 6f 75 20  65 6e 74 65 72 20 74 68  | If you enter th|
00001190  65 20 72 69 67 68 74 20  63 6f 72 6e 65 72 20 61  |e right corner a|
000011a0  6e 64 20 74 68 65 6e 20  74 68 65 20 6c 65 66 74  |nd then the left|
000011b0  20 63 6f 72 6e 65 72 2c  0d 20 20 20 20 20 20 20  | corner,.       |
000011c0  74 68 65 20 73 71 75 61  72 65 20 77 69 6c 6c 20  |the square will |
000011d0  62 65 20 64 72 61 77 6e  20 62 65 6c 6f 77 20 74  |be drawn below t|
000011e0  68 65 20 62 61 73 65 2e  0d 0d 54 20 20 20 20 20  |he base...T     |
000011f0  20 44 72 61 77 20 61 6e  64 20 66 69 6c 6c 20 61  | Draw and fill a|
00001200  20 74 72 69 61 6e 67 6c  65 2e 20 59 6f 75 20 6e  | triangle. You n|
00001210  65 65 64 20 74 6f 20 65  6e 74 65 72 20 74 68 65  |eed to enter the|
00001220  20 74 68 72 65 65 20 61  70 69 63 69 65 73 20 6f  | three apicies o|
00001230  66 0d 20 20 20 20 20 20  20 74 68 65 20 74 72 69  |f.       the tri|
00001240  61 6e 67 6c 65 20 77 69  74 68 20 79 6f 75 72 20  |angle with your |
00001250  6c 69 67 68 74 20 70 65  6e 2e 0d 0d 46 20 20 20  |light pen...F   |
00001260  20 20 20 46 69 6c 6c 20  61 6e 20 65 6e 63 6c 6f  |   Fill an enclo|
00001270  73 65 64 20 61 72 65 61  20 77 69 74 68 20 74 68  |sed area with th|
00001280  65 20 66 6f 72 65 67 72  6f 75 6e 64 20 63 6f 6c  |e foreground col|
00001290  6f 75 72 2e 20 59 6f 75  20 6e 65 65 64 20 74 6f  |our. You need to|
000012a0  20 65 6e 74 65 72 0d 20  20 20 20 20 20 20 6f 6e  | enter.       on|
000012b0  65 20 70 6f 69 6e 74 20  77 69 74 68 20 74 68 65  |e point with the|
000012c0  20 6c 69 67 68 74 20 70  65 6e 20 61 6e 64 20 74  | light pen and t|
000012d0  68 65 20 61 72 65 61 20  77 69 6c 6c 20 66 69 6c  |he area will fil|
000012e0  6c 20 75 70 20 61 6e 64  20 64 6f 77 6e 0d 20 20  |l up and down.  |
000012f0  20 20 20 20 20 66 72 6f  6d 20 74 68 61 74 20 70  |     from that p|
00001300  6f 69 6e 74 20 75 6e 74  69 6c 20 61 6e 79 20 66  |oint until any f|
00001310  6f 72 65 67 72 6f 75 6e  64 20 63 6f 6c 6f 75 72  |oreground colour|
00001320  2e 20 59 6f 75 20 6d 61  79 20 6e 65 65 64 20 74  |. You may need t|
00001330  6f 20 75 73 65 0d 20 20  20 20 20 20 20 74 68 69  |o use.       thi|
00001340  73 20 6f 70 74 69 6f 6e  20 61 20 6e 75 6d 62 65  |s option a numbe|
00001350  72 20 6f 66 20 74 69 6d  65 73 20 74 6f 20 66 69  |r of times to fi|
00001360  6c 6c 20 61 20 27 64 69  66 66 69 63 75 6c 74 27  |ll a 'difficult'|
00001370  20 61 72 65 61 2e 0d 0d  44 65 6c 65 74 65 20 43  | area...Delete C|
00001380  6c 65 61 72 20 74 68 65  20 73 63 72 65 65 6e 2e  |lear the screen.|
00001390  0d 0d 0d 54 68 65 20 70  72 6f 67 72 61 6d 20 41  |...The program A|
000013a0  52 54 49 53 54 20 69 73  20 6f 6e 6c 79 20 61 20  |RTIST is only a |
000013b0  64 65 6d 6f 6e 73 74 72  61 74 69 6f 6e 20 6f 66  |demonstration of|
000013c0  20 74 68 65 20 63 61 70  61 62 69 6c 69 74 69 65  | the capabilitie|
000013d0  73 20 6f 66 20 74 68 65  0d 6c 69 67 68 74 20 70  |s of the.light p|
000013e0  65 6e 20 61 73 20 61 20  64 72 61 77 69 6e 67 20  |en as a drawing |
000013f0  74 6f 6f 6c 2e 20 54 68  65 72 65 20 69 73 20 70  |tool. There is p|
00001400  6c 65 6e 74 79 20 6f 66  20 73 63 6f 70 65 20 61  |lenty of scope a|
00001410  6e 64 20 70 6c 65 6e 74  79 20 6f 66 20 6d 65 6d  |nd plenty of mem|
00001420  6f 72 79 0d 6c 65 66 74  20 66 6f 72 20 69 6d 70  |ory.left for imp|
00001430  72 6f 76 65 6d 65 6e 74  2e 0d 0d 0d 20 20 20 31  |rovement....   1|
00001440  30 20 52 45 4d 3e 20 53  57 54 45 58 54 0d 20 20  |0 REM> SWTEXT.  |
00001450  20 32 30 20 44 49 4d 20  6d 63 6f 64 65 20 26 32  | 20 DIM mcode &2|
00001460  30 30 0d 20 20 20 33 30  20 78 63 6f 6f 72 64 3d  |00.   30 xcoord=|
00001470  26 37 30 0d 20 20 20 34  30 20 79 63 6f 6f 72 64  |&70.   40 ycoord|
00001480  3d 26 37 31 0d 20 20 20  35 30 20 66 69 72 65 3d  |=&71.   50 fire=|
00001490  26 37 32 0d 20 20 20 36  30 20 73 61 76 65 72 65  |&72.   60 savere|
000014a0  67 3d 26 46 43 0d 20 20  20 37 30 20 73 74 61 72  |g=&FC.   70 star|
000014b0  74 3d 26 33 35 30 20 3a  52 45 4d 3a 20 73 63 72  |t=&350 :REM: scr|
000014c0  65 65 6e 20 73 74 61 72  74 20 61 64 64 72 65 73  |een start addres|
000014d0  73 0d 20 20 20 38 30 20  73 63 72 65 65 6e 3d 26  |s.   80 screen=&|
000014e0  33 35 35 20 3a 52 45 4d  3a 20 73 63 72 65 65 6e  |355 :REM: screen|
000014f0  20 6d 6f 64 65 20 4f 53  20 31 2e 32 0d 20 20 20  | mode OS 1.2.   |
00001500  39 30 20 73 68 65 69 6c  61 3d 26 46 45 30 30 0d  |90 sheila=&FE00.|
00001510  20 20 31 30 30 20 64 72  62 3d 26 46 45 34 30 20  |  100 drb=&FE40 |
00001520  3a 52 45 4d 3a 20 73 79  73 74 65 6d 20 36 35 32  |:REM: system 652|
00001530  32 20 69 6e 70 75 74 2f  6f 75 74 70 75 74 20 72  |2 input/output r|
00001540  65 67 69 73 74 65 72 20  42 0d 20 20 31 31 30 20  |egister B.  110 |
00001550  69 66 72 3d 26 46 45 34  44 20 3a 52 45 4d 3a 20  |ifr=&FE4D :REM: |
00001560  73 79 73 74 65 6d 20 36  35 32 32 20 69 6e 74 65  |system 6522 inte|
00001570  72 72 75 70 74 20 66 6c  61 67 20 72 65 67 69 73  |rrupt flag regis|
00001580  74 65 72 0d 20 20 31 32  30 20 69 65 72 3d 26 46  |ter.  120 ier=&F|
00001590  45 34 45 20 3a 52 45 4d  3a 20 73 79 73 74 65 6d  |E4E :REM: system|
000015a0  20 36 35 32 32 20 69 6e  74 65 72 72 75 70 74 20  | 6522 interrupt |
000015b0  65 6e 61 62 6c 65 20 72  65 67 69 73 74 65 72 0d  |enable register.|
000015c0  20 20 31 33 30 20 46 4f  52 20 70 61 73 73 3d 34  |  130 FOR pass=4|
000015d0  20 54 4f 20 36 20 53 54  45 50 20 32 0d 20 20 31  | TO 6 STEP 2.  1|
000015e0  34 30 20 4f 25 3d 6d 63  6f 64 65 0d 20 20 31 35  |40 O%=mcode.  15|
000015f0  30 20 50 25 3d 26 38 30  30 30 0d 20 20 31 36 30  |0 P%=&8000.  160|
00001600  20 5b 20 20 20 20 20 20  20 4f 50 54 20 70 61 73  | [       OPT pas|
00001610  73 0d 20 20 31 37 30 20  20 20 20 20 20 20 20 20  |s.  170         |
00001620  42 52 4b 0d 20 20 31 38  30 20 20 20 20 20 20 20  |BRK.  180       |
00001630  20 20 42 52 4b 0d 20 20  31 39 30 20 20 20 20 20  |  BRK.  190     |
00001640  20 20 20 20 42 52 4b 0d  20 20 32 30 30 20 20 20  |    BRK.  200   |
00001650  20 20 20 20 20 20 4a 4d  50 20 73 65 72 76 69 63  |      JMP servic|
00001660  65 20 20 20 5c 20 73 65  72 76 69 63 65 20 65 6e  |e   \ service en|
00001670  74 72 79 20 74 6f 20 52  4f 4d 0d 20 20 32 31 30  |try to ROM.  210|
00001680  20 20 20 20 20 20 20 20  20 45 51 55 42 20 26 38  |         EQUB &8|
00001690  32 20 20 20 20 20 20 5c  20 52 4f 4d 20 74 79 70  |2      \ ROM typ|
000016a0  65 20 62 79 74 65 20 69  6e 64 69 63 61 74 65 73  |e byte indicates|
000016b0  20 61 20 73 65 72 76 69  63 65 20 65 6e 74 72 79  | a service entry|
000016c0  0d 20 20 32 32 30 20 20  20 20 20 20 20 20 20 45  |.  220         E|
000016d0  51 55 42 20 63 6f 70 79  72 69 67 68 74 20 4d 4f  |QUB copyright MO|
000016e0  44 20 32 35 36 20 5c 20  63 6f 70 79 72 69 67 68  |D 256 \ copyrigh|
000016f0  74 20 6f 66 66 73 65 74  20 70 6f 69 6e 74 65 72  |t offset pointer|
00001700  0d 20 20 32 33 30 20 20  20 20 20 20 20 20 20 42  |.  230         B|
00001710  52 4b 20 20 20 20 20 20  20 20 20 20 20 5c 20 42  |RK           \ B|
00001720  52 4b 20 73 65 72 76 65  73 20 61 73 20 62 69 6e  |RK serves as bin|
00001730  61 72 79 20 76 65 72 73  69 6f 6e 20 6e 75 6d 62  |ary version numb|
00001740  65 72 0d 20 20 32 34 30  20 20 20 20 20 20 20 20  |er.  240        |
00001750  20 45 51 55 53 22 4c 69  67 68 74 20 70 65 6e 20  | EQUS"Light pen |
00001760  54 65 78 74 22 20 5c 20  74 69 74 6c 65 20 73 74  |Text" \ title st|
00001770  72 69 6e 67 0d 20 20 32  35 30 20 2e 63 6f 70 79  |ring.  250 .copy|
00001780  72 69 67 68 74 0d 20 20  32 36 30 20 20 20 20 20  |right.  260     |
00001790  20 20 20 20 42 52 4b 20  20 20 20 20 20 20 20 20  |    BRK         |
000017a0  20 20 5c 20 73 74 61 72  74 20 6f 66 20 63 6f 70  |  \ start of cop|
000017b0  79 72 69 67 68 74 2f 65  6e 64 20 6f 66 20 74 69  |yright/end of ti|
000017c0  74 6c 65 0d 20 20 32 37  30 20 20 20 20 20 20 20  |tle.  270       |
000017d0  20 20 45 51 55 53 20 22  28 43 29 20 47 6f 72 64  |  EQUS "(C) Gord|
000017e0  6f 6e 20 48 6f 72 73 69  6e 67 74 6f 6e 20 31 39  |on Horsington 19|
000017f0  38 37 22 0d 20 20 32 38  30 20 20 20 20 20 20 20  |87".  280       |
00001800  20 20 42 52 4b 20 20 20  20 20 20 20 20 20 20 20  |  BRK           |
00001810  5c 20 63 6f 70 79 72 69  67 68 74 20 74 65 72 6d  |\ copyright term|
00001820  69 6e 61 74 6f 72 0d 20  20 32 39 30 20 2e 65 78  |inator.  290 .ex|
00001830  69 74 0d 20 20 33 30 30  20 20 20 20 20 20 20 20  |it.  300        |
00001840  20 50 4c 41 0d 20 20 33  31 30 20 20 20 20 20 20  | PLA.  310      |
00001850  20 20 20 53 54 41 20 73  61 76 65 72 65 67 0d 20  |   STA savereg. |
00001860  20 33 32 30 20 20 20 20  20 20 20 20 20 4c 44 41  | 320         LDA|
00001870  20 23 26 30 35 20 20 20  20 20 20 5c 20 75 6e 72  | #&05      \ unr|
00001880  65 63 6f 67 6e 69 73 65  64 20 69 6e 74 65 72 72  |ecognised interr|
00001890  75 70 74 20 73 65 72 76  69 63 65 20 63 61 6c 6c  |upt service call|
000018a0  0d 20 20 33 33 30 20 2e  72 65 74 75 72 6e 0d 20  |.  330 .return. |
000018b0  20 33 34 30 20 20 20 20  20 20 20 20 20 52 54 53  | 340         RTS|
000018c0  0d 20 20 33 35 30 20 2e  73 65 72 76 69 63 65 0d  |.  350 .service.|
000018d0  20 20 33 36 30 20 20 20  20 20 20 20 20 20 43 4d  |  360         CM|
000018e0  50 20 23 26 30 35 20 20  20 20 20 20 5c 20 69 73  |P #&05      \ is|
000018f0  20 74 68 69 73 20 61 6e  20 75 6e 72 65 63 6f 67  | this an unrecog|
00001900  6e 69 73 65 64 20 69 6e  74 65 72 72 75 70 74 3f  |nised interrupt?|
00001910  0d 20 20 33 37 30 20 20  20 20 20 20 20 20 20 42  |.  370         B|
00001920  4e 45 20 72 65 74 75 72  6e 20 20 20 20 5c 20 62  |NE return    \ b|
00001930  72 61 6e 63 68 20 69 66  20 6e 6f 74 20 69 6e 74  |ranch if not int|
00001940  65 72 72 75 70 74 0d 20  20 33 38 30 20 20 20 20  |errupt.  380    |
00001950  20 20 20 20 20 4c 44 41  20 73 61 76 65 72 65 67  |     LDA savereg|
00001960  20 20 20 5c 20 6c 6f 61  64 20 69 6e 74 65 72 72  |   \ load interr|
00001970  75 70 74 20 61 63 63 75  6d 75 6c 61 74 6f 72 20  |upt accumulator |
00001980  73 61 76 65 20 72 65 67  69 73 74 65 72 0d 20 20  |save register.  |
00001990  33 39 30 20 20 20 20 20  20 20 20 20 50 48 41 20  |390         PHA |
000019a0  20 20 20 20 20 20 20 20  20 20 5c 20 61 6e 64 20  |          \ and |
000019b0  70 75 73 68 20 69 74 20  6f 6e 20 74 68 65 20 73  |push it on the s|
000019c0  74 61 63 6b 0d 20 20 34  30 30 20 20 20 20 20 20  |tack.  400      |
000019d0  20 20 20 4c 44 41 20 69  66 72 20 20 20 20 20 20  |   LDA ifr      |
000019e0  20 5c 20 6c 6f 61 64 20  73 79 73 74 65 6d 20 56  | \ load system V|
000019f0  49 41 20 69 6e 74 65 72  72 75 70 74 20 73 74 61  |IA interrupt sta|
00001a00  74 75 73 0d 20 20 34 31  30 20 20 20 20 20 20 20  |tus.  410       |
00001a10  20 20 42 50 4c 20 65 78  69 74 20 20 20 20 20 20  |  BPL exit      |
00001a20  5c 20 65 78 69 74 20 69  66 20 62 69 74 20 37 20  |\ exit if bit 7 |
00001a30  63 6c 65 61 72 0d 20 20  34 32 30 20 20 20 20 20  |clear.  420     |
00001a40  20 20 20 20 41 4e 44 20  23 26 30 38 20 20 20 20  |    AND #&08    |
00001a50  20 20 5c 20 41 4e 44 20  77 69 74 68 20 25 30 30  |  \ AND with %00|
00001a60  30 30 31 30 30 30 0d 20  20 34 33 30 20 20 20 20  |001000.  430    |
00001a70  20 20 20 20 20 42 45 51  20 65 78 69 74 20 20 20  |     BEQ exit   |
00001a80  20 20 20 5c 20 65 78 69  74 20 69 66 20 6e 6f 74  |   \ exit if not|
00001a90  20 6c 69 67 68 74 20 70  65 6e 20 69 6e 74 65 72  | light pen inter|
00001aa0  72 75 70 74 0d 20 20 34  34 30 20 20 20 20 20 20  |rupt.  440      |
00001ab0  20 20 20 54 58 41 0d 20  20 34 35 30 20 20 20 20  |   TXA.  450    |
00001ac0  20 20 20 20 20 50 48 41  0d 20 20 34 36 30 20 20  |     PHA.  460  |
00001ad0  20 20 20 20 20 20 20 54  59 41 0d 20 20 34 37 30  |       TYA.  470|
00001ae0  20 20 20 20 20 20 20 20  20 50 48 41 0d 20 20 34  |         PHA.  4|
00001af0  38 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 64  |80         LDA d|
00001b00  72 62 20 20 20 20 20 20  20 5c 20 63 6c 65 61 72  |rb       \ clear|
00001b10  20 69 6e 74 65 72 72 75  70 74 0d 20 20 34 39 30  | interrupt.  490|
00001b20  20 20 20 20 20 20 20 20  20 50 48 41 20 20 20 20  |         PHA    |
00001b30  20 20 20 20 20 20 20 5c  20 70 75 73 68 20 64 61  |       \ push da|
00001b40  74 61 20 72 65 67 69 73  74 65 72 20 42 0d 20 20  |ta register B.  |
00001b50  35 30 30 20 20 20 20 20  20 20 20 20 43 4c 44 20  |500         CLD |
00001b60  20 20 20 20 20 20 20 20  20 20 5c 20 63 6c 65 61  |          \ clea|
00001b70  72 20 64 65 63 69 6d 61  6c 20 66 6c 61 67 0d 20  |r decimal flag. |
00001b80  20 35 31 30 20 20 20 20  20 20 20 20 20 4c 44 59  | 510         LDY|
00001b90  20 73 63 72 65 65 6e 20  20 20 20 5c 20 73 63 72  | screen    \ scr|
00001ba0  65 65 6e 20 6d 6f 64 65  20 69 6e 74 6f 20 59 20  |een mode into Y |
00001bb0  72 65 67 69 73 74 65 72  0d 20 20 35 32 30 20 20  |register.  520  |
00001bc0  20 20 20 20 20 20 20 4c  44 41 20 73 74 61 72 74  |       LDA start|
00001bd0  20 20 20 20 20 5c 20 73  63 72 65 65 6e 20 73 74  |     \ screen st|
00001be0  61 72 74 20 61 64 64 72  65 73 73 2c 20 6c 6f 77  |art address, low|
00001bf0  20 62 79 74 65 0d 20 20  35 33 30 20 20 20 20 20  | byte.  530     |
00001c00  20 20 20 20 53 54 41 20  79 63 6f 6f 72 64 0d 20  |    STA ycoord. |
00001c10  20 35 34 30 20 20 20 20  20 20 20 20 20 4c 44 41  | 540         LDA|
00001c20  20 73 74 61 72 74 2b 31  20 20 20 5c 20 73 63 72  | start+1   \ scr|
00001c30  65 65 6e 20 73 74 61 72  74 20 61 64 64 72 65 73  |een start addres|
00001c40  73 2c 20 68 69 67 68 20  62 79 74 65 0d 20 20 35  |s, high byte.  5|
00001c50  35 30 20 20 20 20 20 20  20 20 20 53 54 41 20 79  |50         STA y|
00001c60  63 6f 6f 72 64 2b 31 0d  20 20 35 36 30 20 20 20  |coord+1.  560   |
00001c70  20 20 20 20 20 20 43 50  59 20 23 26 30 37 20 20  |      CPY #&07  |
00001c80  20 20 20 20 5c 20 69 73  20 74 68 69 73 20 6d 6f  |    \ is this mo|
00001c90  64 65 20 37 3f 0d 20 20  35 37 30 20 20 20 20 20  |de 7?.  570     |
00001ca0  20 20 20 20 42 45 51 20  6d 6f 64 65 37 0d 20 20  |    BEQ mode7.  |
00001cb0  35 38 30 20 20 20 20 20  20 20 20 20 4c 53 52 20  |580         LSR |
00001cc0  79 63 6f 6f 72 64 2b 31  0d 20 20 35 39 30 20 20  |ycoord+1.  590  |
00001cd0  20 20 20 20 20 20 20 52  4f 52 20 79 63 6f 6f 72  |       ROR ycoor|
00001ce0  64 20 20 20 20 5c 20 73  74 61 72 74 20 61 64 64  |d    \ start add|
00001cf0  72 65 73 73 20 44 49 56  20 32 0d 20 20 36 30 30  |ress DIV 2.  600|
00001d00  20 20 20 20 20 20 20 20  20 4c 53 52 20 79 63 6f  |         LSR yco|
00001d10  6f 72 64 2b 31 0d 20 20  36 31 30 20 20 20 20 20  |ord+1.  610     |
00001d20  20 20 20 20 52 4f 52 20  79 63 6f 6f 72 64 20 20  |    ROR ycoord  |
00001d30  20 20 5c 20 73 74 61 72  74 20 61 64 64 72 65 73  |  \ start addres|
00001d40  73 20 44 49 56 20 34 0d  20 20 36 32 30 20 20 20  |s DIV 4.  620   |
00001d50  20 20 20 20 20 20 4c 53  52 20 79 63 6f 6f 72 64  |      LSR ycoord|
00001d60  2b 31 0d 20 20 36 33 30  20 20 20 20 20 20 20 20  |+1.  630        |
00001d70  20 52 4f 52 20 79 63 6f  6f 72 64 20 20 20 20 5c  | ROR ycoord    \|
00001d80  20 73 74 61 72 74 20 61  64 64 72 65 73 73 20 44  | start address D|
00001d90  49 56 20 38 0d 20 20 36  34 30 20 20 20 20 20 20  |IV 8.  640      |
00001da0  20 20 20 4a 4d 50 20 63  6f 6e 74 69 6e 75 65 20  |   JMP continue |
00001db0  20 5c 20 73 6b 69 70 20  6d 6f 64 65 20 37 20 63  | \ skip mode 7 c|
00001dc0  61 6c 63 75 6c 61 74 69  6f 6e 0d 20 20 36 35 30  |alculation.  650|
00001dd0  20 2e 6d 6f 64 65 37 0d  20 20 36 36 30 20 20 20  | .mode7.  660   |
00001de0  20 20 20 20 20 20 53 45  43 20 20 20 20 20 20 20  |      SEC       |
00001df0  20 20 20 20 5c 20 70 72  65 70 61 72 65 20 66 6f  |    \ prepare fo|
00001e00  72 20 73 75 62 74 72 61  63 74 69 6f 6e 0d 20 20  |r subtraction.  |
00001e10  36 37 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |670         LDA |
00001e20  79 63 6f 6f 72 64 2b 31  0d 20 20 36 38 30 20 20  |ycoord+1.  680  |
00001e30  20 20 20 20 20 20 20 53  42 43 20 23 26 35 34 0d  |       SBC #&54.|
00001e40  20 20 36 39 30 20 20 20  20 20 20 20 20 20 53 54  |  690         ST|
00001e50  41 20 79 63 6f 6f 72 64  2b 31 20 20 5c 20 73 75  |A ycoord+1  \ su|
00001e60  62 74 72 61 63 74 20 26  35 34 30 30 20 66 72 6f  |btract &5400 fro|
00001e70  6d 20 73 74 61 72 74 20  61 64 64 72 65 73 73 0d  |m start address.|
00001e80  20 20 37 30 30 20 2e 63  6f 6e 74 69 6e 75 65 0d  |  700 .continue.|
00001e90  20 20 37 31 30 20 20 20  20 20 20 20 20 20 4c 44  |  710         LD|
00001ea0  41 20 6f 66 66 73 65 74  6c 6f 77 2c 59 0d 20 20  |A offsetlow,Y.  |
00001eb0  37 32 30 20 20 20 20 20  20 20 20 20 43 4c 43 20  |720         CLC |
00001ec0  20 20 20 20 20 20 20 20  20 20 5c 20 70 72 65 70  |          \ prep|
00001ed0  61 72 65 20 66 6f 72 20  61 64 64 69 74 69 6f 6e  |are for addition|
00001ee0  0d 20 20 37 33 30 20 20  20 20 20 20 20 20 20 41  |.  730         A|
00001ef0  44 43 20 79 63 6f 6f 72  64 20 20 20 20 5c 20 61  |DC ycoord    \ a|
00001f00  64 64 20 74 72 69 6d 20  74 6f 20 6f 66 66 73 65  |dd trim to offse|
00001f10  74 0d 20 20 37 34 30 20  20 20 20 20 20 20 20 20  |t.  740         |
00001f20  53 54 41 20 79 63 6f 6f  72 64 0d 20 20 37 35 30  |STA ycoord.  750|
00001f30  20 20 20 20 20 20 20 20  20 4c 44 41 20 23 26 30  |         LDA #&0|
00001f40  30 0d 20 20 37 36 30 20  20 20 20 20 20 20 20 20  |0.  760         |
00001f50  41 44 43 20 79 63 6f 6f  72 64 2b 31 0d 20 20 37  |ADC ycoord+1.  7|
00001f60  37 30 20 20 20 20 20 20  20 20 20 53 54 41 20 79  |70         STA y|
00001f70  63 6f 6f 72 64 2b 31 0d  20 20 37 38 30 20 20 20  |coord+1.  780   |
00001f80  20 20 20 20 20 20 53 45  43 20 20 20 20 20 20 20  |      SEC       |
00001f90  20 20 20 20 5c 20 70 72  65 70 61 72 65 20 74 6f  |    \ prepare to|
00001fa0  20 73 75 62 74 72 61 63  74 20 6f 66 66 73 65 74  | subtract offset|
00001fb0  20 66 72 6f 6d 20 6c 70  20 72 65 67 69 73 74 65  | from lp registe|
00001fc0  72 0d 20 20 37 39 30 20  20 20 20 20 20 20 20 20  |r.  790         |
00001fd0  4c 44 58 20 23 26 31 31  20 20 20 20 20 20 5c 20  |LDX #&11      \ |
00001fe0  6c 69 67 68 74 20 70 65  6e 20 72 65 67 69 73 74  |light pen regist|
00001ff0  65 72 2c 20 6c 6f 77 20  62 79 74 65 0d 20 20 38  |er, low byte.  8|
00002000  30 30 20 20 20 20 20 20  20 20 20 53 54 58 20 73  |00         STX s|
00002010  68 65 69 6c 61 20 20 20  20 5c 20 36 38 34 35 20  |heila    \ 6845 |
00002020  61 64 64 72 65 73 73 20  72 65 67 69 73 74 65 72  |address register|
00002030  0d 20 20 38 31 30 20 20  20 20 20 20 20 20 20 4c  |.  810         L|
00002040  44 41 20 73 68 65 69 6c  61 2b 31 20 20 5c 20 36  |DA sheila+1  \ 6|
00002050  38 34 35 20 64 61 74 61  20 72 65 67 69 73 74 65  |845 data registe|
00002060  72 0d 20 20 38 32 30 20  20 20 20 20 20 20 20 20  |r.  820         |
00002070  53 42 43 20 79 63 6f 6f  72 64 20 20 20 20 5c 20  |SBC ycoord    \ |
00002080  73 75 62 74 72 61 63 74  20 6f 66 66 73 65 74 2c  |subtract offset,|
00002090  20 6c 6f 77 20 62 79 74  65 0d 20 20 38 33 30 20  | low byte.  830 |
000020a0  20 20 20 20 20 20 20 20  53 54 41 20 79 63 6f 6f  |        STA ycoo|
000020b0  72 64 20 20 20 20 5c 20  6c 6f 77 20 62 79 74 65  |rd    \ low byte|
000020c0  20 2d 20 6f 66 66 73 65  74 0d 20 20 38 34 30 20  | - offset.  840 |
000020d0  20 20 20 20 20 20 20 20  44 45 58 20 20 20 20 20  |        DEX     |
000020e0  20 20 20 20 20 20 5c 20  58 20 3d 20 26 31 30 2c  |      \ X = &10,|
000020f0  20 6c 69 67 68 74 20 70  65 6e 20 72 65 67 69 73  | light pen regis|
00002100  74 65 72 2c 20 68 69 67  68 20 62 79 74 65 0d 20  |ter, high byte. |
00002110  20 38 35 30 20 20 20 20  20 20 20 20 20 53 54 58  | 850         STX|
00002120  20 73 68 65 69 6c 61 20  20 20 20 5c 20 36 38 34  | sheila    \ 684|
00002130  35 20 61 64 64 72 65 73  73 20 72 65 67 69 73 74  |5 address regist|
00002140  65 72 0d 20 20 38 36 30  20 20 20 20 20 20 20 20  |er.  860        |
00002150  20 4c 44 41 20 73 68 65  69 6c 61 2b 31 20 20 5c  | LDA sheila+1  \|
00002160  20 36 38 34 35 20 64 61  74 61 20 72 65 67 69 73  | 6845 data regis|
00002170  74 65 72 0d 20 20 38 37  30 20 20 20 20 20 20 20  |ter.  870       |
00002180  20 20 53 42 43 20 79 63  6f 6f 72 64 2b 31 20 20  |  SBC ycoord+1  |
00002190  5c 20 73 75 62 74 72 61  63 74 20 6f 66 66 73 65  |\ subtract offse|
000021a0  74 2c 20 68 69 67 68 20  62 79 74 65 0d 20 20 38  |t, high byte.  8|
000021b0  38 30 20 20 20 20 20 20  20 20 20 53 54 41 20 79  |80         STA y|
000021c0  63 6f 6f 72 64 2b 31 20  20 5c 20 68 69 67 68 20  |coord+1  \ high |
000021d0  62 79 74 65 20 2d 20 6f  66 66 73 65 74 0d 20 20  |byte - offset.  |
000021e0  38 39 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |890         LDA |
000021f0  23 26 30 30 20 20 20 20  20 20 5c 20 70 72 65 70  |#&00      \ prep|
00002200  61 72 65 20 66 6f 72 20  31 36 20 62 69 74 20 64  |are for 16 bit d|
00002210  69 76 69 73 69 6f 6e 0d  20 20 39 30 30 20 20 20  |ivision.  900   |
00002220  20 20 20 20 20 20 53 54  41 20 78 63 6f 6f 72 64  |      STA xcoord|
00002230  20 20 20 20 5c 20 63 6c  65 61 72 20 6c 6f 77 20  |    \ clear low |
00002240  70 61 72 74 69 61 6c 20  64 69 76 69 64 65 6e 64  |partial dividend|
00002250  0d 20 20 39 31 30 20 2e  6e 65 78 74 0d 20 20 39  |.  910 .next.  9|
00002260  32 30 20 20 20 20 20 20  20 20 20 41 53 4c 20 79  |20         ASL y|
00002270  63 6f 6f 72 64 20 20 20  20 5c 20 73 68 69 66 74  |coord    \ shift|
00002280  20 64 69 76 69 64 65 6e  64 2f 71 75 6f 74 69 65  | dividend/quotie|
00002290  6e 74 20 6c 65 66 74 0d  20 20 39 33 30 20 20 20  |nt left.  930   |
000022a0  20 20 20 20 20 20 52 4f  4c 20 79 63 6f 6f 72 64  |      ROL ycoord|
000022b0  2b 31 20 20 5c 20 73 68  69 66 74 20 64 69 76 69  |+1  \ shift divi|
000022c0  64 65 6e 64 2f 71 75 6f  74 69 65 6e 74 20 6c 65  |dend/quotient le|
000022d0  66 74 0d 20 20 39 34 30  20 20 20 20 20 20 20 20  |ft.  940        |
000022e0  20 52 4f 4c 20 78 63 6f  6f 72 64 20 20 20 20 5c  | ROL xcoord    \|
000022f0  20 73 68 69 66 74 20 62  69 74 73 20 69 6e 74 6f  | shift bits into|
00002300  20 70 61 72 74 69 61 6c  20 64 69 76 69 64 65 6e  | partial dividen|
00002310  64 0d 20 20 39 35 30 20  20 20 20 20 20 20 20 20  |d.  950         |
00002320  4c 44 41 20 78 63 6f 6f  72 64 20 20 20 20 5c 20  |LDA xcoord    \ |
00002330  6c 6f 61 64 20 70 61 72  74 69 61 6c 20 64 69 76  |load partial div|
00002340  69 64 65 6e 64 0d 20 20  39 36 30 20 20 20 20 20  |idend.  960     |
00002350  20 20 20 20 53 45 43 20  20 20 20 20 20 20 20 20  |    SEC         |
00002360  20 20 5c 20 70 72 65 70  61 72 65 20 66 6f 72 20  |  \ prepare for |
00002370  73 75 62 74 72 61 63 74  69 6f 6e 0d 20 20 39 37  |subtraction.  97|
00002380  30 20 20 20 20 20 20 20  20 20 53 42 43 20 77 69  |0         SBC wi|
00002390  64 74 68 2c 59 20 20 20  5c 20 73 75 62 74 72 61  |dth,Y   \ subtra|
000023a0  63 74 20 64 69 76 69 73  6f 72 0d 20 20 39 38 30  |ct divisor.  980|
000023b0  20 20 20 20 20 20 20 20  20 42 43 43 20 64 6f 6e  |         BCC don|
000023c0  65 20 20 20 20 20 20 5c  20 62 72 61 6e 63 68 20  |e      \ branch |
000023d0  69 66 20 64 69 76 69 64  65 6e 64 20 3c 20 64 69  |if dividend < di|
000023e0  76 69 73 6f 72 0d 20 20  39 39 30 20 20 20 20 20  |visor.  990     |
000023f0  20 20 20 20 49 4e 43 20  79 63 6f 6f 72 64 20 20  |    INC ycoord  |
00002400  20 20 5c 20 69 6e 63 72  65 6d 65 6e 74 20 71 75  |  \ increment qu|
00002410  6f 74 69 65 6e 74 0d 20  31 30 30 30 20 20 20 20  |otient. 1000    |
00002420  20 20 20 20 20 53 54 41  20 78 63 6f 6f 72 64 20  |     STA xcoord |
00002430  20 20 20 5c 20 73 61 76  65 20 6e 65 77 20 70 61  |   \ save new pa|
00002440  72 74 69 61 6c 20 64 69  76 69 64 65 6e 64 0d 20  |rtial dividend. |
00002450  31 30 31 30 20 2e 64 6f  6e 65 0d 20 31 30 32 30  |1010 .done. 1020|
00002460  20 20 20 20 20 20 20 20  20 44 45 58 20 20 20 20  |         DEX    |
00002470  20 20 20 20 20 20 20 5c  20 64 65 63 72 65 6d 65  |       \ decreme|
00002480  6e 74 20 62 69 74 20 63  6f 75 6e 74 65 72 0d 20  |nt bit counter. |
00002490  31 30 33 30 20 20 20 20  20 20 20 20 20 42 4e 45  |1030         BNE|
000024a0  20 6e 65 78 74 20 20 20  20 20 20 5c 20 62 72 61  | next      \ bra|
000024b0  6e 63 68 20 66 6f 72 20  31 36 20 62 69 74 73 0d  |nch for 16 bits.|
000024c0  20 31 30 34 30 20 20 20  20 20 20 20 20 20 4c 44  | 1040         LD|
000024d0  41 20 73 63 61 6c 65 2c  59 20 20 20 5c 20 73 63  |A scale,Y   \ sc|
000024e0  72 65 65 6e 20 6d 6f 64  65 20 73 63 61 6c 65 0d  |reen mode scale.|
000024f0  20 31 30 35 30 20 20 20  20 20 20 20 20 20 42 45  | 1050         BE|
00002500  51 20 70 75 6c 6c 6f 75  74 20 20 20 5c 20 62 72  |Q pullout   \ br|
00002510  61 6e 63 68 20 69 66 20  6d 6f 64 65 73 20 30 2c  |anch if modes 0,|
00002520  20 33 2c 20 34 2c 20 36  20 6f 72 20 37 0d 20 31  | 3, 4, 6 or 7. 1|
00002530  30 36 30 20 20 20 20 20  20 20 20 20 54 41 58 20  |060         TAX |
00002540  20 20 20 20 20 20 20 20  20 20 5c 20 69 6e 20 6d  |          \ in m|
00002550  6f 64 65 31 20 61 6e 64  20 6d 6f 64 65 35 20 58  |ode1 and mode5 X|
00002560  3d 31 2c 20 69 6e 20 6d  6f 64 65 32 20 58 3d 32  |=1, in mode2 X=2|
00002570  0d 20 31 30 37 30 20 20  20 20 20 20 20 20 20 4c  |. 1070         L|
00002580  44 41 20 78 63 6f 6f 72  64 0d 20 31 30 38 30 20  |DA xcoord. 1080 |
00002590  2e 72 65 64 75 63 65 0d  20 31 30 39 30 20 20 20  |.reduce. 1090   |
000025a0  20 20 20 20 20 20 4c 53  52 20 41 20 20 20 20 20  |      LSR A     |
000025b0  20 20 20 20 5c 20 68 6f  72 69 7a 6f 6e 74 61 6c  |    \ horizontal|
000025c0  20 70 6f 73 69 74 69 6f  6e 20 44 49 56 20 32 0d  | position DIV 2.|
000025d0  20 31 31 30 30 20 20 20  20 20 20 20 20 20 44 45  | 1100         DE|
000025e0  58 0d 20 31 31 31 30 20  20 20 20 20 20 20 20 20  |X. 1110         |
000025f0  42 4e 45 20 72 65 64 75  63 65 0d 20 31 31 32 30  |BNE reduce. 1120|
00002600  20 20 20 20 20 20 20 20  20 53 54 41 20 78 63 6f  |         STA xco|
00002610  6f 72 64 0d 20 31 31 33  30 20 2e 70 75 6c 6c 6f  |ord. 1130 .pullo|
00002620  75 74 0d 20 31 31 34 30  20 20 20 20 20 20 20 20  |ut. 1140        |
00002630  20 50 4c 41 20 20 20 20  20 20 20 20 20 20 20 5c  | PLA           \|
00002640  20 70 75 6c 6c 20 64 61  74 61 20 72 65 67 69 73  | pull data regis|
00002650  74 65 72 20 42 0d 20 31  31 35 30 20 20 20 20 20  |ter B. 1150     |
00002660  20 20 20 20 41 4e 44 20  23 26 32 30 20 20 20 20  |    AND #&20    |
00002670  20 20 5c 20 25 30 30 31  30 30 30 30 30 0d 20 31  |  \ %00100000. 1|
00002680  31 36 30 20 20 20 20 20  20 20 20 20 53 54 41 20  |160         STA |
00002690  66 69 72 65 20 20 20 20  20 20 5c 20 73 74 6f 72  |fire      \ stor|
000026a0  65 20 66 69 72 65 20 62  75 74 74 6f 6e 20 73 74  |e fire button st|
000026b0  61 74 75 73 0d 20 31 31  37 30 20 20 20 20 20 20  |atus. 1170      |
000026c0  20 20 20 50 4c 41 0d 20  31 31 38 30 20 20 20 20  |   PLA. 1180    |
000026d0  20 20 20 20 20 54 41 59  0d 20 31 31 39 30 20 20  |     TAY. 1190  |
000026e0  20 20 20 20 20 20 20 50  4c 41 0d 20 31 32 30 30  |       PLA. 1200|
000026f0  20 20 20 20 20 20 20 20  20 54 41 58 0d 20 31 32  |         TAX. 12|
00002700  31 30 20 20 20 20 20 20  20 20 20 50 4c 41 0d 20  |10         PLA. |
00002710  31 32 32 30 20 20 20 20  20 20 20 20 20 53 54 41  |1220         STA|
00002720  20 73 61 76 65 72 65 67  0d 20 31 32 33 30 20 20  | savereg. 1230  |
00002730  20 20 20 20 20 20 20 4c  44 41 20 23 26 30 30 20  |       LDA #&00 |
00002740  20 20 20 20 20 5c 20 69  6e 74 65 72 72 75 70 74  |     \ interrupt|
00002750  20 73 65 72 76 69 63 65  64 0d 20 31 32 34 30 20  | serviced. 1240 |
00002760  20 20 20 20 20 20 20 20  52 54 53 20 20 20 20 20  |        RTS     |
00002770  20 20 20 20 20 20 5c 20  72 65 74 75 72 6e 20 74  |      \ return t|
00002780  6f 20 6f 70 65 72 61 74  69 6e 67 20 73 79 73 74  |o operating syst|
00002790  65 6d 0d 20 31 32 35 30  20 2e 6f 66 66 73 65 74  |em. 1250 .offset|
000027a0  6c 6f 77 0d 20 31 32 36  30 20 20 20 20 20 20 20  |low. 1260       |
000027b0  20 20 45 51 55 42 20 26  30 34 20 20 20 20 20 20  |  EQUB &04      |
000027c0  5c 20 6d 6f 64 65 30 2c  20 75 6e 74 72 69 6d 6d  |\ mode0, untrimm|
000027d0  65 64 20 3d 20 26 30 36  0d 20 31 32 37 30 20 20  |ed = &06. 1270  |
000027e0  20 20 20 20 20 20 20 45  51 55 42 20 26 30 34 20  |       EQUB &04 |
000027f0  20 20 20 20 20 5c 20 6d  6f 64 65 31 2c 20 75 6e  |     \ mode1, un|
00002800  74 72 69 6d 6d 65 64 20  3d 20 26 30 36 0d 20 31  |trimmed = &06. 1|
00002810  32 38 30 20 20 20 20 20  20 20 20 20 45 51 55 42  |280         EQUB|
00002820  20 26 30 34 20 20 20 20  20 20 5c 20 6d 6f 64 65  | &04      \ mode|
00002830  32 2c 20 75 6e 74 72 69  6d 6d 65 64 20 3d 20 26  |2, untrimmed = &|
00002840  30 36 0d 20 31 32 39 30  20 20 20 20 20 20 20 20  |06. 1290        |
00002850  20 45 51 55 42 20 26 30  34 20 20 20 20 20 20 5c  | EQUB &04      \|
00002860  20 6d 6f 64 65 33 2c 20  75 6e 74 72 69 6d 6d 65  | mode3, untrimme|
00002870  64 20 3d 20 26 30 36 0d  20 31 33 30 30 20 20 20  |d = &06. 1300   |
00002880  20 20 20 20 20 20 45 51  55 42 20 26 30 33 20 20  |      EQUB &03  |
00002890  20 20 20 20 5c 20 6d 6f  64 65 34 2c 20 75 6e 74  |    \ mode4, unt|
000028a0  72 69 6d 6d 65 64 20 3d  20 26 30 34 0d 20 31 33  |rimmed = &04. 13|
000028b0  31 30 20 20 20 20 20 20  20 20 20 45 51 55 42 20  |10         EQUB |
000028c0  26 30 33 20 20 20 20 20  20 5c 20 6d 6f 64 65 35  |&03      \ mode5|
000028d0  2c 20 75 6e 74 72 69 6d  6d 65 64 20 3d 20 26 30  |, untrimmed = &0|
000028e0  34 0d 20 31 33 32 30 20  20 20 20 20 20 20 20 20  |4. 1320         |
000028f0  45 51 55 42 20 26 30 33  20 20 20 20 20 20 5c 20  |EQUB &03      \ |
00002900  6d 6f 64 65 36 2c 20 75  6e 74 72 69 6d 6d 65 64  |mode6, untrimmed|
00002910  20 3d 20 26 30 34 0d 20  31 33 33 30 20 20 20 20  | = &04. 1330    |
00002920  20 20 20 20 20 45 51 55  42 20 26 30 36 20 20 20  |     EQUB &06   |
00002930  20 20 20 5c 20 6d 6f 64  65 37 2c 20 75 6e 74 72  |   \ mode7, untr|
00002940  69 6d 6d 65 64 20 3d 20  26 30 38 0d 20 31 33 34  |immed = &08. 134|
00002950  30 20 2e 73 63 61 6c 65  0d 20 31 33 35 30 20 20  |0 .scale. 1350  |
00002960  20 20 20 20 20 20 20 45  51 55 44 20 26 30 30 30  |       EQUD &000|
00002970  32 30 31 30 30 20 5c 20  6d 6f 64 65 73 20 33 2d  |20100 \ modes 3-|
00002980  30 0d 20 31 33 36 30 20  20 20 20 20 20 20 20 20  |0. 1360         |
00002990  45 51 55 44 20 26 30 30  30 30 30 31 30 30 20 5c  |EQUD &00000100 \|
000029a0  20 6d 6f 64 65 73 20 37  2d 34 0d 20 31 33 37 30  | modes 7-4. 1370|
000029b0  20 2e 77 69 64 74 68 0d  20 31 33 38 30 20 20 20  | .width. 1380   |
000029c0  20 20 20 20 20 20 45 51  55 44 20 26 35 30 35 30  |      EQUD &5050|
000029d0  35 30 35 30 20 5c 20 6d  6f 64 65 73 20 33 2d 30  |5050 \ modes 3-0|
000029e0  0d 20 31 33 39 30 20 20  20 20 20 20 20 20 20 45  |. 1390         E|
000029f0  51 55 44 20 26 32 38 32  38 32 38 32 38 20 5c 20  |QUD &28282828 \ |
00002a00  6d 6f 64 65 73 20 37 2d  34 0d 20 31 34 30 30 20  |modes 7-4. 1400 |
00002a10  2e 6c 61 73 74 62 79 74  65 0d 20 31 34 31 30 20  |.lastbyte. 1410 |
00002a20  5d 0d 20 31 34 32 30 20  4e 45 58 54 0d 20 31 34  |]. 1420 NEXT. 14|
00002a30  33 30 20 2a 4f 50 54 31  2c 32 0d 20 31 34 34 30  |30 *OPT1,2. 1440|
00002a40  20 4f 53 43 4c 49 28 22  53 41 56 45 20 4c 50 54  | OSCLI("SAVE LPT|
00002a50  45 58 54 20 22 2b 53 54  52 24 7e 28 6d 63 6f 64  |EXT "+STR$~(mcod|
00002a60  65 29 2b 22 20 2b 20 22  0d 20 20 20 20 20 20 2b  |e)+" + ".      +|
00002a70  53 54 52 24 7e 28 6c 61  73 74 62 79 74 65 2d 26  |STR$~(lastbyte-&|
00002a80  38 30 30 30 29 2b 22 20  46 46 46 46 38 30 30 30  |8000)+" FFFF8000|
00002a90  20 46 46 46 46 38 30 30  30 22 29 0d 20 31 34 35  | FFFF8000"). 145|
00002aa0  30 20 2a 4f 50 54 30 2c  30 0d 0d 0d 20 20 20 31  |0 *OPT0,0...   1|
00002ab0  30 20 52 45 4d 3e 20 53  57 47 52 41 50 48 0d 20  |0 REM> SWGRAPH. |
00002ac0  20 20 32 30 20 44 49 4d  20 6d 63 6f 64 65 20 26  |  20 DIM mcode &|
00002ad0  32 30 30 0d 20 20 20 33  30 20 78 63 6f 6f 72 64  |200.   30 xcoord|
00002ae0  3d 26 37 30 20 3a 52 45  4d 3a 20 26 37 30 2d 26  |=&70 :REM: &70-&|
00002af0  37 33 0d 20 20 20 34 30  20 79 63 6f 6f 72 64 3d  |73.   40 ycoord=|
00002b00  26 37 34 20 3a 52 45 4d  3a 20 26 37 34 2d 26 37  |&74 :REM: &74-&7|
00002b10  37 0d 20 20 20 35 30 20  66 69 72 65 3d 26 37 38  |7.   50 fire=&78|
00002b20  20 3a 52 45 4d 3a 20 66  69 72 65 20 62 75 74 74  | :REM: fire butt|
00002b30  6f 6e 20 73 74 61 74 75  73 0d 20 20 20 36 30 20  |on status.   60 |
00002b40  73 61 76 65 72 65 67 3d  26 46 43 20 3a 52 45 4d  |savereg=&FC :REM|
00002b50  3a 20 69 6e 74 65 72 72  75 70 74 20 61 63 63 75  |: interrupt accu|
00002b60  6d 75 6c 61 74 6f 72 20  73 61 76 65 20 72 65 67  |mulator save reg|
00002b70  69 73 74 65 72 0d 20 20  20 37 30 20 73 74 61 72  |ister.   70 star|
00002b80  74 3d 26 33 35 30 20 3a  52 45 4d 3a 20 73 63 72  |t=&350 :REM: scr|
00002b90  65 65 6e 20 73 74 61 72  74 20 61 64 64 72 65 73  |een start addres|
00002ba0  73 0d 20 20 20 38 30 20  73 63 72 65 65 6e 3d 26  |s.   80 screen=&|
00002bb0  33 35 35 20 3a 52 45 4d  3a 20 73 63 72 65 65 6e  |355 :REM: screen|
00002bc0  20 6d 6f 64 65 20 4f 53  20 31 2e 32 0d 20 20 20  | mode OS 1.2.   |
00002bd0  39 30 20 73 68 65 69 6c  61 3d 26 46 45 30 30 0d  |90 sheila=&FE00.|
00002be0  20 20 31 30 30 20 64 72  62 3d 26 46 45 34 30 20  |  100 drb=&FE40 |
00002bf0  3a 52 45 4d 3a 20 73 79  73 74 65 6d 20 36 35 32  |:REM: system 652|
00002c00  32 20 64 61 74 61 20 72  65 67 69 73 74 65 72 20  |2 data register |
00002c10  42 0d 20 20 31 31 30 20  69 66 72 3d 26 46 45 34  |B.  110 ifr=&FE4|
00002c20  44 20 3a 52 45 4d 3a 20  73 79 73 74 65 6d 20 36  |D :REM: system 6|
00002c30  35 32 32 20 69 6e 74 65  72 72 75 70 74 20 66 6c  |522 interrupt fl|
00002c40  61 67 20 72 65 67 69 73  74 65 72 0d 20 20 31 32  |ag register.  12|
00002c50  30 20 69 65 72 3d 26 46  45 34 45 20 3a 52 45 4d  |0 ier=&FE4E :REM|
00002c60  3a 20 73 79 73 74 65 6d  20 36 35 32 32 20 69 6e  |: system 6522 in|
00002c70  74 65 72 72 75 70 74 20  65 6e 61 62 6c 65 20 72  |terrupt enable r|
00002c80  65 67 69 73 74 65 72 0d  20 20 31 33 30 20 46 4f  |egister.  130 FO|
00002c90  52 20 70 61 73 73 3d 34  20 54 4f 20 36 20 53 54  |R pass=4 TO 6 ST|
00002ca0  45 50 20 32 0d 20 20 31  34 30 20 4f 25 3d 6d 63  |EP 2.  140 O%=mc|
00002cb0  6f 64 65 0d 20 20 31 35  30 20 50 25 3d 26 38 30  |ode.  150 P%=&80|
00002cc0  30 30 0d 20 20 31 36 30  20 5b 20 20 20 20 20 20  |00.  160 [      |
00002cd0  20 4f 50 54 20 70 61 73  73 0d 20 20 31 37 30 20  | OPT pass.  170 |
00002ce0  20 20 20 20 20 20 20 20  42 52 4b 0d 20 20 31 38  |        BRK.  18|
00002cf0  30 20 20 20 20 20 20 20  20 20 42 52 4b 0d 20 20  |0         BRK.  |
00002d00  31 39 30 20 20 20 20 20  20 20 20 20 42 52 4b 0d  |190         BRK.|
00002d10  20 20 32 30 30 20 20 20  20 20 20 20 20 20 4a 4d  |  200         JM|
00002d20  50 20 73 65 72 76 69 63  65 20 20 20 5c 20 73 65  |P service   \ se|
00002d30  72 76 69 63 65 20 65 6e  74 72 79 20 74 6f 20 52  |rvice entry to R|
00002d40  4f 4d 0d 20 20 32 31 30  20 20 20 20 20 20 20 20  |OM.  210        |
00002d50  20 45 51 55 42 20 26 38  32 20 20 20 20 20 20 5c  | EQUB &82      \|
00002d60  20 52 4f 4d 20 74 79 70  65 20 62 79 74 65 20 69  | ROM type byte i|
00002d70  6e 64 69 63 61 74 65 73  20 61 20 73 65 72 76 69  |ndicates a servi|
00002d80  63 65 20 65 6e 74 72 79  0d 20 20 32 32 30 20 20  |ce entry.  220  |
00002d90  20 20 20 20 20 20 20 45  51 55 42 20 63 6f 70 79  |       EQUB copy|
00002da0  72 69 67 68 74 20 4d 4f  44 20 32 35 36 20 5c 20  |right MOD 256 \ |
00002db0  63 6f 70 79 72 69 67 68  74 20 6f 66 66 73 65 74  |copyright offset|
00002dc0  20 70 6f 69 6e 74 65 72  0d 20 20 32 33 30 20 20  | pointer.  230  |
00002dd0  20 20 20 20 20 20 20 42  52 4b 0d 20 20 32 34 30  |       BRK.  240|
00002de0  20 20 20 20 20 20 20 20  20 45 51 55 53 20 22 4c  |         EQUS "L|
00002df0  69 67 68 74 20 70 65 6e  20 47 72 61 70 68 69 63  |ight pen Graphic|
00002e00  73 22 20 5c 20 74 69 74  6c 65 20 73 74 72 69 6e  |s" \ title strin|
00002e10  67 0d 20 20 32 35 30 20  2e 63 6f 70 79 72 69 67  |g.  250 .copyrig|
00002e20  68 74 0d 20 20 32 36 30  20 20 20 20 20 20 20 20  |ht.  260        |
00002e30  20 42 52 4b 20 20 20 20  20 20 20 20 20 20 20 5c  | BRK           \|
00002e40  20 73 74 61 72 74 20 6f  66 20 63 6f 70 79 72 69  | start of copyri|
00002e50  67 68 74 0d 20 20 32 37  30 20 20 20 20 20 20 20  |ght.  270       |
00002e60  20 20 45 51 55 53 20 22  28 43 29 20 47 6f 72 64  |  EQUS "(C) Gord|
00002e70  6f 6e 20 48 6f 72 73 69  6e 67 74 6f 6e 20 31 39  |on Horsington 19|
00002e80  38 37 22 20 5c 20 63 6f  70 79 72 69 67 68 74 20  |87" \ copyright |
00002e90  73 74 72 69 6e 67 0d 20  20 32 38 30 20 20 20 20  |string.  280    |
00002ea0  20 20 20 20 20 42 52 4b  20 20 20 20 20 20 20 20  |     BRK        |
00002eb0  20 20 20 5c 20 63 6f 70  79 72 69 67 68 74 20 74  |   \ copyright t|
00002ec0  65 72 6d 69 6e 61 74 6f  72 0d 20 20 32 39 30 20  |erminator.  290 |
00002ed0  2e 6f 75 74 0d 20 20 33  30 30 20 20 20 20 20 20  |.out.  300      |
00002ee0  20 20 20 4a 4d 50 20 70  75 6c 6c 6f 75 74 0d 20  |   JMP pullout. |
00002ef0  20 33 31 30 20 2e 65 78  69 74 0d 20 20 33 32 30  | 310 .exit.  320|
00002f00  20 20 20 20 20 20 20 20  20 50 4c 41 0d 20 20 33  |         PLA.  3|
00002f10  33 30 20 20 20 20 20 20  20 20 20 53 54 41 20 73  |30         STA s|
00002f20  61 76 65 72 65 67 0d 20  20 33 34 30 20 20 20 20  |avereg.  340    |
00002f30  20 20 20 20 20 4c 44 41  20 23 26 30 35 20 20 20  |     LDA #&05   |
00002f40  20 20 20 5c 20 75 6e 72  65 63 6f 67 6e 69 73 65  |   \ unrecognise|
00002f50  64 20 69 6e 74 65 72 72  75 70 74 20 73 65 72 76  |d interrupt serv|
00002f60  69 63 65 20 63 61 6c 6c  0d 20 20 33 35 30 20 2e  |ice call.  350 .|
00002f70  72 65 74 75 72 6e 0d 20  20 33 36 30 20 20 20 20  |return.  360    |
00002f80  20 20 20 20 20 52 54 53  0d 20 20 33 37 30 20 2e  |     RTS.  370 .|
00002f90  73 65 72 76 69 63 65 0d  20 20 33 38 30 20 20 20  |service.  380   |
00002fa0  20 20 20 20 20 20 43 4d  50 20 23 26 30 35 20 20  |      CMP #&05  |
00002fb0  20 20 20 20 5c 20 69 73  20 74 68 69 73 20 61 6e  |    \ is this an|
00002fc0  20 75 6e 72 65 63 6f 67  6e 69 73 65 64 20 69 6e  | unrecognised in|
00002fd0  74 65 72 72 75 70 74 3f  0d 20 20 33 39 30 20 20  |terrupt?.  390  |
00002fe0  20 20 20 20 20 20 20 42  4e 45 20 72 65 74 75 72  |       BNE retur|
00002ff0  6e 20 20 20 20 5c 20 62  72 61 6e 63 68 20 69 66  |n    \ branch if|
00003000  20 6e 6f 74 20 69 6e 74  65 72 72 75 70 74 0d 20  | not interrupt. |
00003010  20 34 30 30 20 20 20 20  20 20 20 20 20 4c 44 41  | 400         LDA|
00003020  20 73 61 76 65 72 65 67  20 20 20 5c 20 6c 6f 61  | savereg   \ loa|
00003030  64 20 69 6e 74 65 72 72  75 70 74 20 61 63 63 75  |d interrupt accu|
00003040  6d 75 6c 61 74 6f 72 20  73 61 76 65 20 72 65 67  |mulator save reg|
00003050  69 73 74 65 72 0d 20 20  34 31 30 20 20 20 20 20  |ister.  410     |
00003060  20 20 20 20 50 48 41 20  20 20 20 20 20 20 20 20  |    PHA         |
00003070  20 20 5c 20 61 6e 64 20  70 75 73 68 20 69 74 20  |  \ and push it |
00003080  6f 6e 20 74 68 65 20 73  74 61 63 6b 0d 20 20 34  |on the stack.  4|
00003090  32 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 69  |20         LDA i|
000030a0  66 72 20 20 20 20 20 20  20 5c 20 6c 6f 61 64 20  |fr       \ load |
000030b0  73 79 73 74 65 6d 20 56  49 41 20 69 6e 74 65 72  |system VIA inter|
000030c0  72 75 70 74 20 66 6c 61  67 20 72 65 67 69 73 74  |rupt flag regist|
000030d0  65 72 0d 20 20 34 33 30  20 20 20 20 20 20 20 20  |er.  430        |
000030e0  20 42 50 4c 20 65 78 69  74 20 20 20 20 20 20 5c  | BPL exit      \|
000030f0  20 65 78 69 74 20 69 66  20 62 69 74 20 37 20 63  | exit if bit 7 c|
00003100  6c 65 61 72 0d 20 20 34  34 30 20 20 20 20 20 20  |lear.  440      |
00003110  20 20 20 41 4e 44 20 23  26 30 38 20 20 20 20 20  |   AND #&08     |
00003120  20 5c 20 41 4e 44 20 77  69 74 68 20 25 30 30 30  | \ AND with %000|
00003130  30 31 30 30 30 0d 20 20  34 35 30 20 20 20 20 20  |01000.  450     |
00003140  20 20 20 20 42 45 51 20  65 78 69 74 20 20 20 20  |    BEQ exit    |
00003150  20 20 5c 20 65 78 69 74  20 69 66 20 6e 6f 74 20  |  \ exit if not |
00003160  6c 69 67 68 74 20 70 65  6e 20 69 6e 74 65 72 72  |light pen interr|
00003170  75 70 74 0d 20 20 34 36  30 20 20 20 20 20 20 20  |upt.  460       |
00003180  20 20 54 58 41 0d 20 20  34 37 30 20 20 20 20 20  |  TXA.  470     |
00003190  20 20 20 20 50 48 41 0d  20 20 34 38 30 20 20 20  |    PHA.  480   |
000031a0  20 20 20 20 20 20 54 59  41 0d 20 20 34 39 30 20  |      TYA.  490 |
000031b0  20 20 20 20 20 20 20 20  50 48 41 0d 20 20 35 30  |        PHA.  50|
000031c0  30 20 20 20 20 20 20 20  20 20 4c 44 41 20 64 72  |0         LDA dr|
000031d0  62 20 20 20 20 20 20 20  5c 20 63 6c 65 61 72 20  |b       \ clear |
000031e0  69 6e 74 65 72 72 75 70  74 0d 20 20 35 31 30 20  |interrupt.  510 |
000031f0  20 20 20 20 20 20 20 20  50 48 41 20 20 20 20 20  |        PHA     |
00003200  20 20 20 20 20 20 5c 20  70 75 73 68 20 64 61 74  |      \ push dat|
00003210  61 20 72 65 67 69 73 74  65 72 20 42 0d 20 20 35  |a register B.  5|
00003220  32 30 20 20 20 20 20 20  20 20 20 43 4c 44 20 20  |20         CLD  |
00003230  20 20 20 20 20 20 20 20  20 5c 20 63 6c 65 61 72  |         \ clear|
00003240  20 64 65 63 69 6d 61 6c  20 66 6c 61 67 0d 20 20  | decimal flag.  |
00003250  35 33 30 20 20 20 20 20  20 20 20 20 4c 44 41 20  |530         LDA |
00003260  23 26 30 30 0d 20 20 35  34 30 20 20 20 20 20 20  |#&00.  540      |
00003270  20 20 20 4c 44 58 20 23  26 30 37 0d 20 20 35 35  |   LDX #&07.  55|
00003280  30 20 2e 69 6e 69 74 6c  6f 6f 70 0d 20 20 35 36  |0 .initloop.  56|
00003290  30 20 20 20 20 20 20 20  20 20 53 54 41 20 78 63  |0         STA xc|
000032a0  6f 6f 72 64 2c 58 20 20  5c 20 26 37 30 2d 26 37  |oord,X  \ &70-&7|
000032b0  37 20 3d 20 23 26 30 30  0d 20 20 35 37 30 20 20  |7 = #&00.  570  |
000032c0  20 20 20 20 20 20 20 44  45 58 0d 20 20 35 38 30  |       DEX.  580|
000032d0  20 20 20 20 20 20 20 20  20 42 50 4c 20 69 6e 69  |         BPL ini|
000032e0  74 6c 6f 6f 70 0d 20 20  35 39 30 20 20 20 20 20  |tloop.  590     |
000032f0  20 20 20 20 4c 44 59 20  73 63 72 65 65 6e 20 20  |    LDY screen  |
00003300  20 20 5c 20 73 63 72 65  65 6e 20 6d 6f 64 65 20  |  \ screen mode |
00003310  69 6e 74 6f 20 59 20 72  65 67 69 73 74 65 72 0d  |into Y register.|
00003320  20 20 36 30 30 20 20 20  20 20 20 20 20 20 43 50  |  600         CP|
00003330  59 20 23 26 30 36 20 20  20 20 20 20 5c 20 69 73  |Y #&06      \ is|
00003340  20 74 68 69 73 20 6d 6f  64 65 20 36 20 6f 72 20  | this mode 6 or |
00003350  37 3f 0d 20 20 36 31 30  20 20 20 20 20 20 20 20  |7?.  610        |
00003360  20 42 43 53 20 6f 75 74  20 20 20 20 20 20 20 5c  | BCS out       \|
00003370  20 65 78 69 74 20 69 66  20 6e 6f 6e 2d 67 72 61  | exit if non-gra|
00003380  70 68 69 63 73 20 6d 6f  64 65 0d 20 20 36 32 30  |phics mode.  620|
00003390  20 20 20 20 20 20 20 20  20 43 50 59 20 23 26 30  |         CPY #&0|
000033a0  33 20 20 20 20 20 20 5c  20 69 73 20 74 68 69 73  |3      \ is this|
000033b0  20 6d 6f 64 65 20 33 3f  0d 20 20 36 33 30 20 20  | mode 3?.  630  |
000033c0  20 20 20 20 20 20 20 42  45 51 20 6f 75 74 20 20  |       BEQ out  |
000033d0  20 20 20 20 20 5c 20 65  78 69 74 20 69 66 20 6e  |     \ exit if n|
000033e0  6f 6e 2d 67 72 61 70 68  69 63 73 20 6d 6f 64 65  |on-graphics mode|
000033f0  0d 20 20 36 34 30 20 20  20 20 20 20 20 20 20 4c  |.  640         L|
00003400  44 41 20 73 74 61 72 74  20 20 20 20 20 5c 20 73  |DA start     \ s|
00003410  63 72 65 65 6e 20 73 74  61 72 74 20 61 64 64 72  |creen start addr|
00003420  65 73 73 2c 20 6c 6f 77  20 62 79 74 65 0d 20 20  |ess, low byte.  |
00003430  36 35 30 20 20 20 20 20  20 20 20 20 53 54 41 20  |650         STA |
00003440  79 63 6f 6f 72 64 0d 20  20 36 36 30 20 20 20 20  |ycoord.  660    |
00003450  20 20 20 20 20 4c 44 41  20 73 74 61 72 74 2b 31  |     LDA start+1|
00003460  20 20 20 5c 20 73 63 72  65 65 6e 20 73 74 61 72  |   \ screen star|
00003470  74 20 61 64 64 72 65 73  73 2c 20 68 69 67 68 20  |t address, high |
00003480  62 79 74 65 0d 20 20 36  37 30 20 20 20 20 20 20  |byte.  670      |
00003490  20 20 20 53 54 41 20 79  63 6f 6f 72 64 2b 31 0d  |   STA ycoord+1.|
000034a0  20 20 36 38 30 20 20 20  20 20 20 20 20 20 4c 53  |  680         LS|
000034b0  52 20 79 63 6f 6f 72 64  2b 31 0d 20 20 36 39 30  |R ycoord+1.  690|
000034c0  20 20 20 20 20 20 20 20  20 52 4f 52 20 79 63 6f  |         ROR yco|
000034d0  6f 72 64 20 20 20 20 5c  20 73 74 61 72 74 20 61  |ord    \ start a|
000034e0  64 64 72 65 73 73 20 44  49 56 20 32 0d 20 20 37  |ddress DIV 2.  7|
000034f0  30 30 20 20 20 20 20 20  20 20 20 4c 53 52 20 79  |00         LSR y|
00003500  63 6f 6f 72 64 2b 31 0d  20 20 37 31 30 20 20 20  |coord+1.  710   |
00003510  20 20 20 20 20 20 52 4f  52 20 79 63 6f 6f 72 64  |      ROR ycoord|
00003520  20 20 20 20 5c 20 73 74  61 72 74 20 61 64 64 72  |    \ start addr|
00003530  65 73 73 20 44 49 56 20  34 0d 20 20 37 32 30 20  |ess DIV 4.  720 |
00003540  20 20 20 20 20 20 20 20  4c 53 52 20 79 63 6f 6f  |        LSR ycoo|
00003550  72 64 2b 31 0d 20 20 37  33 30 20 20 20 20 20 20  |rd+1.  730      |
00003560  20 20 20 52 4f 52 20 79  63 6f 6f 72 64 20 20 20  |   ROR ycoord   |
00003570  20 5c 20 73 74 61 72 74  20 61 64 64 72 65 73 73  | \ start address|
00003580  20 44 49 56 20 38 0d 20  20 37 34 30 20 20 20 20  | DIV 8.  740    |
00003590  20 20 20 20 20 4c 44 41  20 6f 66 66 73 65 74 6c  |     LDA offsetl|
000035a0  6f 77 2c 59 20 5c 20 74  72 69 6d 20 74 68 65 20  |ow,Y \ trim the |
000035b0  6f 66 66 73 65 74 0d 20  20 37 35 30 20 20 20 20  |offset.  750    |
000035c0  20 20 20 20 20 43 4c 43  20 20 20 20 20 20 20 20  |     CLC        |
000035d0  20 20 20 5c 20 70 72 65  70 61 72 65 20 66 6f 72  |   \ prepare for|
000035e0  20 61 64 64 69 74 69 6f  6e 0d 20 20 37 36 30 20  | addition.  760 |
000035f0  20 20 20 20 20 20 20 20  41 44 43 20 79 63 6f 6f  |        ADC ycoo|
00003600  72 64 20 20 20 20 5c 20  61 64 64 20 74 72 69 6d  |rd    \ add trim|
00003610  20 74 6f 20 6f 66 66 73  65 74 0d 20 20 37 37 30  | to offset.  770|
00003620  20 20 20 20 20 20 20 20  20 53 54 41 20 79 63 6f  |         STA yco|
00003630  6f 72 64 0d 20 20 37 38  30 20 20 20 20 20 20 20  |ord.  780       |
00003640  20 20 4c 44 41 20 23 26  30 30 0d 20 20 37 39 30  |  LDA #&00.  790|
00003650  20 20 20 20 20 20 20 20  20 41 44 43 20 79 63 6f  |         ADC yco|
00003660  6f 72 64 2b 31 0d 20 20  38 30 30 20 20 20 20 20  |ord+1.  800     |
00003670  20 20 20 20 53 54 41 20  79 63 6f 6f 72 64 2b 31  |    STA ycoord+1|
00003680  0d 20 20 38 31 30 20 20  20 20 20 20 20 20 20 53  |.  810         S|
00003690  45 43 20 20 20 20 20 20  20 20 20 20 20 5c 20 70  |EC           \ p|
000036a0  72 65 70 61 72 65 20 74  6f 20 73 75 62 74 72 61  |repare to subtra|
000036b0  63 74 20 6f 66 66 73 65  74 20 66 72 6f 6d 20 6c  |ct offset from l|
000036c0  69 67 68 74 20 70 65 6e  0d 20 20 20 20 20 20 20  |ight pen.       |
000036d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000036e0  20 20 20 20 20 5c 20 72  65 67 69 73 74 65 72 0d  |     \ register.|
000036f0  20 20 38 32 30 20 20 20  20 20 20 20 20 20 4c 44  |  820         LD|
00003700  58 20 23 26 31 31 20 20  20 20 20 20 5c 20 6c 69  |X #&11      \ li|
00003710  67 68 74 20 70 65 6e 20  72 65 67 69 73 74 65 72  |ght pen register|
00003720  2c 20 6c 6f 77 20 62 79  74 65 0d 20 20 38 33 30  |, low byte.  830|
00003730  20 20 20 20 20 20 20 20  20 53 54 58 20 73 68 65  |         STX she|
00003740  69 6c 61 20 20 20 20 5c  20 36 38 34 35 20 61 64  |ila    \ 6845 ad|
00003750  64 72 65 73 73 20 72 65  67 69 73 74 65 72 0d 20  |dress register. |
00003760  20 38 34 30 20 20 20 20  20 20 20 20 20 4c 44 41  | 840         LDA|
00003770  20 73 68 65 69 6c 61 2b  31 20 20 5c 20 36 38 34  | sheila+1  \ 684|
00003780  35 20 64 61 74 61 20 72  65 67 69 73 74 65 72 0d  |5 data register.|
00003790  20 20 38 35 30 20 20 20  20 20 20 20 20 20 53 42  |  850         SB|
000037a0  43 20 79 63 6f 6f 72 64  20 20 20 20 5c 20 73 75  |C ycoord    \ su|
000037b0  62 74 72 61 63 74 20 6f  66 66 73 65 74 2c 20 6c  |btract offset, l|
000037c0  6f 77 20 62 79 74 65 0d  20 20 38 36 30 20 20 20  |ow byte.  860   |
000037d0  20 20 20 20 20 20 53 54  41 20 79 63 6f 6f 72 64  |      STA ycoord|
000037e0  20 20 20 20 5c 20 6c 6f  77 20 62 79 74 65 20 2d  |    \ low byte -|
000037f0  20 6f 66 66 73 65 74 0d  20 20 38 37 30 20 20 20  | offset.  870   |
00003800  20 20 20 20 20 20 44 45  58 20 20 20 20 20 20 20  |      DEX       |
00003810  20 20 20 20 5c 20 58 20  3d 20 23 26 31 30 0d 20  |    \ X = #&10. |
00003820  20 38 38 30 20 20 20 20  20 20 20 20 20 53 54 58  | 880         STX|
00003830  20 73 68 65 69 6c 61 20  20 20 20 5c 20 36 38 34  | sheila    \ 684|
00003840  35 20 61 64 64 72 65 73  73 20 72 65 67 69 73 74  |5 address regist|
00003850  65 72 0d 20 20 38 39 30  20 20 20 20 20 20 20 20  |er.  890        |
00003860  20 4c 44 41 20 73 68 65  69 6c 61 2b 31 20 20 5c  | LDA sheila+1  \|
00003870  20 36 38 34 35 20 64 61  74 61 20 72 65 67 69 73  | 6845 data regis|
00003880  74 65 72 0d 20 20 39 30  30 20 20 20 20 20 20 20  |ter.  900       |
00003890  20 20 53 42 43 20 79 63  6f 6f 72 64 2b 31 20 20  |  SBC ycoord+1  |
000038a0  5c 20 73 75 62 74 72 61  63 74 20 6f 66 66 73 65  |\ subtract offse|
000038b0  74 2c 20 68 69 67 68 20  62 79 74 65 0d 20 20 39  |t, high byte.  9|
000038c0  31 30 20 20 20 20 20 20  20 20 20 53 54 41 20 79  |10         STA y|
000038d0  63 6f 6f 72 64 2b 31 20  20 5c 20 68 69 67 68 20  |coord+1  \ high |
000038e0  62 79 74 65 20 2d 20 6f  66 66 73 65 74 0d 20 20  |byte - offset.  |
000038f0  39 32 30 20 2e 6e 65 78  74 0d 20 20 39 33 30 20  |920 .next.  930 |
00003900  20 20 20 20 20 20 20 20  41 53 4c 20 79 63 6f 6f  |        ASL ycoo|
00003910  72 64 20 20 20 20 5c 20  73 68 69 66 74 20 64 69  |rd    \ shift di|
00003920  76 69 64 65 6e 64 2f 71  75 6f 74 69 65 6e 74 20  |vidend/quotient |
00003930  6c 65 66 74 0d 20 20 39  34 30 20 20 20 20 20 20  |left.  940      |
00003940  20 20 20 52 4f 4c 20 79  63 6f 6f 72 64 2b 31 20  |   ROL ycoord+1 |
00003950  20 5c 20 73 68 69 66 74  20 64 69 76 69 64 65 6e  | \ shift dividen|
00003960  64 2f 71 75 6f 74 69 65  6e 74 20 6c 65 66 74 0d  |d/quotient left.|
00003970  20 20 39 35 30 20 20 20  20 20 20 20 20 20 52 4f  |  950         RO|
00003980  4c 20 78 63 6f 6f 72 64  20 20 20 20 5c 20 73 68  |L xcoord    \ sh|
00003990  69 66 74 20 62 69 74 73  20 69 6e 74 6f 20 70 61  |ift bits into pa|
000039a0  72 74 69 61 6c 20 64 69  76 69 64 65 6e 64 0d 20  |rtial dividend. |
000039b0  20 39 36 30 20 20 20 20  20 20 20 20 20 4c 44 41  | 960         LDA|
000039c0  20 78 63 6f 6f 72 64 20  20 20 20 5c 20 6c 6f 61  | xcoord    \ loa|
000039d0  64 20 70 61 72 74 69 61  6c 20 64 69 76 69 64 65  |d partial divide|
000039e0  6e 64 0d 20 20 39 37 30  20 20 20 20 20 20 20 20  |nd.  970        |
000039f0  20 53 45 43 20 20 20 20  20 20 20 20 20 20 20 5c  | SEC           \|
00003a00  20 70 72 65 70 61 72 65  20 66 6f 72 20 73 75 62  | prepare for sub|
00003a10  74 72 61 63 74 69 6f 6e  0d 20 20 39 38 30 20 20  |traction.  980  |
00003a20  20 20 20 20 20 20 20 53  42 43 20 77 69 64 74 68  |       SBC width|
00003a30  2c 59 20 20 20 5c 20 73  75 62 74 72 61 63 74 20  |,Y   \ subtract |
00003a40  64 69 76 69 73 6f 72 0d  20 20 39 39 30 20 20 20  |divisor.  990   |
00003a50  20 20 20 20 20 20 42 43  43 20 64 6f 6e 65 20 20  |      BCC done  |
00003a60  20 20 20 20 5c 20 62 72  61 6e 63 68 20 69 66 20  |    \ branch if |
00003a70  64 69 76 69 64 65 6e 64  20 3c 20 64 69 76 69 73  |dividend < divis|
00003a80  6f 72 0d 20 31 30 30 30  20 20 20 20 20 20 20 20  |or. 1000        |
00003a90  20 49 4e 43 20 79 63 6f  6f 72 64 20 20 20 20 5c  | INC ycoord    \|
00003aa0  20 69 6e 63 72 65 6d 65  6e 74 20 71 75 6f 74 69  | increment quoti|
00003ab0  65 6e 74 0d 20 31 30 31  30 20 20 20 20 20 20 20  |ent. 1010       |
00003ac0  20 20 53 54 41 20 78 63  6f 6f 72 64 20 20 20 20  |  STA xcoord    |
00003ad0  5c 20 73 61 76 65 20 6e  65 77 20 70 61 72 74 69  |\ save new parti|
00003ae0  61 6c 20 64 69 76 69 64  65 6e 64 0d 20 31 30 32  |al dividend. 102|
00003af0  30 20 2e 64 6f 6e 65 0d  20 31 30 33 30 20 20 20  |0 .done. 1030   |
00003b00  20 20 20 20 20 20 44 45  58 20 20 20 20 20 20 20  |      DEX       |
00003b10  20 20 20 20 5c 20 64 65  63 72 65 6d 65 6e 74 20  |    \ decrement |
00003b20  62 69 74 20 63 6f 75 6e  74 65 72 0d 20 31 30 34  |bit counter. 104|
00003b30  30 20 20 20 20 20 20 20  20 20 42 4e 45 20 6e 65  |0         BNE ne|
00003b40  78 74 20 20 20 20 20 20  5c 20 62 72 61 6e 63 68  |xt      \ branch|
00003b50  20 66 6f 72 20 31 36 20  62 69 74 73 0d 20 31 30  | for 16 bits. 10|
00003b60  35 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 78  |50         LDA x|
00003b70  6c 6f 6f 70 2c 59 20 20  20 5c 20 70 72 65 70 61  |loop,Y   \ prepa|
00003b80  72 65 20 66 6f 72 20 6d  75 6c 74 69 70 6c 69 63  |re for multiplic|
00003b90  61 74 69 6f 6e 0d 20 31  30 36 30 20 20 20 20 20  |ation. 1060     |
00003ba0  20 20 20 20 54 41 58 20  20 20 20 20 20 20 20 20  |    TAX         |
00003bb0  20 20 5c 20 58 3d 34 20  6d 6f 64 65 73 20 30 2d  |  \ X=4 modes 0-|
00003bc0  33 2c 20 58 3d 35 20 6d  6f 64 65 73 20 34 2d 37  |3, X=5 modes 4-7|
00003bd0  0d 20 31 30 37 30 20 2e  6d 75 6c 74 78 0d 20 31  |. 1070 .multx. 1|
00003be0  30 38 30 20 20 20 20 20  20 20 20 20 41 53 4c 20  |080         ASL |
00003bf0  78 63 6f 6f 72 64 20 20  20 20 5c 20 6c 6f 77 20  |xcoord    \ low |
00003c00  62 79 74 65 20 2a 20 32  0d 20 31 30 39 30 20 20  |byte * 2. 1090  |
00003c10  20 20 20 20 20 20 20 52  4f 4c 20 78 63 6f 6f 72  |       ROL xcoor|
00003c20  64 2b 31 20 20 5c 20 68  69 67 68 20 62 79 74 65  |d+1  \ high byte|
00003c30  20 2a 20 32 0d 20 31 31  30 30 20 20 20 20 20 20  | * 2. 1100      |
00003c40  20 20 20 44 45 58 20 20  20 20 20 20 20 20 20 20  |   DEX          |
00003c50  20 5c 20 63 6f 75 6e 74  20 6e 75 6d 62 65 72 20  | \ count number |
00003c60  6f 66 20 6d 75 6c 74 69  70 6c 69 63 61 74 69 6f  |of multiplicatio|
00003c70  6e 73 0d 20 31 31 31 30  20 20 20 20 20 20 20 20  |ns. 1110        |
00003c80  20 42 4e 45 20 6d 75 6c  74 78 20 20 20 20 20 5c  | BNE multx     \|
00003c90  20 67 6f 20 62 61 63 6b  20 69 66 20 6e 6f 74 20  | go back if not |
00003ca0  66 69 6e 69 73 68 65 64  0d 20 31 31 32 30 20 20  |finished. 1120  |
00003cb0  20 20 20 20 20 20 20 4c  44 41 20 78 61 64 64 2c  |       LDA xadd,|
00003cc0  59 20 20 20 20 5c 20 41  3d 38 20 6d 6f 64 65 73  |Y    \ A=8 modes|
00003cd0  20 30 2d 33 2c 20 41 3d  31 36 20 6d 6f 64 65 73  | 0-3, A=16 modes|
00003ce0  20 34 2d 37 0d 20 31 31  33 30 20 20 20 20 20 20  | 4-7. 1130      |
00003cf0  20 20 20 43 4c 43 20 20  20 20 20 20 20 20 20 20  |   CLC          |
00003d00  20 5c 20 70 72 65 70 61  72 65 20 66 6f 72 20 61  | \ prepare for a|
00003d10  64 64 69 74 69 6f 6e 0d  20 31 31 34 30 20 20 20  |ddition. 1140   |
00003d20  20 20 20 20 20 20 41 44  43 20 78 63 6f 6f 72 64  |      ADC xcoord|
00003d30  0d 20 31 31 35 30 20 20  20 20 20 20 20 20 20 53  |. 1150         S|
00003d40  54 41 20 78 63 6f 6f 72  64 0d 20 31 31 36 30 20  |TA xcoord. 1160 |
00003d50  20 20 20 20 20 20 20 20  4c 44 41 20 23 26 30 30  |        LDA #&00|
00003d60  0d 20 31 31 37 30 20 20  20 20 20 20 20 20 20 41  |. 1170         A|
00003d70  44 43 20 78 63 6f 6f 72  64 2b 31 0d 20 31 31 38  |DC xcoord+1. 118|
00003d80  30 20 20 20 20 20 20 20  20 20 53 54 41 20 78 63  |0         STA xc|
00003d90  6f 6f 72 64 2b 31 0d 20  31 31 39 30 20 20 20 20  |oord+1. 1190    |
00003da0  20 20 20 20 20 4c 44 58  20 23 26 30 35 20 20 20  |     LDX #&05   |
00003db0  20 20 20 5c 20 70 72 65  70 61 72 65 20 66 6f 72  |   \ prepare for|
00003dc0  20 79 20 63 6f 6f 72 64  69 6e 61 74 65 20 6d 75  | y coordinate mu|
00003dd0  6c 74 69 70 6c 69 63 61  74 69 6f 6e 0d 20 31 32  |ltiplication. 12|
00003de0  30 30 20 2e 6d 75 6c 74  79 0d 20 31 32 31 30 20  |00 .multy. 1210 |
00003df0  20 20 20 20 20 20 20 20  41 53 4c 20 79 63 6f 6f  |        ASL ycoo|
00003e00  72 64 20 20 20 20 5c 20  6c 6f 77 20 62 79 74 65  |rd    \ low byte|
00003e10  20 2a 20 32 0d 20 31 32  32 30 20 20 20 20 20 20  | * 2. 1220      |
00003e20  20 20 20 52 4f 4c 20 79  63 6f 6f 72 64 2b 31 20  |   ROL ycoord+1 |
00003e30  20 5c 20 68 69 67 68 20  62 79 74 65 20 2a 20 32  | \ high byte * 2|
00003e40  0d 20 31 32 33 30 20 20  20 20 20 20 20 20 20 44  |. 1230         D|
00003e50  45 58 20 20 20 20 20 20  20 20 20 20 20 5c 20 63  |EX           \ c|
00003e60  6f 75 6e 74 20 6e 75 6d  62 65 72 20 6f 66 20 6d  |ount number of m|
00003e70  75 6c 74 69 70 6c 69 63  61 74 69 6f 6e 73 0d 20  |ultiplications. |
00003e80  31 32 34 30 20 20 20 20  20 20 20 20 20 42 4e 45  |1240         BNE|
00003e90  20 6d 75 6c 74 79 20 20  20 20 20 5c 20 67 6f 20  | multy     \ go |
00003ea0  62 61 63 6b 20 69 66 20  6e 6f 74 20 66 69 6e 69  |back if not fini|
00003eb0  73 68 65 64 0d 20 31 32  35 30 20 20 20 20 20 20  |shed. 1250      |
00003ec0  20 20 20 53 45 43 20 20  20 20 20 20 20 20 20 20  |   SEC          |
00003ed0  20 5c 20 70 72 65 70 61  72 65 20 66 6f 72 20 73  | \ prepare for s|
00003ee0  75 62 74 72 61 63 74 69  6f 6e 0d 20 31 32 36 30  |ubtraction. 1260|
00003ef0  20 20 20 20 20 20 20 20  20 4c 44 41 20 23 26 46  |         LDA #&F|
00003f00  30 20 20 20 20 20 20 5c  20 6c 6f 77 20 62 79 74  |0      \ low byt|
00003f10  65 20 6f 66 20 64 65 63  69 6d 61 6c 20 31 30 30  |e of decimal 100|
00003f20  38 0d 20 31 32 37 30 20  20 20 20 20 20 20 20 20  |8. 1270         |
00003f30  53 42 43 20 79 63 6f 6f  72 64 20 20 20 20 5c 20  |SBC ycoord    \ |
00003f40  79 63 6f 6f 72 64 2d 23  26 46 30 0d 20 31 32 38  |ycoord-#&F0. 128|
00003f50  30 20 20 20 20 20 20 20  20 20 53 54 41 20 79 63  |0         STA yc|
00003f60  6f 6f 72 64 0d 20 31 32  39 30 20 20 20 20 20 20  |oord. 1290      |
00003f70  20 20 20 4c 44 41 20 23  26 30 33 20 20 20 20 20  |   LDA #&03     |
00003f80  20 5c 20 68 69 67 68 20  62 79 74 65 20 6f 66 20  | \ high byte of |
00003f90  64 65 63 69 6d 61 6c 20  31 30 30 38 0d 20 31 33  |decimal 1008. 13|
00003fa0  30 30 20 20 20 20 20 20  20 20 20 53 42 43 20 79  |00         SBC y|
00003fb0  63 6f 6f 72 64 2b 31 20  20 5c 20 28 79 63 6f 6f  |coord+1  \ (ycoo|
00003fc0  72 64 2b 31 29 2d 23 26  30 33 0d 20 31 33 31 30  |rd+1)-#&03. 1310|
00003fd0  20 20 20 20 20 20 20 20  20 53 54 41 20 79 63 6f  |         STA yco|
00003fe0  6f 72 64 2b 31 0d 20 31  33 32 30 20 2e 70 75 6c  |ord+1. 1320 .pul|
00003ff0  6c 6f 75 74 0d 20 31 33  33 30 20 20 20 20 20 20  |lout. 1330      |
00004000  20 20 20 50 4c 41 20 20  20 20 20 20 20 20 20 20  |   PLA          |
00004010  20 5c 20 70 75 6c 6c 20  64 61 74 61 20 72 65 67  | \ pull data reg|
00004020  69 73 74 65 72 20 42 0d  20 31 33 34 30 20 20 20  |ister B. 1340   |
00004030  20 20 20 20 20 20 41 4e  44 20 23 26 32 30 20 20  |      AND #&20  |
00004040  20 20 20 20 5c 20 25 30  30 31 30 30 30 30 30 0d  |    \ %00100000.|
00004050  20 31 33 35 30 20 20 20  20 20 20 20 20 20 53 54  | 1350         ST|
00004060  41 20 66 69 72 65 20 20  20 20 20 20 5c 20 73 74  |A fire      \ st|
00004070  6f 72 65 20 66 69 72 65  20 62 75 74 74 6f 6e 20  |ore fire button |
00004080  73 74 61 74 75 73 0d 20  31 33 36 30 20 20 20 20  |status. 1360    |
00004090  20 20 20 20 20 50 4c 41  0d 20 31 33 37 30 20 20  |     PLA. 1370  |
000040a0  20 20 20 20 20 20 20 54  41 59 20 20 20 20 20 20  |       TAY      |
000040b0  20 20 20 20 20 5c 20 72  65 73 74 6f 72 65 20 59  |     \ restore Y|
000040c0  0d 20 31 33 38 30 20 20  20 20 20 20 20 20 20 50  |. 1380         P|
000040d0  4c 41 0d 20 31 33 39 30  20 20 20 20 20 20 20 20  |LA. 1390        |
000040e0  20 54 41 58 20 20 20 20  20 20 20 20 20 20 20 5c  | TAX           \|
000040f0  20 72 65 73 74 6f 72 65  20 58 0d 20 31 34 30 30  | restore X. 1400|
00004100  20 20 20 20 20 20 20 20  20 50 4c 41 0d 20 31 34  |         PLA. 14|
00004110  31 30 20 20 20 20 20 20  20 20 20 53 54 41 20 73  |10         STA s|
00004120  61 76 65 72 65 67 20 20  20 5c 20 72 65 73 74 6f  |avereg   \ resto|
00004130  72 65 20 7a 65 72 6f 20  70 61 67 65 0d 20 31 34  |re zero page. 14|
00004140  32 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 23  |20         LDA #|
00004150  26 30 30 20 20 20 20 20  20 5c 20 69 6e 74 65 72  |&00      \ inter|
00004160  72 75 70 74 20 73 65 72  76 69 63 65 64 0d 20 31  |rupt serviced. 1|
00004170  34 33 30 20 20 20 20 20  20 20 20 20 52 54 53 20  |430         RTS |
00004180  20 20 20 20 20 20 20 20  20 20 5c 20 72 65 74 75  |          \ retu|
00004190  72 6e 20 74 6f 20 6f 70  65 72 61 74 69 6e 67 20  |rn to operating |
000041a0  73 79 73 74 65 6d 0d 20  31 34 34 30 20 2e 6f 66  |system. 1440 .of|
000041b0  66 73 65 74 6c 6f 77 0d  20 31 34 35 30 20 20 20  |fsetlow. 1450   |
000041c0  20 20 20 20 20 20 45 51  55 42 20 26 30 34 20 20  |      EQUB &04  |
000041d0  20 20 20 20 5c 20 6d 6f  64 65 30 2c 20 75 6e 74  |    \ mode0, unt|
000041e0  72 69 6d 6d 65 64 20 3d  20 26 30 36 0d 20 31 34  |rimmed = &06. 14|
000041f0  36 30 20 20 20 20 20 20  20 20 20 45 51 55 42 20  |60         EQUB |
00004200  26 30 34 20 20 20 20 20  20 5c 20 6d 6f 64 65 31  |&04      \ mode1|
00004210  2c 20 75 6e 74 72 69 6d  6d 65 64 20 3d 20 26 30  |, untrimmed = &0|
00004220  36 0d 20 31 34 37 30 20  20 20 20 20 20 20 20 20  |6. 1470         |
00004230  45 51 55 42 20 26 30 34  20 20 20 20 20 20 5c 20  |EQUB &04      \ |
00004240  6d 6f 64 65 32 2c 20 75  6e 74 72 69 6d 6d 65 64  |mode2, untrimmed|
00004250  20 3d 20 26 30 36 0d 20  31 34 38 30 20 20 20 20  | = &06. 1480    |
00004260  20 20 20 20 20 45 51 55  42 20 26 30 30 20 20 20  |     EQUB &00   |
00004270  20 20 20 5c 20 6d 6f 64  65 33 2c 20 64 75 6d 6d  |   \ mode3, dumm|
00004280  79 20 76 61 6c 75 65 0d  20 31 34 39 30 20 20 20  |y value. 1490   |
00004290  20 20 20 20 20 20 45 51  55 42 20 26 30 33 20 20  |      EQUB &03  |
000042a0  20 20 20 20 5c 20 6d 6f  64 65 34 2c 20 75 6e 74  |    \ mode4, unt|
000042b0  72 69 6d 6d 65 64 20 3d  20 26 30 34 0d 20 31 35  |rimmed = &04. 15|
000042c0  30 30 20 20 20 20 20 20  20 20 20 45 51 55 42 20  |00         EQUB |
000042d0  26 30 33 20 20 20 20 20  20 5c 20 6d 6f 64 65 35  |&03      \ mode5|
000042e0  2c 20 75 6e 74 72 69 6d  6d 65 64 20 3d 20 26 30  |, untrimmed = &0|
000042f0  34 0d 20 31 35 31 30 20  2e 78 6c 6f 6f 70 0d 20  |4. 1510 .xloop. |
00004300  31 35 32 30 20 20 20 20  20 20 20 20 20 45 51 55  |1520         EQU|
00004310  44 20 26 30 30 30 34 30  34 30 34 20 5c 20 6d 6f  |D &00040404 \ mo|
00004320  64 65 73 20 33 2d 30 0d  20 31 35 33 30 20 20 20  |des 3-0. 1530   |
00004330  20 20 20 20 20 20 45 51  55 57 20 26 30 35 30 35  |      EQUW &0505|
00004340  20 20 20 20 5c 20 6d 6f  64 65 73 20 35 2d 34 0d  |    \ modes 5-4.|
00004350  20 31 35 34 30 20 2e 78  61 64 64 0d 20 31 35 35  | 1540 .xadd. 155|
00004360  30 20 20 20 20 20 20 20  20 20 45 51 55 44 20 26  |0         EQUD &|
00004370  30 30 30 38 30 38 30 38  20 5c 20 6d 6f 64 65 73  |00080808 \ modes|
00004380  20 33 2d 30 0d 20 31 35  36 30 20 20 20 20 20 20  | 3-0. 1560      |
00004390  20 20 20 45 51 55 57 20  26 31 30 31 30 20 20 20  |   EQUW &1010   |
000043a0  20 5c 20 6d 6f 64 65 73  20 35 2d 34 0d 20 31 35  | \ modes 5-4. 15|
000043b0  37 30 20 2e 77 69 64 74  68 0d 20 31 35 38 30 20  |70 .width. 1580 |
000043c0  20 20 20 20 20 20 20 20  45 51 55 44 20 26 30 30  |        EQUD &00|
000043d0  35 30 35 30 35 30 20 5c  20 6d 6f 64 65 73 20 33  |505050 \ modes 3|
000043e0  2d 30 0d 20 31 35 39 30  20 20 20 20 20 20 20 20  |-0. 1590        |
000043f0  20 45 51 55 57 20 26 32  38 32 38 20 20 20 20 5c  | EQUW &2828    \|
00004400  20 6d 6f 64 65 73 20 35  2d 34 0d 20 31 36 30 30  | modes 5-4. 1600|
00004410  20 2e 6c 61 73 74 62 79  74 65 0d 20 31 36 31 30  | .lastbyte. 1610|
00004420  20 5d 0d 20 31 36 32 30  20 4e 45 58 54 0d 20 31  | ]. 1620 NEXT. 1|
00004430  36 33 30 20 2a 4f 50 54  31 2c 32 0d 20 31 36 34  |630 *OPT1,2. 164|
00004440  30 20 4f 53 43 4c 49 28  22 53 41 56 45 20 4c 50  |0 OSCLI("SAVE LP|
00004450  47 52 41 50 48 20 22 2b  53 54 52 24 7e 28 6d 63  |GRAPH "+STR$~(mc|
00004460  6f 64 65 29 2b 22 20 2b  20 22 0d 20 20 20 20 20  |ode)+" + ".     |
00004470  20 2b 53 54 52 24 7e 28  6c 61 73 74 62 79 74 65  | +STR$~(lastbyte|
00004480  2d 26 38 30 30 30 29 2b  22 20 46 46 46 46 38 30  |-&8000)+" FFFF80|
00004490  30 30 20 46 46 46 46 38  30 30 30 22 29 0d 20 31  |00 FFFF8000"). 1|
000044a0  36 35 30 20 2a 4f 50 54  30 2c 30 0d 0d 0d 20 20  |650 *OPT0,0...  |
000044b0  20 31 30 20 52 45 4d 3e  20 41 52 54 49 53 54 0d  | 10 REM> ARTIST.|
000044c0  20 20 20 32 30 20 52 45  4d 20 75 73 65 73 20 53  |   20 REM uses S|
000044d0  57 52 20 67 72 61 70 68  69 63 73 20 6c 69 67 68  |WR graphics ligh|
000044e0  74 20 70 65 6e 20 64 72  69 76 65 72 0d 20 20 20  |t pen driver.   |
000044f0  33 30 20 4f 4e 45 52 52  4f 52 20 4f 53 43 4c 49  |30 ONERROR OSCLI|
00004500  28 22 46 58 31 35 31 2c  37 38 2c 38 22 29 3a 56  |("FX151,78,8"):V|
00004510  44 55 32 33 2c 31 2c 31  3b 30 3b 30 3b 30 3b 3a  |DU23,1,1;0;0;0;:|
00004520  45 4e 44 0d 20 20 20 34  30 20 41 25 3d 26 45 41  |END.   40 A%=&EA|
00004530  0d 20 20 20 35 30 20 58  25 3d 30 0d 20 20 20 36  |.   50 X%=0.   6|
00004540  30 20 59 25 3d 26 46 46  0d 20 20 20 37 30 20 49  |0 Y%=&FF.   70 I|
00004550  46 20 46 4e 6f 73 62 79  74 65 3c 3e 30 20 50 52  |F FNosbyte<>0 PR|
00004560  49 4e 54 22 4e 6f 74 20  54 75 62 65 20 63 6f 6d  |INT"Not Tube com|
00004570  70 61 74 69 62 6c 65 22  3a 45 4e 44 0d 20 20 20  |patible":END.   |
00004580  38 30 20 2a 46 58 31 35  31 2c 37 38 2c 31 33 36  |80 *FX151,78,136|
00004590  0d 20 20 20 39 30 20 41  25 3d 26 45 42 0d 20 20  |.   90 A%=&EB.  |
000045a0  31 30 30 20 49 46 20 46  4e 6f 73 62 79 74 65 3d  |100 IF FNosbyte=|
000045b0  30 20 73 70 65 65 63 68  3d 46 41 4c 53 45 20 45  |0 speech=FALSE E|
000045c0  4c 53 45 20 73 70 65 65  63 68 3d 54 52 55 45 0d  |LSE speech=TRUE.|
000045d0  20 20 31 31 30 20 4d 4f  44 45 20 32 0d 20 20 31  |  110 MODE 2.  1|
000045e0  32 30 20 56 44 55 32 33  2c 31 2c 30 3b 30 3b 30  |20 VDU23,1,0;0;0|
000045f0  3b 30 3b 0d 20 20 31 33  30 20 78 63 6f 6f 72 64  |;0;.  130 xcoord|
00004600  3d 26 37 30 20 3a 52 45  4d 3a 20 26 37 30 2d 26  |=&70 :REM: &70-&|
00004610  37 33 0d 20 20 31 34 30  20 79 63 6f 6f 72 64 3d  |73.  140 ycoord=|
00004620  26 37 34 20 3a 52 45 4d  3a 20 26 37 34 2d 26 37  |&74 :REM: &74-&7|
00004630  37 0d 20 20 31 35 30 20  21 78 63 6f 6f 72 64 3d  |7.  150 !xcoord=|
00004640  30 0d 20 20 31 36 30 20  21 79 63 6f 6f 72 64 3d  |0.  160 !ycoord=|
00004650  30 0d 20 20 31 37 30 20  70 61 70 65 72 3d 36 0d  |0.  170 paper=6.|
00004660  20 20 31 38 30 20 69 6e  6b 3d 34 0d 20 20 31 39  |  180 ink=4.  19|
00004670  30 20 56 44 55 20 31 39  2c 30 2c 70 61 70 65 72  |0 VDU 19,0,paper|
00004680  3b 30 3b 0d 20 20 32 30  30 20 47 43 4f 4c 20 30  |;0;.  200 GCOL 0|
00004690  2c 69 6e 6b 0d 20 20 32  31 30 20 43 4f 4c 4f 55  |,ink.  210 COLOU|
000046a0  52 20 69 6e 6b 0d 20 20  32 32 30 20 50 52 49 4e  |R ink.  220 PRIN|
000046b0  54 54 41 42 28 30 2c 33  31 29 22 2a 22 3b 0d 20  |TTAB(0,31)"*";. |
000046c0  20 32 33 30 20 50 52 4f  43 72 65 73 65 74 0d 20  | 230 PROCreset. |
000046d0  20 32 34 30 20 52 45 50  45 41 54 0d 20 20 32 35  | 240 REPEAT.  25|
000046e0  30 20 52 45 50 45 41 54  0d 20 20 32 36 30 20 50  |0 REPEAT.  260 P|
000046f0  52 4f 43 78 79 0d 20 20  32 37 30 20 49 46 20 46  |ROCxy.  270 IF F|
00004700  4e 73 77 69 74 63 68 20  50 52 4f 43 77 61 6e 64  |Nswitch PROCwand|
00004710  65 72 20 45 4c 53 45 20  50 4c 4f 54 20 31 33 2c  |er ELSE PLOT 13,|
00004720  6e 65 77 78 2c 6e 65 77  79 0d 20 20 32 38 30 20  |newx,newy.  280 |
00004730  55 4e 54 49 4c 20 46 4e  73 77 69 74 63 68 0d 20  |UNTIL FNswitch. |
00004740  20 32 39 30 20 49 46 20  49 4e 4b 45 59 28 2d 33  | 290 IF INKEY(-3|
00004750  36 29 20 50 52 4f 43 74  72 69 61 6e 67 6c 65 0d  |6) PROCtriangle.|
00004760  20 20 33 30 30 20 49 46  20 49 4e 4b 45 59 28 2d  |  300 IF INKEY(-|
00004770  33 38 29 20 50 52 4f 43  69 6e 6b 0d 20 20 33 31  |38) PROCink.  31|
00004780  30 20 49 46 20 49 4e 4b  45 59 28 2d 35 36 29 20  |0 IF INKEY(-56) |
00004790  50 52 4f 43 70 61 70 65  72 0d 20 20 33 32 30 20  |PROCpaper.  320 |
000047a0  49 46 20 49 4e 4b 45 59  28 2d 36 38 29 20 50 52  |IF INKEY(-68) PR|
000047b0  4f 43 66 69 6c 6c 0d 20  20 33 33 30 20 49 46 20  |OCfill.  330 IF |
000047c0  49 4e 4b 45 59 28 2d 38  32 29 20 50 52 4f 43 73  |INKEY(-82) PROCs|
000047d0  71 75 61 72 65 0d 20 20  33 34 30 20 49 46 20 49  |quare.  340 IF I|
000047e0  4e 4b 45 59 28 2d 38 33  29 20 50 52 4f 43 63 69  |NKEY(-83) PROCci|
000047f0  72 63 6c 65 0d 20 20 33  35 30 20 49 46 20 49 4e  |rcle.  350 IF IN|
00004800  4b 45 59 28 2d 38 37 29  20 50 52 4f 43 6c 69 6e  |KEY(-87) PROClin|
00004810  65 0d 20 20 33 36 30 20  49 46 20 49 4e 4b 45 59  |e.  360 IF INKEY|
00004820  28 2d 39 30 29 20 50 52  4f 43 64 65 6c 65 74 65  |(-90) PROCdelete|
00004830  0d 20 20 33 37 30 20 55  4e 54 49 4c 20 46 41 4c  |.  370 UNTIL FAL|
00004840  53 45 0d 20 20 33 38 30  20 3a 0d 20 20 33 39 30  |SE.  380 :.  390|
00004850  20 44 45 46 50 52 4f 43  74 72 69 61 6e 67 6c 65  | DEFPROCtriangle|
00004860  0d 20 20 34 30 30 20 50  52 4f 43 70 6f 69 6e 74  |.  400 PROCpoint|
00004870  73 28 33 29 0d 20 20 34  31 30 20 50 52 4f 43 69  |s(3).  410 PROCi|
00004880  6e 70 75 74 28 31 39 38  29 0d 20 20 34 32 30 20  |nput(198).  420 |
00004890  78 3d 6e 65 77 78 0d 20  20 34 33 30 20 79 3d 6e  |x=newx.  430 y=n|
000048a0  65 77 79 0d 20 20 34 34  30 20 50 52 4f 43 69 6e  |ewy.  440 PROCin|
000048b0  70 75 74 28 32 35 38 29  0d 20 20 34 35 30 20 50  |put(258).  450 P|
000048c0  52 4f 43 69 6e 70 75 74  28 32 36 39 29 0d 20 20  |ROCinput(269).  |
000048d0  34 36 30 20 4d 4f 56 45  20 78 2c 79 0d 20 20 34  |460 MOVE x,y.  4|
000048e0  37 30 20 4d 4f 56 45 20  6c 61 73 74 78 2c 6c 61  |70 MOVE lastx,la|
000048f0  73 74 79 0d 20 20 34 38  30 20 50 4c 4f 54 20 38  |sty.  480 PLOT 8|
00004900  35 2c 6e 65 77 78 2c 6e  65 77 79 0d 20 20 34 39  |5,newx,newy.  49|
00004910  30 20 45 4e 44 50 52 4f  43 0d 20 20 35 30 30 20  |0 ENDPROC.  500 |
00004920  3a 0d 20 20 35 31 30 20  44 45 46 20 50 52 4f 43  |:.  510 DEF PROC|
00004930  69 6e 6b 0d 20 20 35 32  30 20 50 52 4f 43 63 75  |ink.  520 PROCcu|
00004940  72 73 6f 72 28 6e 65 77  78 2c 6e 65 77 79 29 0d  |rsor(newx,newy).|
00004950  20 20 35 33 30 20 69 6e  6b 3d 69 6e 6b 2b 31 0d  |  530 ink=ink+1.|
00004960  20 20 35 34 30 20 49 46  20 69 6e 6b 3e 37 20 69  |  540 IF ink>7 i|
00004970  6e 6b 3d 31 0d 20 20 35  35 30 20 50 52 4f 43 63  |nk=1.  550 PROCc|
00004980  75 72 73 6f 72 28 6e 65  77 78 2c 6e 65 77 79 29  |ursor(newx,newy)|
00004990  0d 20 20 35 36 30 20 49  46 20 73 70 65 65 63 68  |.  560 IF speech|
000049a0  20 53 4f 55 4e 44 2d 31  2c 69 6e 6b 2b 34 38 2c  | SOUND-1,ink+48,|
000049b0  30 2c 30 20 45 4c 53 45  20 50 52 4f 43 62 65 65  |0,0 ELSE PROCbee|
000049c0  70 0d 20 20 35 37 30 20  43 4f 4c 4f 55 52 20 69  |p.  570 COLOUR i|
000049d0  6e 6b 0d 20 20 35 38 30  20 50 52 49 4e 54 54 41  |nk.  580 PRINTTA|
000049e0  42 28 30 2c 33 31 29 22  2a 22 3b 0d 20 20 35 39  |B(0,31)"*";.  59|
000049f0  30 20 50 52 4f 43 64 65  6c 61 79 0d 20 20 36 30  |0 PROCdelay.  60|
00004a00  30 20 45 4e 44 50 52 4f  43 0d 20 20 36 31 30 20  |0 ENDPROC.  610 |
00004a10  3a 0d 20 20 36 32 30 20  44 45 46 50 52 4f 43 70  |:.  620 DEFPROCp|
00004a20  61 70 65 72 0d 20 20 36  33 30 20 70 61 70 65 72  |aper.  630 paper|
00004a30  3d 70 61 70 65 72 2b 31  0d 20 20 36 34 30 20 49  |=paper+1.  640 I|
00004a40  46 20 70 61 70 65 72 3e  37 20 70 61 70 65 72 3d  |F paper>7 paper=|
00004a50  30 0d 20 20 36 35 30 20  56 44 55 20 31 39 2c 30  |0.  650 VDU 19,0|
00004a60  2c 70 61 70 65 72 3b 30  3b 0d 20 20 36 36 30 20  |,paper;0;.  660 |
00004a70  49 46 20 73 70 65 65 63  68 20 53 4f 55 4e 44 2d  |IF speech SOUND-|
00004a80  31 2c 70 61 70 65 72 2b  34 38 2c 30 2c 30 20 45  |1,paper+48,0,0 E|
00004a90  4c 53 45 20 50 52 4f 43  62 65 65 70 0d 20 20 36  |LSE PROCbeep.  6|
00004aa0  37 30 20 50 52 4f 43 64  65 6c 61 79 0d 20 20 36  |70 PROCdelay.  6|
00004ab0  38 30 20 45 4e 44 50 52  4f 43 0d 20 20 36 39 30  |80 ENDPROC.  690|
00004ac0  20 3a 0d 20 20 37 30 30  20 44 45 46 50 52 4f 43  | :.  700 DEFPROC|
00004ad0  66 69 6c 6c 0d 20 20 37  31 30 20 50 52 4f 43 70  |fill.  710 PROCp|
00004ae0  6f 69 6e 74 73 28 31 29  0d 20 20 37 32 30 20 50  |oints(1).  720 P|
00004af0  52 4f 43 69 6e 70 75 74  28 31 34 32 29 0d 20 20  |ROCinput(142).  |
00004b00  37 33 30 20 68 69 67 68  3d 54 52 55 45 0d 20 20  |730 high=TRUE.  |
00004b10  37 34 30 20 6c 6f 77 3d  54 52 55 45 0d 20 20 37  |740 low=TRUE.  7|
00004b20  35 30 20 6c 6f 77 79 3d  6e 65 77 79 2d 34 0d 20  |50 lowy=newy-4. |
00004b30  20 37 36 30 20 68 69 67  68 79 3d 6e 65 77 79 0d  | 760 highy=newy.|
00004b40  20 20 37 37 30 20 52 45  50 45 41 54 0d 20 20 37  |  770 REPEAT.  7|
00004b50  38 30 20 49 46 20 68 69  67 68 20 50 52 4f 43 68  |80 IF high PROCh|
00004b60  69 67 68 28 6e 65 77 78  2c 68 69 67 68 79 29 0d  |igh(newx,highy).|
00004b70  20 20 37 39 30 20 49 46  20 6c 6f 77 20 50 52 4f  |  790 IF low PRO|
00004b80  43 6c 6f 77 28 6e 65 77  78 2c 6c 6f 77 79 29 0d  |Clow(newx,lowy).|
00004b90  20 20 38 30 30 20 68 69  67 68 79 3d 68 69 67 68  |  800 highy=high|
00004ba0  79 2b 34 0d 20 20 38 31  30 20 6c 6f 77 79 3d 6c  |y+4.  810 lowy=l|
00004bb0  6f 77 79 2d 34 0d 20 20  38 32 30 20 55 4e 54 49  |owy-4.  820 UNTI|
00004bc0  4c 20 28 6c 6f 77 3d 46  41 4c 53 45 29 20 41 4e  |L (low=FALSE) AN|
00004bd0  44 20 28 68 69 67 68 3d  46 41 4c 53 45 29 0d 20  |D (high=FALSE). |
00004be0  20 38 33 30 20 50 52 4f  43 72 65 73 65 74 0d 20  | 830 PROCreset. |
00004bf0  20 38 34 30 20 45 4e 44  50 52 4f 43 0d 20 20 38  | 840 ENDPROC.  8|
00004c00  35 30 20 3a 0d 20 20 38  36 30 20 44 45 46 50 52  |50 :.  860 DEFPR|
00004c10  4f 43 6c 6f 77 28 78 2c  79 29 0d 20 20 38 37 30  |OClow(x,y).  870|
00004c20  20 49 46 20 79 3c 30 20  6c 6f 77 3d 46 41 4c 53  | IF y<0 low=FALS|
00004c30  45 3a 45 4e 44 50 52 4f  43 0d 20 20 38 38 30 20  |E:ENDPROC.  880 |
00004c40  63 6f 6c 6f 75 72 3d 50  4f 49 4e 54 28 78 2c 79  |colour=POINT(x,y|
00004c50  29 0d 20 20 38 39 30 20  49 46 20 63 6f 6c 6f 75  |).  890 IF colou|
00004c60  72 3c 3e 30 20 6c 6f 77  3d 46 41 4c 53 45 3a 45  |r<>0 low=FALSE:E|
00004c70  4e 44 50 52 4f 43 0d 20  20 39 30 30 20 50 4c 4f  |NDPROC.  900 PLO|
00004c80  54 20 37 37 2c 78 2c 79  0d 20 20 39 31 30 20 45  |T 77,x,y.  910 E|
00004c90  4e 44 50 52 4f 43 0d 20  20 39 32 30 20 3a 0d 20  |NDPROC.  920 :. |
00004ca0  20 39 33 30 20 44 45 46  50 52 4f 43 68 69 67 68  | 930 DEFPROChigh|
00004cb0  28 78 2c 79 29 0d 20 20  39 34 30 20 49 46 20 79  |(x,y).  940 IF y|
00004cc0  3e 31 30 32 33 20 68 69  67 68 3d 46 41 4c 53 45  |>1023 high=FALSE|
00004cd0  3a 45 4e 44 50 52 4f 43  0d 20 20 39 35 30 20 63  |:ENDPROC.  950 c|
00004ce0  6f 6c 6f 75 72 3d 50 4f  49 4e 54 28 78 2c 79 29  |olour=POINT(x,y)|
00004cf0  0d 20 20 39 36 30 20 49  46 20 63 6f 6c 6f 75 72  |.  960 IF colour|
00004d00  3c 3e 30 20 68 69 67 68  3d 46 41 4c 53 45 3a 45  |<>0 high=FALSE:E|
00004d10  4e 44 50 52 4f 43 0d 20  20 39 37 30 20 50 4c 4f  |NDPROC.  970 PLO|
00004d20  54 20 37 37 2c 78 2c 79  0d 20 20 39 38 30 20 45  |T 77,x,y.  980 E|
00004d30  4e 44 50 52 4f 43 0d 20  20 39 39 30 20 3a 0d 20  |NDPROC.  990 :. |
00004d40  31 30 30 30 20 44 45 46  50 52 4f 43 73 71 75 61  |1000 DEFPROCsqua|
00004d50  72 65 0d 20 31 30 31 30  20 50 52 4f 43 70 6f 69  |re. 1010 PROCpoi|
00004d60  6e 74 73 28 32 29 0d 20  31 30 32 30 20 50 52 4f  |nts(2). 1020 PRO|
00004d70  43 69 6e 70 75 74 28 31  39 38 29 0d 20 31 30 33  |Cinput(198). 103|
00004d80  30 20 50 52 4f 43 69 6e  70 75 74 28 32 35 38 29  |0 PROCinput(258)|
00004d90  0d 20 31 30 34 30 20 50  52 4f 43 63 75 72 73 6f  |. 1040 PROCcurso|
00004da0  72 28 6e 65 77 78 2c 6e  65 77 79 29 0d 20 31 30  |r(newx,newy). 10|
00004db0  35 30 20 50 4c 4f 54 20  35 2c 6e 65 77 78 2d 28  |50 PLOT 5,newx-(|
00004dc0  6e 65 77 79 2d 6c 61 73  74 79 29 2c 6e 65 77 79  |newy-lasty),newy|
00004dd0  2b 28 6e 65 77 78 2d 6c  61 73 74 78 29 0d 20 31  |+(newx-lastx). 1|
00004de0  30 36 30 20 50 4c 4f 54  20 35 2c 6c 61 73 74 78  |060 PLOT 5,lastx|
00004df0  2d 28 6e 65 77 79 2d 6c  61 73 74 79 29 2c 6c 61  |-(newy-lasty),la|
00004e00  73 74 79 2b 28 6e 65 77  78 2d 6c 61 73 74 78 29  |sty+(newx-lastx)|
00004e10  0d 20 31 30 37 30 20 50  4c 4f 54 20 35 2c 6c 61  |. 1070 PLOT 5,la|
00004e20  73 74 78 2c 6c 61 73 74  79 0d 20 31 30 38 30 20  |stx,lasty. 1080 |
00004e30  50 4c 4f 54 20 35 2c 6e  65 77 78 2c 6e 65 77 79  |PLOT 5,newx,newy|
00004e40  0d 20 31 30 39 30 20 50  52 4f 43 72 65 73 65 74  |. 1090 PROCreset|
00004e50  0d 20 31 31 30 30 20 45  4e 44 50 52 4f 43 0d 20  |. 1100 ENDPROC. |
00004e60  31 31 31 30 20 3a 0d 20  31 31 32 30 20 44 45 46  |1110 :. 1120 DEF|
00004e70  50 52 4f 43 63 69 72 63  6c 65 0d 20 31 31 33 30  |PROCcircle. 1130|
00004e80  20 50 52 4f 43 70 6f 69  6e 74 73 28 32 29 0d 20  | PROCpoints(2). |
00004e90  31 31 34 30 20 50 52 4f  43 69 6e 70 75 74 28 31  |1140 PROCinput(1|
00004ea0  39 38 29 0d 20 31 31 35  30 20 50 52 4f 43 69 6e  |98). 1150 PROCin|
00004eb0  70 75 74 28 32 35 38 29  0d 20 31 31 36 30 20 50  |put(258). 1160 P|
00004ec0  52 4f 43 63 75 72 73 6f  72 28 6c 61 73 74 78 2c  |ROCcursor(lastx,|
00004ed0  6c 61 73 74 79 29 0d 20  31 31 37 30 20 72 61 64  |lasty). 1170 rad|
00004ee0  69 75 73 3d 53 51 52 28  28 28 41 42 53 28 6e 65  |ius=SQR(((ABS(ne|
00004ef0  77 78 2d 6c 61 73 74 78  29 29 5e 32 29 2b 28 28  |wx-lastx))^2)+((|
00004f00  41 42 53 28 6e 65 77 79  2d 6c 61 73 74 79 29 29  |ABS(newy-lasty))|
00004f10  5e 32 29 29 0d 20 31 31  38 30 20 50 52 4f 43 72  |^2)). 1180 PROCr|
00004f20  65 73 65 74 0d 20 31 31  39 30 20 4d 4f 56 45 20  |eset. 1190 MOVE |
00004f30  6c 61 73 74 78 2b 72 61  64 69 75 73 2c 6c 61 73  |lastx+radius,las|
00004f40  74 79 0d 20 31 32 30 30  20 46 4f 52 20 61 6e 67  |ty. 1200 FOR ang|
00004f50  6c 65 3d 31 30 20 54 4f  20 33 36 30 20 53 54 45  |le=10 TO 360 STE|
00004f60  50 20 31 30 0d 20 31 32  31 30 20 78 3d 72 61 64  |P 10. 1210 x=rad|
00004f70  69 75 73 2a 43 4f 53 28  52 41 44 28 61 6e 67 6c  |ius*COS(RAD(angl|
00004f80  65 29 29 0d 20 31 32 32  30 20 79 3d 72 61 64 69  |e)). 1220 y=radi|
00004f90  75 73 2a 53 49 4e 28 52  41 44 28 61 6e 67 6c 65  |us*SIN(RAD(angle|
00004fa0  29 29 0d 20 31 32 33 30  20 50 4c 4f 54 20 35 2c  |)). 1230 PLOT 5,|
00004fb0  6c 61 73 74 78 2b 78 2c  6c 61 73 74 79 2b 79 0d  |lastx+x,lasty+y.|
00004fc0  20 31 32 34 30 20 4e 45  58 54 0d 20 31 32 35 30  | 1240 NEXT. 1250|
00004fd0  20 45 4e 44 50 52 4f 43  0d 20 31 32 36 30 20 3a  | ENDPROC. 1260 :|
00004fe0  0d 20 31 32 37 30 20 44  45 46 50 52 4f 43 6c 69  |. 1270 DEFPROCli|
00004ff0  6e 65 0d 20 31 32 38 30  20 50 52 4f 43 70 6f 69  |ne. 1280 PROCpoi|
00005000  6e 74 73 28 32 29 0d 20  31 32 39 30 20 50 52 4f  |nts(2). 1290 PRO|
00005010  43 69 6e 70 75 74 28 31  39 38 29 0d 20 31 33 30  |Cinput(198). 130|
00005020  30 20 50 52 4f 43 69 6e  70 75 74 28 32 35 38 29  |0 PROCinput(258)|
00005030  0d 20 31 33 31 30 20 50  4c 4f 54 20 35 2c 6c 61  |. 1310 PLOT 5,la|
00005040  73 74 78 2c 6c 61 73 74  79 0d 20 31 33 32 30 20  |stx,lasty. 1320 |
00005050  45 4e 44 50 52 4f 43 0d  20 31 33 33 30 20 3a 0d  |ENDPROC. 1330 :.|
00005060  20 31 33 34 30 20 44 45  46 50 52 4f 43 78 79 0d  | 1340 DEFPROCxy.|
00005070  20 31 33 35 30 20 6f 6c  64 78 3d 6e 65 77 78 0d  | 1350 oldx=newx.|
00005080  20 31 33 36 30 20 6f 6c  64 79 3d 6e 65 77 79 0d  | 1360 oldy=newy.|
00005090  20 31 33 37 30 20 6e 65  77 78 3d 6e 65 77 78 2b  | 1370 newx=newx+|
000050a0  28 28 21 78 63 6f 6f 72  64 2d 6e 65 77 78 29 44  |((!xcoord-newx)D|
000050b0  49 56 34 29 0d 20 31 33  38 30 20 6e 65 77 79 3d  |IV4). 1380 newy=|
000050c0  6e 65 77 79 2b 28 28 21  79 63 6f 6f 72 64 2d 6e  |newy+((!ycoord-n|
000050d0  65 77 79 29 44 49 56 34  29 0d 20 31 33 39 30 20  |ewy)DIV4). 1390 |
000050e0  45 4e 44 50 52 4f 43 0d  20 31 34 30 30 20 3a 0d  |ENDPROC. 1400 :.|
000050f0  20 31 34 31 30 20 44 45  46 50 52 4f 43 64 65 6c  | 1410 DEFPROCdel|
00005100  61 79 0d 20 31 34 32 30  20 74 69 6d 65 3d 54 49  |ay. 1420 time=TI|
00005110  4d 45 2b 32 30 0d 20 31  34 33 30 20 52 45 50 45  |ME+20. 1430 REPE|
00005120  41 54 20 55 4e 54 49 4c  20 74 69 6d 65 3c 54 49  |AT UNTIL time<TI|
00005130  4d 45 0d 20 31 34 34 30  20 52 45 50 45 41 54 20  |ME. 1440 REPEAT |
00005140  55 4e 54 49 4c 20 46 4e  73 77 69 74 63 68 0d 20  |UNTIL FNswitch. |
00005150  31 34 35 30 20 45 4e 44  50 52 4f 43 0d 20 31 34  |1450 ENDPROC. 14|
00005160  36 30 20 3a 0d 20 31 34  37 30 20 44 45 46 50 52  |60 :. 1470 DEFPR|
00005170  4f 43 63 75 72 73 6f 72  28 78 2c 79 29 0d 20 31  |OCcursor(x,y). 1|
00005180  34 38 30 20 47 43 4f 4c  20 33 2c 69 6e 6b 0d 20  |480 GCOL 3,ink. |
00005190  31 34 39 30 20 50 4c 4f  54 20 36 39 2c 78 2c 79  |1490 PLOT 69,x,y|
000051a0  0d 20 31 35 30 30 20 47  43 4f 4c 20 30 2c 69 6e  |. 1500 GCOL 0,in|
000051b0  6b 0d 20 31 35 31 30 20  45 4e 44 50 52 4f 43 0d  |k. 1510 ENDPROC.|
000051c0  20 31 35 32 30 20 3a 0d  20 31 35 33 30 20 44 45  | 1520 :. 1530 DE|
000051d0  46 50 52 4f 43 69 6e 70  75 74 28 73 61 79 29 0d  |FPROCinput(say).|
000051e0  20 31 35 34 30 20 6c 61  73 74 78 3d 6e 65 77 78  | 1540 lastx=newx|
000051f0  0d 20 31 35 35 30 20 6c  61 73 74 79 3d 6e 65 77  |. 1550 lasty=new|
00005200  79 0d 20 31 35 36 30 20  52 45 50 45 41 54 0d 20  |y. 1560 REPEAT. |
00005210  31 35 37 30 20 50 52 4f  43 78 79 0d 20 31 35 38  |1570 PROCxy. 158|
00005220  30 20 50 52 4f 43 77 61  6e 64 65 72 0d 20 31 35  |0 PROCwander. 15|
00005230  39 30 20 55 4e 54 49 4c  20 4e 4f 54 20 46 4e 73  |90 UNTIL NOT FNs|
00005240  77 69 74 63 68 0d 20 31  36 30 30 20 49 46 20 73  |witch. 1600 IF s|
00005250  70 65 65 63 68 20 53 4f  55 4e 44 2d 31 2c 73 61  |peech SOUND-1,sa|
00005260  79 2c 30 2c 30 20 45 4c  53 45 20 50 52 4f 43 62  |y,0,0 ELSE PROCb|
00005270  65 65 70 0d 20 31 36 31  30 20 50 52 4f 43 63 75  |eep. 1610 PROCcu|
00005280  72 73 6f 72 28 6e 65 77  78 2c 6e 65 77 79 29 0d  |rsor(newx,newy).|
00005290  20 31 36 32 30 20 50 52  4f 43 64 65 6c 61 79 0d  | 1620 PROCdelay.|
000052a0  20 31 36 33 30 20 45 4e  44 50 52 4f 43 0d 20 31  | 1630 ENDPROC. 1|
000052b0  36 34 30 20 3a 0d 20 31  36 35 30 20 44 45 46 50  |640 :. 1650 DEFP|
000052c0  52 4f 43 77 61 6e 64 65  72 0d 20 31 36 36 30 20  |ROCwander. 1660 |
000052d0  50 52 4f 43 63 75 72 73  6f 72 28 6f 6c 64 78 2c  |PROCcursor(oldx,|
000052e0  6f 6c 64 79 29 0d 20 31  36 37 30 20 50 52 4f 43  |oldy). 1670 PROC|
000052f0  63 75 72 73 6f 72 28 6e  65 77 78 2c 6e 65 77 79  |cursor(newx,newy|
00005300  29 0d 20 31 36 38 30 20  45 4e 44 50 52 4f 43 0d  |). 1680 ENDPROC.|
00005310  20 31 36 39 30 20 3a 0d  20 31 37 30 30 20 44 45  | 1690 :. 1700 DE|
00005320  46 50 52 4f 43 64 65 6c  65 74 65 0d 20 31 37 31  |FPROCdelete. 171|
00005330  30 20 50 52 4f 43 72 65  73 65 74 0d 20 31 37 32  |0 PROCreset. 172|
00005340  30 20 43 4c 47 0d 20 31  37 33 30 20 43 4f 4c 4f  |0 CLG. 1730 COLO|
00005350  55 52 20 69 6e 6b 0d 20  31 37 34 30 20 50 52 49  |UR ink. 1740 PRI|
00005360  4e 54 54 41 42 28 30 2c  33 31 29 22 2a 22 3b 0d  |NTTAB(0,31)"*";.|
00005370  20 31 37 35 30 20 45 4e  44 50 52 4f 43 0d 20 31  | 1750 ENDPROC. 1|
00005380  37 36 30 20 3a 0d 20 31  37 37 30 20 44 45 46 50  |760 :. 1770 DEFP|
00005390  52 4f 43 72 65 73 65 74  0d 20 31 37 38 30 20 6e  |ROCreset. 1780 n|
000053a0  65 77 78 3d 2d 31 0d 20  31 37 39 30 20 6e 65 77  |ewx=-1. 1790 new|
000053b0  79 3d 2d 31 0d 20 31 38  30 30 20 45 4e 44 50 52  |y=-1. 1800 ENDPR|
000053c0  4f 43 0d 20 31 38 31 30  20 3a 0d 20 31 38 32 30  |OC. 1810 :. 1820|
000053d0  20 44 45 46 50 52 4f 43  70 6f 69 6e 74 73 28 73  | DEFPROCpoints(s|
000053e0  61 79 29 0d 20 31 38 33  30 20 49 46 20 4e 4f 54  |ay). 1830 IF NOT|
000053f0  20 73 70 65 65 63 68 20  50 52 4f 43 62 65 65 70  | speech PROCbeep|
00005400  3a 45 4e 44 50 52 4f 43  0d 20 31 38 34 30 20 53  |:ENDPROC. 1840 S|
00005410  4f 55 4e 44 2d 31 2c 31  39 32 2c 30 2c 30 0d 20  |OUND-1,192,0,0. |
00005420  31 38 35 30 20 53 4f 55  4e 44 2d 31 2c 73 61 79  |1850 SOUND-1,say|
00005430  2b 34 38 2c 30 2c 30 0d  20 31 38 36 30 20 53 4f  |+48,0,0. 1860 SO|
00005440  55 4e 44 2d 31 2c 32 34  33 2c 30 2c 30 0d 20 31  |UND-1,243,0,0. 1|
00005450  38 37 30 20 49 46 20 73  61 79 3e 31 20 53 4f 55  |870 IF say>1 SOU|
00005460  4e 44 2d 31 2c 31 33 38  2c 30 2c 30 0d 20 31 38  |ND-1,138,0,0. 18|
00005470  38 30 20 45 4e 44 50 52  4f 43 0d 20 31 38 39 30  |80 ENDPROC. 1890|
00005480  20 3a 0d 20 31 39 30 30  20 44 45 46 50 52 4f 43  | :. 1900 DEFPROC|
00005490  62 65 65 70 0d 20 31 39  31 30 20 53 4f 55 4e 44  |beep. 1910 SOUND|
000054a0  31 2c 2d 31 30 2c 31 30  30 2c 31 0d 20 31 39 32  |1,-10,100,1. 192|
000054b0  30 20 45 4e 44 50 52 4f  43 0d 20 31 39 33 30 20  |0 ENDPROC. 1930 |
000054c0  3a 0d 20 31 39 34 30 20  44 45 46 46 4e 6f 73 62  |:. 1940 DEFFNosb|
000054d0  79 74 65 0d 20 31 39 35  30 20 3d 28 55 53 52 28  |yte. 1950 =(USR(|
000054e0  26 46 46 46 34 29 41 4e  44 26 46 46 30 30 29 44  |&FFF4)AND&FF00)D|
000054f0  49 56 26 31 30 30 0d 20  31 39 36 30 20 3a 0d 20  |IV&100. 1960 :. |
00005500  31 39 37 30 20 44 45 46  46 4e 73 77 69 74 63 68  |1970 DEFFNswitch|
00005510  0d 20 31 39 38 30 20 49  46 20 28 41 44 56 41 4c  |. 1980 IF (ADVAL|
00005520  28 30 29 41 4e 44 33 29  3d 30 20 49 46 20 21 78  |(0)AND3)=0 IF !x|
00005530  63 6f 6f 72 64 3e 38 20  49 46 20 21 78 63 6f 6f  |coord>8 IF !xcoo|
00005540  72 64 3c 31 32 35 36 20  3d 46 41 4c 53 45 0d 20  |rd<1256 =FALSE. |
00005550  31 39 39 30 20 3d 54 52  55 45 0d                 |1990 =TRUE.|
0000555b
17-02-89/T\Pen05.m0
17-02-89/T\Pen05.m1
17-02-89/T\Pen05.m2
17-02-89/T\Pen05.m4
17-02-89/T\Pen05.m5