Home » CEEFAX disks » telesoftware12.adl » 20-01-89/T\Pen01

20-01-89/T\Pen01

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: 20-01-89/T\Pen01
Read OK:
File size: 39DC bytes
Load address: 0000
Exec address: 0000
File contents
Using a light pen with the BBC microcomputer - by - Gordon Horsington
---------------------------------------------------------------------

Module 1. Introduction to light pen software
--------------------------------------------


This module will introduce the techniques needed to calculate the position
of the light pen in terms of the X and Y text coordinates.

The maximum resolution of a light pen is one 6845 CRTC character. In modes
0, 3, 4, 6 and 7 the displayed text characters correspond with the CRTC
characters and the maximum resolution of any BBC light pen is one
displayed text character. In modes 1, 2 and 5 the resolution is greater
than one displayed text character but the position can still be calculated
in terms of the X and Y text coordinates. It is also possible to calculate
the position of the light pen in terms of the X and Y graphical
coordinates and this will be covered in module 4.

A light pen will produce a positive going TTL pulse whenever the sensor
picks up light given out by the monitor screen. This TTL pulse is usually
called a video strobe pulse (VSP) and the timing of the VSP corresponds
with the position of the light pen on the screen. When the VSP falls back
from logic 1 to logic 0 a number which corresponds with the light pen
position will be latched into the (read only) registers 16 (high byte) and
17 (low byte) of the 6845 CRTC. These two registers form the 14 light pen
register. If the light pen has not been used the light pen register will
contain zero.

In order to read the contents of any CRTC register, the register address
must first be written into &FE00, the 6845 address register, and then the
selected register may be read from &FE01, the 6845 data register. Acorn
have provided two Osbyte calls which should be used when writing to or
reading from Sheila (ie, page &FE). These calls are Osbyte &97 (decimal
151) to write to Sheila and Osbyte &96 (decimal 150) to read from Sheila.
These Osbyte calls are used with the X register containing the offset
within Sheila and the Y register containing the byte to be written (Osbyte
&97). The machine code routine in the demonstration program OFFSET uses
these Osbyte calls to read the contents of the light pen register. Using
the Osbyte calls helps to ensure that OFFSET is Tube compatible. Peeking
and poking the memory locations directly would make it incompatible with a
second processor.

After reading the contents of the light pen register it is necessary to
subtract a correction factor from the number to take account of the
different screen start addresses in the various screen modes. The table in
figure 1 shows these correction factors in the column headed offset. These
offset values can only be used if the screen has not been scrolled. If the
screen is scrolled the position of the start of the screen will have to be
taken into account as well. One method of dealing with this problem will
be covered in module 3.


             Mode   offset   width   scale   Text resolution
             -----+--------+-------+-------+------------------
               0  | &0606  |  &50  |  &00  | single character 
               1  | &0606  |  &50  |  &01  | half character   
               2  | &0606  |  &50  |  &02  | quarter character
               3  | &0806  |  &50  |  &00  | single character 
               4  | &0B04  |  &28  |  &00  | single character 
               5  | &0B04  |  &28  |  &01  | half character   
               6  | &0C04  |  &28  |  &00  | single character 
               7  | &2808  |  &28  |  &00  | single character 
             -----+--------+-------+-------+------------------

Figure 1. The values of offset, width and scale for each screen mode
--------------------------------------------------------------------


The column headed width in figure 1 shows the number of 6845 characters
per row in each screen mode. This number is not necessarily the same as
the number of displayed characters and the 6845 'sees' &50 (decimal 80)
characters per row in modes 0 to 3, and &28 (decimal 40) characters per
row in modes 4 to 7. The 6845 characters per row is not always the same as
the displayed characters per row and for this reason the light pen
coordinates need to be calculated in terms of displayed text coordinates
rather than 6845 coordinates. The light pen position can be calculated in
terms of displayed text coordinates using:

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

The values of offset, width and scale are those appropriate to the screen
mode in use at the time. The reason why 2^scale (2 raised to the power of
scale) is used in the calculation of the X coordinate is to simplify the
machine code arithmetic used to produce the X coordinate. The number
assigned to the variable scale indicates how many times the CRTC X
coordinate has to be divided by 2 to give the text X coordinate.

The machine code routine in the program OFFSET performs these calculations
in any screen mode leaving the results in &70 (X coordinate) and &71 (Y
coordinate). Although zero page will be used to store the results in all
the light pen modules any 3 bytes would do (&73 is used as workspace
during the calculation). Using zero page has the advantage of speeding up
the calculation.

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


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

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


If all light pens and all computers were the same you could simply call
the machine code routine in the program OFFSET and read the X and Y text
coordinates from &70 and &71 every time you wanted the light pen position.
Unfortunately things are not quite that simple and there are problems
because different pens produce VSPs with slightly different timing and
there also seems to be a problem with Osbytes &96 and &97 with the BBC B
OS 1.20.

The best way of illustrating some of the problems with light pens is to
plug your light pen into the analogue port, switch on the computer and
chain the program OFFSET. This program uses the up and down cursor keys to
change the screen modes and the left and right cursor keys to adjust the
least significant byte of the offset.

If you move the light pen around the screen the program will display an
asterisk which follows the pen. You will probably find that the asterisk
either leads or, more likely, lags behind the pen. This can be adjusted
with the left and right cursor keys. The left cursor key will move the
asterisk to the left and the right cursor key will move it to the right.
Pressing the left cursor key adds 1 to the least significant byte of the
offset and pressing the right cursor key subtracts 1. This is known in
light pen jargon as trimming the offset. The current value of the least
significant byte is displayed by the program and you should use the
program to trim the offset in all the screen modes. I have found that the
value of the least significant byte of the offset is usually 1 or 2 less
than the theoretical value. You may well find that different values are
needed with your light pen. Make a note of the values your pen uses
because you will need to trim the offset in all the programs used to
illustrate the light pen modules. You can permanently alter the least
significant byte of the offsets by editing lines 1340 to 1410 of OFFSET.

The problem with Osbytes &96 and &97 is one I have only found when using a
light pen with OS 1.20. If you run the program on a BBC B with OS 1.20 you
could find that, every now and then, an asterisk is displayed in a random
position on the screen. This only happens occasionally but it can be
completely cured by not using the Osbyte calls. If you have this problem
then include lines 1220 to 1240 which have been commented out in OFFSET.
Lines 1220 to 1240 poke and peek the address and data registers directly
and doing this cures the problem but makes the program incompatible with
the Tube. A Tube compatible program which accesses the registers directly
will be used in module 3.

Another problem can be illustrated with OFFSET. If you hold the light pen
at the extreme left or right edge of the screen you could find that the
asterisk is displayed on the opposite edge. This problem can be minimised
by careful trimming and using a light shade on the pen but it cannot
always be completely eliminated. This should not be too much of a problem
when using the light pen to read text coordinates because, in practice,
you will rarely need to access these parts of the screen. It can, however,
cause a terrible mess if you use the light pen to draw on a graphics
screen and we will be coming back to look at this problem in module 4 when
drawing with a light pen is covered.

