Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199609.adf » Regulars » StarInfo/Wood/Spirals
StarInfo/Wood/Spirals
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 » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199609.adf » Regulars |
Filename: | StarInfo/Wood/Spirals |
Read OK: | ✔ |
File size: | 1273 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM >>> Spirals - By Keith T Wood 1996 20REM Use mouse to control effects 30REM Use keys 1, 2, 3, 4 to control speed 40 50ON ERROR: MODEMODE: REPORT: PRINT " at line " ERL/10: END 60 70MODE13: OFF: *POINTER 80 90PROCtrig_tables 100PROCcolours 110PROCkick_code 120PROCspiral 130END 140 150DEFPROCkick_code 160 LOCAL pass% 170 DIM code% &4FF 180 FOR pass%=0 TO 2 STEP 2 190 P%=code% 200 PROCcode 210 NEXT 220ENDPROC 230 240DEFPROCcode 250 260Ang=1: AngInc=2 270Rad=3: RadInc=4 280Spe=5 290Col=5: Tab=6 300Ctb=7: Scr=8 310Xco=9: Yco=10 320 330[OPT pass% 340 350 .stuff EQUD 0 ; angle stored here 360 EQUD 0 ; angle increment 370 EQUD &6CFF ; radius of spiral 380 EQUD 0 ; radius increment 390 EQUD 1 ; speed of rotation 400 EQUD trig_tab% ; trig table address stored here 410 EQUD colr_tab% ; colour table address stored here 420 .scrn EQUD 0 ; screen address put here by basic 430 .vdin EQUD 148 ; used by basic but easier to store here 440 EQUD -1 ; ditto 450 460 .spiraldraw 470 ADR R0, stuff ; get address of spiral variables 480 LDMIA R0, {Ang-Scr} ; load regs with these variables 490 AND AngInc, AngInc, #255 ; limit angle increment to 8 bits 500 AND RadInc, RadInc, #127 ; limit radius increment to 7 bits 510 ORR AngInc, AngInc, #15 ; make sure angle inc. has value 520 ORR RadInc, RadInc, #32 ; ditto - zero increment will loop forever 530 ADD Ang, Ang, AngInc, ASR Spe ; increment angle 540 STR Ang, stuff ; store new angle for next time 550 560 .spiralround 570 MOV Col, Ang, ASR #9 ; calculate colour as a function of angle 580 AND Col, Col, #255 ; trim colour to fit look-up table 590 LDRB Col, [Ctb, Col] ; get colour from table 600 AND R0, Ang, #255 ; trim angle for trig table 610 ADD R0, Tab, R0, ASL #3 ; add angle to trig table ptr. for new addr. 620 LDMIA R0, {Xco, Yco} ; get cosine and sine vals. from new addr. 630 MUL Xco, Rad, Xco ; covert polar to cart. x=radius*COS(ang) 640 MUL Yco, Rad, Yco ; y=radius*SIN(ang) 650 ADD Xco, Scr, Xco, ASR #16 ; need to poke colour at right address 660 ; so add screen address to x coordinate 670 ; note that Xco was shifted 680 ; as the code uses fixed point arithmatic 690 MOV Yco, Yco, ASR #16 ; shift decimal point back 16 bits 700 ADD Yco, Yco, Yco, ASL #2 ; multiplying by 320 to get y coordinate 710 ; offset from screen address 720 ADD Xco, Xco, Yco, ASL #6 ; and calc. screen addr. offset 730 ; (shift is part of the mul. by 320) 740 STRB Col, [Xco, #1] ; store colour in four differnt bytes 750 STRB Col, [Xco, #-1] ; giving a pattern that fills the circle 760 STRB Col, [Xco, #320] ; completely without gaps - unfortunately 770 STRB Col, [Xco, #-320] ; the only way to avoid gaps! 780 ADD Ang, Ang, AngInc, ASR #1 ; increment angle for loop 790 SUBS Rad, Rad, RadInc, ASR #1 ; decrement radius for loop 800 BPL spiralround ; if radius still +ve then loop 810 MOV PC, R14 ; exit 820] 830ENDPROC 840 850DEFPROCcolours 860LOCAL J%, ptr1%, ptr2% 870DIM colr_tab% &FF, grey_tab% &FF 880ptr1%=colr_tab% 890ptr2%=grey_tab% 900FOR J%=0 TO 15 910 PROCblend( ptr1%, (7-J%)AND7, (6-J%)AND7 ) 920 PROCblend( ptr2%, ((J%)AND1)*7, ((J%-1)AND1)*7 ) 930NEXT 940ENDPROC 950 960DEFPROCblend( RETURN ptr%, d1%, d2% ) 970LOCAL J%, r1%, g1%, b1%, r2%, g2%, b2% 980PROCdecode( d1%, r1%, g1%, b1% ) 990PROCdecode( d2%, r2%, g2%, b2% ) 1000FOR J%=0 TO 15 1010 ?ptr%=FNmix( r1%+(r2%-r1%)*J%/15, g1%+(g2%-g1%)*J%/15, b1%+(b2%-b1%)*J%/15 ) 1020 ptr%+=1 1030NEXT 1040ENDPROC 1050 1060DEFFNmix( r%, g%, b% ) 1070LOCAL c% 1080SYS "ColourTrans_ReturnColourNumber", (r%<<24ORg%<<16ORb%<<8)<<4 TO c% 1090=c% 1100 1110DEFPROCdecode( d%, RETURN r%, RETURN g%, RETURN b% ) 1120r%=(d%>>2AND1)*15 1130g%=(d%>>1AND1)*15 1140b%=(d%AND1)*15 1150ENDPROC 1160 1170DEFPROCspiral 1180LOCAL b%, k$ 1190SYS "OS_ReadVduVariables", vdin, scrn 1200!scrn+=(319>>1)+(320*(255>>1)) 1210MOUSE TO 293, 192 1220REPEAT 1230 MOUSE stuff!4, stuff!12, b% 1240 CASE b% OF 1250 WHEN 4: stuff!24=colr_tab% 1260 WHEN 2: stuff!24=grey_tab% 1261 WHEN 1: CLS 1270 ENDCASE 1280 k$=INKEY$(0) 1290 IF VAL(k$)>0 AND VAL(k$)<5 THEN stuff!16=VAL(k$)-1 1300 CALL spiraldraw 1310UNTIL FALSE 1320ENDPROC 1330 1340DEFPROCtrig_tables 1350LOCAL J% 1360DIM trig_tab% &7FF 1370FOR J%=0 TO 255 1380 trig_tab%!(J%*8)=INT(COS(J%/127*PI)*256) 1390 trig_tab%!(J%*8+4)=INT(SIN(J%/127*PI)*256) 1400NEXT 1410ENDPROC
(� >>> Spirals - By Keith T Wood 1996 &� Use mouse to control effects .� Use keys 1, 2, 3, 4 to control speed ( 2%� �: ��: �: � " at line " �/10: � < F�13: �: *POINTER P Z�trig_tables d�colours n�kick_code x�spiral �� � ���kick_code � � pass% � � code% &4FF � � pass%=0 � 2 � 2 � P%=code% � �code � � �� � � ��code � Ang=1: AngInc=2 Rad=3: RadInc=4 Spe=5 "Col=5: Tab=6 ,Ctb=7: Scr=8 6Xco=9: Yco=10 @ J[OPT pass% T ^: .stuff EQUD 0 ; angle stored here h8 EQUD 0 ; angle increment r9 EQUD &6CFF ; radius of spiral |9 EQUD 0 ; radius increment �: EQUD 1 ; speed of rotation �G EQUD trig_tab% ; trig table address stored here �I EQUD colr_tab% ; colour table address stored here �I .scrn EQUD 0 ; screen address put here by basic �O .vdin EQUD 148 ; used by basic but easier to store here �. EQUD -1 ; ditto � � .spiraldraw �H ADR R0, stuff ; get address of spiral variables �G LDMIA R0, {Ang-Scr} ; load regs with these variables �F � AngInc, AngInc, #255 ; limit angle increment to 8 bits �H � RadInc, RadInc, #127 ; limit radius increment to 7 bits �F �R AngInc, AngInc, #15 ; make sure angle inc. has value P �R RadInc, RadInc, #32 ; ditto - zero increment will loop forever 8 ADD Ang, Ang, AngInc, ASR Spe ; increment angle F STR Ang, stuff ; store new angle for next time & 0 .spiralround :P MOV Col, Ang, ASR #9 ; calculate colour as a function of angle DG � Col, Col, #255 ; trim colour to fit look-up table N> LDRB Col, [Ctb, Col] ; get colour from table X@ � R0, Ang, #255 ; trim angle for trig table bS ADD R0, Tab, R0, ASL #3 ; add angle to trig table ptr. for new addr. lQ LDMIA R0, {Xco, Yco} ; get cosine and sine vals. from new addr. vN MUL Xco, Rad, Xco ; covert polar to cart. x=radius*�(ang) �N MUL Yco, Rad, Yco ; y=radius*�(ang) �M ADD Xco, Scr, Xco, ASR #16 ; need to poke colour at right address �N ; so add screen address to x coordinate �B ; note that Xco was shifted �P ; as the code uses fixed point arithmatic �I MOV Yco, Yco, ASR #16 ; shift decimal point back 16 bits �O ADD Yco, Yco, Yco, ASL #2 ; multiplying by 320 to get y coordinate �C ; offset from screen address �F ADD Xco, Xco, Yco, ASL #6 ; and calc. screen addr. offset �K ; (shift is part of the mul. by 320) �L STRB Col, [Xco, #1] ; store colour in four differnt bytes �O STRB Col, [Xco, #-1] ; giving a pattern that fills the circle �P STRB Col, [Xco, #320] ; completely without gaps - unfortunately D STRB Col, [Xco, #-320] ; the only way to avoid gaps! A ADD Ang, Ang, AngInc, ASR #1 ; increment angle for loop B SUBS Rad, Rad, RadInc, ASR #1 ; decrement radius for loop F BPL spiralround ; if radius still +ve then loop *- MOV PC, R14 ; exit 4] >� H R ��colours \� J%, ptr1%, ptr2% f"� colr_tab% &FF, grey_tab% &FF pptr1%=colr_tab% zptr2%=grey_tab% �� J%=0 � 15 �( �blend( ptr1%, (7-J%)�7, (6-J%)�7 ) �. �blend( ptr2%, ((J%)�1)*7, ((J%-1)�1)*7 ) �� �� � ���blend( � ptr%, d1%, d2% ) �&� J%, r1%, g1%, b1%, r2%, g2%, b2% �!�decode( d1%, r1%, g1%, b1% ) �!�decode( d2%, r2%, g2%, b2% ) �� J%=0 � 15 �P ?ptr%=�mix( r1%+(r2%-r1%)*J%/15, g1%+(g2%-g1%)*J%/15, b1%+(b2%-b1%)*J%/15 ) � ptr%+=1 � � $ݤmix( r%, g%, b% ) .� c% 8Fș "ColourTrans_ReturnColourNumber", (r%<<24�g%<<16�b%<<8)<<4 � c% B=c% L V$��decode( d%, � r%, � g%, � b% ) `r%=(d%>>2�1)*15 jg%=(d%>>1�1)*15 tb%=(d%�1)*15 ~� � ���spiral �� b%, k$ �(ș "OS_ReadVduVariables", vdin, scrn �"!scrn+=(319>>1)+(320*(255>>1)) �ȗ � 293, 192 �� � ȗ stuff!4, stuff!12, b% � Ȏ b% � � � 4: stuff!24=colr_tab% � � 2: stuff!24=grey_tab% � � 1: � � � k$=�(0) + � �(k$)>0 � �(k$)<5 � stuff!16=�(k$)-1 � spiraldraw � � (� 2 <��trig_tables F� J% P� trig_tab% &7FF Z� J%=0 � 255 d( trig_tab%!(J%*8)=�(�(J%/127*�)*256) n* trig_tab%!(J%*8+4)=�(�(J%/127*�)*256) x� �� �
00000000 0d 00 0a 28 f4 20 3e 3e 3e 20 53 70 69 72 61 6c |...(. >>> Spiral| 00000010 73 20 2d 20 42 79 20 4b 65 69 74 68 20 54 20 57 |s - By Keith T W| 00000020 6f 6f 64 20 31 39 39 36 0d 00 14 26 f4 20 20 20 |ood 1996...&. | 00000030 20 20 55 73 65 20 6d 6f 75 73 65 20 74 6f 20 63 | Use mouse to c| 00000040 6f 6e 74 72 6f 6c 20 65 66 66 65 63 74 73 0d 00 |ontrol effects..| 00000050 1e 2e f4 20 20 20 20 20 55 73 65 20 6b 65 79 73 |... Use keys| 00000060 20 31 2c 20 32 2c 20 33 2c 20 34 20 74 6f 20 63 | 1, 2, 3, 4 to c| 00000070 6f 6e 74 72 6f 6c 20 73 70 65 65 64 0d 00 28 04 |ontrol speed..(.| 00000080 0d 00 32 25 ee 20 85 3a 20 eb eb 3a 20 f6 3a 20 |..2%. .: ..: .: | 00000090 f1 20 22 20 61 74 20 6c 69 6e 65 20 22 20 9e 2f |. " at line " ./| 000000a0 31 30 3a 20 e0 0d 00 3c 04 0d 00 46 14 eb 31 33 |10: ...<...F..13| 000000b0 3a 20 87 3a 20 2a 50 4f 49 4e 54 45 52 0d 00 50 |: .: *POINTER..P| 000000c0 04 0d 00 5a 10 f2 74 72 69 67 5f 74 61 62 6c 65 |...Z..trig_table| 000000d0 73 0d 00 64 0c f2 63 6f 6c 6f 75 72 73 0d 00 6e |s..d..colours..n| 000000e0 0e f2 6b 69 63 6b 5f 63 6f 64 65 0d 00 78 0b f2 |..kick_code..x..| 000000f0 73 70 69 72 61 6c 0d 00 82 05 e0 0d 00 8c 04 0d |spiral..........| 00000100 00 96 0f dd f2 6b 69 63 6b 5f 63 6f 64 65 0d 00 |.....kick_code..| 00000110 a0 0c 20 ea 20 70 61 73 73 25 0d 00 aa 11 20 de |.. . pass%.... .| 00000120 20 63 6f 64 65 25 20 26 34 46 46 0d 00 b4 16 20 | code% &4FF.... | 00000130 e3 20 70 61 73 73 25 3d 30 20 b8 20 32 20 88 20 |. pass%=0 . 2 . | 00000140 32 0d 00 be 0e 20 20 50 25 3d 63 6f 64 65 25 0d |2.... P%=code%.| 00000150 00 c8 0b 20 20 f2 63 6f 64 65 0d 00 d2 06 20 ed |... .code.... .| 00000160 0d 00 dc 05 e1 0d 00 e6 04 0d 00 f0 0a dd f2 63 |...............c| 00000170 6f 64 65 0d 00 fa 04 0d 01 04 14 41 6e 67 3d 31 |ode........Ang=1| 00000180 3a 20 20 41 6e 67 49 6e 63 3d 32 0d 01 0e 14 52 |: AngInc=2....R| 00000190 61 64 3d 33 3a 20 20 52 61 64 49 6e 63 3d 34 0d |ad=3: RadInc=4.| 000001a0 01 18 09 53 70 65 3d 35 0d 01 22 11 43 6f 6c 3d |...Spe=5..".Col=| 000001b0 35 3a 20 20 54 61 62 3d 36 0d 01 2c 11 43 74 62 |5: Tab=6..,.Ctb| 000001c0 3d 37 3a 20 20 53 63 72 3d 38 0d 01 36 12 58 63 |=7: Scr=8..6.Xc| 000001d0 6f 3d 39 3a 20 20 59 63 6f 3d 31 30 0d 01 40 04 |o=9: Yco=10..@.| 000001e0 0d 01 4a 0e 5b 4f 50 54 20 70 61 73 73 25 0d 01 |..J.[OPT pass%..| 000001f0 54 04 0d 01 5e 3a 20 2e 73 74 75 66 66 20 20 20 |T...^: .stuff | 00000200 20 20 45 51 55 44 20 30 20 20 20 20 20 20 20 20 | EQUD 0 | 00000210 20 20 20 20 20 20 20 20 20 3b 20 61 6e 67 6c 65 | ; angle| 00000220 20 73 74 6f 72 65 64 20 68 65 72 65 0d 01 68 38 | stored here..h8| 00000230 20 20 20 20 20 20 20 20 20 20 20 20 45 51 55 44 | EQUD| 00000240 20 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 0 | 00000250 20 20 20 3b 20 61 6e 67 6c 65 20 69 6e 63 72 65 | ; angle incre| 00000260 6d 65 6e 74 0d 01 72 39 20 20 20 20 20 20 20 20 |ment..r9 | 00000270 20 20 20 20 45 51 55 44 20 26 36 43 46 46 20 20 | EQUD &6CFF | 00000280 20 20 20 20 20 20 20 20 20 20 20 3b 20 72 61 64 | ; rad| 00000290 69 75 73 20 6f 66 20 73 70 69 72 61 6c 0d 01 7c |ius of spiral..|| 000002a0 39 20 20 20 20 20 20 20 20 20 20 20 20 45 51 55 |9 EQU| 000002b0 44 20 30 20 20 20 20 20 20 20 20 20 20 20 20 20 |D 0 | 000002c0 20 20 20 20 3b 20 72 61 64 69 75 73 20 69 6e 63 | ; radius inc| 000002d0 72 65 6d 65 6e 74 0d 01 86 3a 20 20 20 20 20 20 |rement...: | 000002e0 20 20 20 20 20 20 45 51 55 44 20 31 20 20 20 20 | EQUD 1 | 000002f0 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 73 | ; s| 00000300 70 65 65 64 20 6f 66 20 72 6f 74 61 74 69 6f 6e |peed of rotation| 00000310 0d 01 90 47 20 20 20 20 20 20 20 20 20 20 20 20 |...G | 00000320 45 51 55 44 20 74 72 69 67 5f 74 61 62 25 20 20 |EQUD trig_tab% | 00000330 20 20 20 20 20 20 20 3b 20 74 72 69 67 20 74 61 | ; trig ta| 00000340 62 6c 65 20 61 64 64 72 65 73 73 20 73 74 6f 72 |ble address stor| 00000350 65 64 20 68 65 72 65 0d 01 9a 49 20 20 20 20 20 |ed here...I | 00000360 20 20 20 20 20 20 20 45 51 55 44 20 63 6f 6c 72 | EQUD colr| 00000370 5f 74 61 62 25 20 20 20 20 20 20 20 20 20 3b 20 |_tab% ; | 00000380 63 6f 6c 6f 75 72 20 74 61 62 6c 65 20 61 64 64 |colour table add| 00000390 72 65 73 73 20 73 74 6f 72 65 64 20 68 65 72 65 |ress stored here| 000003a0 0d 01 a4 49 20 2e 73 63 72 6e 20 20 20 20 20 20 |...I .scrn | 000003b0 45 51 55 44 20 30 20 20 20 20 20 20 20 20 20 20 |EQUD 0 | 000003c0 20 20 20 20 20 20 20 3b 20 73 63 72 65 65 6e 20 | ; screen | 000003d0 61 64 64 72 65 73 73 20 70 75 74 20 68 65 72 65 |address put here| 000003e0 20 62 79 20 62 61 73 69 63 0d 01 ae 4f 20 2e 76 | by basic...O .v| 000003f0 64 69 6e 20 20 20 20 20 20 45 51 55 44 20 31 34 |din EQUD 14| 00000400 38 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |8 | 00000410 3b 20 75 73 65 64 20 62 79 20 62 61 73 69 63 20 |; used by basic | 00000420 62 75 74 20 65 61 73 69 65 72 20 74 6f 20 73 74 |but easier to st| 00000430 6f 72 65 20 68 65 72 65 0d 01 b8 2e 20 20 20 20 |ore here.... | 00000440 20 20 20 20 20 20 20 20 45 51 55 44 20 2d 31 20 | EQUD -1 | 00000450 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b | ;| 00000460 20 64 69 74 74 6f 0d 01 c2 04 0d 01 cc 10 20 2e | ditto........ .| 00000470 73 70 69 72 61 6c 64 72 61 77 0d 01 d6 48 20 41 |spiraldraw...H A| 00000480 44 52 20 20 20 20 52 30 2c 20 73 74 75 66 66 20 |DR R0, stuff | 00000490 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000004a0 20 3b 20 67 65 74 20 61 64 64 72 65 73 73 20 6f | ; get address o| 000004b0 66 20 73 70 69 72 61 6c 20 76 61 72 69 61 62 6c |f spiral variabl| 000004c0 65 73 0d 01 e0 47 20 4c 44 4d 49 41 20 20 52 30 |es...G LDMIA R0| 000004d0 2c 20 7b 41 6e 67 2d 53 63 72 7d 20 20 20 20 20 |, {Ang-Scr} | 000004e0 20 20 20 20 20 20 20 20 20 3b 20 6c 6f 61 64 20 | ; load | 000004f0 72 65 67 73 20 77 69 74 68 20 74 68 65 73 65 20 |regs with these | 00000500 76 61 72 69 61 62 6c 65 73 0d 01 ea 46 20 80 20 |variables...F . | 00000510 20 20 20 41 6e 67 49 6e 63 2c 20 41 6e 67 49 6e | AngInc, AngIn| 00000520 63 2c 20 23 32 35 35 20 20 20 20 20 20 20 3b 20 |c, #255 ; | 00000530 6c 69 6d 69 74 20 61 6e 67 6c 65 20 69 6e 63 72 |limit angle incr| 00000540 65 6d 65 6e 74 20 74 6f 20 38 20 62 69 74 73 0d |ement to 8 bits.| 00000550 01 f4 48 20 80 20 20 20 20 52 61 64 49 6e 63 2c |..H . RadInc,| 00000560 20 52 61 64 49 6e 63 2c 20 23 31 32 37 20 20 20 | RadInc, #127 | 00000570 20 20 20 20 3b 20 6c 69 6d 69 74 20 72 61 64 69 | ; limit radi| 00000580 75 73 20 69 6e 63 72 65 6d 65 6e 74 20 20 74 6f |us increment to| 00000590 20 37 20 62 69 74 73 0d 01 fe 46 20 84 52 20 20 | 7 bits...F .R | 000005a0 20 20 41 6e 67 49 6e 63 2c 20 41 6e 67 49 6e 63 | AngInc, AngInc| 000005b0 2c 20 23 31 35 20 20 20 20 20 20 20 20 3b 20 6d |, #15 ; m| 000005c0 61 6b 65 20 73 75 72 65 20 61 6e 67 6c 65 20 69 |ake sure angle i| 000005d0 6e 63 2e 20 68 61 73 20 76 61 6c 75 65 0d 02 08 |nc. has value...| 000005e0 50 20 84 52 20 20 20 20 52 61 64 49 6e 63 2c 20 |P .R RadInc, | 000005f0 52 61 64 49 6e 63 2c 20 23 33 32 20 20 20 20 20 |RadInc, #32 | 00000600 20 20 20 3b 20 64 69 74 74 6f 20 2d 20 7a 65 72 | ; ditto - zer| 00000610 6f 20 69 6e 63 72 65 6d 65 6e 74 20 77 69 6c 6c |o increment will| 00000620 20 6c 6f 6f 70 20 66 6f 72 65 76 65 72 0d 02 12 | loop forever...| 00000630 38 20 41 44 44 20 20 20 20 41 6e 67 2c 20 41 6e |8 ADD Ang, An| 00000640 67 2c 20 41 6e 67 49 6e 63 2c 20 41 53 52 20 53 |g, AngInc, ASR S| 00000650 70 65 20 20 3b 20 69 6e 63 72 65 6d 65 6e 74 20 |pe ; increment | 00000660 61 6e 67 6c 65 0d 02 1c 46 20 53 54 52 20 20 20 |angle...F STR | 00000670 20 41 6e 67 2c 20 73 74 75 66 66 20 20 20 20 20 | Ang, stuff | 00000680 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 73 74 | ; st| 00000690 6f 72 65 20 6e 65 77 20 61 6e 67 6c 65 20 66 6f |ore new angle fo| 000006a0 72 20 6e 65 78 74 20 74 69 6d 65 0d 02 26 05 20 |r next time..&. | 000006b0 0d 02 30 11 20 2e 73 70 69 72 61 6c 72 6f 75 6e |..0. .spiralroun| 000006c0 64 0d 02 3a 50 20 4d 4f 56 20 20 20 20 43 6f 6c |d..:P MOV Col| 000006d0 2c 20 41 6e 67 2c 20 41 53 52 20 23 39 20 20 20 |, Ang, ASR #9 | 000006e0 20 20 20 20 20 20 20 20 3b 20 63 61 6c 63 75 6c | ; calcul| 000006f0 61 74 65 20 63 6f 6c 6f 75 72 20 61 73 20 61 20 |ate colour as a | 00000700 66 75 6e 63 74 69 6f 6e 20 6f 66 20 61 6e 67 6c |function of angl| 00000710 65 0d 02 44 47 20 80 20 20 20 20 43 6f 6c 2c 20 |e..DG . Col, | 00000720 43 6f 6c 2c 20 23 32 35 35 20 20 20 20 20 20 20 |Col, #255 | 00000730 20 20 20 20 20 20 3b 20 74 72 69 6d 20 63 6f 6c | ; trim col| 00000740 6f 75 72 20 74 6f 20 66 69 74 20 6c 6f 6f 6b 2d |our to fit look-| 00000750 75 70 20 74 61 62 6c 65 0d 02 4e 3e 20 4c 44 52 |up table..N> LDR| 00000760 42 20 20 20 43 6f 6c 2c 20 5b 43 74 62 2c 20 43 |B Col, [Ctb, C| 00000770 6f 6c 5d 20 20 20 20 20 20 20 20 20 20 20 20 3b |ol] ;| 00000780 20 67 65 74 20 63 6f 6c 6f 75 72 20 66 72 6f 6d | get colour from| 00000790 20 74 61 62 6c 65 0d 02 58 40 20 80 20 20 20 20 | table..X@ . | 000007a0 52 30 2c 20 41 6e 67 2c 20 23 32 35 35 20 20 20 |R0, Ang, #255 | 000007b0 20 20 20 20 20 20 20 20 20 20 20 3b 20 74 72 69 | ; tri| 000007c0 6d 20 61 6e 67 6c 65 20 66 6f 72 20 74 72 69 67 |m angle for trig| 000007d0 20 74 61 62 6c 65 0d 02 62 53 20 41 44 44 20 20 | table..bS ADD | 000007e0 20 20 52 30 2c 20 54 61 62 2c 20 52 30 2c 20 41 | R0, Tab, R0, A| 000007f0 53 4c 20 23 33 20 20 20 20 20 20 20 20 3b 20 61 |SL #3 ; a| 00000800 64 64 20 61 6e 67 6c 65 20 74 6f 20 74 72 69 67 |dd angle to trig| 00000810 20 74 61 62 6c 65 20 70 74 72 2e 20 66 6f 72 20 | table ptr. for | 00000820 6e 65 77 20 61 64 64 72 2e 0d 02 6c 51 20 4c 44 |new addr...lQ LD| 00000830 4d 49 41 20 20 52 30 2c 20 7b 58 63 6f 2c 20 59 |MIA R0, {Xco, Y| 00000840 63 6f 7d 20 20 20 20 20 20 20 20 20 20 20 20 20 |co} | 00000850 3b 20 67 65 74 20 63 6f 73 69 6e 65 20 61 6e 64 |; get cosine and| 00000860 20 73 69 6e 65 20 76 61 6c 73 2e 20 66 72 6f 6d | sine vals. from| 00000870 20 6e 65 77 20 61 64 64 72 2e 0d 02 76 4e 20 4d | new addr...vN M| 00000880 55 4c 20 20 20 20 58 63 6f 2c 20 52 61 64 2c 20 |UL Xco, Rad, | 00000890 58 63 6f 20 20 20 20 20 20 20 20 20 20 20 20 20 |Xco | 000008a0 20 3b 20 63 6f 76 65 72 74 20 70 6f 6c 61 72 20 | ; covert polar | 000008b0 74 6f 20 63 61 72 74 2e 20 78 3d 72 61 64 69 75 |to cart. x=radiu| 000008c0 73 2a 9b 28 61 6e 67 29 0d 02 80 4e 20 4d 55 4c |s*.(ang)...N MUL| 000008d0 20 20 20 20 59 63 6f 2c 20 52 61 64 2c 20 59 63 | Yco, Rad, Yc| 000008e0 6f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b |o ;| 000008f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000900 20 20 20 20 20 20 20 79 3d 72 61 64 69 75 73 2a | y=radius*| 00000910 b5 28 61 6e 67 29 0d 02 8a 4d 20 41 44 44 20 20 |.(ang)...M ADD | 00000920 20 20 58 63 6f 2c 20 53 63 72 2c 20 58 63 6f 2c | Xco, Scr, Xco,| 00000930 20 41 53 52 20 23 31 36 20 20 20 20 20 3b 20 6e | ASR #16 ; n| 00000940 65 65 64 20 74 6f 20 70 6f 6b 65 20 63 6f 6c 6f |eed to poke colo| 00000950 75 72 20 61 74 20 72 69 67 68 74 20 61 64 64 72 |ur at right addr| 00000960 65 73 73 0d 02 94 4e 20 20 20 20 20 20 20 20 20 |ess...N | 00000970 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000980 20 20 20 20 20 20 20 20 20 20 3b 20 73 6f 20 61 | ; so a| 00000990 64 64 20 73 63 72 65 65 6e 20 61 64 64 72 65 73 |dd screen addres| 000009a0 73 20 74 6f 20 78 20 63 6f 6f 72 64 69 6e 61 74 |s to x coordinat| 000009b0 65 0d 02 9e 42 20 20 20 20 20 20 20 20 20 20 20 |e...B | 000009c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000009d0 20 20 20 20 20 20 20 20 3b 20 6e 6f 74 65 20 74 | ; note t| 000009e0 68 61 74 20 58 63 6f 20 77 61 73 20 73 68 69 66 |hat Xco was shif| 000009f0 74 65 64 0d 02 a8 50 20 20 20 20 20 20 20 20 20 |ted...P | 00000a00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000a10 20 20 20 20 20 20 20 20 20 20 3b 20 61 73 20 74 | ; as t| 00000a20 68 65 20 63 6f 64 65 20 75 73 65 73 20 66 69 78 |he code uses fix| 00000a30 65 64 20 70 6f 69 6e 74 20 61 72 69 74 68 6d 61 |ed point arithma| 00000a40 74 69 63 0d 02 b2 49 20 4d 4f 56 20 20 20 20 59 |tic...I MOV Y| 00000a50 63 6f 2c 20 59 63 6f 2c 20 41 53 52 20 23 31 36 |co, Yco, ASR #16| 00000a60 20 20 20 20 20 20 20 20 20 20 3b 20 73 68 69 66 | ; shif| 00000a70 74 20 64 65 63 69 6d 61 6c 20 70 6f 69 6e 74 20 |t decimal point | 00000a80 62 61 63 6b 20 31 36 20 62 69 74 73 0d 02 bc 4f |back 16 bits...O| 00000a90 20 41 44 44 20 20 20 20 59 63 6f 2c 20 59 63 6f | ADD Yco, Yco| 00000aa0 2c 20 59 63 6f 2c 20 41 53 4c 20 23 32 20 20 20 |, Yco, ASL #2 | 00000ab0 20 20 20 3b 20 6d 75 6c 74 69 70 6c 79 69 6e 67 | ; multiplying| 00000ac0 20 62 79 20 33 32 30 20 74 6f 20 67 65 74 20 79 | by 320 to get y| 00000ad0 20 63 6f 6f 72 64 69 6e 61 74 65 0d 02 c6 43 20 | coordinate...C | 00000ae0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 00000b00 20 20 3b 20 6f 66 66 73 65 74 20 66 72 6f 6d 20 | ; offset from | 00000b10 73 63 72 65 65 6e 20 61 64 64 72 65 73 73 0d 02 |screen address..| 00000b20 d0 46 20 41 44 44 20 20 20 20 58 63 6f 2c 20 58 |.F ADD Xco, X| 00000b30 63 6f 2c 20 59 63 6f 2c 20 41 53 4c 20 23 36 20 |co, Yco, ASL #6 | 00000b40 20 20 20 20 20 3b 20 61 6e 64 20 63 61 6c 63 2e | ; and calc.| 00000b50 20 73 63 72 65 65 6e 20 61 64 64 72 2e 20 6f 66 | screen addr. of| 00000b60 66 73 65 74 0d 02 da 4b 20 20 20 20 20 20 20 20 |fset...K | 00000b70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000b80 20 20 20 20 20 20 20 20 20 20 20 3b 20 28 73 68 | ; (sh| 00000b90 69 66 74 20 69 73 20 70 61 72 74 20 6f 66 20 74 |ift is part of t| 00000ba0 68 65 20 6d 75 6c 2e 20 62 79 20 33 32 30 29 0d |he mul. by 320).| 00000bb0 02 e4 4c 20 53 54 52 42 20 20 20 20 20 43 6f 6c |..L STRB Col| 00000bc0 2c 20 5b 58 63 6f 2c 20 23 31 5d 20 20 20 20 20 |, [Xco, #1] | 00000bd0 20 20 20 20 20 20 3b 20 73 74 6f 72 65 20 63 6f | ; store co| 00000be0 6c 6f 75 72 20 69 6e 20 66 6f 75 72 20 64 69 66 |lour in four dif| 00000bf0 66 65 72 6e 74 20 62 79 74 65 73 0d 02 ee 4f 20 |fernt bytes...O | 00000c00 53 54 52 42 20 20 20 20 20 43 6f 6c 2c 20 5b 58 |STRB Col, [X| 00000c10 63 6f 2c 20 23 2d 31 5d 20 20 20 20 20 20 20 20 |co, #-1] | 00000c20 20 20 3b 20 67 69 76 69 6e 67 20 61 20 70 61 74 | ; giving a pat| 00000c30 74 65 72 6e 20 74 68 61 74 20 66 69 6c 6c 73 20 |tern that fills | 00000c40 74 68 65 20 63 69 72 63 6c 65 0d 02 f8 50 20 53 |the circle...P S| 00000c50 54 52 42 20 20 20 20 20 43 6f 6c 2c 20 5b 58 63 |TRB Col, [Xc| 00000c60 6f 2c 20 23 33 32 30 5d 20 20 20 20 20 20 20 20 |o, #320] | 00000c70 20 3b 20 63 6f 6d 70 6c 65 74 65 6c 79 20 77 69 | ; completely wi| 00000c80 74 68 6f 75 74 20 67 61 70 73 20 2d 20 75 6e 66 |thout gaps - unf| 00000c90 6f 72 74 75 6e 61 74 65 6c 79 0d 03 02 44 20 53 |ortunately...D S| 00000ca0 54 52 42 20 20 20 20 20 43 6f 6c 2c 20 5b 58 63 |TRB Col, [Xc| 00000cb0 6f 2c 20 23 2d 33 32 30 5d 20 20 20 20 20 20 20 |o, #-320] | 00000cc0 20 3b 20 74 68 65 20 6f 6e 6c 79 20 77 61 79 20 | ; the only way | 00000cd0 74 6f 20 61 76 6f 69 64 20 67 61 70 73 21 0d 03 |to avoid gaps!..| 00000ce0 0c 41 20 41 44 44 20 20 20 20 41 6e 67 2c 20 41 |.A ADD Ang, A| 00000cf0 6e 67 2c 20 41 6e 67 49 6e 63 2c 20 41 53 52 20 |ng, AngInc, ASR | 00000d00 23 31 20 20 20 3b 20 69 6e 63 72 65 6d 65 6e 74 |#1 ; increment| 00000d10 20 61 6e 67 6c 65 20 66 6f 72 20 6c 6f 6f 70 0d | angle for loop.| 00000d20 03 16 42 20 53 55 42 53 20 20 20 52 61 64 2c 20 |..B SUBS Rad, | 00000d30 52 61 64 2c 20 52 61 64 49 6e 63 2c 20 41 53 52 |Rad, RadInc, ASR| 00000d40 20 23 31 20 20 20 3b 20 64 65 63 72 65 6d 65 6e | #1 ; decremen| 00000d50 74 20 72 61 64 69 75 73 20 66 6f 72 20 6c 6f 6f |t radius for loo| 00000d60 70 0d 03 20 46 20 42 50 4c 20 20 20 20 73 70 69 |p.. F BPL spi| 00000d70 72 61 6c 72 6f 75 6e 64 20 20 20 20 20 20 20 20 |ralround | 00000d80 20 20 20 20 20 20 20 20 3b 20 69 66 20 72 61 64 | ; if rad| 00000d90 69 75 73 20 73 74 69 6c 6c 20 2b 76 65 20 74 68 |ius still +ve th| 00000da0 65 6e 20 6c 6f 6f 70 0d 03 2a 2d 20 4d 4f 56 20 |en loop..*- MOV | 00000db0 20 20 20 50 43 2c 20 52 31 34 20 20 20 20 20 20 | PC, R14 | 00000dc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 | ; | 00000dd0 65 78 69 74 0d 03 34 05 5d 0d 03 3e 05 e1 0d 03 |exit..4.]..>....| 00000de0 48 04 0d 03 52 0d dd f2 63 6f 6c 6f 75 72 73 0d |H...R...colours.| 00000df0 03 5c 16 ea 20 4a 25 2c 20 70 74 72 31 25 2c 20 |.\.. J%, ptr1%, | 00000e00 70 74 72 32 25 0d 03 66 22 de 20 63 6f 6c 72 5f |ptr2%..f". colr_| 00000e10 74 61 62 25 20 26 46 46 2c 20 67 72 65 79 5f 74 |tab% &FF, grey_t| 00000e20 61 62 25 20 26 46 46 0d 03 70 13 70 74 72 31 25 |ab% &FF..p.ptr1%| 00000e30 3d 63 6f 6c 72 5f 74 61 62 25 0d 03 7a 13 70 74 |=colr_tab%..z.pt| 00000e40 72 32 25 3d 67 72 65 79 5f 74 61 62 25 0d 03 84 |r2%=grey_tab%...| 00000e50 0f e3 20 4a 25 3d 30 20 b8 20 31 35 0d 03 8e 28 |.. J%=0 . 15...(| 00000e60 20 f2 62 6c 65 6e 64 28 20 70 74 72 31 25 2c 20 | .blend( ptr1%, | 00000e70 28 37 2d 4a 25 29 80 37 2c 20 28 36 2d 4a 25 29 |(7-J%).7, (6-J%)| 00000e80 80 37 20 29 0d 03 98 2e 20 f2 62 6c 65 6e 64 28 |.7 ).... .blend(| 00000e90 20 70 74 72 32 25 2c 20 28 28 4a 25 29 80 31 29 | ptr2%, ((J%).1)| 00000ea0 2a 37 2c 20 28 28 4a 25 2d 31 29 80 31 29 2a 37 |*7, ((J%-1).1)*7| 00000eb0 20 29 0d 03 a2 05 ed 0d 03 ac 05 e1 0d 03 b6 04 | )..............| 00000ec0 0d 03 c0 1f dd f2 62 6c 65 6e 64 28 20 f8 20 70 |......blend( . p| 00000ed0 74 72 25 2c 20 64 31 25 2c 20 64 32 25 20 29 0d |tr%, d1%, d2% ).| 00000ee0 03 ca 26 ea 20 4a 25 2c 20 72 31 25 2c 20 67 31 |..&. J%, r1%, g1| 00000ef0 25 2c 20 62 31 25 2c 20 72 32 25 2c 20 67 32 25 |%, b1%, r2%, g2%| 00000f00 2c 20 62 32 25 0d 03 d4 21 f2 64 65 63 6f 64 65 |, b2%...!.decode| 00000f10 28 20 64 31 25 2c 20 72 31 25 2c 20 67 31 25 2c |( d1%, r1%, g1%,| 00000f20 20 62 31 25 20 29 0d 03 de 21 f2 64 65 63 6f 64 | b1% )...!.decod| 00000f30 65 28 20 64 32 25 2c 20 72 32 25 2c 20 67 32 25 |e( d2%, r2%, g2%| 00000f40 2c 20 62 32 25 20 29 0d 03 e8 0f e3 20 4a 25 3d |, b2% )..... J%=| 00000f50 30 20 b8 20 31 35 0d 03 f2 50 20 3f 70 74 72 25 |0 . 15...P ?ptr%| 00000f60 3d a4 6d 69 78 28 20 72 31 25 2b 28 72 32 25 2d |=.mix( r1%+(r2%-| 00000f70 72 31 25 29 2a 4a 25 2f 31 35 2c 20 67 31 25 2b |r1%)*J%/15, g1%+| 00000f80 28 67 32 25 2d 67 31 25 29 2a 4a 25 2f 31 35 2c |(g2%-g1%)*J%/15,| 00000f90 20 62 31 25 2b 28 62 32 25 2d 62 31 25 29 2a 4a | b1%+(b2%-b1%)*J| 00000fa0 25 2f 31 35 20 29 0d 03 fc 0c 20 70 74 72 25 2b |%/15 ).... ptr%+| 00000fb0 3d 31 0d 04 06 05 ed 0d 04 10 05 e1 0d 04 1a 04 |=1..............| 00000fc0 0d 04 24 17 dd a4 6d 69 78 28 20 72 25 2c 20 67 |..$...mix( r%, g| 00000fd0 25 2c 20 62 25 20 29 0d 04 2e 08 ea 20 63 25 0d |%, b% )..... c%.| 00000fe0 04 38 46 c8 99 20 22 43 6f 6c 6f 75 72 54 72 61 |.8F.. "ColourTra| 00000ff0 6e 73 5f 52 65 74 75 72 6e 43 6f 6c 6f 75 72 4e |ns_ReturnColourN| 00001000 75 6d 62 65 72 22 2c 20 28 72 25 3c 3c 32 34 84 |umber", (r%<<24.| 00001010 67 25 3c 3c 31 36 84 62 25 3c 3c 38 29 3c 3c 34 |g%<<16.b%<<8)<<4| 00001020 20 b8 20 63 25 0d 04 42 07 3d 63 25 0d 04 4c 04 | . c%..B.=c%..L.| 00001030 0d 04 56 24 dd f2 64 65 63 6f 64 65 28 20 64 25 |..V$..decode( d%| 00001040 2c 20 f8 20 72 25 2c 20 f8 20 67 25 2c 20 f8 20 |, . r%, . g%, . | 00001050 62 25 20 29 0d 04 60 13 72 25 3d 28 64 25 3e 3e |b% )..`.r%=(d%>>| 00001060 32 80 31 29 2a 31 35 0d 04 6a 13 67 25 3d 28 64 |2.1)*15..j.g%=(d| 00001070 25 3e 3e 31 80 31 29 2a 31 35 0d 04 74 10 62 25 |%>>1.1)*15..t.b%| 00001080 3d 28 64 25 80 31 29 2a 31 35 0d 04 7e 05 e1 0d |=(d%.1)*15..~...| 00001090 04 88 04 0d 04 92 0c dd f2 73 70 69 72 61 6c 0d |.........spiral.| 000010a0 04 9c 0c ea 20 62 25 2c 20 6b 24 0d 04 a6 28 c8 |.... b%, k$...(.| 000010b0 99 20 22 4f 53 5f 52 65 61 64 56 64 75 56 61 72 |. "OS_ReadVduVar| 000010c0 69 61 62 6c 65 73 22 2c 20 76 64 69 6e 2c 20 73 |iables", vdin, s| 000010d0 63 72 6e 0d 04 b0 22 21 73 63 72 6e 2b 3d 28 33 |crn..."!scrn+=(3| 000010e0 31 39 3e 3e 31 29 2b 28 33 32 30 2a 28 32 35 35 |19>>1)+(320*(255| 000010f0 3e 3e 31 29 29 0d 04 ba 11 c8 97 20 b8 20 32 39 |>>1))...... . 29| 00001100 33 2c 20 31 39 32 0d 04 c4 05 f5 0d 04 ce 1d 20 |3, 192......... | 00001110 c8 97 20 73 74 75 66 66 21 34 2c 20 73 74 75 66 |.. stuff!4, stuf| 00001120 66 21 31 32 2c 20 62 25 0d 04 d8 0c 20 c8 8e 20 |f!12, b%.... .. | 00001130 62 25 20 ca 0d 04 e2 1d 20 20 c9 20 34 3a 20 73 |b% ..... . 4: s| 00001140 74 75 66 66 21 32 34 3d 63 6f 6c 72 5f 74 61 62 |tuff!24=colr_tab| 00001150 25 0d 04 ec 1d 20 20 c9 20 32 3a 20 73 74 75 66 |%.... . 2: stuf| 00001160 66 21 32 34 3d 67 72 65 79 5f 74 61 62 25 0d 04 |f!24=grey_tab%..| 00001170 ed 0c 20 20 c9 20 31 3a 20 db 0d 04 f6 06 20 cb |.. . 1: ..... .| 00001180 0d 05 00 0c 20 6b 24 3d bf 28 30 29 0d 05 0a 2b |.... k$=.(0)...+| 00001190 20 e7 20 bb 28 6b 24 29 3e 30 20 80 20 bb 28 6b | . .(k$)>0 . .(k| 000011a0 24 29 3c 35 20 8c 20 73 74 75 66 66 21 31 36 3d |$)<5 . stuff!16=| 000011b0 bb 28 6b 24 29 2d 31 0d 05 14 11 20 d6 20 73 70 |.(k$)-1.... . sp| 000011c0 69 72 61 6c 64 72 61 77 0d 05 1e 07 fd 20 a3 0d |iraldraw..... ..| 000011d0 05 28 05 e1 0d 05 32 04 0d 05 3c 11 dd f2 74 72 |.(....2...<...tr| 000011e0 69 67 5f 74 61 62 6c 65 73 0d 05 46 08 ea 20 4a |ig_tables..F.. J| 000011f0 25 0d 05 50 14 de 20 74 72 69 67 5f 74 61 62 25 |%..P.. trig_tab%| 00001200 20 26 37 46 46 0d 05 5a 10 e3 20 4a 25 3d 30 20 | &7FF..Z.. J%=0 | 00001210 b8 20 32 35 35 0d 05 64 28 20 74 72 69 67 5f 74 |. 255..d( trig_t| 00001220 61 62 25 21 28 4a 25 2a 38 29 3d a8 28 9b 28 4a |ab%!(J%*8)=.(.(J| 00001230 25 2f 31 32 37 2a af 29 2a 32 35 36 29 0d 05 6e |%/127*.)*256)..n| 00001240 2a 20 74 72 69 67 5f 74 61 62 25 21 28 4a 25 2a |* trig_tab%!(J%*| 00001250 38 2b 34 29 3d a8 28 b5 28 4a 25 2f 31 32 37 2a |8+4)=.(.(J%/127*| 00001260 af 29 2a 32 35 36 29 0d 05 78 05 ed 0d 05 82 05 |.)*256)..x......| 00001270 e1 0d ff |...| 00001273