Home » Archimedes archive » Acorn User » AU 1998-03 A.adf » Features » DiffDim2/Program1

DiffDim2/Program1

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 1998-03 A.adf » Features
Filename: DiffDim2/Program1
Read OK:
File size: 03C5 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >Rotate cube
   20:
   30ON ERROR MODE 0:PRINT REPORT$;" at line ";ERL:END
   40MODE15:MODE13
   50v%=600
   60ORIGIN 640,512
   70angy%=0:angz%=0
   80bank%=2
   90REPEAT
  100FORangx%=0 TO 359
  110WAIT
  120SYS"OS_Byte",112,bank%
  130bank%=3-bank%
  140SYS"OS_Byte",113,bank%
  150CLS
  160angy%=(angy%+2) MOD 360
  170angz%=(angz%+4) MOD 360
  180cosx=COSRAD(angx%):sinx=SINRAD(angx%)
  190cosy=COSRAD(angy%):siny=SINRAD(angy%)
  200cosz=COSRAD(angz%):sinz=SINRAD(angz%)
  210PROCplot(4,-2,-2,-2)
  220PROCplot(5,2,-2,-2)
  230PROCplot(5,2,2,-2)
  240PROCplot(5,-2,2,-2)
  250PROCplot(5,-2,-2,-2)
  260PROCplot(5,-2,-2,2)
  270PROCplot(5,2,-2,2)
  280PROCplot(5,2,2,2)
  290PROCplot(5,-2,2,2)
  300PROCplot(5,-2,-2,2)
  310PROCplot(4,-2,2,-2)
  320PROCplot(5,-2,2,2)
  330PROCplot(4,2,-2,-2)
  340PROCplot(5,2,-2,2)
  350PROCplot(4,2,2,-2)
  360PROCplot(5,2,2,2)
  370NEXT
  380UNTIL FALSE
  390END
  400:
  410DEFPROCplot(p%,x,y,z)
  420REM rotate by y
  430x1=x*siny+z*cosy
  440z1=x*cosy-z*siny
  450REM rotate by x
  460y2=y*sinx+z1*cosx
  470z2=y*cosx-z1*sinx
  480REM rotate by z
  490x3=x1*sinz+y2*cosz
  500y3=x1*cosz-y2*sinz
  510z3=z2+10
  520x%=v%*(x3/z3):y%=v%*(y3/z3)
  530PLOT p%,x%,y%
  540ENDPROC

� >Rotate cube
:
 � � � 0:� �$;" at line ";�:�
