Home » Archimedes archive » Acorn User » AU 1997-07 A.adf » Regulars » info/Mellor/Perspectiv
info/Mellor/Perspectiv
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 » Acorn User » AU 1997-07 A.adf » Regulars |
Filename: | info/Mellor/Perspectiv |
Read OK: | ✔ |
File size: | 04B8 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM Perspective 20REM *FAST* Texture mapping in BASIC! 30REM By Philip Mellor (aged 15) 40REM Acorn User/Star Info 50: 60MODE15:MODE13:OFF 70st=4:REM 4 for Arm 3 or better, 8 for Arm 250s, 12 for Arm 2s 80: 90ON ERROR MODE3:REPORT:PRINT" - ";ERL:END 100: 110dir$="Sprite" 120file%=OPENIN(dir$) 130size%=EXT#file%+64 140CLOSE#file% 150DIM sprite% size% 160sprite%!0=size% 170SYS "OS_SpriteOp",256+9,sprite% 180SYS "OS_SpriteOp",256+10,sprite%,dir$ 190: 200DIM ScaleFactors 20 210: 220s$="picture" 230: 240wave1=RND(1):wave2=RND(1):fr=1 250MOUSE TO 192,420 260: 270REPEAT 280SYS6,112,fr:CLS 290MOUSE X,Y,Z 300top=INT(SIN(wave1)*280)+720:wave1+=0.066 310bot=INT(SIN(wave2)*280)+720:wave2+=0.09 320IF X>1279-892 X=1279-892 330IF Y>1023-148 Y=1023-148 340PROCwave(s$,X,Y,892,148,top,bot,st) 350SYS6,113,fr:fr=3-fr:WAIT 360UNTIL0 370: 380DEF PROCwave(s$,awx,awy,w,h,s1,s2,st) 390LOCAL size,o 400size=s2:step=(s2-s1)/(h/st) 410o=0 420FOR ty=awy TO awy+h STEP st 430o=(w-size)/2 440VDU24,0;ty;1279;ty+st; 450REMVDU24,awx;ty;awx+w;ty+st; 460PROCscale(s$,awx+o,awy,size,size,w,w) 470size-=step 480NEXT 490ENDPROC 500: 510DEF PROCscale(sn$,x,y,x1,y1,x2,y2) 520IF x1=0 OR y1=0 OR x2=0 OR y2=0 THEN ENDPROC 530!ScaleFactors=x1:!(ScaleFactors+4)=y1 540!(ScaleFactors+8)=x2:!(ScaleFactors+12)=y2 550SYS&0000002E,52+256,sprite%,sn$,x,y,0,ScaleFactors 560ENDPROC
� Perspective &� *FAST* Texture mapping in BASIC! � By Philip Mellor (aged 15) (� Acorn User/Star Info 2: < �15:�13:� F?st=4:� 4 for Arm 3 or better, 8 for Arm 250s, 12 for Arm 2s P: Z� � �3:�:�" - ";�:� d: ndir$="Sprite" xfile%=�(dir$) �size%=�#file%+64 ��#file% �� sprite% size% �sprite%!0=size% �"ș "OS_SpriteOp",256+9,sprite% �(ș "OS_SpriteOp",256+10,sprite%,dir$ �: �� ScaleFactors 20 �: �s$="picture" �: �wave1=�(1):wave2=�(1):fr=1 �ȗ � 192,420 : � ș6,112,fr:� "ȗ X,Y,Z ,(top=�(�(wave1)*280)+720:wave1+=0.066 6'bot=�(�(wave2)*280)+720:wave2+=0.09 @� X>1279-892 X=1279-892 J� Y>1023-148 Y=1023-148 T$�wave(s$,X,Y,892,148,top,bot,st) ^ș6,113,fr:fr=3-fr:Ȗ h�0 r: |$� �wave(s$,awx,awy,w,h,s1,s2,st) �� size,o �size=s2:step=(s2-s1)/(h/st) �o=0 �� ty=awy � awy+h � st �o=(w-size)/2 ��24,0;ty;1279;ty+st; ��VDU24,awx;ty;awx+w;ty+st; �&�scale(s$,awx+o,awy,size,size,w,w) �size-=step �� �� �: �!� �scale(sn$,x,y,x1,y1,x2,y2) #� x1=0 � y1=0 � x2=0 � y2=0 � � )!ScaleFactors=x1:!(ScaleFactors+4)=y1 .!(ScaleFactors+8)=x2:!(ScaleFactors+12)=y2 &5ș&0000002E,52+256,sprite%,sn$,x,y,0,ScaleFactors 0� �
00000000 0d 00 0a 11 f4 20 50 65 72 73 70 65 63 74 69 76 |..... Perspectiv| 00000010 65 0d 00 14 26 f4 20 2a 46 41 53 54 2a 20 54 65 |e...&. *FAST* Te| 00000020 78 74 75 72 65 20 6d 61 70 70 69 6e 67 20 69 6e |xture mapping in| 00000030 20 42 41 53 49 43 21 0d 00 1e 20 f4 20 42 79 20 | BASIC!... . By | 00000040 50 68 69 6c 69 70 20 4d 65 6c 6c 6f 72 20 28 61 |Philip Mellor (a| 00000050 67 65 64 20 31 35 29 0d 00 28 1a f4 20 41 63 6f |ged 15)..(.. Aco| 00000060 72 6e 20 55 73 65 72 2f 53 74 61 72 20 49 6e 66 |rn User/Star Inf| 00000070 6f 0d 00 32 05 3a 0d 00 3c 0d eb 31 35 3a eb 31 |o..2.:..<..15:.1| 00000080 33 3a 87 0d 00 46 3f 73 74 3d 34 3a f4 20 34 20 |3:...F?st=4:. 4 | 00000090 66 6f 72 20 41 72 6d 20 33 20 6f 72 20 62 65 74 |for Arm 3 or bet| 000000a0 74 65 72 2c 20 38 20 66 6f 72 20 41 72 6d 20 32 |ter, 8 for Arm 2| 000000b0 35 30 73 2c 20 31 32 20 66 6f 72 20 41 72 6d 20 |50s, 12 for Arm | 000000c0 32 73 0d 00 50 05 3a 0d 00 5a 17 ee 20 85 20 eb |2s..P.:..Z.. . .| 000000d0 33 3a f6 3a f1 22 20 2d 20 22 3b 9e 3a e0 0d 00 |3:.:." - ";.:...| 000000e0 64 05 3a 0d 00 6e 11 64 69 72 24 3d 22 53 70 72 |d.:..n.dir$="Spr| 000000f0 69 74 65 22 0d 00 78 11 66 69 6c 65 25 3d 8e 28 |ite"..x.file%=.(| 00000100 64 69 72 24 29 0d 00 82 14 73 69 7a 65 25 3d a2 |dir$)....size%=.| 00000110 23 66 69 6c 65 25 2b 36 34 0d 00 8c 0b d9 23 66 |#file%+64.....#f| 00000120 69 6c 65 25 0d 00 96 13 de 20 73 70 72 69 74 65 |ile%..... sprite| 00000130 25 20 73 69 7a 65 25 0d 00 a0 13 73 70 72 69 74 |% size%....sprit| 00000140 65 25 21 30 3d 73 69 7a 65 25 0d 00 aa 22 c8 99 |e%!0=size%..."..| 00000150 20 22 4f 53 5f 53 70 72 69 74 65 4f 70 22 2c 32 | "OS_SpriteOp",2| 00000160 35 36 2b 39 2c 73 70 72 69 74 65 25 0d 00 b4 28 |56+9,sprite%...(| 00000170 c8 99 20 22 4f 53 5f 53 70 72 69 74 65 4f 70 22 |.. "OS_SpriteOp"| 00000180 2c 32 35 36 2b 31 30 2c 73 70 72 69 74 65 25 2c |,256+10,sprite%,| 00000190 64 69 72 24 0d 00 be 05 3a 0d 00 c8 15 de 20 53 |dir$....:..... S| 000001a0 63 61 6c 65 46 61 63 74 6f 72 73 20 32 30 0d 00 |caleFactors 20..| 000001b0 d2 05 3a 0d 00 dc 10 73 24 3d 22 70 69 63 74 75 |..:....s$="pictu| 000001c0 72 65 22 0d 00 e6 05 3a 0d 00 f0 1e 77 61 76 65 |re"....:....wave| 000001d0 31 3d b3 28 31 29 3a 77 61 76 65 32 3d b3 28 31 |1=.(1):wave2=.(1| 000001e0 29 3a 66 72 3d 31 0d 00 fa 10 c8 97 20 b8 20 31 |):fr=1...... . 1| 000001f0 39 32 2c 34 32 30 0d 01 04 05 3a 0d 01 0e 05 f5 |92,420....:.....| 00000200 0d 01 18 10 c8 99 36 2c 31 31 32 2c 66 72 3a db |......6,112,fr:.| 00000210 0d 01 22 0c c8 97 20 58 2c 59 2c 5a 0d 01 2c 28 |.."... X,Y,Z..,(| 00000220 74 6f 70 3d a8 28 b5 28 77 61 76 65 31 29 2a 32 |top=.(.(wave1)*2| 00000230 38 30 29 2b 37 32 30 3a 77 61 76 65 31 2b 3d 30 |80)+720:wave1+=0| 00000240 2e 30 36 36 0d 01 36 27 62 6f 74 3d a8 28 b5 28 |.066..6'bot=.(.(| 00000250 77 61 76 65 32 29 2a 32 38 30 29 2b 37 32 30 3a |wave2)*280)+720:| 00000260 77 61 76 65 32 2b 3d 30 2e 30 39 0d 01 40 1b e7 |wave2+=0.09..@..| 00000270 20 58 3e 31 32 37 39 2d 38 39 32 20 58 3d 31 32 | X>1279-892 X=12| 00000280 37 39 2d 38 39 32 0d 01 4a 1b e7 20 59 3e 31 30 |79-892..J.. Y>10| 00000290 32 33 2d 31 34 38 20 59 3d 31 30 32 33 2d 31 34 |23-148 Y=1023-14| 000002a0 38 0d 01 54 24 f2 77 61 76 65 28 73 24 2c 58 2c |8..T$.wave(s$,X,| 000002b0 59 2c 38 39 32 2c 31 34 38 2c 74 6f 70 2c 62 6f |Y,892,148,top,bo| 000002c0 74 2c 73 74 29 0d 01 5e 19 c8 99 36 2c 31 31 33 |t,st)..^...6,113| 000002d0 2c 66 72 3a 66 72 3d 33 2d 66 72 3a c8 96 0d 01 |,fr:fr=3-fr:....| 000002e0 68 06 fd 30 0d 01 72 05 3a 0d 01 7c 24 dd 20 f2 |h..0..r.:..|$. .| 000002f0 77 61 76 65 28 73 24 2c 61 77 78 2c 61 77 79 2c |wave(s$,awx,awy,| 00000300 77 2c 68 2c 73 31 2c 73 32 2c 73 74 29 0d 01 86 |w,h,s1,s2,st)...| 00000310 0c ea 20 73 69 7a 65 2c 6f 0d 01 90 1f 73 69 7a |.. size,o....siz| 00000320 65 3d 73 32 3a 73 74 65 70 3d 28 73 32 2d 73 31 |e=s2:step=(s2-s1| 00000330 29 2f 28 68 2f 73 74 29 0d 01 9a 07 6f 3d 30 0d |)/(h/st)....o=0.| 00000340 01 a4 19 e3 20 74 79 3d 61 77 79 20 b8 20 61 77 |.... ty=awy . aw| 00000350 79 2b 68 20 88 20 73 74 0d 01 ae 10 6f 3d 28 77 |y+h . st....o=(w| 00000360 2d 73 69 7a 65 29 2f 32 0d 01 b8 18 ef 32 34 2c |-size)/2.....24,| 00000370 30 3b 74 79 3b 31 32 37 39 3b 74 79 2b 73 74 3b |0;ty;1279;ty+st;| 00000380 0d 01 c2 1e f4 56 44 55 32 34 2c 61 77 78 3b 74 |.....VDU24,awx;t| 00000390 79 3b 61 77 78 2b 77 3b 74 79 2b 73 74 3b 0d 01 |y;awx+w;ty+st;..| 000003a0 cc 26 f2 73 63 61 6c 65 28 73 24 2c 61 77 78 2b |.&.scale(s$,awx+| 000003b0 6f 2c 61 77 79 2c 73 69 7a 65 2c 73 69 7a 65 2c |o,awy,size,size,| 000003c0 77 2c 77 29 0d 01 d6 0e 73 69 7a 65 2d 3d 73 74 |w,w)....size-=st| 000003d0 65 70 0d 01 e0 05 ed 0d 01 ea 05 e1 0d 01 f4 05 |ep..............| 000003e0 3a 0d 01 fe 21 dd 20 f2 73 63 61 6c 65 28 73 6e |:...!. .scale(sn| 000003f0 24 2c 78 2c 79 2c 78 31 2c 79 31 2c 78 32 2c 79 |$,x,y,x1,y1,x2,y| 00000400 32 29 0d 02 08 23 e7 20 78 31 3d 30 20 84 20 79 |2)...#. x1=0 . y| 00000410 31 3d 30 20 84 20 78 32 3d 30 20 84 20 79 32 3d |1=0 . x2=0 . y2=| 00000420 30 20 8c 20 e1 0d 02 12 29 21 53 63 61 6c 65 46 |0 . ....)!ScaleF| 00000430 61 63 74 6f 72 73 3d 78 31 3a 21 28 53 63 61 6c |actors=x1:!(Scal| 00000440 65 46 61 63 74 6f 72 73 2b 34 29 3d 79 31 0d 02 |eFactors+4)=y1..| 00000450 1c 2e 21 28 53 63 61 6c 65 46 61 63 74 6f 72 73 |..!(ScaleFactors| 00000460 2b 38 29 3d 78 32 3a 21 28 53 63 61 6c 65 46 61 |+8)=x2:!(ScaleFa| 00000470 63 74 6f 72 73 2b 31 32 29 3d 79 32 0d 02 26 35 |ctors+12)=y2..&5| 00000480 c8 99 26 30 30 30 30 30 30 32 45 2c 35 32 2b 32 |..&0000002E,52+2| 00000490 35 36 2c 73 70 72 69 74 65 25 2c 73 6e 24 2c 78 |56,sprite%,sn$,x| 000004a0 2c 79 2c 30 2c 53 63 61 6c 65 46 61 63 74 6f 72 |,y,0,ScaleFactor| 000004b0 73 0d 02 30 05 e1 0d ff |s..0....| 000004b8