Home » Archimedes archive » Archimedes World » AW-1991-10.adf » October91 » !AWOct91/Goodies/ProgTheARM/TestCT
!AWOct91/Goodies/ProgTheARM/TestCT
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 » Archimedes archive » Archimedes World » AW-1991-10.adf » October91 |
Filename: | !AWOct91/Goodies/ProgTheARM/TestCT |
Read OK: | ✔ |
File size: | 112F bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM > $.TestCT 20 30REM Example program Illustrating the use of 40REM Colourtrans to find the nearest logical 50REM colour for a particular RGB value. 60REM 70REM 80 90sin60=SINRAD60 100cos60=COSRAD60 110 120PROCshow_13 :PROCwait 130PROCshow_12 :PROCwait 140PROCshow_12_grey:PROCwait 150PROCshow_8 :PROCwait 160PROCshow_8_grey :PROCwait 170PROCshow_0 : 180 190END 200 210DEFPROCwait 220PRINT"Press a Key ...";:Q=GET 230ENDPROC 240 250DEFPROCshow_0 260MODE 0 270PRINT"MODE 0, two colours using stipple patterning" 280l2bpp%=0 290PROCshow(640,512) 300ENDPROC 310 320DEFPROCshow_12 330MODE 12 340PRINT"MODE 12 : 16 colours with default palette" 350l2bpp%=2 360PROCshow(640,512) 370ENDPROC 380 390DEFPROCshow_8 400MODE 8 410PRINT"MODE 8 : 4 colours with default palette" 420l2bpp%=1 430PROCshow(640,512) 440ENDPROC 450 460DEFPROCshow_8_grey 470MODE 8 480PRINT"MODE 8 : with 4 colour grey scale palette" 490l2bpp%=1 500PROCpalette_4_greyscale 510PROCshow(640,512) 520ENDPROC 530 540DEFPROCshow_12_grey 550MODE 12 560PRINT"MODE 12 : with 16 grey level palette" 570l2bpp%=2 580PROCpalette_16_greyscale 590PROCshow(640,512) 600ENDPROC 610 620DEFPROCshow_13 630MODE 13 640PRINT"MODE 13, 256 Colours available" 650l2bpp%=3 660PROCshow(640,512) 670ENDPROC 680 690REM 700REM Step through all distinct RGB 24 palette values. 710REM 720REM (Using a step of &11 keeps the high and low nibbles ) 730REM (of the bytes the same. This is strongly recommended ) 740REM (for future compatibility with hardware capable of ) 750REM (more than 256 colour displays. ) 760REM 770REM Calculate the palette word by combining R,G and B values 780REM and pass to the output routine. 790REM 800REM The X an Y positions are based on three axes at 120 degrees 810REM to each other. The green axis is vertial (y direction). 820REM 830 840DEFPROCshow(basex%,basey%) 850LOCALred%,grn%,blu%,bgr24%,x%,y% 860FOR red%=&00 TO &FF STEP &11 870 FOR grn%=&00 TO &FF STEP &11 880 FOR blu%=&00 TO &FF STEP &11 890 900 bgr24% = ( blu% << 24 ) + ( grn% << 16 ) + ( red% << 8 ) 910 920 x%= blu% * sin60 - red% * sin60 930 y%= grn% - red% * cos60 - blu% * cos60 940 950 PROCplot_b(basex%+x%,basey%+y%,bgr24%) 960 970 NEXT 980 NEXT 990NEXT 1000ENDPROC 1010 1020REM 1030REM To view the cube inside out. Use this routine. 1040REM 1050 1060DEFPROCshow_reverse(basex%,basey%) 1070LOCALred%,grn%,blu%,bgr24%,x%,y% 1080FOR red%=&FF TO &00 STEP -&11 1090 FOR grn%=&FF TO &00 STEP -&11 1100 FOR blu%=&FF TO &00 STEP -&11 1110 1120 bgr24% = ( blu% << 24 ) + ( grn% << 16 ) + ( red% << 8 ) 1130 1140 x%= blu% * sin60 - red% * sin60 1150 y%= grn% - red% * cos60 - blu% * cos60 1160 1170 PROCplot_b(basex%+x%,basey%+y%,bgr24%) 1180 1190 NEXT 1200 NEXT 1210NEXT 1220ENDPROC 1230 1240 1250REM The simple version of the colour translation 1260REM This method works for now but will not produce 1270REM the best answers in future releases of the 1280REM ColourTrans module. It is better to get ColourTrans 1290REM to set the GCOL directly to give it the chance 1300REM to do stipple patterns. 1310 1320DEFPROCplot(X%,Y%,bgr24%) 1330LOCALgcol% 1340 1350SYS"ColourTrans_ReturnGCOL",bgr24% TO gcol% 1360 1370IF l2bpp% =3 THEN 1380 GCOL gcol%>>2 TINT (gcol% AND &3)<<6 1390ELSE 1400 GCOL gcol% 1410ENDIF 1420 1430CIRCLE FILL X%,Y%,16 1440 1450ENDPROC 1460 1470 1480REM The "correct" use of colour trans for 256,16 and 4 colour modes. 1481REM You should use this version for all modes. The code for 1482REM two colour modes here is a simulation of how stipple patterning 1483REM could be performed by future versions. Here it uses a function 1484REM called whichcolour which simulates the colourtrans process 1485REM and returns a number suitable for giving to Wimp_SetColour, 1486REM which knows how to do stipple patterning, but only in 2 colour 1487REM modes. 1490 1500DEFPROCplot_b(X%,Y%,bgr24%) 1510CASE l2bpp% OF 1520WHEN 3,2,1 1530 SYS"ColourTrans_SetGCOL",bgr24%,,0,0 1540WHEN 0 1550 SYS"Wimp_SetColour",FNwhichcolour(bgr24%) 1560ENDCASE 1570CIRCLE FILL X%,Y%,12 1580ENDPROC 1590 1600REM Simulate the action of colourtrans 1610REM by calculating a weigthed square and 1620REM then interpolating 1630 1640DEFFNwhichcolour(bgr24%) 1650LOCALr%,g%,b% 1660LOCALi%,res% 1670res%=0 1680r%=(bgr24% >>8 ) AND&FF 1690g%=(bgr24% >>16 ) AND&FF 1700b%=(bgr24% >>24 ) AND&FF 1710i%=2*r%*r%+3*g%*g%+b%*b% 1720CASE TRUE OF 1730WHEN i%< &01000 : res%=0 1740WHEN i%< &02000 : res%=1 1750WHEN i%< &04000 : res%=2 1760WHEN i%< &08000 : res%=3 1770WHEN i%< &10000 : res%=4 1780WHEN i%< &20000 : res%=5 1790WHEN i%< &40000 : res%=6 1800WHEN i%< &80000 : res%=7 1810OTHERWISE res%=7 1820ENDCASE 1830=res% 1840 1850DEFPROCpalette_16_greyscale 1860LOCALI% 1870FOR I%=0TO15 1880 VDU19,I%,16,I%<<4,I%<<4,I%<<4 1890NEXT 1900SYS"ColourTrans_InvalidateCache" 1910ENDPROC 1920 1930DEFPROCpalette_4_greyscale 1940LOCALI% 1950FOR I%=0TO3 1960 VDU19,I%,16,I%<<6,I%<<6,I%<<6 1970NEXT 1980SYS"ColourTrans_InvalidateCache" 1990ENDPROC
� > $.TestCT -� Example program Illustrating the use of (-� Colourtrans to find the nearest logical 2(� colour for a particular RGB value. <� F� P Zsin60=��60 dcos60=��60 n x�show_13 :�wait ��show_12 :�wait ��show_12_grey:�wait ��show_8 :�wait ��show_8_grey :�wait ��show_0 : � �� � � ��wait ��"Press a Key ...";:Q=� �� � ���show_0 � 0 3�"MODE 0, two colours using stipple patterning" l2bpp%=0 "�show(640,512) ,� 6 @ ��show_12 J� 12 T0�"MODE 12 : 16 colours with default palette" ^l2bpp%=2 h�show(640,512) r� | ���show_8 �� 8 �.�"MODE 8 : 4 colours with default palette" �l2bpp%=1 ��show(640,512) �� � ���show_8_grey �� 8 �0�"MODE 8 : with 4 colour grey scale palette" �l2bpp%=1 ��palette_4_greyscale ��show(640,512) � ��show_12_grey &� 12 0+�"MODE 12 : with 16 grey level palette" :l2bpp%=2 D�palette_16_greyscale N�show(640,512) X� b l ��show_13 v� 13 �%�"MODE 13, 256 Colours available" �l2bpp%=3 ��show(640,512) �� � �� �6� Step through all distinct RGB 24 palette values. �� �<� (Using a step of &11 keeps the high and low nibbles ) �<� (of the bytes the same. This is strongly recommended ) �<� (for future compatibility with hardware capable of ) �<� (more than 256 colour displays. ) �� >� Calculate the palette word by combining R,G and B values %� and pass to the output routine. � A� The X an Y positions are based on three axes at 120 degrees *=� to each other. The green axis is vertial (y direction). 4� > H��show(basex%,basey%) R �red%,grn%,blu%,bgr24%,x%,y% \� red%=&00 � &FF � &11 f � grn%=&00 � &FF � &11 p � blu%=&00 � &FF � &11 z �B bgr24% = ( blu% << 24 ) + ( grn% << 16 ) + ( red% << 8 ) � �) x%= blu% * sin60 - red% * sin60 �0 y%= grn% - red% * cos60 - blu% * cos60 � �- �plot_b(basex%+x%,basey%+y%,bgr24%) � � � � � �� �� � �� 4� To view the cube inside out. Use this routine. � $!��show_reverse(basex%,basey%) . �red%,grn%,blu%,bgr24%,x%,y% 8� red%=&FF � &00 � -&11 B � grn%=&FF � &00 � -&11 L � blu%=&FF � &00 � -&11 V `B bgr24% = ( blu% << 24 ) + ( grn% << 16 ) + ( red% << 8 ) j t) x%= blu% * sin60 - red% * sin60 ~0 y%= grn% - red% * cos60 - blu% * cos60 � �- �plot_b(basex%+x%,basey%+y%,bgr24%) � � � � � �� �� � � �2� The simple version of the colour translation �4� This method works for now but will not produce �0� the best answers in future releases of the 9� ColourTrans module. It is better to get ColourTrans 4� to set the GCOL directly to give it the chance � to do stipple patterns. (��plot(X%,Y%,bgr24%) 2 �gcol% < F-ș"ColourTrans_ReturnGCOL",bgr24% � gcol% P Z� l2bpp% =3 � d# � gcol%>>2 Ȝ (gcol% � &3)<<6 n� x � gcol% �� � �ȏ Ȑ X%,Y%,16 � �� � � �F� The "correct" use of colour trans for 256,16 and 4 colour modes. �=� You should use this version for all modes. The code for �E� two colour modes here is a simulation of how stipple patterning �D� could be performed by future versions. Here it uses a function �@� called whichcolour which simulates the colourtrans process �A� and returns a number suitable for giving to Wimp_SetColour, �D� which knows how to do stipple patterning, but only in 2 colour �� modes. � ���plot_b(X%,Y%,bgr24%) �Ȏ l2bpp% � �� 3,2,1 �) ș"ColourTrans_SetGCOL",bgr24%,,0,0 � 0 - ș"Wimp_SetColour",�whichcolour(bgr24%) � "ȏ Ȑ X%,Y%,12 ,� 6 @(� Simulate the action of colourtrans J*� by calculating a weigthed square and T� then interpolating ^ hݤwhichcolour(bgr24%) r �r%,g%,b% |�i%,res% � res%=0 �r%=(bgr24% >>8 ) �&FF �g%=(bgr24% >>16 ) �&FF �b%=(bgr24% >>24 ) �&FF �i%=2*r%*r%+3*g%*g%+b%*b% � Ȏ � � �� i%< &01000 : res%=0 �� i%< &02000 : res%=1 �� i%< &04000 : res%=2 �� i%< &08000 : res%=3 �� i%< &10000 : res%=4 �� i%< &20000 : res%=5 �� i%< &40000 : res%=6 � i%< &80000 : res%=7 res%=7 � & =res% 0 :��palette_16_greyscale D�I% N � I%=0�15 X! �19,I%,16,I%<<4,I%<<4,I%<<4 b� l#ș"ColourTrans_InvalidateCache" v� � ���palette_4_greyscale ��I% �� I%=0�3 �! �19,I%,16,I%<<6,I%<<6,I%<<6 �� �#ș"ColourTrans_InvalidateCache" �� �
00000000 0d 00 0a 10 f4 20 3e 20 24 2e 54 65 73 74 43 54 |..... > $.TestCT| 00000010 0d 00 14 04 0d 00 1e 2d f4 20 45 78 61 6d 70 6c |.......-. Exampl| 00000020 65 20 70 72 6f 67 72 61 6d 20 49 6c 6c 75 73 74 |e program Illust| 00000030 72 61 74 69 6e 67 20 74 68 65 20 75 73 65 20 6f |rating the use o| 00000040 66 0d 00 28 2d f4 20 43 6f 6c 6f 75 72 74 72 61 |f..(-. Colourtra| 00000050 6e 73 20 74 6f 20 66 69 6e 64 20 74 68 65 20 6e |ns to find the n| 00000060 65 61 72 65 73 74 20 6c 6f 67 69 63 61 6c 0d 00 |earest logical..| 00000070 32 28 f4 20 63 6f 6c 6f 75 72 20 66 6f 72 20 61 |2(. colour for a| 00000080 20 70 61 72 74 69 63 75 6c 61 72 20 52 47 42 20 | particular RGB | 00000090 76 61 6c 75 65 2e 0d 00 3c 05 f4 0d 00 46 05 f4 |value...<....F..| 000000a0 0d 00 50 04 0d 00 5a 0e 73 69 6e 36 30 3d b5 b2 |..P...Z.sin60=..| 000000b0 36 30 0d 00 64 0e 63 6f 73 36 30 3d 9b b2 36 30 |60..d.cos60=..60| 000000c0 0d 00 6e 04 0d 00 78 17 f2 73 68 6f 77 5f 31 33 |..n...x..show_13| 000000d0 20 20 20 20 20 3a f2 77 61 69 74 0d 00 82 17 f2 | :.wait.....| 000000e0 73 68 6f 77 5f 31 32 20 20 20 20 20 3a f2 77 61 |show_12 :.wa| 000000f0 69 74 0d 00 8c 17 f2 73 68 6f 77 5f 31 32 5f 67 |it.....show_12_g| 00000100 72 65 79 3a f2 77 61 69 74 0d 00 96 17 f2 73 68 |rey:.wait.....sh| 00000110 6f 77 5f 38 20 20 20 20 20 20 3a f2 77 61 69 74 |ow_8 :.wait| 00000120 0d 00 a0 17 f2 73 68 6f 77 5f 38 5f 67 72 65 79 |.....show_8_grey| 00000130 20 3a f2 77 61 69 74 0d 00 aa 12 f2 73 68 6f 77 | :.wait.....show| 00000140 5f 30 20 20 20 20 20 20 3a 0d 00 b4 04 0d 00 be |_0 :.......| 00000150 05 e0 0d 00 c8 04 0d 00 d2 0a dd f2 77 61 69 74 |............wait| 00000160 0d 00 dc 1b f1 22 50 72 65 73 73 20 61 20 4b 65 |....."Press a Ke| 00000170 79 20 2e 2e 2e 22 3b 3a 51 3d a5 0d 00 e6 05 e1 |y ...";:Q=......| 00000180 0d 00 f0 04 0d 00 fa 0c dd f2 73 68 6f 77 5f 30 |..........show_0| 00000190 0d 01 04 07 eb 20 30 0d 01 0e 33 f1 22 4d 4f 44 |..... 0...3."MOD| 000001a0 45 20 30 2c 20 74 77 6f 20 63 6f 6c 6f 75 72 73 |E 0, two colours| 000001b0 20 75 73 69 6e 67 20 73 74 69 70 70 6c 65 20 70 | using stipple p| 000001c0 61 74 74 65 72 6e 69 6e 67 22 0d 01 18 0c 6c 32 |atterning"....l2| 000001d0 62 70 70 25 3d 30 0d 01 22 12 f2 73 68 6f 77 28 |bpp%=0.."..show(| 000001e0 36 34 30 2c 35 31 32 29 0d 01 2c 05 e1 0d 01 36 |640,512)..,....6| 000001f0 04 0d 01 40 0d dd f2 73 68 6f 77 5f 31 32 0d 01 |...@...show_12..| 00000200 4a 08 eb 20 31 32 0d 01 54 30 f1 22 4d 4f 44 45 |J.. 12..T0."MODE| 00000210 20 31 32 20 3a 20 31 36 20 63 6f 6c 6f 75 72 73 | 12 : 16 colours| 00000220 20 77 69 74 68 20 64 65 66 61 75 6c 74 20 70 61 | with default pa| 00000230 6c 65 74 74 65 22 0d 01 5e 0c 6c 32 62 70 70 25 |lette"..^.l2bpp%| 00000240 3d 32 0d 01 68 12 f2 73 68 6f 77 28 36 34 30 2c |=2..h..show(640,| 00000250 35 31 32 29 0d 01 72 05 e1 0d 01 7c 04 0d 01 86 |512)..r....|....| 00000260 0c dd f2 73 68 6f 77 5f 38 0d 01 90 07 eb 20 38 |...show_8..... 8| 00000270 0d 01 9a 2e f1 22 4d 4f 44 45 20 38 20 3a 20 34 |....."MODE 8 : 4| 00000280 20 63 6f 6c 6f 75 72 73 20 77 69 74 68 20 64 65 | colours with de| 00000290 66 61 75 6c 74 20 70 61 6c 65 74 74 65 22 0d 01 |fault palette"..| 000002a0 a4 0c 6c 32 62 70 70 25 3d 31 0d 01 ae 12 f2 73 |..l2bpp%=1.....s| 000002b0 68 6f 77 28 36 34 30 2c 35 31 32 29 0d 01 b8 05 |how(640,512)....| 000002c0 e1 0d 01 c2 04 0d 01 cc 11 dd f2 73 68 6f 77 5f |...........show_| 000002d0 38 5f 67 72 65 79 0d 01 d6 07 eb 20 38 0d 01 e0 |8_grey..... 8...| 000002e0 30 f1 22 4d 4f 44 45 20 38 20 3a 20 77 69 74 68 |0."MODE 8 : with| 000002f0 20 34 20 63 6f 6c 6f 75 72 20 67 72 65 79 20 73 | 4 colour grey s| 00000300 63 61 6c 65 20 70 61 6c 65 74 74 65 22 0d 01 ea |cale palette"...| 00000310 0c 6c 32 62 70 70 25 3d 31 0d 01 f4 18 f2 70 61 |.l2bpp%=1.....pa| 00000320 6c 65 74 74 65 5f 34 5f 67 72 65 79 73 63 61 6c |lette_4_greyscal| 00000330 65 0d 01 fe 12 f2 73 68 6f 77 28 36 34 30 2c 35 |e.....show(640,5| 00000340 31 32 29 0d 02 08 05 e1 0d 02 12 04 0d 02 1c 12 |12).............| 00000350 dd f2 73 68 6f 77 5f 31 32 5f 67 72 65 79 0d 02 |..show_12_grey..| 00000360 26 08 eb 20 31 32 0d 02 30 2b f1 22 4d 4f 44 45 |&.. 12..0+."MODE| 00000370 20 31 32 20 3a 20 77 69 74 68 20 31 36 20 67 72 | 12 : with 16 gr| 00000380 65 79 20 6c 65 76 65 6c 20 70 61 6c 65 74 74 65 |ey level palette| 00000390 22 0d 02 3a 0c 6c 32 62 70 70 25 3d 32 0d 02 44 |"..:.l2bpp%=2..D| 000003a0 19 f2 70 61 6c 65 74 74 65 5f 31 36 5f 67 72 65 |..palette_16_gre| 000003b0 79 73 63 61 6c 65 0d 02 4e 12 f2 73 68 6f 77 28 |yscale..N..show(| 000003c0 36 34 30 2c 35 31 32 29 0d 02 58 05 e1 0d 02 62 |640,512)..X....b| 000003d0 04 0d 02 6c 0d dd f2 73 68 6f 77 5f 31 33 0d 02 |...l...show_13..| 000003e0 76 08 eb 20 31 33 0d 02 80 25 f1 22 4d 4f 44 45 |v.. 13...%."MODE| 000003f0 20 31 33 2c 20 32 35 36 20 43 6f 6c 6f 75 72 73 | 13, 256 Colours| 00000400 20 61 76 61 69 6c 61 62 6c 65 22 0d 02 8a 0c 6c | available"....l| 00000410 32 62 70 70 25 3d 33 0d 02 94 12 f2 73 68 6f 77 |2bpp%=3.....show| 00000420 28 36 34 30 2c 35 31 32 29 0d 02 9e 05 e1 0d 02 |(640,512).......| 00000430 a8 04 0d 02 b2 05 f4 0d 02 bc 36 f4 20 53 74 65 |..........6. Ste| 00000440 70 20 74 68 72 6f 75 67 68 20 61 6c 6c 20 64 69 |p through all di| 00000450 73 74 69 6e 63 74 20 52 47 42 20 32 34 20 70 61 |stinct RGB 24 pa| 00000460 6c 65 74 74 65 20 76 61 6c 75 65 73 2e 0d 02 c6 |lette values....| 00000470 05 f4 0d 02 d0 3c f4 20 28 55 73 69 6e 67 20 61 |.....<. (Using a| 00000480 20 73 74 65 70 20 6f 66 20 26 31 31 20 6b 65 65 | step of &11 kee| 00000490 70 73 20 74 68 65 20 68 69 67 68 20 61 6e 64 20 |ps the high and | 000004a0 6c 6f 77 20 6e 69 62 62 6c 65 73 20 20 29 0d 02 |low nibbles )..| 000004b0 da 3c f4 20 28 6f 66 20 74 68 65 20 62 79 74 65 |.<. (of the byte| 000004c0 73 20 74 68 65 20 73 61 6d 65 2e 20 54 68 69 73 |s the same. This| 000004d0 20 69 73 20 73 74 72 6f 6e 67 6c 79 20 72 65 63 | is strongly rec| 000004e0 6f 6d 6d 65 6e 64 65 64 20 29 0d 02 e4 3c f4 20 |ommended )...<. | 000004f0 28 66 6f 72 20 66 75 74 75 72 65 20 63 6f 6d 70 |(for future comp| 00000500 61 74 69 62 69 6c 69 74 79 20 77 69 74 68 20 68 |atibility with h| 00000510 61 72 64 77 61 72 65 20 63 61 70 61 62 6c 65 20 |ardware capable | 00000520 6f 66 20 20 20 29 0d 02 ee 3c f4 20 28 6d 6f 72 |of )...<. (mor| 00000530 65 20 74 68 61 6e 20 32 35 36 20 63 6f 6c 6f 75 |e than 256 colou| 00000540 72 20 64 69 73 70 6c 61 79 73 2e 20 20 20 20 20 |r displays. | 00000550 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000560 20 29 0d 02 f8 05 f4 0d 03 02 3e f4 20 43 61 6c | )........>. Cal| 00000570 63 75 6c 61 74 65 20 74 68 65 20 70 61 6c 65 74 |culate the palet| 00000580 74 65 20 77 6f 72 64 20 62 79 20 63 6f 6d 62 69 |te word by combi| 00000590 6e 69 6e 67 20 52 2c 47 20 61 6e 64 20 42 20 76 |ning R,G and B v| 000005a0 61 6c 75 65 73 0d 03 0c 25 f4 20 61 6e 64 20 70 |alues...%. and p| 000005b0 61 73 73 20 74 6f 20 74 68 65 20 6f 75 74 70 75 |ass to the outpu| 000005c0 74 20 72 6f 75 74 69 6e 65 2e 0d 03 16 05 f4 0d |t routine.......| 000005d0 03 20 41 f4 20 54 68 65 20 58 20 61 6e 20 59 20 |. A. The X an Y | 000005e0 70 6f 73 69 74 69 6f 6e 73 20 61 72 65 20 62 61 |positions are ba| 000005f0 73 65 64 20 6f 6e 20 74 68 72 65 65 20 61 78 65 |sed on three axe| 00000600 73 20 61 74 20 31 32 30 20 64 65 67 72 65 65 73 |s at 120 degrees| 00000610 0d 03 2a 3d f4 20 74 6f 20 65 61 63 68 20 6f 74 |..*=. to each ot| 00000620 68 65 72 2e 20 54 68 65 20 67 72 65 65 6e 20 61 |her. The green a| 00000630 78 69 73 20 69 73 20 76 65 72 74 69 61 6c 20 28 |xis is vertial (| 00000640 79 20 64 69 72 65 63 74 69 6f 6e 29 2e 0d 03 34 |y direction)...4| 00000650 05 f4 0d 03 3e 04 0d 03 48 19 dd f2 73 68 6f 77 |....>...H...show| 00000660 28 62 61 73 65 78 25 2c 62 61 73 65 79 25 29 0d |(basex%,basey%).| 00000670 03 52 20 ea 72 65 64 25 2c 67 72 6e 25 2c 62 6c |.R .red%,grn%,bl| 00000680 75 25 2c 62 67 72 32 34 25 2c 78 25 2c 79 25 0d |u%,bgr24%,x%,y%.| 00000690 03 5c 1a e3 20 72 65 64 25 3d 26 30 30 20 b8 20 |.\.. red%=&00 . | 000006a0 26 46 46 20 88 20 26 31 31 0d 03 66 1c 20 20 e3 |&FF . &11..f. .| 000006b0 20 67 72 6e 25 3d 26 30 30 20 b8 20 26 46 46 20 | grn%=&00 . &FF | 000006c0 88 20 26 31 31 0d 03 70 1e 20 20 20 20 e3 20 62 |. &11..p. . b| 000006d0 6c 75 25 3d 26 30 30 20 b8 20 26 46 46 20 88 20 |lu%=&00 . &FF . | 000006e0 26 31 31 0d 03 7a 04 0d 03 84 42 20 20 20 20 20 |&11..z....B | 000006f0 20 62 67 72 32 34 25 20 3d 20 28 20 62 6c 75 25 | bgr24% = ( blu%| 00000700 20 3c 3c 20 32 34 20 29 20 2b 20 28 20 67 72 6e | << 24 ) + ( grn| 00000710 25 20 3c 3c 20 31 36 20 29 20 2b 20 28 20 72 65 |% << 16 ) + ( re| 00000720 64 25 20 3c 3c 20 38 20 29 0d 03 8e 04 0d 03 98 |d% << 8 ).......| 00000730 29 20 20 20 20 20 20 78 25 3d 20 62 6c 75 25 20 |) x%= blu% | 00000740 2a 20 73 69 6e 36 30 20 2d 20 72 65 64 25 20 2a |* sin60 - red% *| 00000750 20 73 69 6e 36 30 0d 03 a2 30 20 20 20 20 20 20 | sin60...0 | 00000760 79 25 3d 20 67 72 6e 25 20 2d 20 72 65 64 25 20 |y%= grn% - red% | 00000770 2a 20 63 6f 73 36 30 20 2d 20 62 6c 75 25 20 2a |* cos60 - blu% *| 00000780 20 63 6f 73 36 30 0d 03 ac 04 0d 03 b6 2d 20 20 | cos60.......- | 00000790 20 20 20 20 f2 70 6c 6f 74 5f 62 28 62 61 73 65 | .plot_b(base| 000007a0 78 25 2b 78 25 2c 62 61 73 65 79 25 2b 79 25 2c |x%+x%,basey%+y%,| 000007b0 62 67 72 32 34 25 29 0d 03 c0 04 0d 03 ca 09 20 |bgr24%)........ | 000007c0 20 20 20 ed 0d 03 d4 07 20 20 ed 0d 03 de 05 ed | ..... ......| 000007d0 0d 03 e8 05 e1 0d 03 f2 04 0d 03 fc 05 f4 0d 04 |................| 000007e0 06 34 f4 20 54 6f 20 76 69 65 77 20 74 68 65 20 |.4. To view the | 000007f0 63 75 62 65 20 69 6e 73 69 64 65 20 6f 75 74 2e |cube inside out.| 00000800 20 55 73 65 20 74 68 69 73 20 72 6f 75 74 69 6e | Use this routin| 00000810 65 2e 0d 04 10 05 f4 0d 04 1a 04 0d 04 24 21 dd |e............$!.| 00000820 f2 73 68 6f 77 5f 72 65 76 65 72 73 65 28 62 61 |.show_reverse(ba| 00000830 73 65 78 25 2c 62 61 73 65 79 25 29 0d 04 2e 20 |sex%,basey%)... | 00000840 ea 72 65 64 25 2c 67 72 6e 25 2c 62 6c 75 25 2c |.red%,grn%,blu%,| 00000850 62 67 72 32 34 25 2c 78 25 2c 79 25 0d 04 38 1b |bgr24%,x%,y%..8.| 00000860 e3 20 72 65 64 25 3d 26 46 46 20 b8 20 26 30 30 |. red%=&FF . &00| 00000870 20 88 20 2d 26 31 31 0d 04 42 1d 20 20 e3 20 67 | . -&11..B. . g| 00000880 72 6e 25 3d 26 46 46 20 b8 20 26 30 30 20 88 20 |rn%=&FF . &00 . | 00000890 2d 26 31 31 0d 04 4c 1f 20 20 20 20 e3 20 62 6c |-&11..L. . bl| 000008a0 75 25 3d 26 46 46 20 b8 20 26 30 30 20 88 20 2d |u%=&FF . &00 . -| 000008b0 26 31 31 0d 04 56 04 0d 04 60 42 20 20 20 20 20 |&11..V...`B | 000008c0 20 62 67 72 32 34 25 20 3d 20 28 20 62 6c 75 25 | bgr24% = ( blu%| 000008d0 20 3c 3c 20 32 34 20 29 20 2b 20 28 20 67 72 6e | << 24 ) + ( grn| 000008e0 25 20 3c 3c 20 31 36 20 29 20 2b 20 28 20 72 65 |% << 16 ) + ( re| 000008f0 64 25 20 3c 3c 20 38 20 29 0d 04 6a 04 0d 04 74 |d% << 8 )..j...t| 00000900 29 20 20 20 20 20 20 78 25 3d 20 62 6c 75 25 20 |) x%= blu% | 00000910 2a 20 73 69 6e 36 30 20 2d 20 72 65 64 25 20 2a |* sin60 - red% *| 00000920 20 73 69 6e 36 30 0d 04 7e 30 20 20 20 20 20 20 | sin60..~0 | 00000930 79 25 3d 20 67 72 6e 25 20 2d 20 72 65 64 25 20 |y%= grn% - red% | 00000940 2a 20 63 6f 73 36 30 20 2d 20 62 6c 75 25 20 2a |* cos60 - blu% *| 00000950 20 63 6f 73 36 30 0d 04 88 04 0d 04 92 2d 20 20 | cos60.......- | 00000960 20 20 20 20 f2 70 6c 6f 74 5f 62 28 62 61 73 65 | .plot_b(base| 00000970 78 25 2b 78 25 2c 62 61 73 65 79 25 2b 79 25 2c |x%+x%,basey%+y%,| 00000980 62 67 72 32 34 25 29 0d 04 9c 04 0d 04 a6 09 20 |bgr24%)........ | 00000990 20 20 20 ed 0d 04 b0 07 20 20 ed 0d 04 ba 05 ed | ..... ......| 000009a0 0d 04 c4 05 e1 0d 04 ce 04 0d 04 d8 04 0d 04 e2 |................| 000009b0 32 f4 20 54 68 65 20 73 69 6d 70 6c 65 20 76 65 |2. The simple ve| 000009c0 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 63 6f 6c |rsion of the col| 000009d0 6f 75 72 20 74 72 61 6e 73 6c 61 74 69 6f 6e 0d |our translation.| 000009e0 04 ec 34 f4 20 54 68 69 73 20 6d 65 74 68 6f 64 |..4. This method| 000009f0 20 77 6f 72 6b 73 20 66 6f 72 20 6e 6f 77 20 62 | works for now b| 00000a00 75 74 20 77 69 6c 6c 20 6e 6f 74 20 70 72 6f 64 |ut will not prod| 00000a10 75 63 65 0d 04 f6 30 f4 20 74 68 65 20 62 65 73 |uce...0. the bes| 00000a20 74 20 61 6e 73 77 65 72 73 20 69 6e 20 66 75 74 |t answers in fut| 00000a30 75 72 65 20 72 65 6c 65 61 73 65 73 20 6f 66 20 |ure releases of | 00000a40 74 68 65 0d 05 00 39 f4 20 43 6f 6c 6f 75 72 54 |the...9. ColourT| 00000a50 72 61 6e 73 20 6d 6f 64 75 6c 65 2e 20 49 74 20 |rans module. It | 00000a60 69 73 20 62 65 74 74 65 72 20 74 6f 20 67 65 74 |is better to get| 00000a70 20 43 6f 6c 6f 75 72 54 72 61 6e 73 0d 05 0a 34 | ColourTrans...4| 00000a80 f4 20 74 6f 20 73 65 74 20 74 68 65 20 47 43 4f |. to set the GCO| 00000a90 4c 20 64 69 72 65 63 74 6c 79 20 74 6f 20 67 69 |L directly to gi| 00000aa0 76 65 20 69 74 20 74 68 65 20 63 68 61 6e 63 65 |ve it the chance| 00000ab0 0d 05 14 1d f4 20 74 6f 20 64 6f 20 73 74 69 70 |..... to do stip| 00000ac0 70 6c 65 20 70 61 74 74 65 72 6e 73 2e 0d 05 1e |ple patterns....| 00000ad0 04 0d 05 28 18 dd f2 70 6c 6f 74 28 58 25 2c 59 |...(...plot(X%,Y| 00000ae0 25 2c 62 67 72 32 34 25 29 0d 05 32 0a ea 67 63 |%,bgr24%)..2..gc| 00000af0 6f 6c 25 0d 05 3c 04 0d 05 46 2d c8 99 22 43 6f |ol%..<...F-.."Co| 00000b00 6c 6f 75 72 54 72 61 6e 73 5f 52 65 74 75 72 6e |lourTrans_Return| 00000b10 47 43 4f 4c 22 2c 62 67 72 32 34 25 20 b8 20 67 |GCOL",bgr24% . g| 00000b20 63 6f 6c 25 0d 05 50 04 0d 05 5a 11 e7 20 6c 32 |col%..P...Z.. l2| 00000b30 62 70 70 25 20 3d 33 20 8c 0d 05 64 23 20 20 e6 |bpp% =3 ...d# .| 00000b40 20 67 63 6f 6c 25 3e 3e 32 20 c8 9c 20 28 67 63 | gcol%>>2 .. (gc| 00000b50 6f 6c 25 20 80 20 26 33 29 3c 3c 36 0d 05 6e 05 |ol% . &3)<<6..n.| 00000b60 cc 0d 05 78 0d 20 20 e6 20 67 63 6f 6c 25 0d 05 |...x. . gcol%..| 00000b70 82 05 cd 0d 05 8c 04 0d 05 96 12 c8 8f 20 c8 90 |............. ..| 00000b80 20 58 25 2c 59 25 2c 31 36 0d 05 a0 04 0d 05 aa | X%,Y%,16.......| 00000b90 05 e1 0d 05 b4 04 0d 05 be 04 0d 05 c8 46 f4 20 |.............F. | 00000ba0 54 68 65 20 22 63 6f 72 72 65 63 74 22 20 75 73 |The "correct" us| 00000bb0 65 20 6f 66 20 63 6f 6c 6f 75 72 20 74 72 61 6e |e of colour tran| 00000bc0 73 20 66 6f 72 20 32 35 36 2c 31 36 20 61 6e 64 |s for 256,16 and| 00000bd0 20 34 20 63 6f 6c 6f 75 72 20 6d 6f 64 65 73 2e | 4 colour modes.| 00000be0 0d 05 c9 3d f4 20 59 6f 75 20 73 68 6f 75 6c 64 |...=. You should| 00000bf0 20 75 73 65 20 74 68 69 73 20 76 65 72 73 69 6f | use this versio| 00000c00 6e 20 66 6f 72 20 61 6c 6c 20 6d 6f 64 65 73 2e |n for all modes.| 00000c10 20 54 68 65 20 63 6f 64 65 20 66 6f 72 0d 05 ca | The code for...| 00000c20 45 f4 20 74 77 6f 20 63 6f 6c 6f 75 72 20 6d 6f |E. two colour mo| 00000c30 64 65 73 20 68 65 72 65 20 69 73 20 61 20 73 69 |des here is a si| 00000c40 6d 75 6c 61 74 69 6f 6e 20 6f 66 20 68 6f 77 20 |mulation of how | 00000c50 73 74 69 70 70 6c 65 20 70 61 74 74 65 72 6e 69 |stipple patterni| 00000c60 6e 67 0d 05 cb 44 f4 20 63 6f 75 6c 64 20 62 65 |ng...D. could be| 00000c70 20 70 65 72 66 6f 72 6d 65 64 20 62 79 20 66 75 | performed by fu| 00000c80 74 75 72 65 20 76 65 72 73 69 6f 6e 73 2e 20 48 |ture versions. H| 00000c90 65 72 65 20 69 74 20 75 73 65 73 20 61 20 66 75 |ere it uses a fu| 00000ca0 6e 63 74 69 6f 6e 0d 05 cc 40 f4 20 63 61 6c 6c |nction...@. call| 00000cb0 65 64 20 77 68 69 63 68 63 6f 6c 6f 75 72 20 77 |ed whichcolour w| 00000cc0 68 69 63 68 20 73 69 6d 75 6c 61 74 65 73 20 74 |hich simulates t| 00000cd0 68 65 20 63 6f 6c 6f 75 72 74 72 61 6e 73 20 70 |he colourtrans p| 00000ce0 72 6f 63 65 73 73 0d 05 cd 41 f4 20 61 6e 64 20 |rocess...A. and | 00000cf0 72 65 74 75 72 6e 73 20 61 20 6e 75 6d 62 65 72 |returns a number| 00000d00 20 73 75 69 74 61 62 6c 65 20 66 6f 72 20 67 69 | suitable for gi| 00000d10 76 69 6e 67 20 74 6f 20 57 69 6d 70 5f 53 65 74 |ving to Wimp_Set| 00000d20 43 6f 6c 6f 75 72 2c 0d 05 ce 44 f4 20 77 68 69 |Colour,...D. whi| 00000d30 63 68 20 6b 6e 6f 77 73 20 68 6f 77 20 74 6f 20 |ch knows how to | 00000d40 64 6f 20 73 74 69 70 70 6c 65 20 70 61 74 74 65 |do stipple patte| 00000d50 72 6e 69 6e 67 2c 20 62 75 74 20 6f 6e 6c 79 20 |rning, but only | 00000d60 69 6e 20 32 20 63 6f 6c 6f 75 72 0d 05 cf 0c f4 |in 2 colour.....| 00000d70 20 6d 6f 64 65 73 2e 0d 05 d2 04 0d 05 dc 1a dd | modes..........| 00000d80 f2 70 6c 6f 74 5f 62 28 58 25 2c 59 25 2c 62 67 |.plot_b(X%,Y%,bg| 00000d90 72 32 34 25 29 0d 05 e6 0f c8 8e 20 6c 32 62 70 |r24%)...... l2bp| 00000da0 70 25 20 ca 0d 05 f0 0b c9 20 33 2c 32 2c 31 0d |p% ...... 3,2,1.| 00000db0 05 fa 29 20 20 c8 99 22 43 6f 6c 6f 75 72 54 72 |..) .."ColourTr| 00000dc0 61 6e 73 5f 53 65 74 47 43 4f 4c 22 2c 62 67 72 |ans_SetGCOL",bgr| 00000dd0 32 34 25 2c 2c 30 2c 30 0d 06 04 07 c9 20 30 0d |24%,,0,0..... 0.| 00000de0 06 0e 2d 20 20 c8 99 22 57 69 6d 70 5f 53 65 74 |..- .."Wimp_Set| 00000df0 43 6f 6c 6f 75 72 22 2c a4 77 68 69 63 68 63 6f |Colour",.whichco| 00000e00 6c 6f 75 72 28 62 67 72 32 34 25 29 0d 06 18 05 |lour(bgr24%)....| 00000e10 cb 0d 06 22 12 c8 8f 20 c8 90 20 58 25 2c 59 25 |..."... .. X%,Y%| 00000e20 2c 31 32 0d 06 2c 05 e1 0d 06 36 04 0d 06 40 28 |,12..,....6...@(| 00000e30 f4 20 53 69 6d 75 6c 61 74 65 20 74 68 65 20 61 |. Simulate the a| 00000e40 63 74 69 6f 6e 20 6f 66 20 63 6f 6c 6f 75 72 74 |ction of colourt| 00000e50 72 61 6e 73 0d 06 4a 2a f4 20 62 79 20 63 61 6c |rans..J*. by cal| 00000e60 63 75 6c 61 74 69 6e 67 20 61 20 77 65 69 67 74 |culating a weigt| 00000e70 68 65 64 20 73 71 75 61 72 65 20 61 6e 64 0d 06 |hed square and..| 00000e80 54 18 f4 20 74 68 65 6e 20 69 6e 74 65 72 70 6f |T.. then interpo| 00000e90 6c 61 74 69 6e 67 0d 06 5e 04 0d 06 68 19 dd a4 |lating..^...h...| 00000ea0 77 68 69 63 68 63 6f 6c 6f 75 72 28 62 67 72 32 |whichcolour(bgr2| 00000eb0 34 25 29 0d 06 72 0d ea 72 25 2c 67 25 2c 62 25 |4%)..r..r%,g%,b%| 00000ec0 0d 06 7c 0c ea 69 25 2c 72 65 73 25 0d 06 86 0a |..|..i%,res%....| 00000ed0 72 65 73 25 3d 30 0d 06 90 1a 72 25 3d 28 62 67 |res%=0....r%=(bg| 00000ee0 72 32 34 25 20 3e 3e 38 20 20 29 20 80 26 46 46 |r24% >>8 ) .&FF| 00000ef0 0d 06 9a 1a 67 25 3d 28 62 67 72 32 34 25 20 3e |....g%=(bgr24% >| 00000f00 3e 31 36 20 29 20 80 26 46 46 0d 06 a4 1a 62 25 |>16 ) .&FF....b%| 00000f10 3d 28 62 67 72 32 34 25 20 3e 3e 32 34 20 29 20 |=(bgr24% >>24 ) | 00000f20 80 26 46 46 0d 06 ae 1c 69 25 3d 32 2a 72 25 2a |.&FF....i%=2*r%*| 00000f30 72 25 2b 33 2a 67 25 2a 67 25 2b 62 25 2a 62 25 |r%+3*g%*g%+b%*b%| 00000f40 0d 06 b8 0a c8 8e 20 b9 20 ca 0d 06 c2 1a c9 20 |...... . ...... | 00000f50 69 25 3c 20 26 30 31 30 30 30 20 20 3a 20 72 65 |i%< &01000 : re| 00000f60 73 25 3d 30 0d 06 cc 1a c9 20 69 25 3c 20 26 30 |s%=0..... i%< &0| 00000f70 32 30 30 30 20 20 3a 20 72 65 73 25 3d 31 0d 06 |2000 : res%=1..| 00000f80 d6 1a c9 20 69 25 3c 20 26 30 34 30 30 30 20 20 |... i%< &04000 | 00000f90 3a 20 72 65 73 25 3d 32 0d 06 e0 19 c9 20 69 25 |: res%=2..... i%| 00000fa0 3c 20 26 30 38 30 30 30 20 3a 20 72 65 73 25 3d |< &08000 : res%=| 00000fb0 33 0d 06 ea 19 c9 20 69 25 3c 20 26 31 30 30 30 |3..... i%< &1000| 00000fc0 30 20 3a 20 72 65 73 25 3d 34 0d 06 f4 19 c9 20 |0 : res%=4..... | 00000fd0 69 25 3c 20 26 32 30 30 30 30 20 3a 20 72 65 73 |i%< &20000 : res| 00000fe0 25 3d 35 0d 06 fe 19 c9 20 69 25 3c 20 26 34 30 |%=5..... i%< &40| 00000ff0 30 30 30 20 3a 20 72 65 73 25 3d 36 0d 07 08 19 |000 : res%=6....| 00001000 c9 20 69 25 3c 20 26 38 30 30 30 30 20 3a 20 72 |. i%< &80000 : r| 00001010 65 73 25 3d 37 0d 07 12 0c 7f 20 72 65 73 25 3d |es%=7..... res%=| 00001020 37 0d 07 1c 05 cb 0d 07 26 09 3d 72 65 73 25 0d |7.......&.=res%.| 00001030 07 30 04 0d 07 3a 1a dd f2 70 61 6c 65 74 74 65 |.0...:...palette| 00001040 5f 31 36 5f 67 72 65 79 73 63 61 6c 65 0d 07 44 |_16_greyscale..D| 00001050 07 ea 49 25 0d 07 4e 0d e3 20 49 25 3d 30 b8 31 |..I%..N.. I%=0.1| 00001060 35 0d 07 58 21 20 20 ef 31 39 2c 49 25 2c 31 36 |5..X! .19,I%,16| 00001070 2c 49 25 3c 3c 34 2c 49 25 3c 3c 34 2c 49 25 3c |,I%<<4,I%<<4,I%<| 00001080 3c 34 0d 07 62 05 ed 0d 07 6c 23 c8 99 22 43 6f |<4..b....l#.."Co| 00001090 6c 6f 75 72 54 72 61 6e 73 5f 49 6e 76 61 6c 69 |lourTrans_Invali| 000010a0 64 61 74 65 43 61 63 68 65 22 0d 07 76 05 e1 0d |dateCache"..v...| 000010b0 07 80 04 0d 07 8a 19 dd f2 70 61 6c 65 74 74 65 |.........palette| 000010c0 5f 34 5f 67 72 65 79 73 63 61 6c 65 0d 07 94 07 |_4_greyscale....| 000010d0 ea 49 25 0d 07 9e 0c e3 20 49 25 3d 30 b8 33 0d |.I%..... I%=0.3.| 000010e0 07 a8 21 20 20 ef 31 39 2c 49 25 2c 31 36 2c 49 |..! .19,I%,16,I| 000010f0 25 3c 3c 36 2c 49 25 3c 3c 36 2c 49 25 3c 3c 36 |%<<6,I%<<6,I%<<6| 00001100 0d 07 b2 05 ed 0d 07 bc 23 c8 99 22 43 6f 6c 6f |........#.."Colo| 00001110 75 72 54 72 61 6e 73 5f 49 6e 76 61 6c 69 64 61 |urTrans_Invalida| 00001120 74 65 43 61 63 68 65 22 0d 07 c6 05 e1 0d ff |teCache".......| 0000112f