Home » CEEFAX disks » telesoftware12.adl » 20-01-89/Offset

20-01-89/Offset

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/Offset
Read OK:
File size: 0D4E bytes
Load address: 0800
Exec address: 802B
File contents
   10REM> OFFSET
   20DIM mcode &100
   30PROCmcode
   40mode=0
   50MODE mode
   60PROCnewmode
   70REPEAT
   80IF INKEY(-58) PROCup:MODE mode:PROCnewmode
   90IF INKEY(-42) PROCdown:MODE mode:PROCnewmode
  100IF INKEY(-26) PROCleft
  110IF INKEY(-122) PROCright
  120CALL mcode
  130IF (?xcoord<>oldx) OR (?ycoord<>oldy) VDU31,oldx,oldy,32,31,?xcoord,?ycoord,42
  140oldx=?xcoord
  150oldy=?ycoord
  160UNTIL FALSE
  170:
  180DEFPROCleft
  190IF offsetlow?mode=12 ENDPROC
  200offsetlow?mode=offsetlow?mode+1
  210PRINTTAB(15,2);offsetlow?mode;" ";
  220PROCdelay
  230ENDPROC
  240:
  250DEFPROCright
  260IF offsetlow?mode=0 ENDPROC
  270offsetlow?mode=offsetlow?mode-1
  280PRINTTAB(15,2);offsetlow?mode;" ";
  290PROCdelay
  300ENDPROC
  310:
  320DEFPROCup
  330mode=mode+1
  340IF mode>7 mode=7
  350ENDPROC
  360:
  370DEFPROCdown
  380mode=mode-1
  390IF mode<0 mode=0
  400ENDPROC
  410:
  420DEFPROCnewmode
  430VDU23,1,0;0;0;0;
  440VDU19,0,6;0;
  450VDU19,1,4;0;
  460COLOUR1
  470PRINTTAB(3,1)"Mode ";mode
  480PRINTTAB(3,2)"offsetlow = ";offsetlow?mode
  490IF mode=7 PROCseven
  500CALL mcode
  510oldx=?xcoord
  520oldy=?ycoord
  530PROCdelay
  540ENDPROC
  550:
  560DEFPROCdelay
  570time=TIME+20
  580REPEAT UNTIL time<TIME
  590ENDPROC
  600:
  610DEFPROCseven
  620FOR line=0 TO 24
  630VDU31,0,line,134,157,132
  640NEXT
  650ENDPROC
  660:
  670DEFPROCmcode
  680xcoord=&70
  690ycoord=&71 :REM: &71-&72
  700osbyte=&FFF4
  710FORpass=0TO2STEP2
  720P%=mcode
  730[OPT pass
  740LDA #&87 \ read screen mode
  750JSR osbyte
  760TYA \ screen mode in Y register
  770AND #&07 \ range 0-7
  780STA screen \ store screen mode
  790LDY #&10 \ light pen register, high byte
  800JSR readio \ read light pen register
  810CPY #&00 \ Y=0 if pen not used
  820BEQ return
  830STY ycoord+1 \ store high byte
  840LDY #&11 \ light pen register, low byte
  850JSR readio \ read light pen register
  860TYA \ low byte into A
  870LDY screen \ screen mode
  880CLD \ clear decimal flag
  890SEC \ prepare for subtraction
  900SBC offsetlow,Y \ subtract screen mode offset
  910STA ycoord \ low byte - offset
  920LDA ycoord+1 \ high byte
  930SBC offsethigh,Y \ subtract screen mode offset
  940STA ycoord+1 \ high byte - offset
  950LDA #&00 \ prepare for 16 bit division
  960STA xcoord \ clear low partial dividend
  970LDX #&10 \ set bit counter for 16 bit division
  980.next
  990ASL ycoord \ shift dividend/quotient left
 1000ROL ycoord+1 \ shift dividend/quotient left
 1010ROL xcoord \ shift bits into partial dividend
 1020LDA xcoord \ load partial dividend
 1030SEC \ prepare for subtraction
 1040SBC width,Y \ subtract divisor
 1050BCC done \ branch if dividend < divisor
 1060INC ycoord \ increment quotient
 1070STA xcoord \ save new partial dividend
 1080.done
 1090DEX \ decrement bit counter
 1100BNE next \ branch for 16 bits
 1110LDA scale,Y \ screen mode scale
 1120BEQ return \ branch if modes 0, 3, 4, 6 or 7
 1130TAX \ in mode1 and mode5 X=1, in mode2 X=2
 1140LDA xcoord
 1150.reduce
 1160LSR A \ horizontal position / 2
 1170DEX
 1180BNE reduce
 1190STA xcoord
 1200.return
 1210RTS \ return to BASIC
 1220.readio
 1230\ STY &FE00
 1240\ LDY &FE01
 1250\ RTS
 1260LDA #&97 \ write to sheila
 1270LDX #&00 \ offset 0 = &FE00
 1280JSR osbyte
 1290LDA #&96 \ read from sheila
 1300LDX #&01 \ offset 1 = &FE01
 1310JMP osbyte \ and return
 1320.screen
 1330EQUB &00 \ screen mode stored here
 1340.offsetlow
 1350EQUB &06 \ mode0, trimmed = 4
 1360EQUB &06 \ mode1, trimmed = 4
 1370EQUB &06 \ mode2, trimmed = 4
 1380EQUB &06 \ mode3, trimmed = 4
 1390EQUB &04 \ mode4, trimmed = 3
 1400EQUB &04 \ mode5, trimmed = 3
 1410EQUB &04 \ mode6, trimmed = 3
 1420EQUB &08 \ mode7, trimmed = 6
 1430.offsethigh
 1440EQUD &08060606 \ modes 3-0
 1450EQUD &280C0B0B \ modes 7-4
 1460.scale
 1470EQUD &00020100 \ modes 3-0
 1480EQUD &00000100 \ modes 7-4
 1490.width
 1500EQUD &50505050 \ modes 3-0
 1510EQUD &28282828 \ modes 7-4
 1520]
 1530NEXT
 1540ENDPROC


