Home » CEEFAX disks » telesoftware6.adl » 28-03-88/B\OSB19
28-03-88/B\OSB19
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 » telesoftware6.adl |
Filename: | 28-03-88/B\OSB19 |
Read OK: | ✔ |
File size: | 1316 bytes |
Load address: | FFFF2200 |
Exec address: | FFFF8023 |
File contents
10REM OSbits Moldule B/osb19 20REM Colours switching using interrupts 30REM Version 3.31 18.5.87 40 50*KEY1MO.3|M|NL.|M 60*KEY10O.|M 70 80osword = &FFF1 90osbyte = &FFF4 100via = &FE60 110irq = &204 120evntv = &220 130v_offset=&560 140 150X%=0 160Y%=&FF 170A%=234 180IF (USR(osbyte) AND &FF00)>0 THEN PRINT "I think you have a second processor"'"Please switch it off and start again":STOP 190 200code% = &A00 210 220FOR pass%=0 TO 2 STEP 2 230P%=code% 240[OPT pass% 250 260\ Save old irq and event vectors 270 280LDA irq 290STA old_irqv 300LDA irq+1 310STA old_irqv+1 320 330LDA evntv 340STA old_evntv 350LDA evntv+1 360STA old_evntv+1 370 380\ Load in new vectors 390 400SEI \ Disable interrupts while vectors change 410 420LDA #interrupt MOD 256 430STA irq 440LDA #interrupt DIV 256 450STA irq+1 460 470LDA #event MOD 256 480STA evntv 490LDA #event DIV 256 500STA evntv+1 510 520\ Set up VIA register 530 540LDA via+11 \ Auxiliary control register 550AND #&3F \ Clear top two bits 560STA via+11 \ Puts T1 into "one-shot" mode 570LDA #&C0 \ Set Bit 6 + 7 580STA via+14 \ Enable T1 interrupts 590 600CLI \ Re-enable interrupts 610RTS 620 630.event 640 650\ This is the event intercept 660 670PHP 680CMP #4 \ Execute code only if event 4, sync 690BNE exit_event 700 710PHA 720TXA 730PHA 740TYA 750PHA \ Save all registers 760CLD \ Force binary mode just in case 770 780LDA #0 790STA colours \ Set/re-set colours flag to zero 800 810\ Top of frame is 'v_offset' microseconds after field-sync 820 830LDA #v_offset MOD 256 840STA via+4 \ Set T1 lo order counter 850LDA #v_offset DIV 256 860STA via+5 \ Set T1 hi order counter and start timing 870 880PLA 890TAY 900PLA 910TAX 920PLA 930 940.exit_event 950 960PLP \ Restore registers 970RTS 980 990.old_irqv OPT FNEQUW(0) 1000.old_evntv OPT FNEQUW(0) 1010.para_block OPT FNEQUB(1) 1020 OPT FNEQUD(0) 1030.colours OPT FNEQUB(0) \ This byte acts as a counter 1040 OPT FNEQUB(1) \ Colours of bands 1 to 6 1050 OPT FNEQUB(3) 1060 OPT FNEQUB(4) 1070 OPT FNEQUB(6) 1080 OPT FNEQUB(2) 1090 OPT FNEQUB(5) 1100.coltimes OPT FNEQUB(4) \ Durations of bands 1 to 6 1110 OPT FNEQUB(12) 1120 OPT FNEQUB(8) 1130 OPT FNEQUB(12) 1140 OPT FNEQUB(4) 1150 OPT FNEQUB(255) \ This should always be &FF 1160 1170.interrupt 1180 1190\ This code is executed when an interrupt is detected 1200\ First, quickly see if it's the interrupt you want 1210 1220BIT via+13 \ Check interrupt flag register 1230BVS colour_change \ Branch if bit 6 set (Timer 1) 1240JMP (old_irqv) \ If not return to irq1 1250 1260.colour_change 1270 1280LDA &FC \ Temporary store for A on interrupting 1290PHA 1300TXA 1310PHA 1320TYA 1330PHA \ Store registers on the stack 1340CLD \ Force binary mode just in case 1350 1360LDA colours 1370TAX 1380LDA #0 1390STA via+4 \ Set lo order counter 1400LDA coltimes,X \ Duration contents into A [hi bit of T1] 1410STA via+5 \ Set hi order counter and start timing 1420 1430LDA colours+1,X \ This loads A with new colour number 1440STA para_block+1 \ and we set up an OSWORD parameter block 1450LDA #0 \ First location already set to 1 1460STA para_block+2 1470STA para_block+3 1480STA para_block+4 1490LDA #&C \ OSWORD &C (12) writes palette 1500LDX #para_block MOD 256 1510LDY #para_block DIV 256 1520JSR osword 1530 1540INC colours \ Increase colour flag 1550 1560PLA 1570TAY 1580PLA 1590TAX 1600PLA \ Restore registers 1610RTI 1620 1630] 1640NEXT 1650 1660MODE 3 1670CALL code% 1680*FX 14 4 1690PROCwriting 1700PRINTTAB(0,20)"Press any key to see the colour bands" 1710K=GET 1720COLOUR 129 1730COLOUR 0 1740CLS 1750PROCwriting 1760END 1770 1780DEF PROCwriting 1790PRINTTAB(0,0)"This demonstrates that in Mode 3" 1800PRINTTAB(0,3)"You can have several colours on screen simultaneously!" 1810PRINTTAB(0,7)"There is a condition though ...."'"The colours have to be in horizontal bands" 1820PRINTTAB(0,12)"And the boundary between the colours"'"is rather jittery" 1830PRINTTAB(0,15)"Here we have six colours on screen at once" 1840ENDPROC 1850 1860**** EQUate a Byte **** 1870DEF FNEQUB(N%) 1880?P%=N% MOD 256 1890IF (pass% AND 3) = 3 THEN PRINT ~?P% 1900P%=P%+1 1910=pass% 1920 1930**** EQUate a Word (2 bytes) **** 1940DEF FNEQUW(N%) 1950?P%=N% MOD 256 1960P%?1=N% DIV 256 1970IF (pass% AND 3) = 3 THEN PRINT ~?P%,~?(P%+1) 1980P%=P%+2 1990=pass% 2000 2010**** EQUate a Double word (4 bytes) **** 2020DEF FNEQUD(N%) 2030LOCAL X% 2040!P%=N% 2050FOR X%=0 TO 3 2060IF (pass% AND 3) = 3 THEN PRINT ~P%?X%; 2070NEXT 2080IF (pass% AND 3) = 3 THEN PRINT 2090P%=P%+4 2100=pass%
� OSbits Moldule B/osb19 (� Colours switching using interrupts � Version 3.31 18.5.87 ( 2*KEY1MO.3|M|NL.|M <*KEY10O.|M F Posword = &FFF1 Zosbyte = &FFF4 dvia = &FE60 nirq = &204 xevntv = &220 �v_offset=&560 � �X%=0 � Y%=&FF � A%=234 �n� (�(osbyte) � &FF00)>0 � � "I think you have a second processor"'"Please switch it off and start again":� � �code% = &A00 � �� pass%=0 � 2 � 2 �P%=code% �[OPT pass% � %\ Save old irq and event vectors LDA irq "STA old_irqv , LDA irq+1 6STA old_irqv+1 @ J LDA evntv TSTA old_evntv ^LDA evntv+1 hSTA old_evntv+1 r |\ Load in new vectors � �GSEI \ Disable interrupts while vectors change � �LDA #interrupt � 256 �STA irq �LDA #interrupt � 256 � STA irq+1 � �LDA #event � 256 � STA evntv �LDA #event � 256 �STA evntv+1 � \ Set up VIA register :LDA via+11 \ Auxiliary control register &0� #&3F \ Clear top two bits 0<STA via+11 \ Puts T1 into "one-shot" mode :-LDA #&C0 \ Set Bit 6 + 7 D4STA via+14 \ Enable T1 interrupts N X4CLI \ Re-enable interrupts bRTS l v .event � �"\ This is the event intercept � �PHP �BCMP #4 \ Execute code only if event 4, sync �BNE exit_event � �PHA �TXA �PHA �TYA �2PHA \ Save all registers �>CLD \ Force binary mode just in case LDA #0 ?STA colours \ Set/re-set colours flag to zero *?\ Top of frame is 'v_offset' microseconds after field-sync 4 >LDA #v_offset � 256 H8STA via+4 \ Set T1 lo order counter RLDA #v_offset � 256 \ISTA via+5 \ Set T1 hi order counter and start timing f pPLA zTAY �PLA �TAX �PLA � �.exit_event � �2PLP \ Restore registers �RTS � �.old_irqv OPT �EQUW(0) �.old_evntv OPT �EQUW(0) �.para_block OPT �EQUB(1) � OPT �EQUD(0) ;.colours OPT �EQUB(0) \ This byte acts as a counter 7 OPT �EQUB(1) \ Colours of bands 1 to 6 OPT �EQUB(3) $ OPT �EQUB(4) . OPT �EQUB(6) 8 OPT �EQUB(2) B OPT �EQUB(5) L9.coltimes OPT �EQUB(4) \ Durations of bands 1 to 6 V OPT �EQUB(12) ` OPT �EQUB(8) j OPT �EQUB(12) t OPT �EQUB(4) ~; OPT �EQUB(255) \ This should always be &FF � �.interrupt � �:\ This code is executed when an interrupt is detected �8\ First, quickly see if it's the interrupt you want � �=BIT via+13 \ Check interrupt flag register �=BVS colour_change \ Branch if bit 6 set (Timer 1) �5JMP (old_irqv) \ If not return to irq1 � �.colour_change � ELDA &FC \ Temporary store for A on interrupting PHA TXA PHA (TYA 2<PHA \ Store registers on the stack <>CLD \ Force binary mode just in case F PLDA colours ZTAX d LDA #0 n4STA via+4 \ Set lo order counter xGLDA coltimes,X \ Duration contents into A [hi bit of T1] �ESTA via+5 \ Set hi order counter and start timing � �CLDA colours+1,X \ This loads A with new colour number �GSTA para_block+1 \ and we set up an OSWORD parameter block �?LDA #0 \ First location already set to 1 �STA para_block+2 �STA para_block+3 �STA para_block+4 �=LDA #&C \ OSWORD &C (12) writes palette �LDX #para_block � 256 �LDY #para_block � 256 �JSR osword � 4INC colours \ Increase colour flag PLA "TAY ,PLA 6TAX @1PLA \ Restore registers JRTI T ^] h� r |� 3 �� code% �*FX 14 4 ��writing �2�0,20)"Press any key to see the colour bands" �K=� � � 129 �� 0 �� ��writing �� � �� �writing �,�0,0)"This demonstrates that in Mode 3" B�0,3)"You can have several colours on screen simultaneously!" Y�0,7)"There is a condition though ...."'"The colours have to be in horizontal bands" E�0,12)"And the boundary between the colours"'"is rather jittery" &7�0,15)"Here we have six colours on screen at once" 0� : D**** EQUate a Byte **** N� �EQUB(N%) X?P%=N% � 256 b� (pass% � 3) = 3 � � ~?P% lP%=P%+1 v =pass% � �%**** EQUate a Word (2 bytes) **** �� �EQUW(N%) �?P%=N% � 256 �P%?1=N% � 256 �'� (pass% � 3) = 3 � � ~?P%,~?(P%+1) �P%=P%+2 � =pass% � �,**** EQUate a Double word (4 bytes) **** �� �EQUD(N%) �� X% � !P%=N% � X%=0 � 3 !� (pass% � 3) = 3 � � ~P%?X%; � � (pass% � 3) = 3 � � *P%=P%+4 4 =pass% �
00000000 0d 00 0a 1c f4 20 4f 53 62 69 74 73 20 4d 6f 6c |..... OSbits Mol| 00000010 64 75 6c 65 20 42 2f 6f 73 62 31 39 0d 00 14 28 |dule B/osb19...(| 00000020 f4 20 43 6f 6c 6f 75 72 73 20 73 77 69 74 63 68 |. Colours switch| 00000030 69 6e 67 20 75 73 69 6e 67 20 69 6e 74 65 72 72 |ing using interr| 00000040 75 70 74 73 0d 00 1e 1b f4 20 56 65 72 73 69 6f |upts..... Versio| 00000050 6e 20 33 2e 33 31 20 20 31 38 2e 35 2e 38 37 0d |n 3.31 18.5.87.| 00000060 00 28 05 20 0d 00 32 15 2a 4b 45 59 31 4d 4f 2e |.(. ..2.*KEY1MO.| 00000070 33 7c 4d 7c 4e 4c 2e 7c 4d 0d 00 3c 0e 2a 4b 45 |3|M|NL.|M..<.*KE| 00000080 59 31 30 4f 2e 7c 4d 0d 00 46 05 20 0d 00 50 12 |Y10O.|M..F. ..P.| 00000090 6f 73 77 6f 72 64 20 3d 20 26 46 46 46 31 0d 00 |osword = &FFF1..| 000000a0 5a 12 6f 73 62 79 74 65 20 3d 20 26 46 46 46 34 |Z.osbyte = &FFF4| 000000b0 0d 00 64 0f 76 69 61 20 3d 20 26 46 45 36 30 0d |..d.via = &FE60.| 000000c0 00 6e 0e 69 72 71 20 3d 20 26 32 30 34 0d 00 78 |.n.irq = &204..x| 000000d0 10 65 76 6e 74 76 20 3d 20 26 32 32 30 0d 00 82 |.evntv = &220...| 000000e0 11 76 5f 6f 66 66 73 65 74 3d 26 35 36 30 0d 00 |.v_offset=&560..| 000000f0 8c 05 20 0d 00 96 08 58 25 3d 30 0d 00 a0 0a 59 |.. ....X%=0....Y| 00000100 25 3d 26 46 46 0d 00 aa 0a 41 25 3d 32 33 34 0d |%=&FF....A%=234.| 00000110 00 b4 6e e7 20 28 ba 28 6f 73 62 79 74 65 29 20 |..n. (.(osbyte) | 00000120 80 20 26 46 46 30 30 29 3e 30 20 8c 20 f1 20 22 |. &FF00)>0 . . "| 00000130 49 20 74 68 69 6e 6b 20 79 6f 75 20 68 61 76 65 |I think you have| 00000140 20 61 20 73 65 63 6f 6e 64 20 70 72 6f 63 65 73 | a second proces| 00000150 73 6f 72 22 27 22 50 6c 65 61 73 65 20 73 77 69 |sor"'"Please swi| 00000160 74 63 68 20 69 74 20 6f 66 66 20 61 6e 64 20 73 |tch it off and s| 00000170 74 61 72 74 20 61 67 61 69 6e 22 3a fa 0d 00 be |tart again":....| 00000180 05 20 0d 00 c8 10 63 6f 64 65 25 20 3d 20 26 41 |. ....code% = &A| 00000190 30 30 0d 00 d2 05 20 0d 00 dc 15 e3 20 70 61 73 |00.... ..... pas| 000001a0 73 25 3d 30 20 b8 20 32 20 88 20 32 0d 00 e6 0c |s%=0 . 2 . 2....| 000001b0 50 25 3d 63 6f 64 65 25 0d 00 f0 0e 5b 4f 50 54 |P%=code%....[OPT| 000001c0 20 70 61 73 73 25 0d 00 fa 05 20 0d 01 04 25 5c | pass%.... ...%\| 000001d0 20 20 53 61 76 65 20 6f 6c 64 20 69 72 71 20 61 | Save old irq a| 000001e0 6e 64 20 65 76 65 6e 74 20 76 65 63 74 6f 72 73 |nd event vectors| 000001f0 0d 01 0e 05 20 0d 01 18 0b 4c 44 41 20 69 72 71 |.... ....LDA irq| 00000200 0d 01 22 10 53 54 41 20 6f 6c 64 5f 69 72 71 76 |..".STA old_irqv| 00000210 0d 01 2c 0d 4c 44 41 20 69 72 71 2b 31 0d 01 36 |..,.LDA irq+1..6| 00000220 12 53 54 41 20 6f 6c 64 5f 69 72 71 76 2b 31 0d |.STA old_irqv+1.| 00000230 01 40 05 20 0d 01 4a 0d 4c 44 41 20 65 76 6e 74 |.@. ..J.LDA evnt| 00000240 76 0d 01 54 11 53 54 41 20 6f 6c 64 5f 65 76 6e |v..T.STA old_evn| 00000250 74 76 0d 01 5e 0f 4c 44 41 20 65 76 6e 74 76 2b |tv..^.LDA evntv+| 00000260 31 0d 01 68 13 53 54 41 20 6f 6c 64 5f 65 76 6e |1..h.STA old_evn| 00000270 74 76 2b 31 0d 01 72 05 20 0d 01 7c 1a 5c 20 20 |tv+1..r. ..|.\ | 00000280 4c 6f 61 64 20 69 6e 20 6e 65 77 20 76 65 63 74 |Load in new vect| 00000290 6f 72 73 0d 01 86 05 20 0d 01 90 47 53 45 49 20 |ors.... ...GSEI | 000002a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000002b0 20 20 20 20 20 20 5c 20 44 69 73 61 62 6c 65 20 | \ Disable | 000002c0 69 6e 74 65 72 72 75 70 74 73 20 77 68 69 6c 65 |interrupts while| 000002d0 20 76 65 63 74 6f 72 73 20 63 68 61 6e 67 65 0d | vectors change.| 000002e0 01 9a 05 20 0d 01 a4 18 4c 44 41 20 23 69 6e 74 |... ....LDA #int| 000002f0 65 72 72 75 70 74 20 83 20 32 35 36 0d 01 ae 0b |errupt . 256....| 00000300 53 54 41 20 69 72 71 0d 01 b8 18 4c 44 41 20 23 |STA irq....LDA #| 00000310 69 6e 74 65 72 72 75 70 74 20 81 20 32 35 36 0d |interrupt . 256.| 00000320 01 c2 0d 53 54 41 20 69 72 71 2b 31 0d 01 cc 05 |...STA irq+1....| 00000330 20 0d 01 d6 14 4c 44 41 20 23 65 76 65 6e 74 20 | ....LDA #event | 00000340 83 20 32 35 36 0d 01 e0 0d 53 54 41 20 65 76 6e |. 256....STA evn| 00000350 74 76 0d 01 ea 14 4c 44 41 20 23 65 76 65 6e 74 |tv....LDA #event| 00000360 20 81 20 32 35 36 0d 01 f4 0f 53 54 41 20 65 76 | . 256....STA ev| 00000370 6e 74 76 2b 31 0d 01 fe 05 20 0d 02 08 1a 5c 20 |ntv+1.... ....\ | 00000380 20 53 65 74 20 75 70 20 56 49 41 20 72 65 67 69 | Set up VIA regi| 00000390 73 74 65 72 0d 02 12 05 20 0d 02 1c 3a 4c 44 41 |ster.... ...:LDA| 000003a0 20 76 69 61 2b 31 31 20 20 20 20 20 20 20 20 20 | via+11 | 000003b0 20 20 20 20 20 20 20 5c 20 41 75 78 69 6c 69 61 | \ Auxilia| 000003c0 72 79 20 63 6f 6e 74 72 6f 6c 20 72 65 67 69 73 |ry control regis| 000003d0 74 65 72 0d 02 26 30 80 20 23 26 33 46 20 20 20 |ter..&0. #&3F | 000003e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c | \| 000003f0 20 43 6c 65 61 72 20 74 6f 70 20 74 77 6f 20 62 | Clear top two b| 00000400 69 74 73 0d 02 30 3c 53 54 41 20 76 69 61 2b 31 |its..0<STA via+1| 00000410 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |1 | 00000420 20 5c 20 50 75 74 73 20 54 31 20 69 6e 74 6f 20 | \ Puts T1 into | 00000430 22 6f 6e 65 2d 73 68 6f 74 22 20 6d 6f 64 65 0d |"one-shot" mode.| 00000440 02 3a 2d 4c 44 41 20 23 26 43 30 20 20 20 20 20 |.:-LDA #&C0 | 00000450 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 53 | \ S| 00000460 65 74 20 42 69 74 20 36 20 2b 20 37 0d 02 44 34 |et Bit 6 + 7..D4| 00000470 53 54 41 20 76 69 61 2b 31 34 20 20 20 20 20 20 |STA via+14 | 00000480 20 20 20 20 20 20 20 20 20 20 5c 20 45 6e 61 62 | \ Enab| 00000490 6c 65 20 54 31 20 69 6e 74 65 72 72 75 70 74 73 |le T1 interrupts| 000004a0 0d 02 4e 05 20 0d 02 58 34 43 4c 49 20 20 20 20 |..N. ..X4CLI | 000004b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000004c0 20 20 20 5c 20 52 65 2d 65 6e 61 62 6c 65 20 69 | \ Re-enable i| 000004d0 6e 74 65 72 72 75 70 74 73 0d 02 62 07 52 54 53 |nterrupts..b.RTS| 000004e0 0d 02 6c 05 20 0d 02 76 0a 2e 65 76 65 6e 74 0d |..l. ..v..event.| 000004f0 02 80 05 20 0d 02 8a 22 5c 20 20 54 68 69 73 20 |... ..."\ This | 00000500 69 73 20 74 68 65 20 65 76 65 6e 74 20 69 6e 74 |is the event int| 00000510 65 72 63 65 70 74 0d 02 94 05 20 0d 02 9e 07 50 |ercept.... ....P| 00000520 48 50 0d 02 a8 42 43 4d 50 20 23 34 20 20 20 20 |HP...BCMP #4 | 00000530 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000540 5c 20 45 78 65 63 75 74 65 20 63 6f 64 65 20 6f |\ Execute code o| 00000550 6e 6c 79 20 69 66 20 65 76 65 6e 74 20 34 2c 20 |nly if event 4, | 00000560 73 79 6e 63 0d 02 b2 12 42 4e 45 20 65 78 69 74 |sync....BNE exit| 00000570 5f 65 76 65 6e 74 0d 02 bc 05 20 0d 02 c6 07 50 |_event.... ....P| 00000580 48 41 0d 02 d0 07 54 58 41 0d 02 da 07 50 48 41 |HA....TXA....PHA| 00000590 0d 02 e4 07 54 59 41 0d 02 ee 32 50 48 41 20 20 |....TYA...2PHA | 000005a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000005b0 20 20 20 20 20 5c 20 53 61 76 65 20 61 6c 6c 20 | \ Save all | 000005c0 72 65 67 69 73 74 65 72 73 0d 02 f8 3e 43 4c 44 |registers...>CLD| 000005d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000005e0 20 20 20 20 20 20 20 5c 20 46 6f 72 63 65 20 62 | \ Force b| 000005f0 69 6e 61 72 79 20 6d 6f 64 65 20 6a 75 73 74 20 |inary mode just | 00000600 69 6e 20 63 61 73 65 0d 03 02 05 20 0d 03 0c 0a |in case.... ....| 00000610 4c 44 41 20 23 30 0d 03 16 3f 53 54 41 20 63 6f |LDA #0...?STA co| 00000620 6c 6f 75 72 73 20 20 20 20 20 20 20 20 20 20 20 |lours | 00000630 20 20 20 20 5c 20 53 65 74 2f 72 65 2d 73 65 74 | \ Set/re-set| 00000640 20 63 6f 6c 6f 75 72 73 20 66 6c 61 67 20 74 6f | colours flag to| 00000650 20 7a 65 72 6f 0d 03 20 05 20 0d 03 2a 3f 5c 20 | zero.. . ..*?\ | 00000660 20 54 6f 70 20 6f 66 20 66 72 61 6d 65 20 69 73 | Top of frame is| 00000670 20 27 76 5f 6f 66 66 73 65 74 27 20 6d 69 63 72 | 'v_offset' micr| 00000680 6f 73 65 63 6f 6e 64 73 20 61 66 74 65 72 20 66 |oseconds after f| 00000690 69 65 6c 64 2d 73 79 6e 63 0d 03 34 05 20 0d 03 |ield-sync..4. ..| 000006a0 3e 17 4c 44 41 20 23 76 5f 6f 66 66 73 65 74 20 |>.LDA #v_offset | 000006b0 83 20 32 35 36 0d 03 48 38 53 54 41 20 76 69 61 |. 256..H8STA via| 000006c0 2b 34 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |+4 | 000006d0 20 20 20 20 5c 20 53 65 74 20 54 31 20 6c 6f 20 | \ Set T1 lo | 000006e0 6f 72 64 65 72 20 63 6f 75 6e 74 65 72 0d 03 52 |order counter..R| 000006f0 17 4c 44 41 20 23 76 5f 6f 66 66 73 65 74 20 81 |.LDA #v_offset .| 00000700 20 32 35 36 0d 03 5c 49 53 54 41 20 76 69 61 2b | 256..\ISTA via+| 00000710 35 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |5 | 00000720 20 20 20 5c 20 53 65 74 20 54 31 20 68 69 20 6f | \ Set T1 hi o| 00000730 72 64 65 72 20 63 6f 75 6e 74 65 72 20 61 6e 64 |rder counter and| 00000740 20 73 74 61 72 74 20 74 69 6d 69 6e 67 0d 03 66 | start timing..f| 00000750 05 20 0d 03 70 07 50 4c 41 0d 03 7a 07 54 41 59 |. ..p.PLA..z.TAY| 00000760 0d 03 84 07 50 4c 41 0d 03 8e 07 54 41 58 0d 03 |....PLA....TAX..| 00000770 98 07 50 4c 41 0d 03 a2 05 20 0d 03 ac 0f 2e 65 |..PLA.... .....e| 00000780 78 69 74 5f 65 76 65 6e 74 0d 03 b6 05 20 0d 03 |xit_event.... ..| 00000790 c0 32 50 4c 50 20 20 20 20 20 20 20 20 20 20 20 |.2PLP | 000007a0 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 52 | \ R| 000007b0 65 73 74 6f 72 65 20 72 65 67 69 73 74 65 72 73 |estore registers| 000007c0 0d 03 ca 07 52 54 53 0d 03 d4 05 20 0d 03 de 1d |....RTS.... ....| 000007d0 2e 6f 6c 64 5f 69 72 71 76 20 20 20 20 4f 50 54 |.old_irqv OPT| 000007e0 20 a4 45 51 55 57 28 30 29 0d 03 e8 1d 2e 6f 6c | .EQUW(0).....ol| 000007f0 64 5f 65 76 6e 74 76 20 20 20 4f 50 54 20 a4 45 |d_evntv OPT .E| 00000800 51 55 57 28 30 29 0d 03 f2 1d 2e 70 61 72 61 5f |QUW(0).....para_| 00000810 62 6c 6f 63 6b 20 20 4f 50 54 20 a4 45 51 55 42 |block OPT .EQUB| 00000820 28 31 29 0d 03 fc 1d 20 20 20 20 20 20 20 20 20 |(1).... | 00000830 20 20 20 20 4f 50 54 20 a4 45 51 55 44 28 30 29 | OPT .EQUD(0)| 00000840 0d 04 06 3b 2e 63 6f 6c 6f 75 72 73 20 20 20 20 |...;.colours | 00000850 20 4f 50 54 20 a4 45 51 55 42 28 30 29 20 5c 20 | OPT .EQUB(0) \ | 00000860 54 68 69 73 20 62 79 74 65 20 61 63 74 73 20 61 |This byte acts a| 00000870 73 20 61 20 63 6f 75 6e 74 65 72 0d 04 10 37 20 |s a counter...7 | 00000880 20 20 20 20 20 20 20 20 20 20 20 20 4f 50 54 20 | OPT | 00000890 a4 45 51 55 42 28 31 29 20 5c 20 43 6f 6c 6f 75 |.EQUB(1) \ Colou| 000008a0 72 73 20 6f 66 20 62 61 6e 64 73 20 31 20 74 6f |rs of bands 1 to| 000008b0 20 36 0d 04 1a 1d 20 20 20 20 20 20 20 20 20 20 | 6.... | 000008c0 20 20 20 4f 50 54 20 a4 45 51 55 42 28 33 29 0d | OPT .EQUB(3).| 000008d0 04 24 1d 20 20 20 20 20 20 20 20 20 20 20 20 20 |.$. | 000008e0 4f 50 54 20 a4 45 51 55 42 28 34 29 0d 04 2e 1d |OPT .EQUB(4)....| 000008f0 20 20 20 20 20 20 20 20 20 20 20 20 20 4f 50 54 | OPT| 00000900 20 a4 45 51 55 42 28 36 29 0d 04 38 1d 20 20 20 | .EQUB(6)..8. | 00000910 20 20 20 20 20 20 20 20 20 20 4f 50 54 20 a4 45 | OPT .E| 00000920 51 55 42 28 32 29 0d 04 42 1d 20 20 20 20 20 20 |QUB(2)..B. | 00000930 20 20 20 20 20 20 20 4f 50 54 20 a4 45 51 55 42 | OPT .EQUB| 00000940 28 35 29 0d 04 4c 39 2e 63 6f 6c 74 69 6d 65 73 |(5)..L9.coltimes| 00000950 20 20 20 20 4f 50 54 20 a4 45 51 55 42 28 34 29 | OPT .EQUB(4)| 00000960 20 5c 20 44 75 72 61 74 69 6f 6e 73 20 6f 66 20 | \ Durations of | 00000970 62 61 6e 64 73 20 31 20 74 6f 20 36 0d 04 56 1e |bands 1 to 6..V.| 00000980 20 20 20 20 20 20 20 20 20 20 20 20 20 4f 50 54 | OPT| 00000990 20 a4 45 51 55 42 28 31 32 29 0d 04 60 1d 20 20 | .EQUB(12)..`. | 000009a0 20 20 20 20 20 20 20 20 20 20 20 4f 50 54 20 a4 | OPT .| 000009b0 45 51 55 42 28 38 29 0d 04 6a 1e 20 20 20 20 20 |EQUB(8)..j. | 000009c0 20 20 20 20 20 20 20 20 4f 50 54 20 a4 45 51 55 | OPT .EQU| 000009d0 42 28 31 32 29 0d 04 74 1d 20 20 20 20 20 20 20 |B(12)..t. | 000009e0 20 20 20 20 20 20 4f 50 54 20 a4 45 51 55 42 28 | OPT .EQUB(| 000009f0 34 29 0d 04 7e 3b 20 20 20 20 20 20 20 20 20 20 |4)..~; | 00000a00 20 20 20 4f 50 54 20 a4 45 51 55 42 28 32 35 35 | OPT .EQUB(255| 00000a10 29 20 5c 20 54 68 69 73 20 73 68 6f 75 6c 64 20 |) \ This should | 00000a20 61 6c 77 61 79 73 20 62 65 20 26 46 46 0d 04 88 |always be &FF...| 00000a30 05 20 0d 04 92 0e 2e 69 6e 74 65 72 72 75 70 74 |. .....interrupt| 00000a40 0d 04 9c 05 20 0d 04 a6 3a 5c 20 20 54 68 69 73 |.... ...:\ This| 00000a50 20 63 6f 64 65 20 69 73 20 65 78 65 63 75 74 65 | code is execute| 00000a60 64 20 77 68 65 6e 20 61 6e 20 69 6e 74 65 72 72 |d when an interr| 00000a70 75 70 74 20 69 73 20 64 65 74 65 63 74 65 64 0d |upt is detected.| 00000a80 04 b0 38 5c 20 20 46 69 72 73 74 2c 20 71 75 69 |..8\ First, qui| 00000a90 63 6b 6c 79 20 73 65 65 20 69 66 20 69 74 27 73 |ckly see if it's| 00000aa0 20 74 68 65 20 69 6e 74 65 72 72 75 70 74 20 79 | the interrupt y| 00000ab0 6f 75 20 77 61 6e 74 0d 04 ba 05 20 0d 04 c4 3d |ou want.... ...=| 00000ac0 42 49 54 20 76 69 61 2b 31 33 20 20 20 20 20 20 |BIT via+13 | 00000ad0 20 20 20 20 20 20 20 20 20 20 5c 20 43 68 65 63 | \ Chec| 00000ae0 6b 20 69 6e 74 65 72 72 75 70 74 20 66 6c 61 67 |k interrupt flag| 00000af0 20 72 65 67 69 73 74 65 72 0d 04 ce 3d 42 56 53 | register...=BVS| 00000b00 20 63 6f 6c 6f 75 72 5f 63 68 61 6e 67 65 20 20 | colour_change | 00000b10 20 20 20 20 20 20 20 5c 20 42 72 61 6e 63 68 20 | \ Branch | 00000b20 69 66 20 62 69 74 20 36 20 73 65 74 20 28 54 69 |if bit 6 set (Ti| 00000b30 6d 65 72 20 31 29 0d 04 d8 35 4a 4d 50 20 28 6f |mer 1)...5JMP (o| 00000b40 6c 64 5f 69 72 71 76 29 20 20 20 20 20 20 20 20 |ld_irqv) | 00000b50 20 20 20 20 5c 20 49 66 20 6e 6f 74 20 72 65 74 | \ If not ret| 00000b60 75 72 6e 20 74 6f 20 69 72 71 31 0d 04 e2 05 20 |urn to irq1.... | 00000b70 0d 04 ec 12 2e 63 6f 6c 6f 75 72 5f 63 68 61 6e |.....colour_chan| 00000b80 67 65 0d 04 f6 05 20 0d 05 00 45 4c 44 41 20 26 |ge.... ...ELDA &| 00000b90 46 43 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |FC | 00000ba0 20 20 20 20 20 5c 20 54 65 6d 70 6f 72 61 72 79 | \ Temporary| 00000bb0 20 73 74 6f 72 65 20 66 6f 72 20 41 20 6f 6e 20 | store for A on | 00000bc0 69 6e 74 65 72 72 75 70 74 69 6e 67 0d 05 0a 07 |interrupting....| 00000bd0 50 48 41 0d 05 14 07 54 58 41 0d 05 1e 07 50 48 |PHA....TXA....PH| 00000be0 41 0d 05 28 07 54 59 41 0d 05 32 3c 50 48 41 20 |A..(.TYA..2<PHA | 00000bf0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000c00 20 20 20 20 20 20 5c 20 53 74 6f 72 65 20 72 65 | \ Store re| 00000c10 67 69 73 74 65 72 73 20 6f 6e 20 74 68 65 20 73 |gisters on the s| 00000c20 74 61 63 6b 0d 05 3c 3e 43 4c 44 20 20 20 20 20 |tack..<>CLD | 00000c30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000c40 20 20 5c 20 46 6f 72 63 65 20 62 69 6e 61 72 79 | \ Force binary| 00000c50 20 6d 6f 64 65 20 6a 75 73 74 20 69 6e 20 63 61 | mode just in ca| 00000c60 73 65 0d 05 46 05 20 0d 05 50 0f 4c 44 41 20 63 |se..F. ..P.LDA c| 00000c70 6f 6c 6f 75 72 73 0d 05 5a 07 54 41 58 0d 05 64 |olours..Z.TAX..d| 00000c80 0a 4c 44 41 20 23 30 0d 05 6e 34 53 54 41 20 76 |.LDA #0..n4STA v| 00000c90 69 61 2b 34 20 20 20 20 20 20 20 20 20 20 20 20 |ia+4 | 00000ca0 20 20 20 20 20 5c 20 53 65 74 20 6c 6f 20 6f 72 | \ Set lo or| 00000cb0 64 65 72 20 63 6f 75 6e 74 65 72 0d 05 78 47 4c |der counter..xGL| 00000cc0 44 41 20 63 6f 6c 74 69 6d 65 73 2c 58 20 20 20 |DA coltimes,X | 00000cd0 20 20 20 20 20 20 20 20 20 5c 20 44 75 72 61 74 | \ Durat| 00000ce0 69 6f 6e 20 63 6f 6e 74 65 6e 74 73 20 69 6e 74 |ion contents int| 00000cf0 6f 20 41 20 5b 68 69 20 62 69 74 20 6f 66 20 54 |o A [hi bit of T| 00000d00 31 5d 0d 05 82 45 53 54 41 20 76 69 61 2b 35 20 |1]...ESTA via+5 | 00000d10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000d20 5c 20 53 65 74 20 68 69 20 6f 72 64 65 72 20 63 |\ Set hi order c| 00000d30 6f 75 6e 74 65 72 20 61 6e 64 20 73 74 61 72 74 |ounter and start| 00000d40 20 74 69 6d 69 6e 67 0d 05 8c 05 20 0d 05 96 43 | timing.... ...C| 00000d50 4c 44 41 20 63 6f 6c 6f 75 72 73 2b 31 2c 58 20 |LDA colours+1,X | 00000d60 20 20 20 20 20 20 20 20 20 20 5c 20 54 68 69 73 | \ This| 00000d70 20 6c 6f 61 64 73 20 41 20 77 69 74 68 20 6e 65 | loads A with ne| 00000d80 77 20 63 6f 6c 6f 75 72 20 6e 75 6d 62 65 72 0d |w colour number.| 00000d90 05 a0 47 53 54 41 20 70 61 72 61 5f 62 6c 6f 63 |..GSTA para_bloc| 00000da0 6b 2b 31 20 20 20 20 20 20 20 20 20 20 5c 20 61 |k+1 \ a| 00000db0 6e 64 20 77 65 20 73 65 74 20 75 70 20 61 6e 20 |nd we set up an | 00000dc0 4f 53 57 4f 52 44 20 70 61 72 61 6d 65 74 65 72 |OSWORD parameter| 00000dd0 20 62 6c 6f 63 6b 0d 05 aa 3f 4c 44 41 20 23 30 | block...?LDA #0| 00000de0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000df0 20 20 20 20 5c 20 46 69 72 73 74 20 6c 6f 63 61 | \ First loca| 00000e00 74 69 6f 6e 20 61 6c 72 65 61 64 79 20 73 65 74 |tion already set| 00000e10 20 74 6f 20 31 0d 05 b4 14 53 54 41 20 70 61 72 | to 1....STA par| 00000e20 61 5f 62 6c 6f 63 6b 2b 32 0d 05 be 14 53 54 41 |a_block+2....STA| 00000e30 20 70 61 72 61 5f 62 6c 6f 63 6b 2b 33 0d 05 c8 | para_block+3...| 00000e40 14 53 54 41 20 70 61 72 61 5f 62 6c 6f 63 6b 2b |.STA para_block+| 00000e50 34 0d 05 d2 3d 4c 44 41 20 23 26 43 20 20 20 20 |4...=LDA #&C | 00000e60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c | \| 00000e70 20 4f 53 57 4f 52 44 20 26 43 20 28 31 32 29 20 | OSWORD &C (12) | 00000e80 77 72 69 74 65 73 20 70 61 6c 65 74 74 65 0d 05 |writes palette..| 00000e90 dc 19 4c 44 58 20 23 70 61 72 61 5f 62 6c 6f 63 |..LDX #para_bloc| 00000ea0 6b 20 83 20 32 35 36 0d 05 e6 19 4c 44 59 20 23 |k . 256....LDY #| 00000eb0 70 61 72 61 5f 62 6c 6f 63 6b 20 81 20 32 35 36 |para_block . 256| 00000ec0 0d 05 f0 0e 4a 53 52 20 6f 73 77 6f 72 64 0d 05 |....JSR osword..| 00000ed0 fa 05 20 0d 06 04 34 49 4e 43 20 63 6f 6c 6f 75 |.. ...4INC colou| 00000ee0 72 73 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |rs | 00000ef0 20 5c 20 49 6e 63 72 65 61 73 65 20 63 6f 6c 6f | \ Increase colo| 00000f00 75 72 20 66 6c 61 67 0d 06 0e 05 20 0d 06 18 07 |ur flag.... ....| 00000f10 50 4c 41 0d 06 22 07 54 41 59 0d 06 2c 07 50 4c |PLA..".TAY..,.PL| 00000f20 41 0d 06 36 07 54 41 58 0d 06 40 31 50 4c 41 20 |A..6.TAX..@1PLA | 00000f30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000f40 20 20 20 20 20 20 5c 20 52 65 73 74 6f 72 65 20 | \ Restore | 00000f50 72 65 67 69 73 74 65 72 73 0d 06 4a 07 52 54 49 |registers..J.RTI| 00000f60 0d 06 54 05 20 0d 06 5e 05 5d 0d 06 68 05 ed 0d |..T. ..^.]..h...| 00000f70 06 72 05 20 0d 06 7c 07 eb 20 33 0d 06 86 0b d6 |.r. ..|.. 3.....| 00000f80 20 63 6f 64 65 25 0d 06 90 0c 2a 46 58 20 31 34 | code%....*FX 14| 00000f90 20 34 0d 06 9a 0c f2 77 72 69 74 69 6e 67 0d 06 | 4.....writing..| 00000fa0 a4 32 f1 8a 30 2c 32 30 29 22 50 72 65 73 73 20 |.2..0,20)"Press | 00000fb0 61 6e 79 20 6b 65 79 20 74 6f 20 73 65 65 20 74 |any key to see t| 00000fc0 68 65 20 63 6f 6c 6f 75 72 20 62 61 6e 64 73 22 |he colour bands"| 00000fd0 0d 06 ae 07 4b 3d a5 0d 06 b8 09 fb 20 31 32 39 |....K=...... 129| 00000fe0 0d 06 c2 07 fb 20 30 0d 06 cc 05 db 0d 06 d6 0c |..... 0.........| 00000ff0 f2 77 72 69 74 69 6e 67 0d 06 e0 05 e0 0d 06 ea |.writing........| 00001000 05 20 0d 06 f4 0e dd 20 f2 77 72 69 74 69 6e 67 |. ..... .writing| 00001010 0d 06 fe 2c f1 8a 30 2c 30 29 22 54 68 69 73 20 |...,..0,0)"This | 00001020 64 65 6d 6f 6e 73 74 72 61 74 65 73 20 74 68 61 |demonstrates tha| 00001030 74 20 69 6e 20 4d 6f 64 65 20 33 22 0d 07 08 42 |t in Mode 3"...B| 00001040 f1 8a 30 2c 33 29 22 59 6f 75 20 63 61 6e 20 68 |..0,3)"You can h| 00001050 61 76 65 20 73 65 76 65 72 61 6c 20 63 6f 6c 6f |ave several colo| 00001060 75 72 73 20 6f 6e 20 73 63 72 65 65 6e 20 73 69 |urs on screen si| 00001070 6d 75 6c 74 61 6e 65 6f 75 73 6c 79 21 22 0d 07 |multaneously!"..| 00001080 12 59 f1 8a 30 2c 37 29 22 54 68 65 72 65 20 69 |.Y..0,7)"There i| 00001090 73 20 61 20 63 6f 6e 64 69 74 69 6f 6e 20 74 68 |s a condition th| 000010a0 6f 75 67 68 20 2e 2e 2e 2e 22 27 22 54 68 65 20 |ough ...."'"The | 000010b0 63 6f 6c 6f 75 72 73 20 68 61 76 65 20 74 6f 20 |colours have to | 000010c0 62 65 20 69 6e 20 68 6f 72 69 7a 6f 6e 74 61 6c |be in horizontal| 000010d0 20 62 61 6e 64 73 22 0d 07 1c 45 f1 8a 30 2c 31 | bands"...E..0,1| 000010e0 32 29 22 41 6e 64 20 74 68 65 20 62 6f 75 6e 64 |2)"And the bound| 000010f0 61 72 79 20 62 65 74 77 65 65 6e 20 74 68 65 20 |ary between the | 00001100 63 6f 6c 6f 75 72 73 22 27 22 69 73 20 72 61 74 |colours"'"is rat| 00001110 68 65 72 20 6a 69 74 74 65 72 79 22 0d 07 26 37 |her jittery"..&7| 00001120 f1 8a 30 2c 31 35 29 22 48 65 72 65 20 77 65 20 |..0,15)"Here we | 00001130 68 61 76 65 20 73 69 78 20 63 6f 6c 6f 75 72 73 |have six colours| 00001140 20 6f 6e 20 73 63 72 65 65 6e 20 61 74 20 6f 6e | on screen at on| 00001150 63 65 22 0d 07 30 05 e1 0d 07 3a 05 20 0d 07 44 |ce"..0....:. ..D| 00001160 1b 2a 2a 2a 2a 20 45 51 55 61 74 65 20 61 20 42 |.**** EQUate a B| 00001170 79 74 65 20 2a 2a 2a 2a 0d 07 4e 0f dd 20 a4 45 |yte ****..N.. .E| 00001180 51 55 42 28 4e 25 29 0d 07 58 10 3f 50 25 3d 4e |QUB(N%)..X.?P%=N| 00001190 25 20 83 20 32 35 36 0d 07 62 1e e7 20 28 70 61 |% . 256..b.. (pa| 000011a0 73 73 25 20 80 20 33 29 20 3d 20 33 20 8c 20 f1 |ss% . 3) = 3 . .| 000011b0 20 7e 3f 50 25 0d 07 6c 0b 50 25 3d 50 25 2b 31 | ~?P%..l.P%=P%+1| 000011c0 0d 07 76 0a 3d 70 61 73 73 25 0d 07 80 05 20 0d |..v.=pass%.... .| 000011d0 07 8a 25 2a 2a 2a 2a 20 45 51 55 61 74 65 20 61 |..%**** EQUate a| 000011e0 20 57 6f 72 64 20 28 32 20 62 79 74 65 73 29 20 | Word (2 bytes) | 000011f0 2a 2a 2a 2a 0d 07 94 0f dd 20 a4 45 51 55 57 28 |****..... .EQUW(| 00001200 4e 25 29 0d 07 9e 10 3f 50 25 3d 4e 25 20 83 20 |N%)....?P%=N% . | 00001210 32 35 36 0d 07 a8 11 50 25 3f 31 3d 4e 25 20 81 |256....P%?1=N% .| 00001220 20 32 35 36 0d 07 b2 27 e7 20 28 70 61 73 73 25 | 256...'. (pass%| 00001230 20 80 20 33 29 20 3d 20 33 20 8c 20 f1 20 7e 3f | . 3) = 3 . . ~?| 00001240 50 25 2c 7e 3f 28 50 25 2b 31 29 0d 07 bc 0b 50 |P%,~?(P%+1)....P| 00001250 25 3d 50 25 2b 32 0d 07 c6 0a 3d 70 61 73 73 25 |%=P%+2....=pass%| 00001260 0d 07 d0 05 20 0d 07 da 2c 2a 2a 2a 2a 20 45 51 |.... ...,**** EQ| 00001270 55 61 74 65 20 61 20 44 6f 75 62 6c 65 20 77 6f |Uate a Double wo| 00001280 72 64 20 28 34 20 62 79 74 65 73 29 20 2a 2a 2a |rd (4 bytes) ***| 00001290 2a 0d 07 e4 0f dd 20 a4 45 51 55 44 28 4e 25 29 |*..... .EQUD(N%)| 000012a0 0d 07 ee 08 ea 20 58 25 0d 07 f8 0a 21 50 25 3d |..... X%....!P%=| 000012b0 4e 25 0d 08 02 0e e3 20 58 25 3d 30 20 b8 20 33 |N%..... X%=0 . 3| 000012c0 0d 08 0c 21 e7 20 28 70 61 73 73 25 20 80 20 33 |...!. (pass% . 3| 000012d0 29 20 3d 20 33 20 8c 20 f1 20 7e 50 25 3f 58 25 |) = 3 . . ~P%?X%| 000012e0 3b 0d 08 16 05 ed 0d 08 20 19 e7 20 28 70 61 73 |;....... .. (pas| 000012f0 73 25 20 80 20 33 29 20 3d 20 33 20 8c 20 f1 0d |s% . 3) = 3 . ..| 00001300 08 2a 0b 50 25 3d 50 25 2b 34 0d 08 34 0a 3d 70 |.*.P%=P%+4..4.=p| 00001310 61 73 73 25 0d ff |ass%..| 00001316