(�15:�13
2
v%=600
<ȑ 640,512
Fangy%=0:angz%=0
Pbank%=2
Z�
d�angx%=0 � 359
nȖ
xș"OS_Byte",112,bank%
�bank%=3-bank%
�ș"OS_Byte",113,bank%
��
�angy%=(angy%+2) � 360
�angz%=(angz%+4) � 360
�!cosx=��(angx%):sinx=��(angx%)
�!cosy=��(angy%):siny=��(angy%)
�!cosz=��(angz%):sinz=��(angz%)
��plot(4,-2,-2,-2)
��plot(5,2,-2,-2)
��plot(5,2,2,-2)
��plot(5,-2,2,-2)
��plot(5,-2,-2,-2)
�plot(5,-2,-2,2)
�plot(5,2,-2,2)
�plot(5,2,2,2)
"�plot(5,-2,2,2)
,�plot(5,-2,-2,2)
6�plot(4,-2,2,-2)
@�plot(5,-2,2,2)
J�plot(4,2,-2,-2)
T�plot(5,2,-2,2)
^�plot(4,2,2,-2)
h�plot(5,2,2,2)
r�
|� �
��
�:
���plot(p%,x,y,z)
�� rotate by y
�x1=x*siny+z*cosy
�z1=x*cosy-z*siny
�� rotate by x
�y2=y*sinx+z1*cosx
�z2=y*cosx-z1*sinx
�� rotate by z
�x3=x1*sinz+y2*cosz
�y3=x1*cosz-y2*sinz
�z3=z2+10
x%=v%*(x3/z3):y%=v%*(y3/z3)
� p%,x%,y%
�
�
00000000  0d 00 0a 12 f4 20 3e 52  6f 74 61 74 65 20 63 75  |..... >Rotate cu|
00000010  62 65 0d 00 14 05 3a 0d  00 1e 20 ee 20 85 20 eb  |be....:... . . .|
00000020  20 30 3a f1 20 f6 24 3b  22 20 61 74 20 6c 69 6e  | 0:. .$;" at lin|
00000030  65 20 22 3b 9e 3a e0 0d  00 28 0b eb 31 35 3a eb  |e ";.:...(..15:.|
00000040  31 33 0d 00 32 0a 76 25  3d 36 30 30 0d 00 3c 0e  |13..2.v%=600..<.|
00000050  c8 91 20 36 34 30 2c 35  31 32 0d 00 46 13 61 6e  |.. 640,512..F.an|
00000060  67 79 25 3d 30 3a 61 6e  67 7a 25 3d 30 0d 00 50  |gy%=0:angz%=0..P|
00000070  0b 62 61 6e 6b 25 3d 32  0d 00 5a 05 f5 0d 00 64  |.bank%=2..Z....d|
00000080  12 e3 61 6e 67 78 25 3d  30 20 b8 20 33 35 39 0d  |..angx%=0 . 359.|
00000090  00 6e 06 c8 96 0d 00 78  19 c8 99 22 4f 53 5f 42  |.n.....x..."OS_B|
000000a0  79 74 65 22 2c 31 31 32  2c 62 61 6e 6b 25 0d 00  |yte",112,bank%..|
000000b0  82 11 62 61 6e 6b 25 3d  33 2d 62 61 6e 6b 25 0d  |..bank%=3-bank%.|
000000c0  00 8c 19 c8 99 22 4f 53  5f 42 79 74 65 22 2c 31  |....."OS_Byte",1|
000000d0  31 33 2c 62 61 6e 6b 25  0d 00 96 05 db 0d 00 a0  |13,bank%........|
000000e0  19 61 6e 67 79 25 3d 28  61 6e 67 79 25 2b 32 29  |.angy%=(angy%+2)|
000000f0  20 83 20 33 36 30 0d 00  aa 19 61 6e 67 7a 25 3d  | . 360....angz%=|
00000100  28 61 6e 67 7a 25 2b 34  29 20 83 20 33 36 30 0d  |(angz%+4) . 360.|
00000110  00 b4 21 63 6f 73 78 3d  9b b2 28 61 6e 67 78 25  |..!cosx=..(angx%|
00000120  29 3a 73 69 6e 78 3d b5  b2 28 61 6e 67 78 25 29  |):sinx=..(angx%)|
00000130  0d 00 be 21 63 6f 73 79  3d 9b b2 28 61 6e 67 79  |...!cosy=..(angy|
00000140  25 29 3a 73 69 6e 79 3d  b5 b2 28 61 6e 67 79 25  |%):siny=..(angy%|
00000150  29 0d 00 c8 21 63 6f 73  7a 3d 9b b2 28 61 6e 67  |)...!cosz=..(ang|
00000160  7a 25 29 3a 73 69 6e 7a  3d b5 b2 28 61 6e 67 7a  |z%):sinz=..(angz|
00000170  25 29 0d 00 d2 15 f2 70  6c 6f 74 28 34 2c 2d 32  |%).....plot(4,-2|
00000180  2c 2d 32 2c 2d 32 29 0d  00 dc 14 f2 70 6c 6f 74  |,-2,-2).....plot|
00000190  28 35 2c 32 2c 2d 32 2c  2d 32 29 0d 00 e6 13 f2  |(5,2,-2,-2).....|
000001a0  70 6c 6f 74 28 35 2c 32  2c 32 2c 2d 32 29 0d 00  |plot(5,2,2,-2)..|
000001b0  f0 14 f2 70 6c 6f 74 28  35 2c 2d 32 2c 32 2c 2d  |...plot(5,-2,2,-|
000001c0  32 29 0d 00 fa 15 f2 70  6c 6f 74 28 35 2c 2d 32  |2).....plot(5,-2|
000001d0  2c 2d 32 2c 2d 32 29 0d  01 04 14 f2 70 6c 6f 74  |,-2,-2).....plot|
000001e0  28 35 2c 2d 32 2c 2d 32  2c 32 29 0d 01 0e 13 f2  |(5,-2,-2,2).....|
000001f0  70 6c 6f 74 28 35 2c 32  2c 2d 32 2c 32 29 0d 01  |plot(5,2,-2,2)..|
00000200  18 12 f2 70 6c 6f 74 28  35 2c 32 2c 32 2c 32 29  |...plot(5,2,2,2)|
00000210  0d 01 22 13 f2 70 6c 6f  74 28 35 2c 2d 32 2c 32  |.."..plot(5,-2,2|
00000220  2c 32 29 0d 01 2c 14 f2  70 6c 6f 74 28 35 2c 2d  |,2)..,..plot(5,-|
00000230  32 2c 2d 32 2c 32 29 0d  01 36 14 f2 70 6c 6f 74  |2,-2,2)..6..plot|
00000240  28 34 2c 2d 32 2c 32 2c  2d 32 29 0d 01 40 13 f2  |(4,-2,2,-2)..@..|
00000250  70 6c 6f 74 28 35 2c 2d  32 2c 32 2c 32 29 0d 01  |plot(5,-2,2,2)..|
00000260  4a 14 f2 70 6c 6f 74 28  34 2c 32 2c 2d 32 2c 2d  |J..plot(4,2,-2,-|
00000270  32 29 0d 01 54 13 f2 70  6c 6f 74 28 35 2c 32 2c  |2)..T..plot(5,2,|
00000280  2d 32 2c 32 29 0d 01 5e  13 f2 70 6c 6f 74 28 34  |-2,2)..^..plot(4|
00000290  2c 32 2c 32 2c 2d 32 29  0d 01 68 12 f2 70 6c 6f  |,2,2,-2)..h..plo|
000002a0  74 28 35 2c 32 2c 32 2c  32 29 0d 01 72 05 ed 0d  |t(5,2,2,2)..r...|
000002b0  01 7c 07 fd 20 a3 0d 01  86 05 e0 0d 01 90 05 3a  |.|.. ..........:|
000002c0  0d 01 9a 14 dd f2 70 6c  6f 74 28 70 25 2c 78 2c  |......plot(p%,x,|
000002d0  79 2c 7a 29 0d 01 a4 11  f4 20 72 6f 74 61 74 65  |y,z)..... rotate|
000002e0  20 62 79 20 79 0d 01 ae  14 78 31 3d 78 2a 73 69  | by y....x1=x*si|
000002f0  6e 79 2b 7a 2a 63 6f 73  79 0d 01 b8 14 7a 31 3d  |ny+z*cosy....z1=|
00000300  78 2a 63 6f 73 79 2d 7a  2a 73 69 6e 79 0d 01 c2  |x*cosy-z*siny...|
00000310  11 f4 20 72 6f 74 61 74  65 20 62 79 20 78 0d 01  |.. rotate by x..|
00000320  cc 15 79 32 3d 79 2a 73  69 6e 78 2b 7a 31 2a 63  |..y2=y*sinx+z1*c|
00000330  6f 73 78 0d 01 d6 15 7a  32 3d 79 2a 63 6f 73 78  |osx....z2=y*cosx|
00000340  2d 7a 31 2a 73 69 6e 78  0d 01 e0 11 f4 20 72 6f  |-z1*sinx..... ro|
00000350  74 61 74 65 20 62 79 20  7a 0d 01 ea 16 78 33 3d  |tate by z....x3=|
00000360  78 31 2a 73 69 6e 7a 2b  79 32 2a 63 6f 73 7a 0d  |x1*sinz+y2*cosz.|
00000370  01 f4 16 79 33 3d 78 31  2a 63 6f 73 7a 2d 79 32  |...y3=x1*cosz-y2|
00000380  2a 73 69 6e 7a 0d 01 fe  0c 7a 33 3d 7a 32 2b 31  |*sinz....z3=z2+1|
00000390  30 0d 02 08 1f 78 25 3d  76 25 2a 28 78 33 2f 7a  |0....x%=v%*(x3/z|
000003a0  33 29 3a 79 25 3d 76 25  2a 28 79 33 2f 7a 33 29  |3):y%=v%*(y3/z3)|
000003b0  0d 02 12 0e f0 20 70 25  2c 78 25 2c 79 25 0d 02  |..... p%,x%,y%..|
000003c0  1c 05 e1 0d ff                                    |.....|
000003c5