�> OFFSET
� mcode &100

�mcode
(
mode=0
2
� mode
<�newmode
F�
P � �(-58) �up:� mode:�newmode
Z"� �(-42) �down:� mode:�newmode
d� �(-26) �left
n� �(-122) �right
x� mcode
�N� (?xcoord<>oldx) � (?ycoord<>oldy) �31,oldx,oldy,32,31,?xcoord,?ycoord,42
�oldx=?xcoord
�oldy=?ycoord
�� �
�:
�
��left
�� offsetlow?mode=12 �
�#offsetlow?mode=offsetlow?mode+1
��15,2);offsetlow?mode;" ";
�
�delay
��
�:
���right
� offsetlow?mode=0 �
#offsetlow?mode=offsetlow?mode-1
�15,2);offsetlow?mode;" ";
"
�delay
,�
6:
@��up
Jmode=mode+1
T� mode>7 mode=7
^�
h:
r
��down
|mode=mode-1
�� mode<0 mode=0
��
�:
�
��newmode
��23,1,0;0;0;0;
��19,0,6;0;
��19,1,4;0;
��1
��3,1)"Mode ";mode
�'�3,2)"offsetlow = ";offsetlow?mode
�� mode=7 �seven
�� mcode
�oldx=?xcoord
oldy=?ycoord