One last problem with light pens can be demonstrated if you position the
light pen in the lower right hand corner of the screen. The program will
print an asterisk and scroll the screen. You should try to scroll the
screen in this manner to discover the effect it has on the light pen text
coordinates. The solution to the error produced by screen scrolling will
be covered in module 3.


   10 REM> OFFSET
   20 DIM mcode &100
   30 PROCmcode
   40 mode=0
   50 MODE mode
   60 PROCnewmode
   70 REPEAT
   80 IF INKEY(-58) PROCup:MODE mode:PROCnewmode
   90 IF INKEY(-42) PROCdown:MODE mode:PROCnewmode
  100 IF INKEY(-26) PROCleft
  110 IF INKEY(-122) PROCright
  120 CALL mcode
  130 IF (?xcoord<>oldx) OR (?ycoord<>oldy)
      VDU31,oldx,oldy,32,31,?xcoord,?ycoord,42
  140 oldx=?xcoord
  150 oldy=?ycoord
  160 UNTIL FALSE
  170 :
  180 DEFPROCleft
  190 IF offsetlow?mode=12 ENDPROC
  200 offsetlow?mode=offsetlow?mode+1
  210 PRINTTAB(15,2);offsetlow?mode;" ";
  220 PROCdelay
  230 ENDPROC
  240 :
  250 DEFPROCright
  260 IF offsetlow?mode=0 ENDPROC
  270 offsetlow?mode=offsetlow?mode-1
  280 PRINTTAB(15,2);offsetlow?mode;" ";
  290 PROCdelay
  300 ENDPROC
  310 :
  320 DEFPROCup
  330 mode=mode+1
  340 IF mode>7 mode=7
  350 ENDPROC
  360 :
  370 DEFPROCdown
  380 mode=mode-1
  390 IF mode<0 mode=0
  400 ENDPROC
  410 :
  420 DEFPROCnewmode
  430 VDU23,1,0;0;0;0;
  440 VDU19,0,6;0;
  450 VDU19,1,4;0;
  460 COLOUR1
  470 PRINTTAB(3,1)"Mode ";mode
  480 PRINTTAB(3,2)"offsetlow = ";offsetlow?mode
  490 IF mode=7 PROCseven
  500 CALL mcode
  510 oldx=?xcoord
  520 oldy=?ycoord
  530 PROCdelay
  540 ENDPROC
  550 :
  560 DEFPROCdelay
  570 time=TIME+20
  580 REPEAT UNTIL time<TIME
  590 ENDPROC
  600 :
  610 DEFPROCseven
  620 FOR line=0 TO 24
  630 VDU31,0,line,134,157,132
  640 NEXT
  650 ENDPROC
  660 :
  670 DEFPROCmcode
  680 xcoord=&70
  690 ycoord=&71 :REM: &71-&72
  700 osbyte=&FFF4
  710 FORpass=0TO2STEP2
  720 P%=mcode
  730 [       OPT pass
  740         LDA #&87      \ read screen mode
  750         JSR osbyte
  760         TYA           \ screen mode in Y register
  770         AND #&07      \ range 0-7
  780         STA screen    \ store screen mode
  790         LDY #&10      \ light pen register, high byte
  800         JSR readio    \ read light pen register
  810         CPY #&00      \ Y=0 if pen not used
  820         BEQ return
  830         STY ycoord+1  \ store high byte
  840         LDY #&11      \ light pen register, low byte
  850         JSR readio    \ read light pen register
  860         TYA           \ low byte into A
  870         LDY screen    \ screen mode
  880         CLD           \ clear decimal flag
  890         SEC           \ prepare for subtraction
  900         SBC offsetlow,Y \ subtract screen mode offset
  910         STA ycoord    \ low byte - offset
  920         LDA ycoord+1  \ high byte
  930         SBC offsethigh,Y \ subtract screen mode offset
  940         STA ycoord+1  \ high byte - offset
  950         LDA #&00      \ prepare for 16 bit division
  960         STA xcoord    \ clear low partial dividend
  970         LDX #&10      \ set bit counter for 16 bit division
  980 .next
  990         ASL ycoord    \ shift dividend/quotient left
 1000         ROL ycoord+1  \ shift dividend/quotient left
 1010         ROL xcoord    \ shift bits into partial dividend
 1020         LDA xcoord    \ load partial dividend
 1030         SEC           \ prepare for subtraction
 1040         SBC width,Y   \ subtract divisor
 1050         BCC done      \ branch if dividend < divisor
 1060         INC ycoord    \ increment quotient
 1070         STA xcoord    \ save new partial dividend
 1080 .done
 1090         DEX           \ decrement bit counter
 1100         BNE next      \ branch for 16 bits
 1110         LDA scale,Y   \ screen mode scale
 1120         BEQ return    \ branch if modes 0, 3, 4, 6 or 7
 1130         TAX           \ in mode1 and mode5 X=1, in mode2 X=2
 1140         LDA xcoord
 1150 .reduce
 1160         LSR A         \ horizontal position / 2
 1170         DEX
 1180         BNE reduce
 1190         STA xcoord
 1200 .return
 1210         RTS           \ return to BASIC
 1220 .readio
 1230 \       STY &FE00
 1240 \       LDY &FE01
 1250 \       RTS
 1260         LDA #&97      \ write to sheila
 1270         LDX #&00      \ offset 0 = &FE00
 1280         JSR osbyte
 1290         LDA #&96      \ read from sheila
 1300         LDX #&01      \ offset 1 = &FE01
 1310         JMP osbyte    \ and return
 1320 .screen
 1330         EQUB &00      \ screen mode stored here
 1340 .offsetlow
 1350         EQUB &06      \ mode0, trimmed = 4
 1360         EQUB &06      \ mode1, trimmed = 4
 1370         EQUB &06      \ mode2, trimmed = 4
 1380         EQUB &06      \ mode3, trimmed = 4
 1390         EQUB &04      \ mode4, trimmed = 3
 1400         EQUB &04      \ mode5, trimmed = 3
 1410         EQUB &04      \ mode6, trimmed = 3
 1420         EQUB &08      \ mode7, trimmed = 6
 1430 .offsethigh
 1440         EQUD &08060606 \ modes 3-0
 1450         EQUD &280C0B0B \ modes 7-4
 1460 .scale
 1470         EQUD &00020100 \ modes 3-0
 1480         EQUD &00000100 \ modes 7-4
 1490 .width
 1500         EQUD &50505050 \ modes 3-0
 1510         EQUD &28282828 \ modes 7-4
 1520 ]
 1530 NEXT
 1540 ENDPROC
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 31 2e 20 49  6e 74 72 6f 64 75 63 74  |ule 1. Introduct|
000000a0  69 6f 6e 20 74 6f 20 6c  69 67 68 74 20 70 65 6e  |ion to light pen|
000000b0  20 73 6f 66 74 77 61 72  65 0d 2d 2d 2d 2d 2d 2d  | software.------|
000000c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000000e0  2d 2d 2d 2d 2d 2d 0d 0d  0d 54 68 69 73 20 6d 6f  |------...This mo|
000000f0  64 75 6c 65 20 77 69 6c  6c 20 69 6e 74 72 6f 64  |dule will introd|
00000100  75 63 65 20 74 68 65 20  74 65 63 68 6e 69 71 75  |uce the techniqu|
00000110  65 73 20 6e 65 65 64 65  64 20 74 6f 20 63 61 6c  |es needed to cal|
00000120  63 75 6c 61 74 65 20 74  68 65 20 70 6f 73 69 74  |culate the posit|
00000130  69 6f 6e 0d 6f 66 20 74  68 65 20 6c 69 67 68 74  |ion.of the light|
00000140  20 70 65 6e 20 69 6e 20  74 65 72 6d 73 20 6f 66  | pen in terms of|
00000150  20 74 68 65 20 58 20 61  6e 64 20 59 20 74 65 78  | the X and Y tex|
00000160  74 20 63 6f 6f 72 64 69  6e 61 74 65 73 2e 0d 0d  |t coordinates...|
00000170  54 68 65 20 6d 61 78 69  6d 75 6d 20 72 65 73 6f  |The maximum reso|
00000180  6c 75 74 69 6f 6e 20 6f  66 20 61 20 6c 69 67 68  |lution of a ligh|
00000190  74 20 70 65 6e 20 69 73  20 6f 6e 65 20 36 38 34  |t pen is one 684|
000001a0  35 20 43 52 54 43 20 63  68 61 72 61 63 74 65 72  |5 CRTC character|
000001b0  2e 20 49 6e 20 6d 6f 64  65 73 0d 30 2c 20 33 2c  |. In modes.0, 3,|
000001c0  20 34 2c 20 36 20 61 6e  64 20 37 20 74 68 65 20  | 4, 6 and 7 the |
000001d0  64 69 73 70 6c 61 79 65  64 20 74 65 78 74 20 63  |displayed text c|
000001e0  68 61 72 61 63 74 65 72  73 20 63 6f 72 72 65 73  |haracters corres|
000001f0  70 6f 6e 64 20 77 69 74  68 20 74 68 65 20 43 52  |pond with the CR|
00000200  54 43 0d 63 68 61 72 61  63 74 65 72 73 20 61 6e  |TC.characters an|
00000210  64 20 74 68 65 20 6d 61  78 69 6d 75 6d 20 72 65  |d the maximum re|
00000220  73 6f 6c 75 74 69 6f 6e  20 6f 66 20 61 6e 79 20  |solution of any |
00000230  42 42 43 20 6c 69 67 68  74 20 70 65 6e 20 69 73  |BBC light pen is|
00000240  20 6f 6e 65 0d 64 69 73  70 6c 61 79 65 64 20 74  | one.displayed t|
00000250  65 78 74 20 63 68 61 72  61 63 74 65 72 2e 20 49  |ext character. I|
00000260  6e 20 6d 6f 64 65 73 20  31 2c 20 32 20 61 6e 64  |n modes 1, 2 and|
00000270  20 35 20 74 68 65 20 72  65 73 6f 6c 75 74 69 6f  | 5 the resolutio|
00000280  6e 20 69 73 20 67 72 65  61 74 65 72 0d 74 68 61  |n is greater.tha|
00000290  6e 20 6f 6e 65 20 64 69  73 70 6c 61 79 65 64 20  |n one displayed |
000002a0  74 65 78 74 20 63 68 61  72 61 63 74 65 72 20 62  |text character b|
000002b0  75 74 20 74 68 65 20 70  6f 73 69 74 69 6f 6e 20  |ut the position |
000002c0  63 61 6e 20 73 74 69 6c  6c 20 62 65 20 63 61 6c  |can still be cal|
000002d0  63 75 6c 61 74 65 64 0d  69 6e 20 74 65 72 6d 73  |culated.in terms|
000002e0  20 6f 66 20 74 68 65 20  58 20 61 6e 64 20 59 20  | of the X and Y |
000002f0  74 65 78 74 20 63 6f 6f  72 64 69 6e 61 74 65 73  |text coordinates|
00000300  2e 20 49 74 20 69 73 20  61 6c 73 6f 20 70 6f 73  |. It is also pos|
00000310  73 69 62 6c 65 20 74 6f  20 63 61 6c 63 75 6c 61  |sible to calcula|
00000320  74 65 0d 74 68 65 20 70  6f 73 69 74 69 6f 6e 20  |te.the position |
00000330  6f 66 20 74 68 65 20 6c  69 67 68 74 20 70 65 6e  |of the light pen|
00000340  20 69 6e 20 74 65 72 6d  73 20 6f 66 20 74 68 65  | in terms of the|
00000350  20 58 20 61 6e 64 20 59  20 67 72 61 70 68 69 63  | X and Y graphic|
00000360  61 6c 0d 63 6f 6f 72 64  69 6e 61 74 65 73 20 61  |al.coordinates a|
00000370  6e 64 20 74 68 69 73 20  77 69 6c 6c 20 62 65 20  |nd this will be |
00000380  63 6f 76 65 72 65 64 20  69 6e 20 6d 6f 64 75 6c  |covered in modul|
00000390  65 20 34 2e 0d 0d 41 20  6c 69 67 68 74 20 70 65  |e 4...A light pe|
000003a0  6e 20 77 69 6c 6c 20 70  72 6f 64 75 63 65 20 61  |n will produce a|
000003b0  20 70 6f 73 69 74 69 76  65 20 67 6f 69 6e 67 20  | positive going |
000003c0  54 54 4c 20 70 75 6c 73  65 20 77 68 65 6e 65 76  |TTL pulse whenev|
000003d0  65 72 20 74 68 65 20 73  65 6e 73 6f 72 0d 70 69  |er the sensor.pi|
000003e0  63 6b 73 20 75 70 20 6c  69 67 68 74 20 67 69 76  |cks up light giv|
000003f0  65 6e 20 6f 75 74 20 62  79 20 74 68 65 20 6d 6f  |en out by the mo|
00000400  6e 69 74 6f 72 20 73 63  72 65 65 6e 2e 20 54 68  |nitor screen. Th|
00000410  69 73 20 54 54 4c 20 70  75 6c 73 65 20 69 73 20  |is TTL pulse is |
00000420  75 73 75 61 6c 6c 79 0d  63 61 6c 6c 65 64 20 61  |usually.called a|
00000430  20 76 69 64 65 6f 20 73  74 72 6f 62 65 20 70 75  | video strobe pu|
00000440  6c 73 65 20 28 56 53 50  29 20 61 6e 64 20 74 68  |lse (VSP) and th|
00000450  65 20 74 69 6d 69 6e 67  20 6f 66 20 74 68 65 20  |e timing of the |
00000460  56 53 50 20 63 6f 72 72  65 73 70 6f 6e 64 73 0d  |VSP corresponds.|
00000470  77 69 74 68 20 74 68 65  20 70 6f 73 69 74 69 6f  |with the positio|
00000480  6e 20 6f 66 20 74 68 65  20 6c 69 67 68 74 20 70  |n of the light p|
00000490  65 6e 20 6f 6e 20 74 68  65 20 73 63 72 65 65 6e  |en on the screen|
000004a0  2e 20 57 68 65 6e 20 74  68 65 20 56 53 50 20 66  |. When the VSP f|
000004b0  61 6c 6c 73 20 62 61 63  6b 0d 66 72 6f 6d 20 6c  |alls back.from l|
000004c0  6f 67 69 63 20 31 20 74  6f 20 6c 6f 67 69 63 20  |ogic 1 to logic |
000004d0  30 20 61 20 6e 75 6d 62  65 72 20 77 68 69 63 68  |0 a number which|
000004e0  20 63 6f 72 72 65 73 70  6f 6e 64 73 20 77 69 74  | corresponds wit|
000004f0  68 20 74 68 65 20 6c 69  67 68 74 20 70 65 6e 0d  |h the light pen.|
00000500  70 6f 73 69 74 69 6f 6e  20 77 69 6c 6c 20 62 65  |position will be|
00000510  20 6c 61 74 63 68 65 64  20 69 6e 74 6f 20 74 68  | latched into th|
00000520  65 20 28 72 65 61 64 20  6f 6e 6c 79 29 20 72 65  |e (read only) re|
00000530  67 69 73 74 65 72 73 20  31 36 20 28 68 69 67 68  |gisters 16 (high|
00000540  20 62 79 74 65 29 20 61  6e 64 0d 31 37 20 28 6c  | byte) and.17 (l|
00000550  6f 77 20 62 79 74 65 29  20 6f 66 20 74 68 65 20  |ow byte) of the |
00000560  36 38 34 35 20 43 52 54  43 2e 20 54 68 65 73 65  |6845 CRTC. These|
00000570  20 74 77 6f 20 72 65 67  69 73 74 65 72 73 20 66  | two registers f|
00000580  6f 72 6d 20 74 68 65 20  31 34 20 6c 69 67 68 74  |orm the 14 light|
00000590  20 70 65 6e 0d 72 65 67  69 73 74 65 72 2e 20 49  | pen.register. I|
000005a0  66 20 74 68 65 20 6c 69  67 68 74 20 70 65 6e 20  |f the light pen |
000005b0  68 61 73 20 6e 6f 74 20  62 65 65 6e 20 75 73 65  |has not been use|
000005c0  64 20 74 68 65 20 6c 69  67 68 74 20 70 65 6e 20  |d the light pen |
000005d0  72 65 67 69 73 74 65 72  20 77 69 6c 6c 0d 63 6f  |register will.co|
000005e0  6e 74 61 69 6e 20 7a 65  72 6f 2e 0d 0d 49 6e 20  |ntain zero...In |
000005f0  6f 72 64 65 72 20 74 6f  20 72 65 61 64 20 74 68  |order to read th|
00000600  65 20 63 6f 6e 74 65 6e  74 73 20 6f 66 20 61 6e  |e contents of an|
00000610  79 20 43 52 54 43 20 72  65 67 69 73 74 65 72 2c  |y CRTC register,|
00000620  20 74 68 65 20 72 65 67  69 73 74 65 72 20 61 64  | the register ad|
00000630  64 72 65 73 73 0d 6d 75  73 74 20 66 69 72 73 74  |dress.must first|
00000640  20 62 65 20 77 72 69 74  74 65 6e 20 69 6e 74 6f  | be written into|
00000650  20 26 46 45 30 30 2c 20  74 68 65 20 36 38 34 35  | &FE00, the 6845|
00000660  20 61 64 64 72 65 73 73  20 72 65 67 69 73 74 65  | address registe|
00000670  72 2c 20 61 6e 64 20 74  68 65 6e 20 74 68 65 0d  |r, and then the.|
00000680  73 65 6c 65 63 74 65 64  20 72 65 67 69 73 74 65  |selected registe|
00000690  72 20 6d 61 79 20 62 65  20 72 65 61 64 20 66 72  |r may be read fr|
000006a0  6f 6d 20 26 46 45 30 31  2c 20 74 68 65 20 36 38  |om &FE01, the 68|
000006b0  34 35 20 64 61 74 61 20  72 65 67 69 73 74 65 72  |45 data register|
000006c0  2e 20 41 63 6f 72 6e 0d  68 61 76 65 20 70 72 6f  |. Acorn.have pro|
000006d0  76 69 64 65 64 20 74 77  6f 20 4f 73 62 79 74 65  |vided two Osbyte|
000006e0  20 63 61 6c 6c 73 20 77  68 69 63 68 20 73 68 6f  | calls which sho|
000006f0  75 6c 64 20 62 65 20 75  73 65 64 20 77 68 65 6e  |uld be used when|
00000700  20 77 72 69 74 69 6e 67  20 74 6f 20 6f 72 0d 72  | writing to or.r|
00000710  65 61 64 69 6e 67 20 66  72 6f 6d 20 53 68 65 69  |eading from Shei|
00000720  6c 61 20 28 69 65 2c 20  70 61 67 65 20 26 46 45  |la (ie, page &FE|
00000730  29 2e 20 54 68 65 73 65  20 63 61 6c 6c 73 20 61  |). These calls a|
00000740  72 65 20 4f 73 62 79 74  65 20 26 39 37 20 28 64  |re Osbyte &97 (d|
00000750  65 63 69 6d 61 6c 0d 31  35 31 29 20 74 6f 20 77  |ecimal.151) to w|
00000760  72 69 74 65 20 74 6f 20  53 68 65 69 6c 61 20 61  |rite to Sheila a|
00000770  6e 64 20 4f 73 62 79 74  65 20 26 39 36 20 28 64  |nd Osbyte &96 (d|
00000780  65 63 69 6d 61 6c 20 31  35 30 29 20 74 6f 20 72  |ecimal 150) to r|
00000790  65 61 64 20 66 72 6f 6d  20 53 68 65 69 6c 61 2e  |ead from Sheila.|
000007a0  0d 54 68 65 73 65 20 4f  73 62 79 74 65 20 63 61  |.These Osbyte ca|
000007b0  6c 6c 73 20 61 72 65 20  75 73 65 64 20 77 69 74  |lls are used wit|
000007c0  68 20 74 68 65 20 58 20  72 65 67 69 73 74 65 72  |h the X register|
000007d0  20 63 6f 6e 74 61 69 6e  69 6e 67 20 74 68 65 20  | containing the |
000007e0  6f 66 66 73 65 74 0d 77  69 74 68 69 6e 20 53 68  |offset.within Sh|
000007f0  65 69 6c 61 20 61 6e 64  20 74 68 65 20 59 20 72  |eila and the Y r|
00000800  65 67 69 73 74 65 72 20  63 6f 6e 74 61 69 6e 69  |egister containi|
00000810  6e 67 20 74 68 65 20 62  79 74 65 20 74 6f 20 62  |ng the byte to b|
00000820  65 20 77 72 69 74 74 65  6e 20 28 4f 73 62 79 74  |e written (Osbyt|
00000830  65 0d 26 39 37 29 2e 20  54 68 65 20 6d 61 63 68  |e.&97). The mach|
00000840  69 6e 65 20 63 6f 64 65  20 72 6f 75 74 69 6e 65  |ine code routine|
00000850  20 69 6e 20 74 68 65 20  64 65 6d 6f 6e 73 74 72  | in the demonstr|
00000860  61 74 69 6f 6e 20 70 72  6f 67 72 61 6d 20 4f 46  |ation program OF|
00000870  46 53 45 54 20 75 73 65  73 0d 74 68 65 73 65 20  |FSET uses.these |
00000880  4f 73 62 79 74 65 20 63  61 6c 6c 73 20 74 6f 20  |Osbyte calls to |
00000890  72 65 61 64 20 74 68 65  20 63 6f 6e 74 65 6e 74  |read the content|
000008a0  73 20 6f 66 20 74 68 65  20 6c 69 67 68 74 20 70  |s of the light p|
000008b0  65 6e 20 72 65 67 69 73  74 65 72 2e 20 55 73 69  |en register. Usi|
000008c0  6e 67 0d 74 68 65 20 4f  73 62 79 74 65 20 63 61  |ng.the Osbyte ca|
000008d0  6c 6c 73 20 68 65 6c 70  73 20 74 6f 20 65 6e 73  |lls helps to ens|
000008e0  75 72 65 20 74 68 61 74  20 4f 46 46 53 45 54 20  |ure that OFFSET |
000008f0  69 73 20 54 75 62 65 20  63 6f 6d 70 61 74 69 62  |is Tube compatib|
00000900  6c 65 2e 20 50 65 65 6b  69 6e 67 0d 61 6e 64 20  |le. Peeking.and |
00000910  70 6f 6b 69 6e 67 20 74  68 65 20 6d 65 6d 6f 72  |poking the memor|
00000920  79 20 6c 6f 63 61 74 69  6f 6e 73 20 64 69 72 65  |y locations dire|
00000930  63 74 6c 79 20 77 6f 75  6c 64 20 6d 61 6b 65 20  |ctly would make |
00000940  69 74 20 69 6e 63 6f 6d  70 61 74 69 62 6c 65 20  |it incompatible |
00000950  77 69 74 68 20 61 0d 73  65 63 6f 6e 64 20 70 72  |with a.second pr|
00000960  6f 63 65 73 73 6f 72 2e  0d 0d 41 66 74 65 72 20  |ocessor...After |
00000970  72 65 61 64 69 6e 67 20  74 68 65 20 63 6f 6e 74  |reading the cont|
00000980  65 6e 74 73 20 6f 66 20  74 68 65 20 6c 69 67 68  |ents of the ligh|
00000990  74 20 70 65 6e 20 72 65  67 69 73 74 65 72 20 69  |t pen register i|
000009a0  74 20 69 73 20 6e 65 63  65 73 73 61 72 79 20 74  |t is necessary t|
000009b0  6f 0d 73 75 62 74 72 61  63 74 20 61 20 63 6f 72  |o.subtract a cor|
000009c0  72 65 63 74 69 6f 6e 20  66 61 63 74 6f 72 20 66  |rection factor f|
000009d0  72 6f 6d 20 74 68 65 20  6e 75 6d 62 65 72 20 74  |rom the number t|
000009e0  6f 20 74 61 6b 65 20 61  63 63 6f 75 6e 74 20 6f  |o take account o|
000009f0  66 20 74 68 65 0d 64 69  66 66 65 72 65 6e 74 20  |f the.different |
00000a00  73 63 72 65 65 6e 20 73  74 61 72 74 20 61 64 64  |screen start add|
00000a10  72 65 73 73 65 73 20 69  6e 20 74 68 65 20 76 61  |resses in the va|
00000a20  72 69 6f 75 73 20 73 63  72 65 65 6e 20 6d 6f 64  |rious screen mod|
00000a30  65 73 2e 20 54 68 65 20  74 61 62 6c 65 20 69 6e  |es. The table in|
00000a40  0d 66 69 67 75 72 65 20  31 20 73 68 6f 77 73 20  |.figure 1 shows |
00000a50  74 68 65 73 65 20 63 6f  72 72 65 63 74 69 6f 6e  |these correction|
00000a60  20 66 61 63 74 6f 72 73  20 69 6e 20 74 68 65 20  | factors in the |
00000a70  63 6f 6c 75 6d 6e 20 68  65 61 64 65 64 20 6f 66  |column headed of|
00000a80  66 73 65 74 2e 20 54 68  65 73 65 0d 6f 66 66 73  |fset. These.offs|
00000a90  65 74 20 76 61 6c 75 65  73 20 63 61 6e 20 6f 6e  |et values can on|
00000aa0  6c 79 20 62 65 20 75 73  65 64 20 69 66 20 74 68  |ly be used if th|
00000ab0  65 20 73 63 72 65 65 6e  20 68 61 73 20 6e 6f 74  |e screen has not|
00000ac0  20 62 65 65 6e 20 73 63  72 6f 6c 6c 65 64 2e 20  | been scrolled. |
00000ad0  49 66 20 74 68 65 0d 73  63 72 65 65 6e 20 69 73  |If the.screen is|
00000ae0  20 73 63 72 6f 6c 6c 65  64 20 74 68 65 20 70 6f  | scrolled the po|
00000af0  73 69 74 69 6f 6e 20 6f  66 20 74 68 65 20 73 74  |sition of the st|
00000b00  61 72 74 20 6f 66 20 74  68 65 20 73 63 72 65 65  |art of the scree|
00000b10  6e 20 77 69 6c 6c 20 68  61 76 65 20 74 6f 20 62  |n will have to b|
00000b20  65 0d 74 61 6b 65 6e 20  69 6e 74 6f 20 61 63 63  |e.taken into acc|
00000b30  6f 75 6e 74 20 61 73 20  77 65 6c 6c 2e 20 4f 6e  |ount as well. On|
00000b40  65 20 6d 65 74 68 6f 64  20 6f 66 20 64 65 61 6c  |e method of deal|
00000b50  69 6e 67 20 77 69 74 68  20 74 68 69 73 20 70 72  |ing with this pr|
00000b60  6f 62 6c 65 6d 20 77 69  6c 6c 0d 62 65 20 63 6f  |oblem will.be co|
00000b70  76 65 72 65 64 20 69 6e  20 6d 6f 64 75 6c 65 20  |vered in module |
00000b80  33 2e 0d 0d 0d 20 20 20  20 20 20 20 20 20 20 20  |3....           |
00000b90  20 20 4d 6f 64 65 20 20  20 6f 66 66 73 65 74 20  |  Mode   offset |
00000ba0  20 20 77 69 64 74 68 20  20 20 73 63 61 6c 65 20  |  width   scale |
00000bb0  20 20 54 65 78 74 20 72  65 73 6f 6c 75 74 69 6f  |  Text resolutio|
00000bc0  6e 0d 20 20 20 20 20 20  20 20 20 20 20 20 20 2d  |n.             -|
00000bd0  2d 2d 2d 2d 2b 2d 2d 2d  2d 2d 2d 2d 2d 2b 2d 2d  |----+--------+--|
00000be0  2d 2d 2d 2d 2d 2b 2d 2d  2d 2d 2d 2d 2d 2b 2d 2d  |-----+-------+--|
00000bf0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000c00  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000c10  30 20 20 7c 20 26 30 36  30 36 20 20 7c 20 20 26  |0  | &0606  |  &|
00000c20  35 30 20 20 7c 20 20 26  30 30 20 20 7c 20 73 69  |50  |  &00  | si|
00000c30  6e 67 6c 65 20 63 68 61  72 61 63 74 65 72 20 0d  |ngle character .|
00000c40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 31  |               1|
00000c50  20 20 7c 20 26 30 36 30  36 20 20 7c 20 20 26 35  |  | &0606  |  &5|
00000c60  30 20 20 7c 20 20 26 30  31 20 20 7c 20 68 61 6c  |0  |  &01  | hal|
00000c70  66 20 63 68 61 72 61 63  74 65 72 20 20 20 0d 20  |f character   . |
00000c80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 32 20  |              2 |
00000c90  20 7c 20 26 30 36 30 36  20 20 7c 20 20 26 35 30  | | &0606  |  &50|
00000ca0  20 20 7c 20 20 26 30 32  20 20 7c 20 71 75 61 72  |  |  &02  | quar|
00000cb0  74 65 72 20 63 68 61 72  61 63 74 65 72 0d 20 20  |ter character.  |
00000cc0  20 20 20 20 20 20 20 20  20 20 20 20 20 33 20 20  |             3  |
00000cd0  7c 20 26 30 38 30 36 20  20 7c 20 20 26 35 30 20  || &0806  |  &50 |
00000ce0  20 7c 20 20 26 30 30 20  20 7c 20 73 69 6e 67 6c  | |  &00  | singl|
00000cf0  65 20 63 68 61 72 61 63  74 65 72 20 0d 20 20 20  |e character .   |
00000d00  20 20 20 20 20 20 20 20  20 20 20 20 34 20 20 7c  |            4  ||
00000d10  20 26 30 42 30 34 20 20  7c 20 20 26 32 38 20 20  | &0B04  |  &28  |
00000d20  7c 20 20 26 30 30 20 20  7c 20 73 69 6e 67 6c 65  ||  &00  | single|
00000d30  20 63 68 61 72 61 63 74  65 72 20 0d 20 20 20 20  | character .    |
00000d40  20 20 20 20 20 20 20 20  20 20 20 35 20 20 7c 20  |           5  | |
00000d50  26 30 42 30 34 20 20 7c  20 20 26 32 38 20 20 7c  |&0B04  |  &28  ||
00000d60  20 20 26 30 31 20 20 7c  20 68 61 6c 66 20 63 68  |  &01  | half ch|
00000d70  61 72 61 63 74 65 72 20  20 20 0d 20 20 20 20 20  |aracter   .     |
00000d80  20 20 20 20 20 20 20 20  20 20 36 20 20 7c 20 26  |          6  | &|
00000d90  30 43 30 34 20 20 7c 20  20 26 32 38 20 20 7c 20  |0C04  |  &28  | |
00000da0  20 26 30 30 20 20 7c 20  73 69 6e 67 6c 65 20 63  | &00  | single c|
00000db0  68 61 72 61 63 74 65 72  20 0d 20 20 20 20 20 20  |haracter .      |
00000dc0  20 20 20 20 20 20 20 20  20 37 20 20 7c 20 26 32  |         7  | &2|
00000dd0  38 30 38 20 20 7c 20 20  26 32 38 20 20 7c 20 20  |808  |  &28  |  |
00000de0  26 30 30 20 20 7c 20 73  69 6e 67 6c 65 20 63 68  |&00  | single ch|
00000df0  61 72 61 63 74 65 72 20  0d 20 20 20 20 20 20 20  |aracter .       |
00000e00  20 20 20 20 20 20 2d 2d  2d 2d 2d 2b 2d 2d 2d 2d  |      -----+----|
00000e10  2d 2d 2d 2d 2b 2d 2d 2d  2d 2d 2d 2d 2b 2d 2d 2d  |----+-------+---|
00000e20  2d 2d 2d 2d 2b 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----+-----------|
00000e30  2d 2d 2d 2d 2d 2d 2d 0d  0d 46 69 67 75 72 65 20  |-------..Figure |
00000e40  31 2e 20 54 68 65 20 76  61 6c 75 65 73 20 6f 66  |1. The values of|
00000e50  20 6f 66 66 73 65 74 2c  20 77 69 64 74 68 20 61  | offset, width a|
00000e60  6e 64 20 73 63 61 6c 65  20 66 6f 72 20 65 61 63  |nd scale for eac|
00000e70  68 20 73 63 72 65 65 6e  20 6d 6f 64 65 0d 2d 2d  |h screen mode.--|
00000e80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000ec0  2d 2d 0d 0d 0d 54 68 65  20 63 6f 6c 75 6d 6e 20  |--...The column |
00000ed0  68 65 61 64 65 64 20 77  69 64 74 68 20 69 6e 20  |headed width in |
00000ee0  66 69 67 75 72 65 20 31  20 73 68 6f 77 73 20 74  |figure 1 shows t|
00000ef0  68 65 20 6e 75 6d 62 65  72 20 6f 66 20 36 38 34  |he number of 684|
00000f00  35 20 63 68 61 72 61 63  74 65 72 73 0d 70 65 72  |5 characters.per|
00000f10  20 72 6f 77 20 69 6e 20  65 61 63 68 20 73 63 72  | row in each scr|
00000f20  65 65 6e 20 6d 6f 64 65  2e 20 54 68 69 73 20 6e  |een mode. This n|
00000f30  75 6d 62 65 72 20 69 73  20 6e 6f 74 20 6e 65 63  |umber is not nec|
00000f40  65 73 73 61 72 69 6c 79  20 74 68 65 20 73 61 6d  |essarily the sam|
00000f50  65 20 61 73 0d 74 68 65  20 6e 75 6d 62 65 72 20  |e as.the number |
00000f60  6f 66 20 64 69 73 70 6c  61 79 65 64 20 63 68 61  |of displayed cha|
00000f70  72 61 63 74 65 72 73 20  61 6e 64 20 74 68 65 20  |racters and the |
00000f80  36 38 34 35 20 27 73 65  65 73 27 20 26 35 30 20  |6845 'sees' &50 |
00000f90  28 64 65 63 69 6d 61 6c  20 38 30 29 0d 63 68 61  |(decimal 80).cha|
00000fa0  72 61 63 74 65 72 73 20  70 65 72 20 72 6f 77 20  |racters per row |
00000fb0  69 6e 20 6d 6f 64 65 73  20 30 20 74 6f 20 33 2c  |in modes 0 to 3,|
00000fc0  20 61 6e 64 20 26 32 38  20 28 64 65 63 69 6d 61  | and &28 (decima|
00000fd0  6c 20 34 30 29 20 63 68  61 72 61 63 74 65 72 73  |l 40) characters|
00000fe0  20 70 65 72 0d 72 6f 77  20 69 6e 20 6d 6f 64 65  | per.row in mode|
00000ff0  73 20 34 20 74 6f 20 37  2e 20 54 68 65 20 36 38  |s 4 to 7. The 68|
00001000  34 35 20 63 68 61 72 61  63 74 65 72 73 20 70 65  |45 characters pe|
00001010  72 20 72 6f 77 20 69 73  20 6e 6f 74 20 61 6c 77  |r row is not alw|
00001020  61 79 73 20 74 68 65 20  73 61 6d 65 20 61 73 0d  |ays the same as.|
00001030  74 68 65 20 64 69 73 70  6c 61 79 65 64 20 63 68  |the displayed ch|
00001040  61 72 61 63 74 65 72 73  20 70 65 72 20 72 6f 77  |aracters per row|
00001050  20 61 6e 64 20 66 6f 72  20 74 68 69 73 20 72 65  | and for this re|
00001060  61 73 6f 6e 20 74 68 65  20 6c 69 67 68 74 20 70  |ason the light p|
00001070  65 6e 0d 63 6f 6f 72 64  69 6e 61 74 65 73 20 6e  |en.coordinates n|
00001080  65 65 64 20 74 6f 20 62  65 20 63 61 6c 63 75 6c  |eed to be calcul|
00001090  61 74 65 64 20 69 6e 20  74 65 72 6d 73 20 6f 66  |ated in terms of|
000010a0  20 64 69 73 70 6c 61 79  65 64 20 74 65 78 74 20  | displayed text |
000010b0  63 6f 6f 72 64 69 6e 61  74 65 73 0d 72 61 74 68  |coordinates.rath|
000010c0  65 72 20 74 68 61 6e 20  36 38 34 35 20 63 6f 6f  |er than 6845 coo|
000010d0  72 64 69 6e 61 74 65 73  2e 20 54 68 65 20 6c 69  |rdinates. The li|
000010e0  67 68 74 20 70 65 6e 20  70 6f 73 69 74 69 6f 6e  |ght pen position|
000010f0  20 63 61 6e 20 62 65 20  63 61 6c 63 75 6c 61 74  | can be calculat|
00001100  65 64 20 69 6e 0d 74 65  72 6d 73 20 6f 66 20 64  |ed in.terms of d|
00001110  69 73 70 6c 61 79 65 64  20 74 65 78 74 20 63 6f  |isplayed text co|
00001120  6f 72 64 69 6e 61 74 65  73 20 75 73 69 6e 67 3a  |ordinates using:|
00001130  0d 0d 59 20 63 6f 6f 72  64 69 6e 61 74 65 20 3d  |..Y coordinate =|
00001140  20 28 6c 69 67 68 74 20  70 65 6e 20 72 65 67 69  | (light pen regi|
00001150  73 74 65 72 20 2d 20 6f  66 66 73 65 74 29 20 44  |ster - offset) D|
00001160  49 56 20 77 69 64 74 68  0d 58 20 63 6f 6f 72 64  |IV width.X coord|
00001170  69 6e 61 74 65 20 3d 20  28 28 6c 69 67 68 74 20  |inate = ((light |
00001180  70 65 6e 20 72 65 67 69  73 74 65 72 20 2d 20 6f  |pen register - o|
00001190  66 66 73 65 74 29 20 4d  4f 44 20 77 69 64 74 68  |ffset) MOD width|
000011a0  29 20 44 49 56 20 28 32  5e 73 63 61 6c 65 29 0d  |) DIV (2^scale).|
000011b0  0d 54 68 65 20 76 61 6c  75 65 73 20 6f 66 20 6f  |.The values of o|
000011c0  66 66 73 65 74 2c 20 77  69 64 74 68 20 61 6e 64  |ffset, width and|
000011d0  20 73 63 61 6c 65 20 61  72 65 20 74 68 6f 73 65  | scale are those|
000011e0  20 61 70 70 72 6f 70 72  69 61 74 65 20 74 6f 20  | appropriate to |
000011f0  74 68 65 20 73 63 72 65  65 6e 0d 6d 6f 64 65 20  |the screen.mode |
00001200  69 6e 20 75 73 65 20 61  74 20 74 68 65 20 74 69  |in use at the ti|
00001210  6d 65 2e 20 54 68 65 20  72 65 61 73 6f 6e 20 77  |me. The reason w|
00001220  68 79 20 32 5e 73 63 61  6c 65 20 28 32 20 72 61  |hy 2^scale (2 ra|
00001230  69 73 65 64 20 74 6f 20  74 68 65 20 70 6f 77 65  |ised to the powe|
00001240  72 20 6f 66 0d 73 63 61  6c 65 29 20 69 73 20 75  |r of.scale) is u|
00001250  73 65 64 20 69 6e 20 74  68 65 20 63 61 6c 63 75  |sed in the calcu|
00001260  6c 61 74 69 6f 6e 20 6f  66 20 74 68 65 20 58 20  |lation of the X |
00001270  63 6f 6f 72 64 69 6e 61  74 65 20 69 73 20 74 6f  |coordinate is to|
00001280  20 73 69 6d 70 6c 69 66  79 20 74 68 65 0d 6d 61  | simplify the.ma|
00001290  63 68 69 6e 65 20 63 6f  64 65 20 61 72 69 74 68  |chine code arith|
000012a0  6d 65 74 69 63 20 75 73  65 64 20 74 6f 20 70 72  |metic used to pr|
000012b0  6f 64 75 63 65 20 74 68  65 20 58 20 63 6f 6f 72  |oduce the X coor|
000012c0  64 69 6e 61 74 65 2e 20  54 68 65 20 6e 75 6d 62  |dinate. The numb|
000012d0  65 72 0d 61 73 73 69 67  6e 65 64 20 74 6f 20 74  |er.assigned to t|
000012e0  68 65 20 76 61 72 69 61  62 6c 65 20 73 63 61 6c  |he variable scal|
000012f0  65 20 69 6e 64 69 63 61  74 65 73 20 68 6f 77 20  |e indicates how |
00001300  6d 61 6e 79 20 74 69 6d  65 73 20 74 68 65 20 43  |many times the C|
00001310  52 54 43 20 58 0d 63 6f  6f 72 64 69 6e 61 74 65  |RTC X.coordinate|
00001320  20 68 61 73 20 74 6f 20  62 65 20 64 69 76 69 64  | has to be divid|
00001330  65 64 20 62 79 20 32 20  74 6f 20 67 69 76 65 20  |ed by 2 to give |
00001340  74 68 65 20 74 65 78 74  20 58 20 63 6f 6f 72 64  |the text X coord|
00001350  69 6e 61 74 65 2e 0d 0d  54 68 65 20 6d 61 63 68  |inate...The mach|
00001360  69 6e 65 20 63 6f 64 65  20 72 6f 75 74 69 6e 65  |ine code routine|
00001370  20 69 6e 20 74 68 65 20  70 72 6f 67 72 61 6d 20  | in the program |
00001380  4f 46 46 53 45 54 20 70  65 72 66 6f 72 6d 73 20  |OFFSET performs |
00001390  74 68 65 73 65 20 63 61  6c 63 75 6c 61 74 69 6f  |these calculatio|
000013a0  6e 73 0d 69 6e 20 61 6e  79 20 73 63 72 65 65 6e  |ns.in any screen|
000013b0  20 6d 6f 64 65 20 6c 65  61 76 69 6e 67 20 74 68  | mode leaving th|
000013c0  65 20 72 65 73 75 6c 74  73 20 69 6e 20 26 37 30  |e results in &70|
000013d0  20 28 58 20 63 6f 6f 72  64 69 6e 61 74 65 29 20  | (X coordinate) |
000013e0  61 6e 64 20 26 37 31 20  28 59 0d 63 6f 6f 72 64  |and &71 (Y.coord|
000013f0  69 6e 61 74 65 29 2e 20  41 6c 74 68 6f 75 67 68  |inate). Although|
00001400  20 7a 65 72 6f 20 70 61  67 65 20 77 69 6c 6c 20  | zero page will |
00001410  62 65 20 75 73 65 64 20  74 6f 20 73 74 6f 72 65  |be used to store|
00001420  20 74 68 65 20 72 65 73  75 6c 74 73 20 69 6e 20  | the results in |
00001430  61 6c 6c 0d 74 68 65 20  6c 69 67 68 74 20 70 65  |all.the light pe|
00001440  6e 20 6d 6f 64 75 6c 65  73 20 61 6e 79 20 33 20  |n modules any 3 |
00001450  62 79 74 65 73 20 77 6f  75 6c 64 20 64 6f 20 28  |bytes would do (|
00001460  26 37 33 20 69 73 20 75  73 65 64 20 61 73 20 77  |&73 is used as w|
00001470  6f 72 6b 73 70 61 63 65  0d 64 75 72 69 6e 67 20  |orkspace.during |
00001480  74 68 65 20 63 61 6c 63  75 6c 61 74 69 6f 6e 29  |the calculation)|
00001490  2e 20 55 73 69 6e 67 20  7a 65 72 6f 20 70 61 67  |. Using zero pag|
000014a0  65 20 68 61 73 20 74 68  65 20 61 64 76 61 6e 74  |e has the advant|
000014b0  61 67 65 20 6f 66 20 73  70 65 65 64 69 6e 67 20  |age of speeding |
000014c0  75 70 0d 74 68 65 20 63  61 6c 63 75 6c 61 74 69  |up.the calculati|
000014d0  6f 6e 2e 0d 0d 54 68 65  20 72 61 6e 67 65 20 6f  |on...The range o|
000014e0  66 20 74 68 65 20 58 20  61 6e 64 20 59 20 63 6f  |f the X and Y co|
000014f0  6f 72 64 69 6e 61 74 65  73 20 6d 61 64 65 20 61  |ordinates made a|
00001500  76 61 69 6c 61 62 6c 65  20 64 65 70 65 6e 64 73  |vailable depends|
00001510  20 6f 6e 20 74 68 65 20  73 63 72 65 65 6e 0d 6d  | on the screen.m|
00001520  6f 64 65 20 61 6e 64 20  63 6f 72 72 65 73 70 6f  |ode and correspo|
00001530  6e 64 73 20 77 69 74 68  20 74 68 65 20 76 61 6c  |nds with the val|
00001540  75 65 73 20 6f 66 20 58  20 61 6e 64 20 59 20 75  |ues of X and Y u|
00001550  73 65 64 20 62 79 20 74  68 65 20 42 41 53 49 43  |sed by the BASIC|
00001560  20 54 41 42 28 78 2c 79  29 0d 63 6f 6d 6d 61 6e  | TAB(x,y).comman|
00001570  64 2e 20 54 68 65 20 72  61 6e 67 65 20 6f 66 20  |d. The range of |
00001580  76 61 6c 75 65 73 20 61  72 65 20 73 68 6f 77 6e  |values are shown|
00001590  20 69 6e 20 66 69 67 75  72 65 20 32 2e 0d 0d 0d  | in figure 2....|
000015a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000015b0  20 20 20 20 4d 6f 64 65  20 20 20 58 20 28 3f 26  |    Mode   X (?&|
000015c0  37 30 29 20 20 20 59 20  28 3f 26 37 31 29 0d 20  |70)   Y (?&71). |
000015d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000015e0  20 20 2d 2d 2d 2d 2d 2d  2b 2d 2d 2d 2d 2d 2d 2d  |  ------+-------|
000015f0  2d 2d 2d 2b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0d 20  |---+----------. |
00001600  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001610  20 20 20 20 20 30 20 20  7c 20 20 30 20 2d 20 37  |     0  |  0 - 7|
00001620  39 20 20 7c 20 20 30 20  2d 20 33 31 0d 20 20 20  |9  |  0 - 31.   |
00001630  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001640  20 20 20 31 20 20 7c 20  20 30 20 2d 20 33 39 20  |   1  |  0 - 39 |
00001650  20 7c 20 20 30 20 2d 20  33 31 0d 20 20 20 20 20  | |  0 - 31.     |
00001660  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001670  20 32 20 20 7c 20 20 30  20 2d 20 31 39 20 20 7c  | 2  |  0 - 19  ||
00001680  20 20 30 20 2d 20 33 31  0d 20 20 20 20 20 20 20  |  0 - 31.       |
00001690  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 33  |               3|
000016a0  20 20 7c 20 20 30 20 2d  20 37 39 20 20 7c 20 20  |  |  0 - 79  |  |
000016b0  30 20 2d 20 32 34 0d 20  20 20 20 20 20 20 20 20  |0 - 24.         |
000016c0  20 20 20 20 20 20 20 20  20 20 20 20 20 34 20 20  |             4  |
000016d0  7c 20 20 30 20 2d 20 33  39 20 20 7c 20 20 30 20  ||  0 - 39  |  0 |
000016e0  2d 20 33 31 0d 20 20 20  20 20 20 20 20 20 20 20  |- 31.           |
000016f0  20 20 20 20 20 20 20 20  20 20 20 35 20 20 7c 20  |           5  | |
00001700  20 30 20 2d 20 31 39 20  20 7c 20 20 30 20 2d 20  | 0 - 19  |  0 - |
00001710  33 31 0d 20 20 20 20 20  20 20 20 20 20 20 20 20  |31.             |
00001720  20 20 20 20 20 20 20 20  20 36 20 20 7c 20 20 30  |         6  |  0|
00001730  20 2d 20 33 39 20 20 7c  20 20 30 20 2d 20 32 34  | - 39  |  0 - 24|
00001740  0d 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00001750  20 20 20 20 20 20 20 37  20 20 7c 20 20 30 20 2d  |       7  |  0 -|
00001760  20 33 39 20 20 7c 20 20  30 20 2d 20 32 34 0d 20  | 39  |  0 - 24. |
00001770  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001780  20 20 2d 2d 2d 2d 2d 2d  2b 2d 2d 2d 2d 2d 2d 2d  |  ------+-------|
00001790  2d 2d 2d 2b 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 0d 0d  |---+----------..|
000017a0  46 69 67 75 72 65 20 32  2e 20 54 68 65 20 72 61  |Figure 2. The ra|
000017b0  6e 67 65 20 6f 66 20 58  20 61 6e 64 20 59 20 63  |nge of X and Y c|
000017c0  6f 6f 72 64 69 6e 61 74  65 73 20 69 6e 20 74 68  |oordinates in th|
000017d0  65 20 76 61 72 69 6f 75  73 20 73 63 72 65 65 6e  |e various screen|
000017e0  20 6d 6f 64 65 73 0d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | modes.---------|
000017f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001820  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0d 0d 0d  |-------------...|
00001830  49 66 20 61 6c 6c 20 6c  69 67 68 74 20 70 65 6e  |If all light pen|
00001840  73 20 61 6e 64 20 61 6c  6c 20 63 6f 6d 70 75 74  |s and all comput|
00001850  65 72 73 20 77 65 72 65  20 74 68 65 20 73 61 6d  |ers were the sam|
00001860  65 20 79 6f 75 20 63 6f  75 6c 64 20 73 69 6d 70  |e you could simp|
00001870  6c 79 20 63 61 6c 6c 0d  74 68 65 20 6d 61 63 68  |ly call.the mach|
00001880  69 6e 65 20 63 6f 64 65  20 72 6f 75 74 69 6e 65  |ine code routine|
00001890  20 69 6e 20 74 68 65 20  70 72 6f 67 72 61 6d 20  | in the program |
000018a0  4f 46 46 53 45 54 20 61  6e 64 20 72 65 61 64 20  |OFFSET and read |
000018b0  74 68 65 20 58 20 61 6e  64 20 59 20 74 65 78 74  |the X and Y text|
000018c0  0d 63 6f 6f 72 64 69 6e  61 74 65 73 20 66 72 6f  |.coordinates fro|
000018d0  6d 20 26 37 30 20 61 6e  64 20 26 37 31 20 65 76  |m &70 and &71 ev|
000018e0  65 72 79 20 74 69 6d 65  20 79 6f 75 20 77 61 6e  |ery time you wan|
000018f0  74 65 64 20 74 68 65 20  6c 69 67 68 74 20 70 65  |ted the light pe|
00001900  6e 20 70 6f 73 69 74 69  6f 6e 2e 0d 55 6e 66 6f  |n position..Unfo|
00001910  72 74 75 6e 61 74 65 6c  79 20 74 68 69 6e 67 73  |rtunately things|
00001920  20 61 72 65 20 6e 6f 74  20 71 75 69 74 65 20 74  | are not quite t|
00001930  68 61 74 20 73 69 6d 70  6c 65 20 61 6e 64 20 74  |hat simple and t|
00001940  68 65 72 65 20 61 72 65  20 70 72 6f 62 6c 65 6d  |here are problem|
00001950  73 0d 62 65 63 61 75 73  65 20 64 69 66 66 65 72  |s.because differ|
00001960  65 6e 74 20 70 65 6e 73  20 70 72 6f 64 75 63 65  |ent pens produce|
00001970  20 56 53 50 73 20 77 69  74 68 20 73 6c 69 67 68  | VSPs with sligh|
00001980  74 6c 79 20 64 69 66 66  65 72 65 6e 74 20 74 69  |tly different ti|
00001990  6d 69 6e 67 20 61 6e 64  0d 74 68 65 72 65 20 61  |ming and.there a|
000019a0  6c 73 6f 20 73 65 65 6d  73 20 74 6f 20 62 65 20  |lso seems to be |
000019b0  61 20 70 72 6f 62 6c 65  6d 20 77 69 74 68 20 4f  |a problem with O|
000019c0  73 62 79 74 65 73 20 26  39 36 20 61 6e 64 20 26  |sbytes &96 and &|
000019d0  39 37 20 77 69 74 68 20  74 68 65 20 42 42 43 20  |97 with the BBC |
000019e0  42 0d 4f 53 20 31 2e 32  30 2e 0d 0d 54 68 65 20  |B.OS 1.20...The |
000019f0  62 65 73 74 20 77 61 79  20 6f 66 20 69 6c 6c 75  |best way of illu|
00001a00  73 74 72 61 74 69 6e 67  20 73 6f 6d 65 20 6f 66  |strating some of|
00001a10  20 74 68 65 20 70 72 6f  62 6c 65 6d 73 20 77 69  | the problems wi|
00001a20  74 68 20 6c 69 67 68 74  20 70 65 6e 73 20 69 73  |th light pens is|
00001a30  20 74 6f 0d 70 6c 75 67  20 79 6f 75 72 20 6c 69  | to.plug your li|
00001a40  67 68 74 20 70 65 6e 20  69 6e 74 6f 20 74 68 65  |ght pen into the|
00001a50  20 61 6e 61 6c 6f 67 75  65 20 70 6f 72 74 2c 20  | analogue port, |
00001a60  73 77 69 74 63 68 20 6f  6e 20 74 68 65 20 63 6f  |switch on the co|
00001a70  6d 70 75 74 65 72 20 61  6e 64 0d 63 68 61 69 6e  |mputer and.chain|
00001a80  20 74 68 65 20 70 72 6f  67 72 61 6d 20 4f 46 46  | the program OFF|
00001a90  53 45 54 2e 20 54 68 69  73 20 70 72 6f 67 72 61  |SET. This progra|
00001aa0  6d 20 75 73 65 73 20 74  68 65 20 75 70 20 61 6e  |m uses the up an|
00001ab0  64 20 64 6f 77 6e 20 63  75 72 73 6f 72 20 6b 65  |d down cursor ke|
00001ac0  79 73 20 74 6f 0d 63 68  61 6e 67 65 20 74 68 65  |ys to.change the|
00001ad0  20 73 63 72 65 65 6e 20  6d 6f 64 65 73 20 61 6e  | screen modes an|
00001ae0  64 20 74 68 65 20 6c 65  66 74 20 61 6e 64 20 72  |d the left and r|
00001af0  69 67 68 74 20 63 75 72  73 6f 72 20 6b 65 79 73  |ight cursor keys|
00001b00  20 74 6f 20 61 64 6a 75  73 74 20 74 68 65 0d 6c  | to adjust the.l|
00001b10  65 61 73 74 20 73 69 67  6e 69 66 69 63 61 6e 74  |east significant|
00001b20  20 62 79 74 65 20 6f 66  20 74 68 65 20 6f 66 66  | byte of the off|
00001b30  73 65 74 2e 0d 0d 49 66  20 79 6f 75 20 6d 6f 76  |set...If you mov|
00001b40  65 20 74 68 65 20 6c 69  67 68 74 20 70 65 6e 20  |e the light pen |
00001b50  61 72 6f 75 6e 64 20 74  68 65 20 73 63 72 65 65  |around the scree|
00001b60  6e 20 74 68 65 20 70 72  6f 67 72 61 6d 20 77 69  |n the program wi|
00001b70  6c 6c 20 64 69 73 70 6c  61 79 20 61 6e 0d 61 73  |ll display an.as|
00001b80  74 65 72 69 73 6b 20 77  68 69 63 68 20 66 6f 6c  |terisk which fol|
00001b90  6c 6f 77 73 20 74 68 65  20 70 65 6e 2e 20 59 6f  |lows the pen. Yo|
00001ba0  75 20 77 69 6c 6c 20 70  72 6f 62 61 62 6c 79 20  |u will probably |
00001bb0  66 69 6e 64 20 74 68 61  74 20 74 68 65 20 61 73  |find that the as|
00001bc0  74 65 72 69 73 6b 0d 65  69 74 68 65 72 20 6c 65  |terisk.either le|
00001bd0  61 64 73 20 6f 72 2c 20  6d 6f 72 65 20 6c 69 6b  |ads or, more lik|
00001be0  65 6c 79 2c 20 6c 61 67  73 20 62 65 68 69 6e 64  |ely, lags behind|
00001bf0  20 74 68 65 20 70 65 6e  2e 20 54 68 69 73 20 63  | the pen. This c|
00001c00  61 6e 20 62 65 20 61 64  6a 75 73 74 65 64 0d 77  |an be adjusted.w|
00001c10  69 74 68 20 74 68 65 20  6c 65 66 74 20 61 6e 64  |ith the left and|
00001c20  20 72 69 67 68 74 20 63  75 72 73 6f 72 20 6b 65  | right cursor ke|
00001c30  79 73 2e 20 54 68 65 20  6c 65 66 74 20 63 75 72  |ys. The left cur|
00001c40  73 6f 72 20 6b 65 79 20  77 69 6c 6c 20 6d 6f 76  |sor key will mov|
00001c50  65 20 74 68 65 0d 61 73  74 65 72 69 73 6b 20 74  |e the.asterisk t|
00001c60  6f 20 74 68 65 20 6c 65  66 74 20 61 6e 64 20 74  |o the left and t|
00001c70  68 65 20 72 69 67 68 74  20 63 75 72 73 6f 72 20  |he right cursor |
00001c80  6b 65 79 20 77 69 6c 6c  20 6d 6f 76 65 20 69 74  |key will move it|
00001c90  20 74 6f 20 74 68 65 20  72 69 67 68 74 2e 0d 50  | to the right..P|
00001ca0  72 65 73 73 69 6e 67 20  74 68 65 20 6c 65 66 74  |ressing the left|
00001cb0  20 63 75 72 73 6f 72 20  6b 65 79 20 61 64 64 73  | cursor key adds|
00001cc0  20 31 20 74 6f 20 74 68  65 20 6c 65 61 73 74 20  | 1 to the least |
00001cd0  73 69 67 6e 69 66 69 63  61 6e 74 20 62 79 74 65  |significant byte|
00001ce0  20 6f 66 20 74 68 65 0d  6f 66 66 73 65 74 20 61  | of the.offset a|
00001cf0  6e 64 20 70 72 65 73 73  69 6e 67 20 74 68 65 20  |nd pressing the |
00001d00  72 69 67 68 74 20 63 75  72 73 6f 72 20 6b 65 79  |right cursor key|
00001d10  20 73 75 62 74 72 61 63  74 73 20 31 2e 20 54 68  | subtracts 1. Th|
00001d20  69 73 20 69 73 20 6b 6e  6f 77 6e 20 69 6e 0d 6c  |is is known in.l|
00001d30  69 67 68 74 20 70 65 6e  20 6a 61 72 67 6f 6e 20  |ight pen jargon |
00001d40  61 73 20 74 72 69 6d 6d  69 6e 67 20 74 68 65 20  |as trimming the |
00001d50  6f 66 66 73 65 74 2e 20  54 68 65 20 63 75 72 72  |offset. The curr|
00001d60  65 6e 74 20 76 61 6c 75  65 20 6f 66 20 74 68 65  |ent value of the|
00001d70  20 6c 65 61 73 74 0d 73  69 67 6e 69 66 69 63 61  | least.significa|
00001d80  6e 74 20 62 79 74 65 20  69 73 20 64 69 73 70 6c  |nt byte is displ|
00001d90  61 79 65 64 20 62 79 20  74 68 65 20 70 72 6f 67  |ayed by the prog|
00001da0  72 61 6d 20 61 6e 64 20  79 6f 75 20 73 68 6f 75  |ram and you shou|
00001db0  6c 64 20 75 73 65 20 74  68 65 0d 70 72 6f 67 72  |ld use the.progr|
00001dc0  61 6d 20 74 6f 20 74 72  69 6d 20 74 68 65 20 6f  |am to trim the o|
00001dd0  66 66 73 65 74 20 69 6e  20 61 6c 6c 20 74 68 65  |ffset in all the|
00001de0  20 73 63 72 65 65 6e 20  6d 6f 64 65 73 2e 20 49  | screen modes. I|
00001df0  20 68 61 76 65 20 66 6f  75 6e 64 20 74 68 61 74  | have found that|
00001e00  20 74 68 65 0d 76 61 6c  75 65 20 6f 66 20 74 68  | the.value of th|
00001e10  65 20 6c 65 61 73 74 20  73 69 67 6e 69 66 69 63  |e least signific|
00001e20  61 6e 74 20 62 79 74 65  20 6f 66 20 74 68 65 20  |ant byte of the |
00001e30  6f 66 66 73 65 74 20 69  73 20 75 73 75 61 6c 6c  |offset is usuall|
00001e40  79 20 31 20 6f 72 20 32  20 6c 65 73 73 0d 74 68  |y 1 or 2 less.th|
00001e50  61 6e 20 74 68 65 20 74  68 65 6f 72 65 74 69 63  |an the theoretic|
00001e60  61 6c 20 76 61 6c 75 65  2e 20 59 6f 75 20 6d 61  |al value. You ma|
00001e70  79 20 77 65 6c 6c 20 66  69 6e 64 20 74 68 61 74  |y well find that|
00001e80  20 64 69 66 66 65 72 65  6e 74 20 76 61 6c 75 65  | different value|
00001e90  73 20 61 72 65 0d 6e 65  65 64 65 64 20 77 69 74  |s are.needed wit|
00001ea0  68 20 79 6f 75 72 20 6c  69 67 68 74 20 70 65 6e  |h your light pen|
00001eb0  2e 20 4d 61 6b 65 20 61  20 6e 6f 74 65 20 6f 66  |. Make a note of|
00001ec0  20 74 68 65 20 76 61 6c  75 65 73 20 79 6f 75 72  | the values your|
00001ed0  20 70 65 6e 20 75 73 65  73 0d 62 65 63 61 75 73  | pen uses.becaus|
00001ee0  65 20 79 6f 75 20 77 69  6c 6c 20 6e 65 65 64 20  |e you will need |
00001ef0  74 6f 20 74 72 69 6d 20  74 68 65 20 6f 66 66 73  |to trim the offs|
00001f00  65 74 20 69 6e 20 61 6c  6c 20 74 68 65 20 70 72  |et in all the pr|
00001f10  6f 67 72 61 6d 73 20 75  73 65 64 20 74 6f 0d 69  |ograms used to.i|
00001f20  6c 6c 75 73 74 72 61 74  65 20 74 68 65 20 6c 69  |llustrate the li|
00001f30  67 68 74 20 70 65 6e 20  6d 6f 64 75 6c 65 73 2e  |ght pen modules.|
00001f40  20 59 6f 75 20 63 61 6e  20 70 65 72 6d 61 6e 65  | You can permane|
00001f50  6e 74 6c 79 20 61 6c 74  65 72 20 74 68 65 20 6c  |ntly alter the l|
00001f60  65 61 73 74 0d 73 69 67  6e 69 66 69 63 61 6e 74  |east.significant|
00001f70  20 62 79 74 65 20 6f 66  20 74 68 65 20 6f 66 66  | byte of the off|
00001f80  73 65 74 73 20 62 79 20  65 64 69 74 69 6e 67 20  |sets by editing |
00001f90  6c 69 6e 65 73 20 31 33  34 30 20 74 6f 20 31 34  |lines 1340 to 14|
00001fa0  31 30 20 6f 66 20 4f 46  46 53 45 54 2e 0d 0d 54  |10 of OFFSET...T|
00001fb0  68 65 20 70 72 6f 62 6c  65 6d 20 77 69 74 68 20  |he problem with |
00001fc0  4f 73 62 79 74 65 73 20  26 39 36 20 61 6e 64 20  |Osbytes &96 and |
00001fd0  26 39 37 20 69 73 20 6f  6e 65 20 49 20 68 61 76  |&97 is one I hav|
00001fe0  65 20 6f 6e 6c 79 20 66  6f 75 6e 64 20 77 68 65  |e only found whe|
00001ff0  6e 20 75 73 69 6e 67 20  61 0d 6c 69 67 68 74 20  |n using a.light |
00002000  70 65 6e 20 77 69 74 68  20 4f 53 20 31 2e 32 30  |pen with OS 1.20|
00002010  2e 20 49 66 20 79 6f 75  20 72 75 6e 20 74 68 65  |. If you run the|
00002020  20 70 72 6f 67 72 61 6d  20 6f 6e 20 61 20 42 42  | program on a BB|
00002030  43 20 42 20 77 69 74 68  20 4f 53 20 31 2e 32 30  |C B with OS 1.20|
00002040  20 79 6f 75 0d 63 6f 75  6c 64 20 66 69 6e 64 20  | you.could find |
00002050  74 68 61 74 2c 20 65 76  65 72 79 20 6e 6f 77 20  |that, every now |
00002060  61 6e 64 20 74 68 65 6e  2c 20 61 6e 20 61 73 74  |and then, an ast|
00002070  65 72 69 73 6b 20 69 73  20 64 69 73 70 6c 61 79  |erisk is display|
00002080  65 64 20 69 6e 20 61 20  72 61 6e 64 6f 6d 0d 70  |ed in a random.p|
00002090  6f 73 69 74 69 6f 6e 20  6f 6e 20 74 68 65 20 73  |osition on the s|
000020a0  63 72 65 65 6e 2e 20 54  68 69 73 20 6f 6e 6c 79  |creen. This only|
000020b0  20 68 61 70 70 65 6e 73  20 6f 63 63 61 73 69 6f  | happens occasio|
000020c0  6e 61 6c 6c 79 20 62 75  74 20 69 74 20 63 61 6e  |nally but it can|
000020d0  20 62 65 0d 63 6f 6d 70  6c 65 74 65 6c 79 20 63  | be.completely c|
000020e0  75 72 65 64 20 62 79 20  6e 6f 74 20 75 73 69 6e  |ured by not usin|
000020f0  67 20 74 68 65 20 4f 73  62 79 74 65 20 63 61 6c  |g the Osbyte cal|
00002100  6c 73 2e 20 49 66 20 79  6f 75 20 68 61 76 65 20  |ls. If you have |
00002110  74 68 69 73 20 70 72 6f  62 6c 65 6d 0d 74 68 65  |this problem.the|
00002120  6e 20 69 6e 63 6c 75 64  65 20 6c 69 6e 65 73 20  |n include lines |
00002130  31 32 32 30 20 74 6f 20  31 32 34 30 20 77 68 69  |1220 to 1240 whi|
00002140  63 68 20 68 61 76 65 20  62 65 65 6e 20 63 6f 6d  |ch have been com|
00002150  6d 65 6e 74 65 64 20 6f  75 74 20 69 6e 20 4f 46  |mented out in OF|
00002160  46 53 45 54 2e 0d 4c 69  6e 65 73 20 31 32 32 30  |FSET..Lines 1220|
00002170  20 74 6f 20 31 32 34 30  20 70 6f 6b 65 20 61 6e  | to 1240 poke an|
00002180  64 20 70 65 65 6b 20 74  68 65 20 61 64 64 72 65  |d peek the addre|
00002190  73 73 20 61 6e 64 20 64  61 74 61 20 72 65 67 69  |ss and data regi|
000021a0  73 74 65 72 73 20 64 69  72 65 63 74 6c 79 0d 61  |sters directly.a|
000021b0  6e 64 20 64 6f 69 6e 67  20 74 68 69 73 20 63 75  |nd doing this cu|
000021c0  72 65 73 20 74 68 65 20  70 72 6f 62 6c 65 6d 20  |res the problem |
000021d0  62 75 74 20 6d 61 6b 65  73 20 74 68 65 20 70 72  |but makes the pr|
000021e0  6f 67 72 61 6d 20 69 6e  63 6f 6d 70 61 74 69 62  |ogram incompatib|
000021f0  6c 65 20 77 69 74 68 0d  74 68 65 20 54 75 62 65  |le with.the Tube|
00002200  2e 20 41 20 54 75 62 65  20 63 6f 6d 70 61 74 69  |. A Tube compati|
00002210  62 6c 65 20 70 72 6f 67  72 61 6d 20 77 68 69 63  |ble program whic|
00002220  68 20 61 63 63 65 73 73  65 73 20 74 68 65 20 72  |h accesses the r|
00002230  65 67 69 73 74 65 72 73  20 64 69 72 65 63 74 6c  |egisters directl|
00002240  79 0d 77 69 6c 6c 20 62  65 20 75 73 65 64 20 69  |y.will be used i|
00002250  6e 20 6d 6f 64 75 6c 65  20 33 2e 0d 0d 41 6e 6f  |n module 3...Ano|
00002260  74 68 65 72 20 70 72 6f  62 6c 65 6d 20 63 61 6e  |ther problem can|
00002270  20 62 65 20 69 6c 6c 75  73 74 72 61 74 65 64 20  | be illustrated |
00002280  77 69 74 68 20 4f 46 46  53 45 54 2e 20 49 66 20  |with OFFSET. If |
00002290  79 6f 75 20 68 6f 6c 64  20 74 68 65 20 6c 69 67  |you hold the lig|
000022a0  68 74 20 70 65 6e 0d 61  74 20 74 68 65 20 65 78  |ht pen.at the ex|
000022b0  74 72 65 6d 65 20 6c 65  66 74 20 6f 72 20 72 69  |treme left or ri|
000022c0  67 68 74 20 65 64 67 65  20 6f 66 20 74 68 65 20  |ght edge of the |
000022d0  73 63 72 65 65 6e 20 79  6f 75 20 63 6f 75 6c 64  |screen you could|
000022e0  20 66 69 6e 64 20 74 68  61 74 20 74 68 65 0d 61  | find that the.a|
000022f0  73 74 65 72 69 73 6b 20  69 73 20 64 69 73 70 6c  |sterisk is displ|
00002300  61 79 65 64 20 6f 6e 20  74 68 65 20 6f 70 70 6f  |ayed on the oppo|
00002310  73 69 74 65 20 65 64 67  65 2e 20 54 68 69 73 20  |site edge. This |
00002320  70 72 6f 62 6c 65 6d 20  63 61 6e 20 62 65 20 6d  |problem can be m|
00002330  69 6e 69 6d 69 73 65 64  0d 62 79 20 63 61 72 65  |inimised.by care|
00002340  66 75 6c 20 74 72 69 6d  6d 69 6e 67 20 61 6e 64  |ful trimming and|
00002350  20 75 73 69 6e 67 20 61  20 6c 69 67 68 74 20 73  | using a light s|
00002360  68 61 64 65 20 6f 6e 20  74 68 65 20 70 65 6e 20  |hade on the pen |
00002370  62 75 74 20 69 74 20 63  61 6e 6e 6f 74 0d 61 6c  |but it cannot.al|
00002380  77 61 79 73 20 62 65 20  63 6f 6d 70 6c 65 74 65  |ways be complete|
00002390  6c 79 20 65 6c 69 6d 69  6e 61 74 65 64 2e 20 54  |ly eliminated. T|
000023a0  68 69 73 20 73 68 6f 75  6c 64 20 6e 6f 74 20 62  |his should not b|
000023b0  65 20 74 6f 6f 20 6d 75  63 68 20 6f 66 20 61 20  |e too much of a |
000023c0  70 72 6f 62 6c 65 6d 0d  77 68 65 6e 20 75 73 69  |problem.when usi|
000023d0  6e 67 20 74 68 65 20 6c  69 67 68 74 20 70 65 6e  |ng the light pen|
000023e0  20 74 6f 20 72 65 61 64  20 74 65 78 74 20 63 6f  | to read text co|
000023f0  6f 72 64 69 6e 61 74 65  73 20 62 65 63 61 75 73  |ordinates becaus|
00002400  65 2c 20 69 6e 20 70 72  61 63 74 69 63 65 2c 0d  |e, in practice,.|
00002410  79 6f 75 20 77 69 6c 6c  20 72 61 72 65 6c 79 20  |you will rarely |
00002420  6e 65 65 64 20 74 6f 20  61 63 63 65 73 73 20 74  |need to access t|
00002430  68 65 73 65 20 70 61 72  74 73 20 6f 66 20 74 68  |hese parts of th|
00002440  65 20 73 63 72 65 65 6e  2e 20 49 74 20 63 61 6e  |e screen. It can|
00002450  2c 20 68 6f 77 65 76 65  72 2c 0d 63 61 75 73 65  |, however,.cause|
00002460  20 61 20 74 65 72 72 69  62 6c 65 20 6d 65 73 73  | a terrible mess|
00002470  20 69 66 20 79 6f 75 20  75 73 65 20 74 68 65 20  | if you use the |
00002480  6c 69 67 68 74 20 70 65  6e 20 74 6f 20 64 72 61  |light pen to dra|
00002490  77 20 6f 6e 20 61 20 67  72 61 70 68 69 63 73 0d  |w on a graphics.|
000024a0  73 63 72 65 65 6e 20 61  6e 64 20 77 65 20 77 69  |screen and we wi|
000024b0  6c 6c 20 62 65 20 63 6f  6d 69 6e 67 20 62 61 63  |ll be coming bac|
000024c0  6b 20 74 6f 20 6c 6f 6f  6b 20 61 74 20 74 68 69  |k to look at thi|
000024d0  73 20 70 72 6f 62 6c 65  6d 20 69 6e 20 6d 6f 64  |s problem in mod|
000024e0  75 6c 65 20 34 20 77 68  65 6e 0d 64 72 61 77 69  |ule 4 when.drawi|
000024f0  6e 67 20 77 69 74 68 20  61 20 6c 69 67 68 74 20  |ng with a light |
00002500  70 65 6e 20 69 73 20 63  6f 76 65 72 65 64 2e 0d  |pen is covered..|
00002510  0d 4f 6e 65 20 6c 61 73  74 20 70 72 6f 62 6c 65  |.One last proble|
00002520  6d 20 77 69 74 68 20 6c  69 67 68 74 20 70 65 6e  |m with light pen|
00002530  73 20 63 61 6e 20 62 65  20 64 65 6d 6f 6e 73 74  |s can be demonst|
00002540  72 61 74 65 64 20 69 66  20 79 6f 75 20 70 6f 73  |rated if you pos|
00002550  69 74 69 6f 6e 20 74 68  65 0d 6c 69 67 68 74 20  |ition the.light |
00002560  70 65 6e 20 69 6e 20 74  68 65 20 6c 6f 77 65 72  |pen in the lower|
00002570  20 72 69 67 68 74 20 68  61 6e 64 20 63 6f 72 6e  | right hand corn|
00002580  65 72 20 6f 66 20 74 68  65 20 73 63 72 65 65 6e  |er of the screen|
00002590  2e 20 54 68 65 20 70 72  6f 67 72 61 6d 20 77 69  |. The program wi|
000025a0  6c 6c 0d 70 72 69 6e 74  20 61 6e 20 61 73 74 65  |ll.print an aste|
000025b0  72 69 73 6b 20 61 6e 64  20 73 63 72 6f 6c 6c 20  |risk and scroll |
000025c0  74 68 65 20 73 63 72 65  65 6e 2e 20 59 6f 75 20  |the screen. You |
000025d0  73 68 6f 75 6c 64 20 74  72 79 20 74 6f 20 73 63  |should try to sc|
000025e0  72 6f 6c 6c 20 74 68 65  0d 73 63 72 65 65 6e 20  |roll the.screen |
000025f0  69 6e 20 74 68 69 73 20  6d 61 6e 6e 65 72 20 74  |in this manner t|
00002600  6f 20 64 69 73 63 6f 76  65 72 20 74 68 65 20 65  |o discover the e|
00002610  66 66 65 63 74 20 69 74  20 68 61 73 20 6f 6e 20  |ffect it has on |
00002620  74 68 65 20 6c 69 67 68  74 20 70 65 6e 20 74 65  |the light pen te|
00002630  78 74 0d 63 6f 6f 72 64  69 6e 61 74 65 73 2e 20  |xt.coordinates. |
00002640  54 68 65 20 73 6f 6c 75  74 69 6f 6e 20 74 6f 20  |The solution to |
00002650  74 68 65 20 65 72 72 6f  72 20 70 72 6f 64 75 63  |the error produc|
00002660  65 64 20 62 79 20 73 63  72 65 65 6e 20 73 63 72  |ed by screen scr|
00002670  6f 6c 6c 69 6e 67 20 77  69 6c 6c 0d 62 65 20 63  |olling will.be c|
00002680  6f 76 65 72 65 64 20 69  6e 20 6d 6f 64 75 6c 65  |overed in module|
00002690  20 33 2e 0d 0d 0d 20 20  20 31 30 20 52 45 4d 3e  | 3....   10 REM>|
000026a0  20 4f 46 46 53 45 54 0d  20 20 20 32 30 20 44 49  | OFFSET.   20 DI|
000026b0  4d 20 6d 63 6f 64 65 20  26 31 30 30 0d 20 20 20  |M mcode &100.   |
000026c0  33 30 20 50 52 4f 43 6d  63 6f 64 65 0d 20 20 20  |30 PROCmcode.   |
000026d0  34 30 20 6d 6f 64 65 3d  30 0d 20 20 20 35 30 20  |40 mode=0.   50 |
000026e0  4d 4f 44 45 20 6d 6f 64  65 0d 20 20 20 36 30 20  |MODE mode.   60 |
000026f0  50 52 4f 43 6e 65 77 6d  6f 64 65 0d 20 20 20 37  |PROCnewmode.   7|
00002700  30 20 52 45 50 45 41 54  0d 20 20 20 38 30 20 49  |0 REPEAT.   80 I|
00002710  46 20 49 4e 4b 45 59 28  2d 35 38 29 20 50 52 4f  |F INKEY(-58) PRO|
00002720  43 75 70 3a 4d 4f 44 45  20 6d 6f 64 65 3a 50 52  |Cup:MODE mode:PR|
00002730  4f 43 6e 65 77 6d 6f 64  65 0d 20 20 20 39 30 20  |OCnewmode.   90 |
00002740  49 46 20 49 4e 4b 45 59  28 2d 34 32 29 20 50 52  |IF INKEY(-42) PR|
00002750  4f 43 64 6f 77 6e 3a 4d  4f 44 45 20 6d 6f 64 65  |OCdown:MODE mode|
00002760  3a 50 52 4f 43 6e 65 77  6d 6f 64 65 0d 20 20 31  |:PROCnewmode.  1|
00002770  30 30 20 49 46 20 49 4e  4b 45 59 28 2d 32 36 29  |00 IF INKEY(-26)|
00002780  20 50 52 4f 43 6c 65 66  74 0d 20 20 31 31 30 20  | PROCleft.  110 |
00002790  49 46 20 49 4e 4b 45 59  28 2d 31 32 32 29 20 50  |IF INKEY(-122) P|
000027a0  52 4f 43 72 69 67 68 74  0d 20 20 31 32 30 20 43  |ROCright.  120 C|
000027b0  41 4c 4c 20 6d 63 6f 64  65 0d 20 20 31 33 30 20  |ALL mcode.  130 |
000027c0  49 46 20 28 3f 78 63 6f  6f 72 64 3c 3e 6f 6c 64  |IF (?xcoord<>old|
000027d0  78 29 20 4f 52 20 28 3f  79 63 6f 6f 72 64 3c 3e  |x) OR (?ycoord<>|
000027e0  6f 6c 64 79 29 0d 20 20  20 20 20 20 56 44 55 33  |oldy).      VDU3|
000027f0  31 2c 6f 6c 64 78 2c 6f  6c 64 79 2c 33 32 2c 33  |1,oldx,oldy,32,3|
00002800  31 2c 3f 78 63 6f 6f 72  64 2c 3f 79 63 6f 6f 72  |1,?xcoord,?ycoor|
00002810  64 2c 34 32 0d 20 20 31  34 30 20 6f 6c 64 78 3d  |d,42.  140 oldx=|
00002820  3f 78 63 6f 6f 72 64 0d  20 20 31 35 30 20 6f 6c  |?xcoord.  150 ol|
00002830  64 79 3d 3f 79 63 6f 6f  72 64 0d 20 20 31 36 30  |dy=?ycoord.  160|
00002840  20 55 4e 54 49 4c 20 46  41 4c 53 45 0d 20 20 31  | UNTIL FALSE.  1|
00002850  37 30 20 3a 0d 20 20 31  38 30 20 44 45 46 50 52  |70 :.  180 DEFPR|
00002860  4f 43 6c 65 66 74 0d 20  20 31 39 30 20 49 46 20  |OCleft.  190 IF |
00002870  6f 66 66 73 65 74 6c 6f  77 3f 6d 6f 64 65 3d 31  |offsetlow?mode=1|
00002880  32 20 45 4e 44 50 52 4f  43 0d 20 20 32 30 30 20  |2 ENDPROC.  200 |
00002890  6f 66 66 73 65 74 6c 6f  77 3f 6d 6f 64 65 3d 6f  |offsetlow?mode=o|
000028a0  66 66 73 65 74 6c 6f 77  3f 6d 6f 64 65 2b 31 0d  |ffsetlow?mode+1.|
000028b0  20 20 32 31 30 20 50 52  49 4e 54 54 41 42 28 31  |  210 PRINTTAB(1|
000028c0  35 2c 32 29 3b 6f 66 66  73 65 74 6c 6f 77 3f 6d  |5,2);offsetlow?m|
000028d0  6f 64 65 3b 22 20 22 3b  0d 20 20 32 32 30 20 50  |ode;" ";.  220 P|
000028e0  52 4f 43 64 65 6c 61 79  0d 20 20 32 33 30 20 45  |ROCdelay.  230 E|
000028f0  4e 44 50 52 4f 43 0d 20  20 32 34 30 20 3a 0d 20  |NDPROC.  240 :. |
00002900  20 32 35 30 20 44 45 46  50 52 4f 43 72 69 67 68  | 250 DEFPROCrigh|
00002910  74 0d 20 20 32 36 30 20  49 46 20 6f 66 66 73 65  |t.  260 IF offse|
00002920  74 6c 6f 77 3f 6d 6f 64  65 3d 30 20 45 4e 44 50  |tlow?mode=0 ENDP|
00002930  52 4f 43 0d 20 20 32 37  30 20 6f 66 66 73 65 74  |ROC.  270 offset|
00002940  6c 6f 77 3f 6d 6f 64 65  3d 6f 66 66 73 65 74 6c  |low?mode=offsetl|
00002950  6f 77 3f 6d 6f 64 65 2d  31 0d 20 20 32 38 30 20  |ow?mode-1.  280 |
00002960  50 52 49 4e 54 54 41 42  28 31 35 2c 32 29 3b 6f  |PRINTTAB(15,2);o|
00002970  66 66 73 65 74 6c 6f 77  3f 6d 6f 64 65 3b 22 20  |ffsetlow?mode;" |
00002980  22 3b 0d 20 20 32 39 30  20 50 52 4f 43 64 65 6c  |";.  290 PROCdel|
00002990  61 79 0d 20 20 33 30 30  20 45 4e 44 50 52 4f 43  |ay.  300 ENDPROC|
000029a0  0d 20 20 33 31 30 20 3a  0d 20 20 33 32 30 20 44  |.  310 :.  320 D|
000029b0  45 46 50 52 4f 43 75 70  0d 20 20 33 33 30 20 6d  |EFPROCup.  330 m|
000029c0  6f 64 65 3d 6d 6f 64 65  2b 31 0d 20 20 33 34 30  |ode=mode+1.  340|
000029d0  20 49 46 20 6d 6f 64 65  3e 37 20 6d 6f 64 65 3d  | IF mode>7 mode=|
000029e0  37 0d 20 20 33 35 30 20  45 4e 44 50 52 4f 43 0d  |7.  350 ENDPROC.|
000029f0  20 20 33 36 30 20 3a 0d  20 20 33 37 30 20 44 45  |  360 :.  370 DE|
00002a00  46 50 52 4f 43 64 6f 77  6e 0d 20 20 33 38 30 20  |FPROCdown.  380 |
00002a10  6d 6f 64 65 3d 6d 6f 64  65 2d 31 0d 20 20 33 39  |mode=mode-1.  39|
00002a20  30 20 49 46 20 6d 6f 64  65 3c 30 20 6d 6f 64 65  |0 IF mode<0 mode|
00002a30  3d 30 0d 20 20 34 30 30  20 45 4e 44 50 52 4f 43  |=0.  400 ENDPROC|
00002a40  0d 20 20 34 31 30 20 3a  0d 20 20 34 32 30 20 44  |.  410 :.  420 D|
00002a50  45 46 50 52 4f 43 6e 65  77 6d 6f 64 65 0d 20 20  |EFPROCnewmode.  |
00002a60  34 33 30 20 56 44 55 32  33 2c 31 2c 30 3b 30 3b  |430 VDU23,1,0;0;|
00002a70  30 3b 30 3b 0d 20 20 34  34 30 20 56 44 55 31 39  |0;0;.  440 VDU19|
00002a80  2c 30 2c 36 3b 30 3b 0d  20 20 34 35 30 20 56 44  |,0,6;0;.  450 VD|
00002a90  55 31 39 2c 31 2c 34 3b  30 3b 0d 20 20 34 36 30  |U19,1,4;0;.  460|
00002aa0  20 43 4f 4c 4f 55 52 31  0d 20 20 34 37 30 20 50  | COLOUR1.  470 P|
00002ab0  52 49 4e 54 54 41 42 28  33 2c 31 29 22 4d 6f 64  |RINTTAB(3,1)"Mod|
00002ac0  65 20 22 3b 6d 6f 64 65  0d 20 20 34 38 30 20 50  |e ";mode.  480 P|
00002ad0  52 49 4e 54 54 41 42 28  33 2c 32 29 22 6f 66 66  |RINTTAB(3,2)"off|
00002ae0  73 65 74 6c 6f 77 20 3d  20 22 3b 6f 66 66 73 65  |setlow = ";offse|
00002af0  74 6c 6f 77 3f 6d 6f 64  65 0d 20 20 34 39 30 20  |tlow?mode.  490 |
00002b00  49 46 20 6d 6f 64 65 3d  37 20 50 52 4f 43 73 65  |IF mode=7 PROCse|
00002b10  76 65 6e 0d 20 20 35 30  30 20 43 41 4c 4c 20 6d  |ven.  500 CALL m|
00002b20  63 6f 64 65 0d 20 20 35  31 30 20 6f 6c 64 78 3d  |code.  510 oldx=|
00002b30  3f 78 63 6f 6f 72 64 0d  20 20 35 32 30 20 6f 6c  |?xcoord.  520 ol|
00002b40  64 79 3d 3f 79 63 6f 6f  72 64 0d 20 20 35 33 30  |dy=?ycoord.  530|
00002b50  20 50 52 4f 43 64 65 6c  61 79 0d 20 20 35 34 30  | PROCdelay.  540|
00002b60  20 45 4e 44 50 52 4f 43  0d 20 20 35 35 30 20 3a  | ENDPROC.  550 :|
00002b70  0d 20 20 35 36 30 20 44  45 46 50 52 4f 43 64 65  |.  560 DEFPROCde|
00002b80  6c 61 79 0d 20 20 35 37  30 20 74 69 6d 65 3d 54  |lay.  570 time=T|
00002b90  49 4d 45 2b 32 30 0d 20  20 35 38 30 20 52 45 50  |IME+20.  580 REP|
00002ba0  45 41 54 20 55 4e 54 49  4c 20 74 69 6d 65 3c 54  |EAT UNTIL time<T|
00002bb0  49 4d 45 0d 20 20 35 39  30 20 45 4e 44 50 52 4f  |IME.  590 ENDPRO|
00002bc0  43 0d 20 20 36 30 30 20  3a 0d 20 20 36 31 30 20  |C.  600 :.  610 |
00002bd0  44 45 46 50 52 4f 43 73  65 76 65 6e 0d 20 20 36  |DEFPROCseven.  6|
00002be0  32 30 20 46 4f 52 20 6c  69 6e 65 3d 30 20 54 4f  |20 FOR line=0 TO|
00002bf0  20 32 34 0d 20 20 36 33  30 20 56 44 55 33 31 2c  | 24.  630 VDU31,|
00002c00  30 2c 6c 69 6e 65 2c 31  33 34 2c 31 35 37 2c 31  |0,line,134,157,1|
00002c10  33 32 0d 20 20 36 34 30  20 4e 45 58 54 0d 20 20  |32.  640 NEXT.  |
00002c20  36 35 30 20 45 4e 44 50  52 4f 43 0d 20 20 36 36  |650 ENDPROC.  66|
00002c30  30 20 3a 0d 20 20 36 37  30 20 44 45 46 50 52 4f  |0 :.  670 DEFPRO|
00002c40  43 6d 63 6f 64 65 0d 20  20 36 38 30 20 78 63 6f  |Cmcode.  680 xco|
00002c50  6f 72 64 3d 26 37 30 0d  20 20 36 39 30 20 79 63  |ord=&70.  690 yc|
00002c60  6f 6f 72 64 3d 26 37 31  20 3a 52 45 4d 3a 20 26  |oord=&71 :REM: &|
00002c70  37 31 2d 26 37 32 0d 20  20 37 30 30 20 6f 73 62  |71-&72.  700 osb|
00002c80  79 74 65 3d 26 46 46 46  34 0d 20 20 37 31 30 20  |yte=&FFF4.  710 |
00002c90  46 4f 52 70 61 73 73 3d  30 54 4f 32 53 54 45 50  |FORpass=0TO2STEP|
00002ca0  32 0d 20 20 37 32 30 20  50 25 3d 6d 63 6f 64 65  |2.  720 P%=mcode|
00002cb0  0d 20 20 37 33 30 20 5b  20 20 20 20 20 20 20 4f  |.  730 [       O|
00002cc0  50 54 20 70 61 73 73 0d  20 20 37 34 30 20 20 20  |PT pass.  740   |
00002cd0  20 20 20 20 20 20 4c 44  41 20 23 26 38 37 20 20  |      LDA #&87  |
00002ce0  20 20 20 20 5c 20 72 65  61 64 20 73 63 72 65 65  |    \ read scree|
00002cf0  6e 20 6d 6f 64 65 0d 20  20 37 35 30 20 20 20 20  |n mode.  750    |
00002d00  20 20 20 20 20 4a 53 52  20 6f 73 62 79 74 65 0d  |     JSR osbyte.|
00002d10  20 20 37 36 30 20 20 20  20 20 20 20 20 20 54 59  |  760         TY|
00002d20  41 20 20 20 20 20 20 20  20 20 20 20 5c 20 73 63  |A           \ sc|
00002d30  72 65 65 6e 20 6d 6f 64  65 20 69 6e 20 59 20 72  |reen mode in Y r|
00002d40  65 67 69 73 74 65 72 0d  20 20 37 37 30 20 20 20  |egister.  770   |
00002d50  20 20 20 20 20 20 41 4e  44 20 23 26 30 37 20 20  |      AND #&07  |
00002d60  20 20 20 20 5c 20 72 61  6e 67 65 20 30 2d 37 0d  |    \ range 0-7.|
00002d70  20 20 37 38 30 20 20 20  20 20 20 20 20 20 53 54  |  780         ST|
00002d80  41 20 73 63 72 65 65 6e  20 20 20 20 5c 20 73 74  |A screen    \ st|
00002d90  6f 72 65 20 73 63 72 65  65 6e 20 6d 6f 64 65 0d  |ore screen mode.|
00002da0  20 20 37 39 30 20 20 20  20 20 20 20 20 20 4c 44  |  790         LD|
00002db0  59 20 23 26 31 30 20 20  20 20 20 20 5c 20 6c 69  |Y #&10      \ li|
00002dc0  67 68 74 20 70 65 6e 20  72 65 67 69 73 74 65 72  |ght pen register|
00002dd0  2c 20 68 69 67 68 20 62  79 74 65 0d 20 20 38 30  |, high byte.  80|
00002de0  30 20 20 20 20 20 20 20  20 20 4a 53 52 20 72 65  |0         JSR re|
00002df0  61 64 69 6f 20 20 20 20  5c 20 72 65 61 64 20 6c  |adio    \ read l|
00002e00  69 67 68 74 20 70 65 6e  20 72 65 67 69 73 74 65  |ight pen registe|
00002e10  72 0d 20 20 38 31 30 20  20 20 20 20 20 20 20 20  |r.  810         |
00002e20  43 50 59 20 23 26 30 30  20 20 20 20 20 20 5c 20  |CPY #&00      \ |
00002e30  59 3d 30 20 69 66 20 70  65 6e 20 6e 6f 74 20 75  |Y=0 if pen not u|
00002e40  73 65 64 0d 20 20 38 32  30 20 20 20 20 20 20 20  |sed.  820       |
00002e50  20 20 42 45 51 20 72 65  74 75 72 6e 0d 20 20 38  |  BEQ return.  8|
00002e60  33 30 20 20 20 20 20 20  20 20 20 53 54 59 20 79  |30         STY y|
00002e70  63 6f 6f 72 64 2b 31 20  20 5c 20 73 74 6f 72 65  |coord+1  \ store|
00002e80  20 68 69 67 68 20 62 79  74 65 0d 20 20 38 34 30  | high byte.  840|
00002e90  20 20 20 20 20 20 20 20  20 4c 44 59 20 23 26 31  |         LDY #&1|
00002ea0  31 20 20 20 20 20 20 5c  20 6c 69 67 68 74 20 70  |1      \ light p|
00002eb0  65 6e 20 72 65 67 69 73  74 65 72 2c 20 6c 6f 77  |en register, low|
00002ec0  20 62 79 74 65 0d 20 20  38 35 30 20 20 20 20 20  | byte.  850     |
00002ed0  20 20 20 20 4a 53 52 20  72 65 61 64 69 6f 20 20  |    JSR readio  |
00002ee0  20 20 5c 20 72 65 61 64  20 6c 69 67 68 74 20 70  |  \ read light p|
00002ef0  65 6e 20 72 65 67 69 73  74 65 72 0d 20 20 38 36  |en register.  86|
00002f00  30 20 20 20 20 20 20 20  20 20 54 59 41 20 20 20  |0         TYA   |
00002f10  20 20 20 20 20 20 20 20  5c 20 6c 6f 77 20 62 79  |        \ low by|
00002f20  74 65 20 69 6e 74 6f 20  41 0d 20 20 38 37 30 20  |te into A.  870 |
00002f30  20 20 20 20 20 20 20 20  4c 44 59 20 73 63 72 65  |        LDY scre|
00002f40  65 6e 20 20 20 20 5c 20  73 63 72 65 65 6e 20 6d  |en    \ screen m|
00002f50  6f 64 65 0d 20 20 38 38  30 20 20 20 20 20 20 20  |ode.  880       |
00002f60  20 20 43 4c 44 20 20 20  20 20 20 20 20 20 20 20  |  CLD           |
00002f70  5c 20 63 6c 65 61 72 20  64 65 63 69 6d 61 6c 20  |\ clear decimal |
00002f80  66 6c 61 67 0d 20 20 38  39 30 20 20 20 20 20 20  |flag.  890      |
00002f90  20 20 20 53 45 43 20 20  20 20 20 20 20 20 20 20  |   SEC          |
00002fa0  20 5c 20 70 72 65 70 61  72 65 20 66 6f 72 20 73  | \ prepare for s|
00002fb0  75 62 74 72 61 63 74 69  6f 6e 0d 20 20 39 30 30  |ubtraction.  900|
00002fc0  20 20 20 20 20 20 20 20  20 53 42 43 20 6f 66 66  |         SBC off|
00002fd0  73 65 74 6c 6f 77 2c 59  20 5c 20 73 75 62 74 72  |setlow,Y \ subtr|
00002fe0  61 63 74 20 73 63 72 65  65 6e 20 6d 6f 64 65 20  |act screen mode |
00002ff0  6f 66 66 73 65 74 0d 20  20 39 31 30 20 20 20 20  |offset.  910    |
00003000  20 20 20 20 20 53 54 41  20 79 63 6f 6f 72 64 20  |     STA ycoord |
00003010  20 20 20 5c 20 6c 6f 77  20 62 79 74 65 20 2d 20  |   \ low byte - |
00003020  6f 66 66 73 65 74 0d 20  20 39 32 30 20 20 20 20  |offset.  920    |
00003030  20 20 20 20 20 4c 44 41  20 79 63 6f 6f 72 64 2b  |     LDA ycoord+|
00003040  31 20 20 5c 20 68 69 67  68 20 62 79 74 65 0d 20  |1  \ high byte. |
00003050  20 39 33 30 20 20 20 20  20 20 20 20 20 53 42 43  | 930         SBC|
00003060  20 6f 66 66 73 65 74 68  69 67 68 2c 59 20 5c 20  | offsethigh,Y \ |
00003070  73 75 62 74 72 61 63 74  20 73 63 72 65 65 6e 20  |subtract screen |
00003080  6d 6f 64 65 20 6f 66 66  73 65 74 0d 20 20 39 34  |mode offset.  94|
00003090  30 20 20 20 20 20 20 20  20 20 53 54 41 20 79 63  |0         STA yc|
000030a0  6f 6f 72 64 2b 31 20 20  5c 20 68 69 67 68 20 62  |oord+1  \ high b|
000030b0  79 74 65 20 2d 20 6f 66  66 73 65 74 0d 20 20 39  |yte - offset.  9|
000030c0  35 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 23  |50         LDA #|
000030d0  26 30 30 20 20 20 20 20  20 5c 20 70 72 65 70 61  |&00      \ prepa|
000030e0  72 65 20 66 6f 72 20 31  36 20 62 69 74 20 64 69  |re for 16 bit di|
000030f0  76 69 73 69 6f 6e 0d 20  20 39 36 30 20 20 20 20  |vision.  960    |
00003100  20 20 20 20 20 53 54 41  20 78 63 6f 6f 72 64 20  |     STA xcoord |
00003110  20 20 20 5c 20 63 6c 65  61 72 20 6c 6f 77 20 70  |   \ clear low p|
00003120  61 72 74 69 61 6c 20 64  69 76 69 64 65 6e 64 0d  |artial dividend.|
00003130  20 20 39 37 30 20 20 20  20 20 20 20 20 20 4c 44  |  970         LD|
00003140  58 20 23 26 31 30 20 20  20 20 20 20 5c 20 73 65  |X #&10      \ se|
00003150  74 20 62 69 74 20 63 6f  75 6e 74 65 72 20 66 6f  |t bit counter fo|
00003160  72 20 31 36 20 62 69 74  20 64 69 76 69 73 69 6f  |r 16 bit divisio|
00003170  6e 0d 20 20 39 38 30 20  2e 6e 65 78 74 0d 20 20  |n.  980 .next.  |
00003180  39 39 30 20 20 20 20 20  20 20 20 20 41 53 4c 20  |990         ASL |
00003190  79 63 6f 6f 72 64 20 20  20 20 5c 20 73 68 69 66  |ycoord    \ shif|
000031a0  74 20 64 69 76 69 64 65  6e 64 2f 71 75 6f 74 69  |t dividend/quoti|
000031b0  65 6e 74 20 6c 65 66 74  0d 20 31 30 30 30 20 20  |ent left. 1000  |
000031c0  20 20 20 20 20 20 20 52  4f 4c 20 79 63 6f 6f 72  |       ROL ycoor|
000031d0  64 2b 31 20 20 5c 20 73  68 69 66 74 20 64 69 76  |d+1  \ shift div|
000031e0  69 64 65 6e 64 2f 71 75  6f 74 69 65 6e 74 20 6c  |idend/quotient l|
000031f0  65 66 74 0d 20 31 30 31  30 20 20 20 20 20 20 20  |eft. 1010       |
00003200  20 20 52 4f 4c 20 78 63  6f 6f 72 64 20 20 20 20  |  ROL xcoord    |
00003210  5c 20 73 68 69 66 74 20  62 69 74 73 20 69 6e 74  |\ shift bits int|
00003220  6f 20 70 61 72 74 69 61  6c 20 64 69 76 69 64 65  |o partial divide|
00003230  6e 64 0d 20 31 30 32 30  20 20 20 20 20 20 20 20  |nd. 1020        |
00003240  20 4c 44 41 20 78 63 6f  6f 72 64 20 20 20 20 5c  | LDA xcoord    \|
00003250  20 6c 6f 61 64 20 70 61  72 74 69 61 6c 20 64 69  | load partial di|
00003260  76 69 64 65 6e 64 0d 20  31 30 33 30 20 20 20 20  |vidend. 1030    |
00003270  20 20 20 20 20 53 45 43  20 20 20 20 20 20 20 20  |     SEC        |
00003280  20 20 20 5c 20 70 72 65  70 61 72 65 20 66 6f 72  |   \ prepare for|
00003290  20 73 75 62 74 72 61 63  74 69 6f 6e 0d 20 31 30  | subtraction. 10|
000032a0  34 30 20 20 20 20 20 20  20 20 20 53 42 43 20 77  |40         SBC w|
000032b0  69 64 74 68 2c 59 20 20  20 5c 20 73 75 62 74 72  |idth,Y   \ subtr|
000032c0  61 63 74 20 64 69 76 69  73 6f 72 0d 20 31 30 35  |act divisor. 105|
000032d0  30 20 20 20 20 20 20 20  20 20 42 43 43 20 64 6f  |0         BCC do|
000032e0  6e 65 20 20 20 20 20 20  5c 20 62 72 61 6e 63 68  |ne      \ branch|
000032f0  20 69 66 20 64 69 76 69  64 65 6e 64 20 3c 20 64  | if dividend < d|
00003300  69 76 69 73 6f 72 0d 20  31 30 36 30 20 20 20 20  |ivisor. 1060    |
00003310  20 20 20 20 20 49 4e 43  20 79 63 6f 6f 72 64 20  |     INC ycoord |
00003320  20 20 20 5c 20 69 6e 63  72 65 6d 65 6e 74 20 71  |   \ increment q|
00003330  75 6f 74 69 65 6e 74 0d  20 31 30 37 30 20 20 20  |uotient. 1070   |
00003340  20 20 20 20 20 20 53 54  41 20 78 63 6f 6f 72 64  |      STA xcoord|
00003350  20 20 20 20 5c 20 73 61  76 65 20 6e 65 77 20 70  |    \ save new p|
00003360  61 72 74 69 61 6c 20 64  69 76 69 64 65 6e 64 0d  |artial dividend.|
00003370  20 31 30 38 30 20 2e 64  6f 6e 65 0d 20 31 30 39  | 1080 .done. 109|
00003380  30 20 20 20 20 20 20 20  20 20 44 45 58 20 20 20  |0         DEX   |
00003390  20 20 20 20 20 20 20 20  5c 20 64 65 63 72 65 6d  |        \ decrem|
000033a0  65 6e 74 20 62 69 74 20  63 6f 75 6e 74 65 72 0d  |ent bit counter.|
000033b0  20 31 31 30 30 20 20 20  20 20 20 20 20 20 42 4e  | 1100         BN|
000033c0  45 20 6e 65 78 74 20 20  20 20 20 20 5c 20 62 72  |E next      \ br|
000033d0  61 6e 63 68 20 66 6f 72  20 31 36 20 62 69 74 73  |anch for 16 bits|
000033e0  0d 20 31 31 31 30 20 20  20 20 20 20 20 20 20 4c  |. 1110         L|
000033f0  44 41 20 73 63 61 6c 65  2c 59 20 20 20 5c 20 73  |DA scale,Y   \ s|
00003400  63 72 65 65 6e 20 6d 6f  64 65 20 73 63 61 6c 65  |creen mode scale|
00003410  0d 20 31 31 32 30 20 20  20 20 20 20 20 20 20 42  |. 1120         B|
00003420  45 51 20 72 65 74 75 72  6e 20 20 20 20 5c 20 62  |EQ return    \ b|
00003430  72 61 6e 63 68 20 69 66  20 6d 6f 64 65 73 20 30  |ranch if modes 0|
00003440  2c 20 33 2c 20 34 2c 20  36 20 6f 72 20 37 0d 20  |, 3, 4, 6 or 7. |
00003450  31 31 33 30 20 20 20 20  20 20 20 20 20 54 41 58  |1130         TAX|
00003460  20 20 20 20 20 20 20 20  20 20 20 5c 20 69 6e 20  |           \ in |
00003470  6d 6f 64 65 31 20 61 6e  64 20 6d 6f 64 65 35 20  |mode1 and mode5 |
00003480  58 3d 31 2c 20 69 6e 20  6d 6f 64 65 32 20 58 3d  |X=1, in mode2 X=|
00003490  32 0d 20 31 31 34 30 20  20 20 20 20 20 20 20 20  |2. 1140         |
000034a0  4c 44 41 20 78 63 6f 6f  72 64 0d 20 31 31 35 30  |LDA xcoord. 1150|
000034b0  20 2e 72 65 64 75 63 65  0d 20 31 31 36 30 20 20  | .reduce. 1160  |
000034c0  20 20 20 20 20 20 20 4c  53 52 20 41 20 20 20 20  |       LSR A    |
000034d0  20 20 20 20 20 5c 20 68  6f 72 69 7a 6f 6e 74 61  |     \ horizonta|
000034e0  6c 20 70 6f 73 69 74 69  6f 6e 20 2f 20 32 0d 20  |l position / 2. |
000034f0  31 31 37 30 20 20 20 20  20 20 20 20 20 44 45 58  |1170         DEX|
00003500  0d 20 31 31 38 30 20 20  20 20 20 20 20 20 20 42  |. 1180         B|
00003510  4e 45 20 72 65 64 75 63  65 0d 20 31 31 39 30 20  |NE reduce. 1190 |
00003520  20 20 20 20 20 20 20 20  53 54 41 20 78 63 6f 6f  |        STA xcoo|
00003530  72 64 0d 20 31 32 30 30  20 2e 72 65 74 75 72 6e  |rd. 1200 .return|
00003540  0d 20 31 32 31 30 20 20  20 20 20 20 20 20 20 52  |. 1210         R|
00003550  54 53 20 20 20 20 20 20  20 20 20 20 20 5c 20 72  |TS           \ r|
00003560  65 74 75 72 6e 20 74 6f  20 42 41 53 49 43 0d 20  |eturn to BASIC. |
00003570  31 32 32 30 20 2e 72 65  61 64 69 6f 0d 20 31 32  |1220 .readio. 12|
00003580  33 30 20 5c 20 20 20 20  20 20 20 53 54 59 20 26  |30 \       STY &|
00003590  46 45 30 30 0d 20 31 32  34 30 20 5c 20 20 20 20  |FE00. 1240 \    |
000035a0  20 20 20 4c 44 59 20 26  46 45 30 31 0d 20 31 32  |   LDY &FE01. 12|
000035b0  35 30 20 5c 20 20 20 20  20 20 20 52 54 53 0d 20  |50 \       RTS. |
000035c0  31 32 36 30 20 20 20 20  20 20 20 20 20 4c 44 41  |1260         LDA|
000035d0  20 23 26 39 37 20 20 20  20 20 20 5c 20 77 72 69  | #&97      \ wri|
000035e0  74 65 20 74 6f 20 73 68  65 69 6c 61 0d 20 31 32  |te to sheila. 12|
000035f0  37 30 20 20 20 20 20 20  20 20 20 4c 44 58 20 23  |70         LDX #|
00003600  26 30 30 20 20 20 20 20  20 5c 20 6f 66 66 73 65  |&00      \ offse|
00003610  74 20 30 20 3d 20 26 46  45 30 30 0d 20 31 32 38  |t 0 = &FE00. 128|
00003620  30 20 20 20 20 20 20 20  20 20 4a 53 52 20 6f 73  |0         JSR os|
00003630  62 79 74 65 0d 20 31 32  39 30 20 20 20 20 20 20  |byte. 1290      |
00003640  20 20 20 4c 44 41 20 23  26 39 36 20 20 20 20 20  |   LDA #&96     |
00003650  20 5c 20 72 65 61 64 20  66 72 6f 6d 20 73 68 65  | \ read from she|
00003660  69 6c 61 0d 20 31 33 30  30 20 20 20 20 20 20 20  |ila. 1300       |
00003670  20 20 4c 44 58 20 23 26  30 31 20 20 20 20 20 20  |  LDX #&01      |
00003680  5c 20 6f 66 66 73 65 74  20 31 20 3d 20 26 46 45  |\ offset 1 = &FE|
00003690  30 31 0d 20 31 33 31 30  20 20 20 20 20 20 20 20  |01. 1310        |
000036a0  20 4a 4d 50 20 6f 73 62  79 74 65 20 20 20 20 5c  | JMP osbyte    \|
000036b0  20 61 6e 64 20 72 65 74  75 72 6e 0d 20 31 33 32  | and return. 132|
000036c0  30 20 2e 73 63 72 65 65  6e 0d 20 31 33 33 30 20  |0 .screen. 1330 |
000036d0  20 20 20 20 20 20 20 20  45 51 55 42 20 26 30 30  |        EQUB &00|
000036e0  20 20 20 20 20 20 5c 20  73 63 72 65 65 6e 20 6d  |      \ screen m|
000036f0  6f 64 65 20 73 74 6f 72  65 64 20 68 65 72 65 0d  |ode stored here.|
00003700  20 31 33 34 30 20 2e 6f  66 66 73 65 74 6c 6f 77  | 1340 .offsetlow|
00003710  0d 20 31 33 35 30 20 20  20 20 20 20 20 20 20 45  |. 1350         E|
00003720  51 55 42 20 26 30 36 20  20 20 20 20 20 5c 20 6d  |QUB &06      \ m|
00003730  6f 64 65 30 2c 20 74 72  69 6d 6d 65 64 20 3d 20  |ode0, trimmed = |
00003740  34 0d 20 31 33 36 30 20  20 20 20 20 20 20 20 20  |4. 1360         |
00003750  45 51 55 42 20 26 30 36  20 20 20 20 20 20 5c 20  |EQUB &06      \ |
00003760  6d 6f 64 65 31 2c 20 74  72 69 6d 6d 65 64 20 3d  |mode1, trimmed =|
00003770  20 34 0d 20 31 33 37 30  20 20 20 20 20 20 20 20  | 4. 1370        |
00003780  20 45 51 55 42 20 26 30  36 20 20 20 20 20 20 5c  | EQUB &06      \|
00003790  20 6d 6f 64 65 32 2c 20  74 72 69 6d 6d 65 64 20  | mode2, trimmed |
000037a0  3d 20 34 0d 20 31 33 38  30 20 20 20 20 20 20 20  |= 4. 1380       |
000037b0  20 20 45 51 55 42 20 26  30 36 20 20 20 20 20 20  |  EQUB &06      |
000037c0  5c 20 6d 6f 64 65 33 2c  20 74 72 69 6d 6d 65 64  |\ mode3, trimmed|
000037d0  20 3d 20 34 0d 20 31 33  39 30 20 20 20 20 20 20  | = 4. 1390      |
000037e0  20 20 20 45 51 55 42 20  26 30 34 20 20 20 20 20  |   EQUB &04     |
000037f0  20 5c 20 6d 6f 64 65 34  2c 20 74 72 69 6d 6d 65  | \ mode4, trimme|
00003800  64 20 3d 20 33 0d 20 31  34 30 30 20 20 20 20 20  |d = 3. 1400     |
00003810  20 20 20 20 45 51 55 42  20 26 30 34 20 20 20 20  |    EQUB &04    |
00003820  20 20 5c 20 6d 6f 64 65  35 2c 20 74 72 69 6d 6d  |  \ mode5, trimm|
00003830  65 64 20 3d 20 33 0d 20  31 34 31 30 20 20 20 20  |ed = 3. 1410    |
00003840  20 20 20 20 20 45 51 55  42 20 26 30 34 20 20 20  |     EQUB &04   |
00003850  20 20 20 5c 20 6d 6f 64  65 36 2c 20 74 72 69 6d  |   \ mode6, trim|
00003860  6d 65 64 20 3d 20 33 0d  20 31 34 32 30 20 20 20  |med = 3. 1420   |
00003870  20 20 20 20 20 20 45 51  55 42 20 26 30 38 20 20  |      EQUB &08  |
00003880  20 20 20 20 5c 20 6d 6f  64 65 37 2c 20 74 72 69  |    \ mode7, tri|
00003890  6d 6d 65 64 20 3d 20 36  0d 20 31 34 33 30 20 2e  |mmed = 6. 1430 .|
000038a0  6f 66 66 73 65 74 68 69  67 68 0d 20 31 34 34 30  |offsethigh. 1440|
000038b0  20 20 20 20 20 20 20 20  20 45 51 55 44 20 26 30  |         EQUD &0|
000038c0  38 30 36 30 36 30 36 20  5c 20 6d 6f 64 65 73 20  |8060606 \ modes |
000038d0  33 2d 30 0d 20 31 34 35  30 20 20 20 20 20 20 20  |3-0. 1450       |
000038e0  20 20 45 51 55 44 20 26  32 38 30 43 30 42 30 42  |  EQUD &280C0B0B|
000038f0  20 5c 20 6d 6f 64 65 73  20 37 2d 34 0d 20 31 34  | \ modes 7-4. 14|
00003900  36 30 20 2e 73 63 61 6c  65 0d 20 31 34 37 30 20  |60 .scale. 1470 |
00003910  20 20 20 20 20 20 20 20  45 51 55 44 20 26 30 30  |        EQUD &00|
00003920  30 32 30 31 30 30 20 5c  20 6d 6f 64 65 73 20 33  |020100 \ modes 3|
00003930  2d 30 0d 20 31 34 38 30  20 20 20 20 20 20 20 20  |-0. 1480        |
00003940  20 45 51 55 44 20 26 30  30 30 30 30 31 30 30 20  | EQUD &00000100 |
00003950  5c 20 6d 6f 64 65 73 20  37 2d 34 0d 20 31 34 39  |\ modes 7-4. 149|
00003960  30 20 2e 77 69 64 74 68  0d 20 31 35 30 30 20 20  |0 .width. 1500  |
00003970  20 20 20 20 20 20 20 45  51 55 44 20 26 35 30 35  |       EQUD &505|
00003980  30 35 30 35 30 20 5c 20  6d 6f 64 65 73 20 33 2d  |05050 \ modes 3-|
00003990  30 0d 20 31 35 31 30 20  20 20 20 20 20 20 20 20  |0. 1510         |
000039a0  45 51 55 44 20 26 32 38  32 38 32 38 32 38 20 5c  |EQUD &28282828 \|
000039b0  20 6d 6f 64 65 73 20 37  2d 34 0d 20 31 35 32 30  | modes 7-4. 1520|
000039c0  20 5d 0d 20 31 35 33 30  20 4e 45 58 54 0d 20 31  | ]. 1530 NEXT. 1|
000039d0  35 34 30 20 45 4e 44 50  52 4f 43 0d              |540 ENDPROC.|
000039dc
20-01-89/T\Pen01.m0
20-01-89/T\Pen01.m1
20-01-89/T\Pen01.m2
20-01-89/T\Pen01.m4
20-01-89/T\Pen01.m5