Home » CEEFAX disks » telesoftware12.adl » 17-02-89/SWgraph
17-02-89/SWgraph
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » CEEFAX disks » telesoftware12.adl |
Filename: | 17-02-89/SWgraph |
Read OK: | ✔ |
File size: | 1204 bytes |
Load address: | 0800 |
Exec address: | 8023 |
File contents
10REM> SWGRAPH 20DIM mcode &200 30xcoord=&70 :REM: &70-&73 40ycoord=&74 :REM: &74-&77 50fire=&78 :REM: fire button status 60savereg=&FC :REM: interrupt accumulator save register 70start=&350 :REM: screen start address 80screen=&355 :REM: screen mode OS 1.2 90sheila=&FE00 100drb=&FE40 :REM: system 6522 data register B 110ifr=&FE4D :REM: system 6522 interrupt flag register 120ier=&FE4E :REM: system 6522 interrupt enable register 130FOR pass=4 TO 6 STEP 2 140O%=mcode 150P%=&8000 160[OPT pass 170BRK 180BRK 190BRK 200JMP service \ service entry to ROM 210EQUB &82 \ ROM type byte indicates a service entry 220EQUB copyright MOD 256 \ copyright offset pointer 230BRK 240EQUS "Light pen Graphics" \ title string 250.copyright 260BRK \ start of copyright 270EQUS "(C) Gordon Horsington 1987" \ copyright string 280BRK \ copyright terminator 290.out 300JMP pullout 310.exit 320PLA 330STA savereg 340LDA #&05 \ unrecognised interrupt service call 350.return 360RTS 370.service 380CMP #&05 \ is this an unrecognised interrupt? 390BNE return \ branch if not interrupt 400LDA savereg \ load interrupt accumulator save register 410PHA \ and push it on the stack 420LDA ifr \ load system VIA interrupt flag register 430BPL exit \ exit if bit 7 clear 440AND #&08 \ AND with %00001000 450BEQ exit \ exit if not light pen interrupt 460TXA 470PHA 480TYA 490PHA 500LDA drb \ clear interrupt 510PHA \ push data register B 520CLD \ clear decimal flag 530LDA #&00 540LDX #&07 550.initloop 560STA xcoord,X \ &70-&77 = #&00 570DEX 580BPL initloop 590LDY screen \ screen mode into Y register 600CPY #&06 \ is this mode 6 or 7? 610BCS out \ exit if non-graphics mode 620CPY #&03 \ is this mode 3? 630BEQ out \ exit if non-graphics mode 640LDA start \ screen start address, low byte 650STA ycoord 660LDA start+1 \ screen start address, high byte 670STA ycoord+1 680LSR ycoord+1 690ROR ycoord \ start address DIV 2 700LSR ycoord+1 710ROR ycoord \ start address DIV 4 720LSR ycoord+1 730ROR ycoord \ start address DIV 8 740LDA offsetlow,Y \ trim the offset 750CLC \ prepare for addition 760ADC ycoord \ add trim to offset 770STA ycoord 780LDA #&00 790ADC ycoord+1 800STA ycoord+1 810SEC \ prepare to subtract offset from light pen register 820LDX #&11 \ light pen register, low byte 830STX sheila \ 6845 address register 840LDA sheila+1 \ 6845 data register 850SBC ycoord \ subtract offset, low byte 860STA ycoord \ low byte - offset 870DEX \ X = #&10 880STX sheila \ 6845 address register 890LDA sheila+1 \ 6845 data register 900SBC ycoord+1 \ subtract offset, high byte 910STA ycoord+1 \ high byte - offset 920.next 930ASL ycoord \ shift dividend/quotient left 940ROL ycoord+1 \ shift dividend/quotient left 950ROL xcoord \ shift bits into partial dividend 960LDA xcoord \ load partial dividend 970SEC \ prepare for subtraction 980SBC width,Y \ subtract divisor 990BCC done \ branch if dividend < divisor 1000INC ycoord \ increment quotient 1010STA xcoord \ save new partial dividend 1020.done 1030DEX \ decrement bit counter 1040BNE next \ branch for 16 bits 1050LDA xloop,Y \ prepare for multiplication 1060TAX \ X=4 modes 0-3, X=5 modes 4-7 1070.multx 1080ASL xcoord \ low byte * 2 1090ROL xcoord+1 \ high byte * 2 1100DEX \ count number of multiplications 1110BNE multx \ go back if not finished 1120LDA xadd,Y \ A=8 modes 0-3, A=16 modes 4-7 1130CLC \ prepare for addition 1140ADC xcoord 1150STA xcoord 1160LDA #&00 1170ADC xcoord+1 1180STA xcoord+1 1190LDX #&05 \ prepare for y coordinate multiplication 1200.multy 1210ASL ycoord \ low byte * 2 1220ROL ycoord+1 \ high byte * 2 1230DEX \ count number of multiplications 1240BNE multy \ go back if not finished 1250SEC \ prepare for subtraction 1260LDA #&F0 \ low byte of decimal 1008 1270SBC ycoord \ ycoord-#&F0 1280STA ycoord 1290LDA #&03 \ high byte of decimal 1008 1300SBC ycoord+1 \ (ycoord+1)-#&03 1310STA ycoord+1 1320.pullout 1330PLA \ pull data register B 1340AND #&20 \ %00100000 1350STA fire \ store fire button status 1360PLA 1370TAY \ restore Y 1380PLA 1390TAX \ restore X 1400PLA 1410STA savereg \ restore zero page 1420LDA #&00 \ interrupt serviced 1430RTS \ return to operating system 1440.offsetlow 1450EQUB &04 \ mode0, untrimmed = &06 1460EQUB &04 \ mode1, untrimmed = &06 1470EQUB &04 \ mode2, untrimmed = &06 1480EQUB &00 \ mode3, dummy value 1490EQUB &03 \ mode4, untrimmed = &04 1500EQUB &03 \ mode5, untrimmed = &04 1510.xloop 1520EQUD &00040404 \ modes 3-0 1530EQUW &0505 \ modes 5-4 1540.xadd 1550EQUD &00080808 \ modes 3-0 1560EQUW &1010 \ modes 5-4 1570.width 1580EQUD &00505050 \ modes 3-0 1590EQUW &2828 \ modes 5-4 1600.lastbyte 1610] 1620NEXT 1630*OPT1,2 1640OSCLI("SAVE LPGRAPH "+STR$~(mcode)+" + "+STR$~(lastbyte-&8000)+" FFFF8000 FFFF8000") 1650*OPT0,0
�> SWGRAPH � mcode &200 xcoord=&70 :�: &70-&73 (ycoord=&74 :�: &74-&77 2#fire=&78 :�: fire button status <7savereg=&FC :�: interrupt accumulator save register F'start=&350 :�: screen start address P&screen=&355 :�: screen mode OS 1.2 Zsheila=&FE00 d-drb=&FE40 :�: system 6522 data register B n5ifr=&FE4D :�: system 6522 interrupt flag register x7ier=&FE4E :�: system 6522 interrupt enable register �� pass=4 � 6 � 2 �O%=mcode �P%=&8000 � [OPT pass �BRK �BRK �BRK �&JMP service \ service entry to ROM �6EQUB &82 \ ROM type byte indicates a service entry �3EQUB copyright � 256 \ copyright offset pointer �BRK �,EQUS "Light pen Graphics" \ title string �.copyright BRK \ start of copyright 8EQUS "(C) Gordon Horsington 1987" \ copyright string BRK \ copyright terminator ".out ,JMP pullout 6 .exit @PLA JSTA savereg T2LDA #&05 \ unrecognised interrupt service call ^.return hRTS r.service |1CMP #&05 \ is this an unrecognised interrupt? �(BNE return \ branch if not interrupt �:LDA savereg \ load interrupt accumulator save register �"PHA \ and push it on the stack �5LDA ifr \ load system VIA interrupt flag register �"BPL exit \ exit if bit 7 clear �� #&08 \ � with %00001000 �.BEQ exit \ exit if not light pen interrupt �TXA �PHA �TYA �PHA �LDA drb \ clear interrupt �PHA \ push data register B CLD \ clear decimal flag LDA #&00 LDX #&07 & .initloop 0!STA xcoord,X \ &70-&77 = #&00 :DEX DBPL initloop N,LDY screen \ screen mode into Y register X#CPY #&06 \ is this mode 6 or 7? b'BCS out \ exit if non-graphics mode lCPY #&03 \ is this mode 3? v'BEQ out \ exit if non-graphics mode �.LDA start \ screen start address, low byte �STA ycoord �1LDA start+1 \ screen start address, high byte �STA ycoord+1 �LSR ycoord+1 �"ROR ycoord \ start address � 2 �LSR ycoord+1 �"ROR ycoord \ start address � 4 �LSR ycoord+1 �"ROR ycoord \ start address � 8 �%LDA offsetlow,Y \ trim the offset �CLC \ prepare for addition �#ADC ycoord \ add trim to offset STA ycoord LDA #&00 ADC ycoord+1 STA ycoord+1 *<SEC \ prepare to subtract offset from light pen register 4+LDX #&11 \ light pen register, low byte >&STX sheila \ 6845 address register H%LDA sheila+1 \ 6845 data register R*SBC ycoord \ subtract offset, low byte \"STA ycoord \ low byte - offset fDEX \ X = #&10 p&STX sheila \ 6845 address register z%LDA sheila+1 \ 6845 data register �-SBC ycoord+1 \ subtract offset, high byte �%STA ycoord+1 \ high byte - offset � .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 � .done DEX \ decrement bit counter !BNE next \ branch for 16 bits ,LDA xloop,Y \ prepare for multiplication $&TAX \ X=4 modes 0-3, X=5 modes 4-7 . .multx 8ASL xcoord \ low byte * 2 B ROL xcoord+1 \ high byte * 2 L)DEX \ count number of multiplications V'BNE multx \ go back if not finished `.LDA xadd,Y \ A=8 modes 0-3, A=16 modes 4-7 jCLC \ prepare for addition tADC xcoord ~STA xcoord �LDA #&00 �ADC xcoord+1 �STA xcoord+1 �6LDX #&05 \ prepare for y coordinate multiplication � .multy �ASL ycoord \ low byte * 2 � ROL ycoord+1 \ high byte * 2 �)DEX \ count number of multiplications �'BNE multy \ go back if not finished �!SEC \ prepare for subtraction �'LDA #&F0 \ low byte of decimal 1008 �SBC ycoord \ ycoord-#&F0 STA ycoord (LDA #&03 \ high byte of decimal 1008 "SBC ycoord+1 \ (ycoord+1)-#&03 STA ycoord+1 (.pullout 2PLA \ pull data register B <� #&20 \ %00100000 F'STA fire \ store fire button status PPLA ZTAY \ restore Y dPLA nTAX \ restore X xPLA �#STA savereg \ restore zero page �!LDA #&00 \ interrupt serviced �$RTS \ return to operating system �.offsetlow �%EQUB &04 \ mode0, untrimmed = &06 �%EQUB &04 \ mode1, untrimmed = &06 �%EQUB &04 \ mode2, untrimmed = &06 �!EQUB &00 \ mode3, dummy value �%EQUB &03 \ mode4, untrimmed = &04 �%EQUB &03 \ mode5, untrimmed = &04 � .xloop �EQUD &00040404 \ modes 3-0 �EQUW &0505 \ modes 5-4 .xadd EQUD &00080808 \ modes 3-0 EQUW &1010 \ modes 5-4 " .width ,EQUD &00505050 \ modes 3-0 6EQUW &2828 \ modes 5-4 @ .lastbyte J] T� ^*OPT1,2 hN�("SAVE LPGRAPH "+�~(mcode)+" + "+�~(lastbyte-&8000)+" FFFF8000 FFFF8000") r*OPT0,0 �
00000000 0d 00 0a 0e f4 3e 20 53 57 47 52 41 50 48 0d 00 |.....> SWGRAPH..| 00000010 14 10 de 20 6d 63 6f 64 65 20 26 32 30 30 0d 00 |... mcode &200..| 00000020 1e 1a 78 63 6f 6f 72 64 3d 26 37 30 20 3a f4 3a |..xcoord=&70 :.:| 00000030 20 26 37 30 2d 26 37 33 0d 00 28 1a 79 63 6f 6f | &70-&73..(.ycoo| 00000040 72 64 3d 26 37 34 20 3a f4 3a 20 26 37 34 2d 26 |rd=&74 :.: &74-&| 00000050 37 37 0d 00 32 23 66 69 72 65 3d 26 37 38 20 3a |77..2#fire=&78 :| 00000060 f4 3a 20 66 69 72 65 20 62 75 74 74 6f 6e 20 73 |.: fire button s| 00000070 74 61 74 75 73 0d 00 3c 37 73 61 76 65 72 65 67 |tatus..<7savereg| 00000080 3d 26 46 43 20 3a f4 3a 20 69 6e 74 65 72 72 75 |=&FC :.: interru| 00000090 70 74 20 61 63 63 75 6d 75 6c 61 74 6f 72 20 73 |pt accumulator s| 000000a0 61 76 65 20 72 65 67 69 73 74 65 72 0d 00 46 27 |ave register..F'| 000000b0 73 74 61 72 74 3d 26 33 35 30 20 3a f4 3a 20 73 |start=&350 :.: s| 000000c0 63 72 65 65 6e 20 73 74 61 72 74 20 61 64 64 72 |creen start addr| 000000d0 65 73 73 0d 00 50 26 73 63 72 65 65 6e 3d 26 33 |ess..P&screen=&3| 000000e0 35 35 20 3a f4 3a 20 73 63 72 65 65 6e 20 6d 6f |55 :.: screen mo| 000000f0 64 65 20 4f 53 20 31 2e 32 0d 00 5a 10 73 68 65 |de OS 1.2..Z.she| 00000100 69 6c 61 3d 26 46 45 30 30 0d 00 64 2d 64 72 62 |ila=&FE00..d-drb| 00000110 3d 26 46 45 34 30 20 3a f4 3a 20 73 79 73 74 65 |=&FE40 :.: syste| 00000120 6d 20 36 35 32 32 20 64 61 74 61 20 72 65 67 69 |m 6522 data regi| 00000130 73 74 65 72 20 42 0d 00 6e 35 69 66 72 3d 26 46 |ster B..n5ifr=&F| 00000140 45 34 44 20 3a f4 3a 20 73 79 73 74 65 6d 20 36 |E4D :.: system 6| 00000150 35 32 32 20 69 6e 74 65 72 72 75 70 74 20 66 6c |522 interrupt fl| 00000160 61 67 20 72 65 67 69 73 74 65 72 0d 00 78 37 69 |ag register..x7i| 00000170 65 72 3d 26 46 45 34 45 20 3a f4 3a 20 73 79 73 |er=&FE4E :.: sys| 00000180 74 65 6d 20 36 35 32 32 20 69 6e 74 65 72 72 75 |tem 6522 interru| 00000190 70 74 20 65 6e 61 62 6c 65 20 72 65 67 69 73 74 |pt enable regist| 000001a0 65 72 0d 00 82 14 e3 20 70 61 73 73 3d 34 20 b8 |er..... pass=4 .| 000001b0 20 36 20 88 20 32 0d 00 8c 0c 4f 25 3d 6d 63 6f | 6 . 2....O%=mco| 000001c0 64 65 0d 00 96 0c 50 25 3d 26 38 30 30 30 0d 00 |de....P%=&8000..| 000001d0 a0 0d 5b 4f 50 54 20 70 61 73 73 0d 00 aa 07 42 |..[OPT pass....B| 000001e0 52 4b 0d 00 b4 07 42 52 4b 0d 00 be 07 42 52 4b |RK....BRK....BRK| 000001f0 0d 00 c8 26 4a 4d 50 20 73 65 72 76 69 63 65 20 |...&JMP service | 00000200 5c 20 73 65 72 76 69 63 65 20 65 6e 74 72 79 20 |\ service entry | 00000210 74 6f 20 52 4f 4d 0d 00 d2 36 45 51 55 42 20 26 |to ROM...6EQUB &| 00000220 38 32 20 5c 20 52 4f 4d 20 74 79 70 65 20 62 79 |82 \ ROM type by| 00000230 74 65 20 69 6e 64 69 63 61 74 65 73 20 61 20 73 |te indicates a s| 00000240 65 72 76 69 63 65 20 65 6e 74 72 79 0d 00 dc 33 |ervice entry...3| 00000250 45 51 55 42 20 63 6f 70 79 72 69 67 68 74 20 83 |EQUB copyright .| 00000260 20 32 35 36 20 5c 20 63 6f 70 79 72 69 67 68 74 | 256 \ copyright| 00000270 20 6f 66 66 73 65 74 20 70 6f 69 6e 74 65 72 0d | offset pointer.| 00000280 00 e6 07 42 52 4b 0d 00 f0 2c 45 51 55 53 20 22 |...BRK...,EQUS "| 00000290 4c 69 67 68 74 20 70 65 6e 20 47 72 61 70 68 69 |Light pen Graphi| 000002a0 63 73 22 20 5c 20 74 69 74 6c 65 20 73 74 72 69 |cs" \ title stri| 000002b0 6e 67 0d 00 fa 0e 2e 63 6f 70 79 72 69 67 68 74 |ng.....copyright| 000002c0 0d 01 04 1c 42 52 4b 20 5c 20 73 74 61 72 74 20 |....BRK \ start | 000002d0 6f 66 20 63 6f 70 79 72 69 67 68 74 0d 01 0e 38 |of copyright...8| 000002e0 45 51 55 53 20 22 28 43 29 20 47 6f 72 64 6f 6e |EQUS "(C) Gordon| 000002f0 20 48 6f 72 73 69 6e 67 74 6f 6e 20 31 39 38 37 | Horsington 1987| 00000300 22 20 5c 20 63 6f 70 79 72 69 67 68 74 20 73 74 |" \ copyright st| 00000310 72 69 6e 67 0d 01 18 1e 42 52 4b 20 5c 20 63 6f |ring....BRK \ co| 00000320 70 79 72 69 67 68 74 20 74 65 72 6d 69 6e 61 74 |pyright terminat| 00000330 6f 72 0d 01 22 08 2e 6f 75 74 0d 01 2c 0f 4a 4d |or.."..out..,.JM| 00000340 50 20 70 75 6c 6c 6f 75 74 0d 01 36 09 2e 65 78 |P pullout..6..ex| 00000350 69 74 0d 01 40 07 50 4c 41 0d 01 4a 0f 53 54 41 |it..@.PLA..J.STA| 00000360 20 73 61 76 65 72 65 67 0d 01 54 32 4c 44 41 20 | savereg..T2LDA | 00000370 23 26 30 35 20 5c 20 75 6e 72 65 63 6f 67 6e 69 |#&05 \ unrecogni| 00000380 73 65 64 20 69 6e 74 65 72 72 75 70 74 20 73 65 |sed interrupt se| 00000390 72 76 69 63 65 20 63 61 6c 6c 0d 01 5e 0b 2e 72 |rvice call..^..r| 000003a0 65 74 75 72 6e 0d 01 68 07 52 54 53 0d 01 72 0c |eturn..h.RTS..r.| 000003b0 2e 73 65 72 76 69 63 65 0d 01 7c 31 43 4d 50 20 |.service..|1CMP | 000003c0 23 26 30 35 20 5c 20 69 73 20 74 68 69 73 20 61 |#&05 \ is this a| 000003d0 6e 20 75 6e 72 65 63 6f 67 6e 69 73 65 64 20 69 |n unrecognised i| 000003e0 6e 74 65 72 72 75 70 74 3f 0d 01 86 28 42 4e 45 |nterrupt?...(BNE| 000003f0 20 72 65 74 75 72 6e 20 5c 20 62 72 61 6e 63 68 | return \ branch| 00000400 20 69 66 20 6e 6f 74 20 69 6e 74 65 72 72 75 70 | if not interrup| 00000410 74 0d 01 90 3a 4c 44 41 20 73 61 76 65 72 65 67 |t...:LDA savereg| 00000420 20 5c 20 6c 6f 61 64 20 69 6e 74 65 72 72 75 70 | \ load interrup| 00000430 74 20 61 63 63 75 6d 75 6c 61 74 6f 72 20 73 61 |t accumulator sa| 00000440 76 65 20 72 65 67 69 73 74 65 72 0d 01 9a 22 50 |ve register..."P| 00000450 48 41 20 5c 20 61 6e 64 20 70 75 73 68 20 69 74 |HA \ and push it| 00000460 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 0d 01 a4 | on the stack...| 00000470 35 4c 44 41 20 69 66 72 20 5c 20 6c 6f 61 64 20 |5LDA ifr \ load | 00000480 73 79 73 74 65 6d 20 56 49 41 20 69 6e 74 65 72 |system VIA inter| 00000490 72 75 70 74 20 66 6c 61 67 20 72 65 67 69 73 74 |rupt flag regist| 000004a0 65 72 0d 01 ae 22 42 50 4c 20 65 78 69 74 20 5c |er..."BPL exit \| 000004b0 20 65 78 69 74 20 69 66 20 62 69 74 20 37 20 63 | exit if bit 7 c| 000004c0 6c 65 61 72 0d 01 b8 1d 80 20 23 26 30 38 20 5c |lear..... #&08 \| 000004d0 20 80 20 77 69 74 68 20 25 30 30 30 30 31 30 30 | . with %0000100| 000004e0 30 0d 01 c2 2e 42 45 51 20 65 78 69 74 20 5c 20 |0....BEQ exit \ | 000004f0 65 78 69 74 20 69 66 20 6e 6f 74 20 6c 69 67 68 |exit if not ligh| 00000500 74 20 70 65 6e 20 69 6e 74 65 72 72 75 70 74 0d |t pen interrupt.| 00000510 01 cc 07 54 58 41 0d 01 d6 07 50 48 41 0d 01 e0 |...TXA....PHA...| 00000520 07 54 59 41 0d 01 ea 07 50 48 41 0d 01 f4 1d 4c |.TYA....PHA....L| 00000530 44 41 20 64 72 62 20 5c 20 63 6c 65 61 72 20 69 |DA drb \ clear i| 00000540 6e 74 65 72 72 75 70 74 0d 01 fe 1e 50 48 41 20 |nterrupt....PHA | 00000550 5c 20 70 75 73 68 20 64 61 74 61 20 72 65 67 69 |\ push data regi| 00000560 73 74 65 72 20 42 0d 02 08 1c 43 4c 44 20 5c 20 |ster B....CLD \ | 00000570 63 6c 65 61 72 20 64 65 63 69 6d 61 6c 20 66 6c |clear decimal fl| 00000580 61 67 0d 02 12 0c 4c 44 41 20 23 26 30 30 0d 02 |ag....LDA #&00..| 00000590 1c 0c 4c 44 58 20 23 26 30 37 0d 02 26 0d 2e 69 |..LDX #&07..&..i| 000005a0 6e 69 74 6c 6f 6f 70 0d 02 30 21 53 54 41 20 78 |nitloop..0!STA x| 000005b0 63 6f 6f 72 64 2c 58 20 5c 20 26 37 30 2d 26 37 |coord,X \ &70-&7| 000005c0 37 20 3d 20 23 26 30 30 0d 02 3a 07 44 45 58 0d |7 = #&00..:.DEX.| 000005d0 02 44 10 42 50 4c 20 69 6e 69 74 6c 6f 6f 70 0d |.D.BPL initloop.| 000005e0 02 4e 2c 4c 44 59 20 73 63 72 65 65 6e 20 5c 20 |.N,LDY screen \ | 000005f0 73 63 72 65 65 6e 20 6d 6f 64 65 20 69 6e 74 6f |screen mode into| 00000600 20 59 20 72 65 67 69 73 74 65 72 0d 02 58 23 43 | Y register..X#C| 00000610 50 59 20 23 26 30 36 20 5c 20 69 73 20 74 68 69 |PY #&06 \ is thi| 00000620 73 20 6d 6f 64 65 20 36 20 6f 72 20 37 3f 0d 02 |s mode 6 or 7?..| 00000630 62 27 42 43 53 20 6f 75 74 20 5c 20 65 78 69 74 |b'BCS out \ exit| 00000640 20 69 66 20 6e 6f 6e 2d 67 72 61 70 68 69 63 73 | if non-graphics| 00000650 20 6d 6f 64 65 0d 02 6c 1e 43 50 59 20 23 26 30 | mode..l.CPY #&0| 00000660 33 20 5c 20 69 73 20 74 68 69 73 20 6d 6f 64 65 |3 \ is this mode| 00000670 20 33 3f 0d 02 76 27 42 45 51 20 6f 75 74 20 5c | 3?..v'BEQ out \| 00000680 20 65 78 69 74 20 69 66 20 6e 6f 6e 2d 67 72 61 | exit if non-gra| 00000690 70 68 69 63 73 20 6d 6f 64 65 0d 02 80 2e 4c 44 |phics mode....LD| 000006a0 41 20 73 74 61 72 74 20 5c 20 73 63 72 65 65 6e |A start \ screen| 000006b0 20 73 74 61 72 74 20 61 64 64 72 65 73 73 2c 20 | start address, | 000006c0 6c 6f 77 20 62 79 74 65 0d 02 8a 0e 53 54 41 20 |low byte....STA | 000006d0 79 63 6f 6f 72 64 0d 02 94 31 4c 44 41 20 73 74 |ycoord...1LDA st| 000006e0 61 72 74 2b 31 20 5c 20 73 63 72 65 65 6e 20 73 |art+1 \ screen s| 000006f0 74 61 72 74 20 61 64 64 72 65 73 73 2c 20 68 69 |tart address, hi| 00000700 67 68 20 62 79 74 65 0d 02 9e 10 53 54 41 20 79 |gh byte....STA y| 00000710 63 6f 6f 72 64 2b 31 0d 02 a8 10 4c 53 52 20 79 |coord+1....LSR y| 00000720 63 6f 6f 72 64 2b 31 0d 02 b2 22 52 4f 52 20 79 |coord+1..."ROR y| 00000730 63 6f 6f 72 64 20 5c 20 73 74 61 72 74 20 61 64 |coord \ start ad| 00000740 64 72 65 73 73 20 81 20 32 0d 02 bc 10 4c 53 52 |dress . 2....LSR| 00000750 20 79 63 6f 6f 72 64 2b 31 0d 02 c6 22 52 4f 52 | ycoord+1..."ROR| 00000760 20 79 63 6f 6f 72 64 20 5c 20 73 74 61 72 74 20 | ycoord \ start | 00000770 61 64 64 72 65 73 73 20 81 20 34 0d 02 d0 10 4c |address . 4....L| 00000780 53 52 20 79 63 6f 6f 72 64 2b 31 0d 02 da 22 52 |SR ycoord+1..."R| 00000790 4f 52 20 79 63 6f 6f 72 64 20 5c 20 73 74 61 72 |OR ycoord \ star| 000007a0 74 20 61 64 64 72 65 73 73 20 81 20 38 0d 02 e4 |t address . 8...| 000007b0 25 4c 44 41 20 6f 66 66 73 65 74 6c 6f 77 2c 59 |%LDA offsetlow,Y| 000007c0 20 5c 20 74 72 69 6d 20 74 68 65 20 6f 66 66 73 | \ trim the offs| 000007d0 65 74 0d 02 ee 1e 43 4c 43 20 5c 20 70 72 65 70 |et....CLC \ prep| 000007e0 61 72 65 20 66 6f 72 20 61 64 64 69 74 69 6f 6e |are for addition| 000007f0 0d 02 f8 23 41 44 43 20 79 63 6f 6f 72 64 20 5c |...#ADC ycoord \| 00000800 20 61 64 64 20 74 72 69 6d 20 74 6f 20 6f 66 66 | add trim to off| 00000810 73 65 74 0d 03 02 0e 53 54 41 20 79 63 6f 6f 72 |set....STA ycoor| 00000820 64 0d 03 0c 0c 4c 44 41 20 23 26 30 30 0d 03 16 |d....LDA #&00...| 00000830 10 41 44 43 20 79 63 6f 6f 72 64 2b 31 0d 03 20 |.ADC ycoord+1.. | 00000840 10 53 54 41 20 79 63 6f 6f 72 64 2b 31 0d 03 2a |.STA ycoord+1..*| 00000850 3c 53 45 43 20 5c 20 70 72 65 70 61 72 65 20 74 |<SEC \ prepare t| 00000860 6f 20 73 75 62 74 72 61 63 74 20 6f 66 66 73 65 |o subtract offse| 00000870 74 20 66 72 6f 6d 20 6c 69 67 68 74 20 70 65 6e |t from light pen| 00000880 20 72 65 67 69 73 74 65 72 0d 03 34 2b 4c 44 58 | register..4+LDX| 00000890 20 23 26 31 31 20 5c 20 6c 69 67 68 74 20 70 65 | #&11 \ light pe| 000008a0 6e 20 72 65 67 69 73 74 65 72 2c 20 6c 6f 77 20 |n register, low | 000008b0 62 79 74 65 0d 03 3e 26 53 54 58 20 73 68 65 69 |byte..>&STX shei| 000008c0 6c 61 20 5c 20 36 38 34 35 20 61 64 64 72 65 73 |la \ 6845 addres| 000008d0 73 20 72 65 67 69 73 74 65 72 0d 03 48 25 4c 44 |s register..H%LD| 000008e0 41 20 73 68 65 69 6c 61 2b 31 20 5c 20 36 38 34 |A sheila+1 \ 684| 000008f0 35 20 64 61 74 61 20 72 65 67 69 73 74 65 72 0d |5 data register.| 00000900 03 52 2a 53 42 43 20 79 63 6f 6f 72 64 20 5c 20 |.R*SBC ycoord \ | 00000910 73 75 62 74 72 61 63 74 20 6f 66 66 73 65 74 2c |subtract offset,| 00000920 20 6c 6f 77 20 62 79 74 65 0d 03 5c 22 53 54 41 | low byte..\"STA| 00000930 20 79 63 6f 6f 72 64 20 5c 20 6c 6f 77 20 62 79 | ycoord \ low by| 00000940 74 65 20 2d 20 6f 66 66 73 65 74 0d 03 66 12 44 |te - offset..f.D| 00000950 45 58 20 5c 20 58 20 3d 20 23 26 31 30 0d 03 70 |EX \ X = #&10..p| 00000960 26 53 54 58 20 73 68 65 69 6c 61 20 5c 20 36 38 |&STX sheila \ 68| 00000970 34 35 20 61 64 64 72 65 73 73 20 72 65 67 69 73 |45 address regis| 00000980 74 65 72 0d 03 7a 25 4c 44 41 20 73 68 65 69 6c |ter..z%LDA sheil| 00000990 61 2b 31 20 5c 20 36 38 34 35 20 64 61 74 61 20 |a+1 \ 6845 data | 000009a0 72 65 67 69 73 74 65 72 0d 03 84 2d 53 42 43 20 |register...-SBC | 000009b0 79 63 6f 6f 72 64 2b 31 20 5c 20 73 75 62 74 72 |ycoord+1 \ subtr| 000009c0 61 63 74 20 6f 66 66 73 65 74 2c 20 68 69 67 68 |act offset, high| 000009d0 20 62 79 74 65 0d 03 8e 25 53 54 41 20 79 63 6f | byte...%STA yco| 000009e0 6f 72 64 2b 31 20 5c 20 68 69 67 68 20 62 79 74 |ord+1 \ high byt| 000009f0 65 20 2d 20 6f 66 66 73 65 74 0d 03 98 09 2e 6e |e - offset.....n| 00000a00 65 78 74 0d 03 a2 2d 41 53 4c 20 79 63 6f 6f 72 |ext...-ASL ycoor| 00000a10 64 20 5c 20 73 68 69 66 74 20 64 69 76 69 64 65 |d \ shift divide| 00000a20 6e 64 2f 71 75 6f 74 69 65 6e 74 20 6c 65 66 74 |nd/quotient left| 00000a30 0d 03 ac 2f 52 4f 4c 20 79 63 6f 6f 72 64 2b 31 |.../ROL ycoord+1| 00000a40 20 5c 20 73 68 69 66 74 20 64 69 76 69 64 65 6e | \ shift dividen| 00000a50 64 2f 71 75 6f 74 69 65 6e 74 20 6c 65 66 74 0d |d/quotient left.| 00000a60 03 b6 31 52 4f 4c 20 78 63 6f 6f 72 64 20 5c 20 |..1ROL xcoord \ | 00000a70 73 68 69 66 74 20 62 69 74 73 20 69 6e 74 6f 20 |shift bits into | 00000a80 70 61 72 74 69 61 6c 20 64 69 76 69 64 65 6e 64 |partial dividend| 00000a90 0d 03 c0 26 4c 44 41 20 78 63 6f 6f 72 64 20 5c |...&LDA xcoord \| 00000aa0 20 6c 6f 61 64 20 70 61 72 74 69 61 6c 20 64 69 | load partial di| 00000ab0 76 69 64 65 6e 64 0d 03 ca 21 53 45 43 20 5c 20 |vidend...!SEC \ | 00000ac0 70 72 65 70 61 72 65 20 66 6f 72 20 73 75 62 74 |prepare for subt| 00000ad0 72 61 63 74 69 6f 6e 0d 03 d4 22 53 42 43 20 77 |raction..."SBC w| 00000ae0 69 64 74 68 2c 59 20 5c 20 73 75 62 74 72 61 63 |idth,Y \ subtrac| 00000af0 74 20 64 69 76 69 73 6f 72 0d 03 de 2b 42 43 43 |t divisor...+BCC| 00000b00 20 64 6f 6e 65 20 5c 20 62 72 61 6e 63 68 20 69 | done \ branch i| 00000b10 66 20 64 69 76 69 64 65 6e 64 20 3c 20 64 69 76 |f dividend < div| 00000b20 69 73 6f 72 0d 03 e8 23 49 4e 43 20 79 63 6f 6f |isor...#INC ycoo| 00000b30 72 64 20 5c 20 69 6e 63 72 65 6d 65 6e 74 20 71 |rd \ increment q| 00000b40 75 6f 74 69 65 6e 74 0d 03 f2 2a 53 54 41 20 78 |uotient...*STA x| 00000b50 63 6f 6f 72 64 20 5c 20 73 61 76 65 20 6e 65 77 |coord \ save new| 00000b60 20 70 61 72 74 69 61 6c 20 64 69 76 69 64 65 6e | partial dividen| 00000b70 64 0d 03 fc 09 2e 64 6f 6e 65 0d 04 06 1f 44 45 |d.....done....DE| 00000b80 58 20 5c 20 64 65 63 72 65 6d 65 6e 74 20 62 69 |X \ decrement bi| 00000b90 74 20 63 6f 75 6e 74 65 72 0d 04 10 21 42 4e 45 |t counter...!BNE| 00000ba0 20 6e 65 78 74 20 5c 20 62 72 61 6e 63 68 20 66 | next \ branch f| 00000bb0 6f 72 20 31 36 20 62 69 74 73 0d 04 1a 2c 4c 44 |or 16 bits...,LD| 00000bc0 41 20 78 6c 6f 6f 70 2c 59 20 5c 20 70 72 65 70 |A xloop,Y \ prep| 00000bd0 61 72 65 20 66 6f 72 20 6d 75 6c 74 69 70 6c 69 |are for multipli| 00000be0 63 61 74 69 6f 6e 0d 04 24 26 54 41 58 20 5c 20 |cation..$&TAX \ | 00000bf0 58 3d 34 20 6d 6f 64 65 73 20 30 2d 33 2c 20 58 |X=4 modes 0-3, X| 00000c00 3d 35 20 6d 6f 64 65 73 20 34 2d 37 0d 04 2e 0a |=5 modes 4-7....| 00000c10 2e 6d 75 6c 74 78 0d 04 38 1d 41 53 4c 20 78 63 |.multx..8.ASL xc| 00000c20 6f 6f 72 64 20 5c 20 6c 6f 77 20 62 79 74 65 20 |oord \ low byte | 00000c30 2a 20 32 0d 04 42 20 52 4f 4c 20 78 63 6f 6f 72 |* 2..B ROL xcoor| 00000c40 64 2b 31 20 5c 20 68 69 67 68 20 62 79 74 65 20 |d+1 \ high byte | 00000c50 2a 20 32 0d 04 4c 29 44 45 58 20 5c 20 63 6f 75 |* 2..L)DEX \ cou| 00000c60 6e 74 20 6e 75 6d 62 65 72 20 6f 66 20 6d 75 6c |nt number of mul| 00000c70 74 69 70 6c 69 63 61 74 69 6f 6e 73 0d 04 56 27 |tiplications..V'| 00000c80 42 4e 45 20 6d 75 6c 74 78 20 5c 20 67 6f 20 62 |BNE multx \ go b| 00000c90 61 63 6b 20 69 66 20 6e 6f 74 20 66 69 6e 69 73 |ack if not finis| 00000ca0 68 65 64 0d 04 60 2e 4c 44 41 20 78 61 64 64 2c |hed..`.LDA xadd,| 00000cb0 59 20 5c 20 41 3d 38 20 6d 6f 64 65 73 20 30 2d |Y \ A=8 modes 0-| 00000cc0 33 2c 20 41 3d 31 36 20 6d 6f 64 65 73 20 34 2d |3, A=16 modes 4-| 00000cd0 37 0d 04 6a 1e 43 4c 43 20 5c 20 70 72 65 70 61 |7..j.CLC \ prepa| 00000ce0 72 65 20 66 6f 72 20 61 64 64 69 74 69 6f 6e 0d |re for addition.| 00000cf0 04 74 0e 41 44 43 20 78 63 6f 6f 72 64 0d 04 7e |.t.ADC xcoord..~| 00000d00 0e 53 54 41 20 78 63 6f 6f 72 64 0d 04 88 0c 4c |.STA xcoord....L| 00000d10 44 41 20 23 26 30 30 0d 04 92 10 41 44 43 20 78 |DA #&00....ADC x| 00000d20 63 6f 6f 72 64 2b 31 0d 04 9c 10 53 54 41 20 78 |coord+1....STA x| 00000d30 63 6f 6f 72 64 2b 31 0d 04 a6 36 4c 44 58 20 23 |coord+1...6LDX #| 00000d40 26 30 35 20 5c 20 70 72 65 70 61 72 65 20 66 6f |&05 \ prepare fo| 00000d50 72 20 79 20 63 6f 6f 72 64 69 6e 61 74 65 20 6d |r y coordinate m| 00000d60 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 0d 04 b0 |ultiplication...| 00000d70 0a 2e 6d 75 6c 74 79 0d 04 ba 1d 41 53 4c 20 79 |..multy....ASL y| 00000d80 63 6f 6f 72 64 20 5c 20 6c 6f 77 20 62 79 74 65 |coord \ low byte| 00000d90 20 2a 20 32 0d 04 c4 20 52 4f 4c 20 79 63 6f 6f | * 2... ROL ycoo| 00000da0 72 64 2b 31 20 5c 20 68 69 67 68 20 62 79 74 65 |rd+1 \ high byte| 00000db0 20 2a 20 32 0d 04 ce 29 44 45 58 20 5c 20 63 6f | * 2...)DEX \ co| 00000dc0 75 6e 74 20 6e 75 6d 62 65 72 20 6f 66 20 6d 75 |unt number of mu| 00000dd0 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 0d 04 d8 |ltiplications...| 00000de0 27 42 4e 45 20 6d 75 6c 74 79 20 5c 20 67 6f 20 |'BNE multy \ go | 00000df0 62 61 63 6b 20 69 66 20 6e 6f 74 20 66 69 6e 69 |back if not fini| 00000e00 73 68 65 64 0d 04 e2 21 53 45 43 20 5c 20 70 72 |shed...!SEC \ pr| 00000e10 65 70 61 72 65 20 66 6f 72 20 73 75 62 74 72 61 |epare for subtra| 00000e20 63 74 69 6f 6e 0d 04 ec 27 4c 44 41 20 23 26 46 |ction...'LDA #&F| 00000e30 30 20 5c 20 6c 6f 77 20 62 79 74 65 20 6f 66 20 |0 \ low byte of | 00000e40 64 65 63 69 6d 61 6c 20 31 30 30 38 0d 04 f6 1c |decimal 1008....| 00000e50 53 42 43 20 79 63 6f 6f 72 64 20 5c 20 79 63 6f |SBC ycoord \ yco| 00000e60 6f 72 64 2d 23 26 46 30 0d 05 00 0e 53 54 41 20 |ord-#&F0....STA | 00000e70 79 63 6f 6f 72 64 0d 05 0a 28 4c 44 41 20 23 26 |ycoord...(LDA #&| 00000e80 30 33 20 5c 20 68 69 67 68 20 62 79 74 65 20 6f |03 \ high byte o| 00000e90 66 20 64 65 63 69 6d 61 6c 20 31 30 30 38 0d 05 |f decimal 1008..| 00000ea0 14 22 53 42 43 20 79 63 6f 6f 72 64 2b 31 20 5c |."SBC ycoord+1 \| 00000eb0 20 28 79 63 6f 6f 72 64 2b 31 29 2d 23 26 30 33 | (ycoord+1)-#&03| 00000ec0 0d 05 1e 10 53 54 41 20 79 63 6f 6f 72 64 2b 31 |....STA ycoord+1| 00000ed0 0d 05 28 0c 2e 70 75 6c 6c 6f 75 74 0d 05 32 1e |..(..pullout..2.| 00000ee0 50 4c 41 20 5c 20 70 75 6c 6c 20 64 61 74 61 20 |PLA \ pull data | 00000ef0 72 65 67 69 73 74 65 72 20 42 0d 05 3c 16 80 20 |register B..<.. | 00000f00 23 26 32 30 20 5c 20 25 30 30 31 30 30 30 30 30 |#&20 \ %00100000| 00000f10 0d 05 46 27 53 54 41 20 66 69 72 65 20 5c 20 73 |..F'STA fire \ s| 00000f20 74 6f 72 65 20 66 69 72 65 20 62 75 74 74 6f 6e |tore fire button| 00000f30 20 73 74 61 74 75 73 0d 05 50 07 50 4c 41 0d 05 | status..P.PLA..| 00000f40 5a 13 54 41 59 20 5c 20 72 65 73 74 6f 72 65 20 |Z.TAY \ restore | 00000f50 59 0d 05 64 07 50 4c 41 0d 05 6e 13 54 41 58 20 |Y..d.PLA..n.TAX | 00000f60 5c 20 72 65 73 74 6f 72 65 20 58 0d 05 78 07 50 |\ restore X..x.P| 00000f70 4c 41 0d 05 82 23 53 54 41 20 73 61 76 65 72 65 |LA...#STA savere| 00000f80 67 20 5c 20 72 65 73 74 6f 72 65 20 7a 65 72 6f |g \ restore zero| 00000f90 20 70 61 67 65 0d 05 8c 21 4c 44 41 20 23 26 30 | page...!LDA #&0| 00000fa0 30 20 5c 20 69 6e 74 65 72 72 75 70 74 20 73 65 |0 \ interrupt se| 00000fb0 72 76 69 63 65 64 0d 05 96 24 52 54 53 20 5c 20 |rviced...$RTS \ | 00000fc0 72 65 74 75 72 6e 20 74 6f 20 6f 70 65 72 61 74 |return to operat| 00000fd0 69 6e 67 20 73 79 73 74 65 6d 0d 05 a0 0e 2e 6f |ing system.....o| 00000fe0 66 66 73 65 74 6c 6f 77 0d 05 aa 25 45 51 55 42 |ffsetlow...%EQUB| 00000ff0 20 26 30 34 20 5c 20 6d 6f 64 65 30 2c 20 75 6e | &04 \ mode0, un| 00001000 74 72 69 6d 6d 65 64 20 3d 20 26 30 36 0d 05 b4 |trimmed = &06...| 00001010 25 45 51 55 42 20 26 30 34 20 5c 20 6d 6f 64 65 |%EQUB &04 \ mode| 00001020 31 2c 20 75 6e 74 72 69 6d 6d 65 64 20 3d 20 26 |1, untrimmed = &| 00001030 30 36 0d 05 be 25 45 51 55 42 20 26 30 34 20 5c |06...%EQUB &04 \| 00001040 20 6d 6f 64 65 32 2c 20 75 6e 74 72 69 6d 6d 65 | mode2, untrimme| 00001050 64 20 3d 20 26 30 36 0d 05 c8 21 45 51 55 42 20 |d = &06...!EQUB | 00001060 26 30 30 20 5c 20 6d 6f 64 65 33 2c 20 64 75 6d |&00 \ mode3, dum| 00001070 6d 79 20 76 61 6c 75 65 0d 05 d2 25 45 51 55 42 |my value...%EQUB| 00001080 20 26 30 33 20 5c 20 6d 6f 64 65 34 2c 20 75 6e | &03 \ mode4, un| 00001090 74 72 69 6d 6d 65 64 20 3d 20 26 30 34 0d 05 dc |trimmed = &04...| 000010a0 25 45 51 55 42 20 26 30 33 20 5c 20 6d 6f 64 65 |%EQUB &03 \ mode| 000010b0 35 2c 20 75 6e 74 72 69 6d 6d 65 64 20 3d 20 26 |5, untrimmed = &| 000010c0 30 34 0d 05 e6 0a 2e 78 6c 6f 6f 70 0d 05 f0 1e |04.....xloop....| 000010d0 45 51 55 44 20 26 30 30 30 34 30 34 30 34 20 5c |EQUD &00040404 \| 000010e0 20 6d 6f 64 65 73 20 33 2d 30 0d 05 fa 1a 45 51 | modes 3-0....EQ| 000010f0 55 57 20 26 30 35 30 35 20 5c 20 6d 6f 64 65 73 |UW &0505 \ modes| 00001100 20 35 2d 34 0d 06 04 09 2e 78 61 64 64 0d 06 0e | 5-4.....xadd...| 00001110 1e 45 51 55 44 20 26 30 30 30 38 30 38 30 38 20 |.EQUD &00080808 | 00001120 5c 20 6d 6f 64 65 73 20 33 2d 30 0d 06 18 1a 45 |\ modes 3-0....E| 00001130 51 55 57 20 26 31 30 31 30 20 5c 20 6d 6f 64 65 |QUW &1010 \ mode| 00001140 73 20 35 2d 34 0d 06 22 0a 2e 77 69 64 74 68 0d |s 5-4.."..width.| 00001150 06 2c 1e 45 51 55 44 20 26 30 30 35 30 35 30 35 |.,.EQUD &0050505| 00001160 30 20 5c 20 6d 6f 64 65 73 20 33 2d 30 0d 06 36 |0 \ modes 3-0..6| 00001170 1a 45 51 55 57 20 26 32 38 32 38 20 5c 20 6d 6f |.EQUW &2828 \ mo| 00001180 64 65 73 20 35 2d 34 0d 06 40 0d 2e 6c 61 73 74 |des 5-4..@..last| 00001190 62 79 74 65 0d 06 4a 05 5d 0d 06 54 05 ed 0d 06 |byte..J.]..T....| 000011a0 5e 0b 2a 4f 50 54 31 2c 32 0d 06 68 4e ff 28 22 |^.*OPT1,2..hN.("| 000011b0 53 41 56 45 20 4c 50 47 52 41 50 48 20 22 2b c3 |SAVE LPGRAPH "+.| 000011c0 7e 28 6d 63 6f 64 65 29 2b 22 20 2b 20 22 2b c3 |~(mcode)+" + "+.| 000011d0 7e 28 6c 61 73 74 62 79 74 65 2d 26 38 30 30 30 |~(lastbyte-&8000| 000011e0 29 2b 22 20 46 46 46 46 38 30 30 30 20 46 46 46 |)+" FFFF8000 FFF| 000011f0 46 38 30 30 30 22 29 0d 06 72 0b 2a 4f 50 54 30 |F8000")..r.*OPT0| 00001200 2c 30 0d ff |,0..| 00001204