�delay
�
&:
0��delay
:
time=�+20
D� � time<�
N�
X:
b��seven
l� line=0 � 24
v�31,0,line,134,157,132
��
��
�:
���mcode
�xcoord=&70
�ycoord=&71 :�: &71-&72
�osbyte=&FFF4
��pass=0�2�2
�P%=mcode
�
[OPT pass
�LDA #&87 \ read screen mode
�JSR osbyte
�#TYA \ screen mode in Y register
� #&07 \ range 0-7
"STA screen \ store screen mode
,LDY #&10 \ light pen register, high byte
 (JSR readio \ read light pen register
*"CPY #&00 \ Y=0 if pen not used
4BEQ return
>"STY ycoord+1 \ store high byte
H+LDY #&11 \ light pen register, low byte
R(JSR readio \ read light pen register
\TYA \ low byte into A
fLDY screen \ screen mode
pCLD \ clear decimal flag
z!SEC \ prepare for subtraction
�1SBC offsetlow,Y \ subtract screen mode offset
�"STA ycoord \ low byte - offset
�LDA ycoord+1 \ high byte
�2SBC offsethigh,Y \ subtract screen mode offset
�%STA ycoord+1 \ high byte - offset
�*LDA #&00 \ prepare for 16 bit division
�+STA xcoord \ clear low partial dividend
�2LDX #&10 \ set bit counter for 16 bit division
�	.next
�-ASL ycoord \ shift dividend/quotient left
�/ROL ycoord+1 \ shift dividend/quotient left
�1ROL xcoord \ shift bits into partial dividend
�&LDA xcoord \ load partial dividend
!SEC \ prepare for subtraction
"SBC width,Y \ subtract divisor
+BCC done \ branch if dividend < divisor
$#INC ycoord \ increment quotient
.*STA xcoord \ save new partial dividend
8	.done
BDEX \ decrement bit counter
L!BNE next \ branch for 16 bits
V#LDA scale,Y \ screen mode scale
`0BEQ return \ branch if modes 0, 3, 4, 6 or 7
j.TAX \ in mode1 and mode5 X=1, in mode2 X=2
tLDA xcoord
~.reduce
�#LSR A \ horizontal position / 2
�DEX
�BNE reduce
�STA xcoord
�.return
�RTS \ return to BASIC
�.readio
�\ STY &FE00
�\ LDY &FE01
�	\ RTS
�LDA #&97 \ write to sheila
�LDX #&00 \ offset 0 = &FE00
JSR osbyte

LDA #&96 \ read from sheila
LDX #&01 \ offset 1 = &FE01
JMP osbyte \ and return
(.screen
2&EQUB &00 \ screen mode stored here
<.offsetlow
F!EQUB &06 \ mode0, trimmed = 4
P!EQUB &06 \ mode1, trimmed = 4
Z!EQUB &06 \ mode2, trimmed = 4
d!EQUB &06 \ mode3, trimmed = 4
n!EQUB &04 \ mode4, trimmed = 3
x!EQUB &04 \ mode5, trimmed = 3
�!EQUB &04 \ mode6, trimmed = 3
�!EQUB &08 \ mode7, trimmed = 6
�.offsethigh
�EQUD &08060606 \ modes 3-0
�EQUD &280C0B0B \ modes 7-4
�
.scale
�EQUD &00020100 \ modes 3-0
�EQUD &00000100 \ modes 7-4
�
.width
�EQUD &50505050 \ modes 3-0
�EQUD &28282828 \ modes 7-4
�]
��
�
�
00000000  0d 00 0a 0d f4 3e 20 4f  46 46 53 45 54 0d 00 14  |.....> OFFSET...|
00000010  10 de 20 6d 63 6f 64 65  20 26 31 30 30 0d 00 1e  |.. mcode &100...|
00000020  0a f2 6d 63 6f 64 65 0d  00 28 0a 6d 6f 64 65 3d  |..mcode..(.mode=|
00000030  30 0d 00 32 0a eb 20 6d  6f 64 65 0d 00 3c 0c f2  |0..2.. mode..<..|
00000040  6e 65 77 6d 6f 64 65 0d  00 46 05 f5 0d 00 50 20  |newmode..F....P |
00000050  e7 20 a6 28 2d 35 38 29  20 f2 75 70 3a eb 20 6d  |. .(-58) .up:. m|
00000060  6f 64 65 3a f2 6e 65 77  6d 6f 64 65 0d 00 5a 22  |ode:.newmode..Z"|
00000070  e7 20 a6 28 2d 34 32 29  20 f2 64 6f 77 6e 3a eb  |. .(-42) .down:.|
00000080  20 6d 6f 64 65 3a f2 6e  65 77 6d 6f 64 65 0d 00  | mode:.newmode..|
00000090  64 12 e7 20 a6 28 2d 32  36 29 20 f2 6c 65 66 74  |d.. .(-26) .left|
000000a0  0d 00 6e 14 e7 20 a6 28  2d 31 32 32 29 20 f2 72  |..n.. .(-122) .r|
000000b0  69 67 68 74 0d 00 78 0b  d6 20 6d 63 6f 64 65 0d  |ight..x.. mcode.|
000000c0  00 82 4e e7 20 28 3f 78  63 6f 6f 72 64 3c 3e 6f  |..N. (?xcoord<>o|
000000d0  6c 64 78 29 20 84 20 28  3f 79 63 6f 6f 72 64 3c  |ldx) . (?ycoord<|
000000e0  3e 6f 6c 64 79 29 20 ef  33 31 2c 6f 6c 64 78 2c  |>oldy) .31,oldx,|
000000f0  6f 6c 64 79 2c 33 32 2c  33 31 2c 3f 78 63 6f 6f  |oldy,32,31,?xcoo|
00000100  72 64 2c 3f 79 63 6f 6f  72 64 2c 34 32 0d 00 8c  |rd,?ycoord,42...|
00000110  10 6f 6c 64 78 3d 3f 78  63 6f 6f 72 64 0d 00 96  |.oldx=?xcoord...|
00000120  10 6f 6c 64 79 3d 3f 79  63 6f 6f 72 64 0d 00 a0  |.oldy=?ycoord...|
00000130  07 fd 20 a3 0d 00 aa 05  3a 0d 00 b4 0a dd f2 6c  |.. .....:......l|
00000140  65 66 74 0d 00 be 19 e7  20 6f 66 66 73 65 74 6c  |eft..... offsetl|
00000150  6f 77 3f 6d 6f 64 65 3d  31 32 20 e1 0d 00 c8 23  |ow?mode=12 ....#|
00000160  6f 66 66 73 65 74 6c 6f  77 3f 6d 6f 64 65 3d 6f  |offsetlow?mode=o|
00000170  66 66 73 65 74 6c 6f 77  3f 6d 6f 64 65 2b 31 0d  |ffsetlow?mode+1.|
00000180  00 d2 1f f1 8a 31 35 2c  32 29 3b 6f 66 66 73 65  |.....15,2);offse|
00000190  74 6c 6f 77 3f 6d 6f 64  65 3b 22 20 22 3b 0d 00  |tlow?mode;" ";..|
000001a0  dc 0a f2 64 65 6c 61 79  0d 00 e6 05 e1 0d 00 f0  |...delay........|
000001b0  05 3a 0d 00 fa 0b dd f2  72 69 67 68 74 0d 01 04  |.:......right...|
000001c0  18 e7 20 6f 66 66 73 65  74 6c 6f 77 3f 6d 6f 64  |.. offsetlow?mod|
000001d0  65 3d 30 20 e1 0d 01 0e  23 6f 66 66 73 65 74 6c  |e=0 ....#offsetl|
000001e0  6f 77 3f 6d 6f 64 65 3d  6f 66 66 73 65 74 6c 6f  |ow?mode=offsetlo|
000001f0  77 3f 6d 6f 64 65 2d 31  0d 01 18 1f f1 8a 31 35  |w?mode-1......15|
00000200  2c 32 29 3b 6f 66 66 73  65 74 6c 6f 77 3f 6d 6f  |,2);offsetlow?mo|
00000210  64 65 3b 22 20 22 3b 0d  01 22 0a f2 64 65 6c 61  |de;" ";.."..dela|
00000220  79 0d 01 2c 05 e1 0d 01  36 05 3a 0d 01 40 08 dd  |y..,....6.:..@..|
00000230  f2 75 70 0d 01 4a 0f 6d  6f 64 65 3d 6d 6f 64 65  |.up..J.mode=mode|
00000240  2b 31 0d 01 54 13 e7 20  6d 6f 64 65 3e 37 20 6d  |+1..T.. mode>7 m|
00000250  6f 64 65 3d 37 0d 01 5e  05 e1 0d 01 68 05 3a 0d  |ode=7..^....h.:.|
00000260  01 72 0a dd f2 64 6f 77  6e 0d 01 7c 0f 6d 6f 64  |.r...down..|.mod|
00000270  65 3d 6d 6f 64 65 2d 31  0d 01 86 13 e7 20 6d 6f  |e=mode-1..... mo|
00000280  64 65 3c 30 20 6d 6f 64  65 3d 30 0d 01 90 05 e1  |de<0 mode=0.....|
00000290  0d 01 9a 05 3a 0d 01 a4  0d dd f2 6e 65 77 6d 6f  |....:......newmo|
000002a0  64 65 0d 01 ae 12 ef 32  33 2c 31 2c 30 3b 30 3b  |de.....23,1,0;0;|
000002b0  30 3b 30 3b 0d 01 b8 0e  ef 31 39 2c 30 2c 36 3b  |0;0;.....19,0,6;|
000002c0  30 3b 0d 01 c2 0e ef 31  39 2c 31 2c 34 3b 30 3b  |0;.....19,1,4;0;|
000002d0  0d 01 cc 06 fb 31 0d 01  d6 16 f1 8a 33 2c 31 29  |.....1......3,1)|
000002e0  22 4d 6f 64 65 20 22 3b  6d 6f 64 65 0d 01 e0 27  |"Mode ";mode...'|
000002f0  f1 8a 33 2c 32 29 22 6f  66 66 73 65 74 6c 6f 77  |..3,2)"offsetlow|
00000300  20 3d 20 22 3b 6f 66 66  73 65 74 6c 6f 77 3f 6d  | = ";offsetlow?m|
00000310  6f 64 65 0d 01 ea 13 e7  20 6d 6f 64 65 3d 37 20  |ode..... mode=7 |
00000320  f2 73 65 76 65 6e 0d 01  f4 0b d6 20 6d 63 6f 64  |.seven..... mcod|
00000330  65 0d 01 fe 10 6f 6c 64  78 3d 3f 78 63 6f 6f 72  |e....oldx=?xcoor|
00000340  64 0d 02 08 10 6f 6c 64  79 3d 3f 79 63 6f 6f 72  |d....oldy=?ycoor|
00000350  64 0d 02 12 0a f2 64 65  6c 61 79 0d 02 1c 05 e1  |d.....delay.....|
00000360  0d 02 26 05 3a 0d 02 30  0b dd f2 64 65 6c 61 79  |..&.:..0...delay|
00000370  0d 02 3a 0d 74 69 6d 65  3d 91 2b 32 30 0d 02 44  |..:.time=.+20..D|
00000380  0e f5 20 fd 20 74 69 6d  65 3c 91 0d 02 4e 05 e1  |.. . time<...N..|
00000390  0d 02 58 05 3a 0d 02 62  0b dd f2 73 65 76 65 6e  |..X.:..b...seven|
000003a0  0d 02 6c 11 e3 20 6c 69  6e 65 3d 30 20 b8 20 32  |..l.. line=0 . 2|
000003b0  34 0d 02 76 1a ef 33 31  2c 30 2c 6c 69 6e 65 2c  |4..v..31,0,line,|
000003c0  31 33 34 2c 31 35 37 2c  31 33 32 0d 02 80 05 ed  |134,157,132.....|
000003d0  0d 02 8a 05 e1 0d 02 94  05 3a 0d 02 9e 0b dd f2  |.........:......|
000003e0  6d 63 6f 64 65 0d 02 a8  0e 78 63 6f 6f 72 64 3d  |mcode....xcoord=|
000003f0  26 37 30 0d 02 b2 1a 79  63 6f 6f 72 64 3d 26 37  |&70....ycoord=&7|
00000400  31 20 3a f4 3a 20 26 37  31 2d 26 37 32 0d 02 bc  |1 :.: &71-&72...|
00000410  10 6f 73 62 79 74 65 3d  26 46 46 46 34 0d 02 c6  |.osbyte=&FFF4...|
00000420  0f e3 70 61 73 73 3d 30  b8 32 88 32 0d 02 d0 0c  |..pass=0.2.2....|
00000430  50 25 3d 6d 63 6f 64 65  0d 02 da 0d 5b 4f 50 54  |P%=mcode....[OPT|
00000440  20 70 61 73 73 0d 02 e4  1f 4c 44 41 20 23 26 38  | pass....LDA #&8|
00000450  37 20 5c 20 72 65 61 64  20 73 63 72 65 65 6e 20  |7 \ read screen |
00000460  6d 6f 64 65 0d 02 ee 0e  4a 53 52 20 6f 73 62 79  |mode....JSR osby|
00000470  74 65 0d 02 f8 23 54 59  41 20 5c 20 73 63 72 65  |te...#TYA \ scre|
00000480  65 6e 20 6d 6f 64 65 20  69 6e 20 59 20 72 65 67  |en mode in Y reg|
00000490  69 73 74 65 72 0d 03 02  16 80 20 23 26 30 37 20  |ister..... #&07 |
000004a0  5c 20 72 61 6e 67 65 20  30 2d 37 0d 03 0c 22 53  |\ range 0-7..."S|
000004b0  54 41 20 73 63 72 65 65  6e 20 5c 20 73 74 6f 72  |TA screen \ stor|
000004c0  65 20 73 63 72 65 65 6e  20 6d 6f 64 65 0d 03 16  |e screen mode...|
000004d0  2c 4c 44 59 20 23 26 31  30 20 5c 20 6c 69 67 68  |,LDY #&10 \ ligh|
000004e0  74 20 70 65 6e 20 72 65  67 69 73 74 65 72 2c 20  |t pen register, |
000004f0  68 69 67 68 20 62 79 74  65 0d 03 20 28 4a 53 52  |high byte.. (JSR|
00000500  20 72 65 61 64 69 6f 20  5c 20 72 65 61 64 20 6c  | readio \ read l|
00000510  69 67 68 74 20 70 65 6e  20 72 65 67 69 73 74 65  |ight pen registe|
00000520  72 0d 03 2a 22 43 50 59  20 23 26 30 30 20 5c 20  |r..*"CPY #&00 \ |
00000530  59 3d 30 20 69 66 20 70  65 6e 20 6e 6f 74 20 75  |Y=0 if pen not u|
00000540  73 65 64 0d 03 34 0e 42  45 51 20 72 65 74 75 72  |sed..4.BEQ retur|
00000550  6e 0d 03 3e 22 53 54 59  20 79 63 6f 6f 72 64 2b  |n..>"STY ycoord+|
00000560  31 20 5c 20 73 74 6f 72  65 20 68 69 67 68 20 62  |1 \ store high b|
00000570  79 74 65 0d 03 48 2b 4c  44 59 20 23 26 31 31 20  |yte..H+LDY #&11 |
00000580  5c 20 6c 69 67 68 74 20  70 65 6e 20 72 65 67 69  |\ light pen regi|
00000590  73 74 65 72 2c 20 6c 6f  77 20 62 79 74 65 0d 03  |ster, low byte..|
000005a0  52 28 4a 53 52 20 72 65  61 64 69 6f 20 5c 20 72  |R(JSR readio \ r|
000005b0  65 61 64 20 6c 69 67 68  74 20 70 65 6e 20 72 65  |ead light pen re|
000005c0  67 69 73 74 65 72 0d 03  5c 19 54 59 41 20 5c 20  |gister..\.TYA \ |
000005d0  6c 6f 77 20 62 79 74 65  20 69 6e 74 6f 20 41 0d  |low byte into A.|
000005e0  03 66 1c 4c 44 59 20 73  63 72 65 65 6e 20 5c 20  |.f.LDY screen \ |
000005f0  73 63 72 65 65 6e 20 6d  6f 64 65 0d 03 70 1c 43  |screen mode..p.C|
00000600  4c 44 20 5c 20 63 6c 65  61 72 20 64 65 63 69 6d  |LD \ clear decim|
00000610  61 6c 20 66 6c 61 67 0d  03 7a 21 53 45 43 20 5c  |al flag..z!SEC \|
00000620  20 70 72 65 70 61 72 65  20 66 6f 72 20 73 75 62  | prepare for sub|
00000630  74 72 61 63 74 69 6f 6e  0d 03 84 31 53 42 43 20  |traction...1SBC |
00000640  6f 66 66 73 65 74 6c 6f  77 2c 59 20 5c 20 73 75  |offsetlow,Y \ su|
00000650  62 74 72 61 63 74 20 73  63 72 65 65 6e 20 6d 6f  |btract screen mo|
00000660  64 65 20 6f 66 66 73 65  74 0d 03 8e 22 53 54 41  |de offset..."STA|
00000670  20 79 63 6f 6f 72 64 20  5c 20 6c 6f 77 20 62 79  | ycoord \ low by|
00000680  74 65 20 2d 20 6f 66 66  73 65 74 0d 03 98 1c 4c  |te - offset....L|
00000690  44 41 20 79 63 6f 6f 72  64 2b 31 20 5c 20 68 69  |DA ycoord+1 \ hi|
000006a0  67 68 20 62 79 74 65 0d  03 a2 32 53 42 43 20 6f  |gh byte...2SBC o|
000006b0  66 66 73 65 74 68 69 67  68 2c 59 20 5c 20 73 75  |ffsethigh,Y \ su|
000006c0  62 74 72 61 63 74 20 73  63 72 65 65 6e 20 6d 6f  |btract screen mo|
000006d0  64 65 20 6f 66 66 73 65  74 0d 03 ac 25 53 54 41  |de offset...%STA|
000006e0  20 79 63 6f 6f 72 64 2b  31 20 5c 20 68 69 67 68  | ycoord+1 \ high|
000006f0  20 62 79 74 65 20 2d 20  6f 66 66 73 65 74 0d 03  | byte - offset..|
00000700  b6 2a 4c 44 41 20 23 26  30 30 20 5c 20 70 72 65  |.*LDA #&00 \ pre|
00000710  70 61 72 65 20 66 6f 72  20 31 36 20 62 69 74 20  |pare for 16 bit |
00000720  64 69 76 69 73 69 6f 6e  0d 03 c0 2b 53 54 41 20  |division...+STA |
00000730  78 63 6f 6f 72 64 20 5c  20 63 6c 65 61 72 20 6c  |xcoord \ clear l|
00000740  6f 77 20 70 61 72 74 69  61 6c 20 64 69 76 69 64  |ow partial divid|
00000750  65 6e 64 0d 03 ca 32 4c  44 58 20 23 26 31 30 20  |end...2LDX #&10 |
00000760  5c 20 73 65 74 20 62 69  74 20 63 6f 75 6e 74 65  |\ set bit counte|
00000770  72 20 66 6f 72 20 31 36  20 62 69 74 20 64 69 76  |r for 16 bit div|
00000780  69 73 69 6f 6e 0d 03 d4  09 2e 6e 65 78 74 0d 03  |ision.....next..|
00000790  de 2d 41 53 4c 20 79 63  6f 6f 72 64 20 5c 20 73  |.-ASL ycoord \ s|
000007a0  68 69 66 74 20 64 69 76  69 64 65 6e 64 2f 71 75  |hift dividend/qu|
000007b0  6f 74 69 65 6e 74 20 6c  65 66 74 0d 03 e8 2f 52  |otient left.../R|
000007c0  4f 4c 20 79 63 6f 6f 72  64 2b 31 20 5c 20 73 68  |OL ycoord+1 \ sh|
000007d0  69 66 74 20 64 69 76 69  64 65 6e 64 2f 71 75 6f  |ift dividend/quo|
000007e0  74 69 65 6e 74 20 6c 65  66 74 0d 03 f2 31 52 4f  |tient left...1RO|
000007f0  4c 20 78 63 6f 6f 72 64  20 5c 20 73 68 69 66 74  |L xcoord \ shift|
00000800  20 62 69 74 73 20 69 6e  74 6f 20 70 61 72 74 69  | bits into parti|
00000810  61 6c 20 64 69 76 69 64  65 6e 64 0d 03 fc 26 4c  |al dividend...&L|
00000820  44 41 20 78 63 6f 6f 72  64 20 5c 20 6c 6f 61 64  |DA xcoord \ load|
00000830  20 70 61 72 74 69 61 6c  20 64 69 76 69 64 65 6e  | partial dividen|
00000840  64 0d 04 06 21 53 45 43  20 5c 20 70 72 65 70 61  |d...!SEC \ prepa|
00000850  72 65 20 66 6f 72 20 73  75 62 74 72 61 63 74 69  |re for subtracti|
00000860  6f 6e 0d 04 10 22 53 42  43 20 77 69 64 74 68 2c  |on..."SBC width,|
00000870  59 20 5c 20 73 75 62 74  72 61 63 74 20 64 69 76  |Y \ subtract div|
00000880  69 73 6f 72 0d 04 1a 2b  42 43 43 20 64 6f 6e 65  |isor...+BCC done|
00000890  20 5c 20 62 72 61 6e 63  68 20 69 66 20 64 69 76  | \ branch if div|
000008a0  69 64 65 6e 64 20 3c 20  64 69 76 69 73 6f 72 0d  |idend < divisor.|
000008b0  04 24 23 49 4e 43 20 79  63 6f 6f 72 64 20 5c 20  |.$#INC ycoord \ |
000008c0  69 6e 63 72 65 6d 65 6e  74 20 71 75 6f 74 69 65  |increment quotie|
000008d0  6e 74 0d 04 2e 2a 53 54  41 20 78 63 6f 6f 72 64  |nt...*STA xcoord|
000008e0  20 5c 20 73 61 76 65 20  6e 65 77 20 70 61 72 74  | \ save new part|
000008f0  69 61 6c 20 64 69 76 69  64 65 6e 64 0d 04 38 09  |ial dividend..8.|
00000900  2e 64 6f 6e 65 0d 04 42  1f 44 45 58 20 5c 20 64  |.done..B.DEX \ d|
00000910  65 63 72 65 6d 65 6e 74  20 62 69 74 20 63 6f 75  |ecrement bit cou|
00000920  6e 74 65 72 0d 04 4c 21  42 4e 45 20 6e 65 78 74  |nter..L!BNE next|
00000930  20 5c 20 62 72 61 6e 63  68 20 66 6f 72 20 31 36  | \ branch for 16|
00000940  20 62 69 74 73 0d 04 56  23 4c 44 41 20 73 63 61  | bits..V#LDA sca|
00000950  6c 65 2c 59 20 5c 20 73  63 72 65 65 6e 20 6d 6f  |le,Y \ screen mo|
00000960  64 65 20 73 63 61 6c 65  0d 04 60 30 42 45 51 20  |de scale..`0BEQ |
00000970  72 65 74 75 72 6e 20 5c  20 62 72 61 6e 63 68 20  |return \ branch |
00000980  69 66 20 6d 6f 64 65 73  20 30 2c 20 33 2c 20 34  |if modes 0, 3, 4|
00000990  2c 20 36 20 6f 72 20 37  0d 04 6a 2e 54 41 58 20  |, 6 or 7..j.TAX |
000009a0  5c 20 69 6e 20 6d 6f 64  65 31 20 61 6e 64 20 6d  |\ in mode1 and m|
000009b0  6f 64 65 35 20 58 3d 31  2c 20 69 6e 20 6d 6f 64  |ode5 X=1, in mod|
000009c0  65 32 20 58 3d 32 0d 04  74 0e 4c 44 41 20 78 63  |e2 X=2..t.LDA xc|
000009d0  6f 6f 72 64 0d 04 7e 0b  2e 72 65 64 75 63 65 0d  |oord..~..reduce.|
000009e0  04 88 23 4c 53 52 20 41  20 5c 20 68 6f 72 69 7a  |..#LSR A \ horiz|
000009f0  6f 6e 74 61 6c 20 70 6f  73 69 74 69 6f 6e 20 2f  |ontal position /|
00000a00  20 32 0d 04 92 07 44 45  58 0d 04 9c 0e 42 4e 45  | 2....DEX....BNE|
00000a10  20 72 65 64 75 63 65 0d  04 a6 0e 53 54 41 20 78  | reduce....STA x|
00000a20  63 6f 6f 72 64 0d 04 b0  0b 2e 72 65 74 75 72 6e  |coord.....return|
00000a30  0d 04 ba 19 52 54 53 20  5c 20 72 65 74 75 72 6e  |....RTS \ return|
00000a40  20 74 6f 20 42 41 53 49  43 0d 04 c4 0b 2e 72 65  | to BASIC.....re|
00000a50  61 64 69 6f 0d 04 ce 0f  5c 20 53 54 59 20 26 46  |adio....\ STY &F|
00000a60  45 30 30 0d 04 d8 0f 5c  20 4c 44 59 20 26 46 45  |E00....\ LDY &FE|
00000a70  30 31 0d 04 e2 09 5c 20  52 54 53 0d 04 ec 1e 4c  |01....\ RTS....L|
00000a80  44 41 20 23 26 39 37 20  5c 20 77 72 69 74 65 20  |DA #&97 \ write |
00000a90  74 6f 20 73 68 65 69 6c  61 0d 04 f6 1f 4c 44 58  |to sheila....LDX|
00000aa0  20 23 26 30 30 20 5c 20  6f 66 66 73 65 74 20 30  | #&00 \ offset 0|
00000ab0  20 3d 20 26 46 45 30 30  0d 05 00 0e 4a 53 52 20  | = &FE00....JSR |
00000ac0  6f 73 62 79 74 65 0d 05  0a 1f 4c 44 41 20 23 26  |osbyte....LDA #&|
00000ad0  39 36 20 5c 20 72 65 61  64 20 66 72 6f 6d 20 73  |96 \ read from s|
00000ae0  68 65 69 6c 61 0d 05 14  1f 4c 44 58 20 23 26 30  |heila....LDX #&0|
00000af0  31 20 5c 20 6f 66 66 73  65 74 20 31 20 3d 20 26  |1 \ offset 1 = &|
00000b00  46 45 30 31 0d 05 1e 1b  4a 4d 50 20 6f 73 62 79  |FE01....JMP osby|
00000b10  74 65 20 5c 20 61 6e 64  20 72 65 74 75 72 6e 0d  |te \ and return.|
00000b20  05 28 0b 2e 73 63 72 65  65 6e 0d 05 32 26 45 51  |.(..screen..2&EQ|
00000b30  55 42 20 26 30 30 20 5c  20 73 63 72 65 65 6e 20  |UB &00 \ screen |
00000b40  6d 6f 64 65 20 73 74 6f  72 65 64 20 68 65 72 65  |mode stored here|
00000b50  0d 05 3c 0e 2e 6f 66 66  73 65 74 6c 6f 77 0d 05  |..<..offsetlow..|
00000b60  46 21 45 51 55 42 20 26  30 36 20 5c 20 6d 6f 64  |F!EQUB &06 \ mod|
00000b70  65 30 2c 20 74 72 69 6d  6d 65 64 20 3d 20 34 0d  |e0, trimmed = 4.|
00000b80  05 50 21 45 51 55 42 20  26 30 36 20 5c 20 6d 6f  |.P!EQUB &06 \ mo|
00000b90  64 65 31 2c 20 74 72 69  6d 6d 65 64 20 3d 20 34  |de1, trimmed = 4|
00000ba0  0d 05 5a 21 45 51 55 42  20 26 30 36 20 5c 20 6d  |..Z!EQUB &06 \ m|
00000bb0  6f 64 65 32 2c 20 74 72  69 6d 6d 65 64 20 3d 20  |ode2, trimmed = |
00000bc0  34 0d 05 64 21 45 51 55  42 20 26 30 36 20 5c 20  |4..d!EQUB &06 \ |
00000bd0  6d 6f 64 65 33 2c 20 74  72 69 6d 6d 65 64 20 3d  |mode3, trimmed =|
00000be0  20 34 0d 05 6e 21 45 51  55 42 20 26 30 34 20 5c  | 4..n!EQUB &04 \|
00000bf0  20 6d 6f 64 65 34 2c 20  74 72 69 6d 6d 65 64 20  | mode4, trimmed |
00000c00  3d 20 33 0d 05 78 21 45  51 55 42 20 26 30 34 20  |= 3..x!EQUB &04 |
00000c10  5c 20 6d 6f 64 65 35 2c  20 74 72 69 6d 6d 65 64  |\ mode5, trimmed|
00000c20  20 3d 20 33 0d 05 82 21  45 51 55 42 20 26 30 34  | = 3...!EQUB &04|
00000c30  20 5c 20 6d 6f 64 65 36  2c 20 74 72 69 6d 6d 65  | \ mode6, trimme|
00000c40  64 20 3d 20 33 0d 05 8c  21 45 51 55 42 20 26 30  |d = 3...!EQUB &0|
00000c50  38 20 5c 20 6d 6f 64 65  37 2c 20 74 72 69 6d 6d  |8 \ mode7, trimm|
00000c60  65 64 20 3d 20 36 0d 05  96 0f 2e 6f 66 66 73 65  |ed = 6.....offse|
00000c70  74 68 69 67 68 0d 05 a0  1e 45 51 55 44 20 26 30  |thigh....EQUD &0|
00000c80  38 30 36 30 36 30 36 20  5c 20 6d 6f 64 65 73 20  |8060606 \ modes |
00000c90  33 2d 30 0d 05 aa 1e 45  51 55 44 20 26 32 38 30  |3-0....EQUD &280|
00000ca0  43 30 42 30 42 20 5c 20  6d 6f 64 65 73 20 37 2d  |C0B0B \ modes 7-|
00000cb0  34 0d 05 b4 0a 2e 73 63  61 6c 65 0d 05 be 1e 45  |4.....scale....E|
00000cc0  51 55 44 20 26 30 30 30  32 30 31 30 30 20 5c 20  |QUD &00020100 \ |
00000cd0  6d 6f 64 65 73 20 33 2d  30 0d 05 c8 1e 45 51 55  |modes 3-0....EQU|
00000ce0  44 20 26 30 30 30 30 30  31 30 30 20 5c 20 6d 6f  |D &00000100 \ mo|
00000cf0  64 65 73 20 37 2d 34 0d  05 d2 0a 2e 77 69 64 74  |des 7-4.....widt|
00000d00  68 0d 05 dc 1e 45 51 55  44 20 26 35 30 35 30 35  |h....EQUD &50505|
00000d10  30 35 30 20 5c 20 6d 6f  64 65 73 20 33 2d 30 0d  |050 \ modes 3-0.|
00000d20  05 e6 1e 45 51 55 44 20  26 32 38 32 38 32 38 32  |...EQUD &2828282|
00000d30  38 20 5c 20 6d 6f 64 65  73 20 37 2d 34 0d 05 f0  |8 \ modes 7-4...|
00000d40  05 5d 0d 05 fa 05 ed 0d  06 04 05 e1 0d ff        |.]............|
00000d4e
20-01-89/Offset.m0
20-01-89/Offset.m1
20-01-89/Offset.m2
20-01-89/Offset.m4
20-01-89/Offset.m5