Home » Archimedes archive » Acorn User » AU 1998-05 A.adf » Regulars » StarInfo/Vibe/ROTATE2

StarInfo/Vibe/ROTATE2

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-05 A.adf » Regulars
Filename: StarInfo/Vibe/ROTATE2
Read OK:
File size: 051F bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > ROTATE2
   20
   30MODE29
   40DIM SPR &10000,ROT 32
   50SPR!0=&FFFF:SPR!4=0:SPR!8=16:SPR!12=16
   60SYS"OS_SpriteOp",256+15,SPR,"SIGN",0,256,64,29
   70
   80SYS"OS_SpriteOp",256+60,SPR,"SIGN"
   90COLOUR0:COLOUR128+1:CLS
  100PRINT'"  This procedure demonstrates"
  110PRINT"  a OS_SpriteOp SWI which can"
  120PRINT"  rotate a sprite around its"
  130PRINT"  center and at the same time"
  140PRINT"  enlarge or diminish the size"
  150PRINT"  of the sprite."
  160GCOL0:RECTANGLE 0,0,511,127
  170SYS"OS_SpriteOp",256+60,SPR,0
  180
  190Z=0
  200FOR A%=0TO365STEP2
  210Z=Z+0.005
  220PROCROT(SPR,"SIGN",800,600,Z,1.5*Z,A%)
  230NEXT
  240Z1=Z:Z2=1.5*Z
  250FORN%=1TO50:Z2=Z2+.10:PROCROT(SPR,"SIGN",800,600,Z1,Z2,A%):NEXT
  260FORN%=1TO50:Z1=Z1+.032:PROCROT(SPR,"SIGN",800,600,Z1,Z2,A%):NEXT
  270REPEAT
  280Z1=.5+1.5*RND(1):Z2=.5+1.5*RND(1):A%=RND(60)+330:X%=RND(1600):Y%=RND(1200)
  290PROCROT(SPR,"SIGN",X%,Y%,Z1,Z2,A%)
  300UNTIL0
  310
  320END
  330
  340DEFPROCROT(SPR,N$,X%,Y%,SX,SY,A%)
  350LOCAL XR%,YR%,W%,H%
  360SYS"OS_SpriteOp",256+40,SPR,N$ TO ,,,W%,H%
  370SX=SX*W%:SY=SY*H%
  380XR%=-SX*COSRADA%+SY*SINRADA%:YR%=SY*COSRADA%+SX*SINRADA%
  390ROT!00=(XR%+X%)*256:ROT!04=(YR%+Y%)*256
  400XR%=SX*COSRADA%+SY*SINRADA%:YR%=SY*COSRADA%-SX*SINRADA%
  410ROT!08=(XR%+X%)*256:ROT!12=(YR%+Y%)*256
  420XR%=SX*COSRADA%-SY*SINRADA%:YR%=-SY*COSRADA%-SX*SINRADA%
  430ROT!16=(XR%+X%)*256:ROT!20=(YR%+Y%)*256
  440XR%=-SX*COSRADA%-SY*SINRADA%:YR%=-SY*COSRADA%+SX*SINRADA%
  450ROT!24=(XR%+X%)*256:ROT!28=(YR%+Y%)*256
  460SYS"OS_SpriteOp",256+56,SPR,N$,1,,8,ROT
  470ENDPROC
� > ROTATE2

�29
(� SPR &10000,ROT 32
2*SPR!0=&FFFF:SPR!4=0:SPR!8=16:SPR!12=16
<1ș"OS_SpriteOp",256+15,SPR,"SIGN",0,256,64,29
F
P%ș"OS_SpriteOp",256+60,SPR,"SIGN"
Z�0:�128+1:�
d%�'"  This procedure demonstrates"
n$�"  a OS_SpriteOp SWI which can"
x#�"  rotate a sprite around its"
�$�"  center and at the same time"
�%�"  enlarge or diminish the size"
��"  of the sprite."
��0:ȓ 0,0,511,127
� ș"OS_SpriteOp",256+60,SPR,0
�
�Z=0
�� A%=0�365�2
�
Z=Z+0.005
�'�ROT(SPR,"SIGN",800,600,Z,1.5*Z,A%)
��
�Z1=Z:Z2=1.5*Z
�:�N%=1�50:Z2=Z2+.10:�ROT(SPR,"SIGN",800,600,Z1,Z2,A%):�
;�N%=1�50:Z1=Z1+.032:�ROT(SPR,"SIGN",800,600,Z1,Z2,A%):�
�
DZ1=.5+1.5*�(1):Z2=.5+1.5*�(1):A%=�(60)+330:X%=�(1600):Y%=�(1200)
"#�ROT(SPR,"SIGN",X%,Y%,Z1,Z2,A%)
,�0
6
@�
J
T ��ROT(SPR,N$,X%,Y%,SX,SY,A%)
^� XR%,YR%,W%,H%
h,ș"OS_SpriteOp",256+40,SPR,N$ � ,,,W%,H%
rSX=SX*W%:SY=SY*H%
|,XR%=-SX*��A%+SY*��A%:YR%=SY*��A%+SX*��A%
�+ROT!00=(XR%+X%)*256:ROT!04=(YR%+Y%)*256
�+XR%=SX*��A%+SY*��A%:YR%=SY*��A%-SX*��A%
�+ROT!08=(XR%+X%)*256:ROT!12=(YR%+Y%)*256
�,XR%=SX*��A%-SY*��A%:YR%=-SY*��A%-SX*��A%
�+ROT!16=(XR%+X%)*256:ROT!20=(YR%+Y%)*256
�-XR%=-SX*��A%-SY*��A%:YR%=-SY*��A%+SX*��A%
�+ROT!24=(XR%+X%)*256:ROT!28=(YR%+Y%)*256
�*ș"OS_SpriteOp",256+56,SPR,N$,1,,8,ROT
��
�
00000000  0d 00 0a 0f f4 20 3e 20  52 4f 54 41 54 45 32 0d  |..... > ROTATE2.|
00000010  00 14 04 0d 00 1e 07 eb  32 39 0d 00 28 17 de 20  |........29..(.. |
00000020  53 50 52 20 26 31 30 30  30 30 2c 52 4f 54 20 33  |SPR &10000,ROT 3|
00000030  32 0d 00 32 2a 53 50 52  21 30 3d 26 46 46 46 46  |2..2*SPR!0=&FFFF|
00000040  3a 53 50 52 21 34 3d 30  3a 53 50 52 21 38 3d 31  |:SPR!4=0:SPR!8=1|
00000050  36 3a 53 50 52 21 31 32  3d 31 36 0d 00 3c 31 c8  |6:SPR!12=16..<1.|
00000060  99 22 4f 53 5f 53 70 72  69 74 65 4f 70 22 2c 32  |."OS_SpriteOp",2|
00000070  35 36 2b 31 35 2c 53 50  52 2c 22 53 49 47 4e 22  |56+15,SPR,"SIGN"|
00000080  2c 30 2c 32 35 36 2c 36  34 2c 32 39 0d 00 46 04  |,0,256,64,29..F.|
00000090  0d 00 50 25 c8 99 22 4f  53 5f 53 70 72 69 74 65  |..P%.."OS_Sprite|
000000a0  4f 70 22 2c 32 35 36 2b  36 30 2c 53 50 52 2c 22  |Op",256+60,SPR,"|
000000b0  53 49 47 4e 22 0d 00 5a  0f fb 30 3a fb 31 32 38  |SIGN"..Z..0:.128|
000000c0  2b 31 3a db 0d 00 64 25  f1 27 22 20 20 54 68 69  |+1:...d%.'"  Thi|
000000d0  73 20 70 72 6f 63 65 64  75 72 65 20 64 65 6d 6f  |s procedure demo|
000000e0  6e 73 74 72 61 74 65 73  22 0d 00 6e 24 f1 22 20  |nstrates"..n$." |
000000f0  20 61 20 4f 53 5f 53 70  72 69 74 65 4f 70 20 53  | a OS_SpriteOp S|
00000100  57 49 20 77 68 69 63 68  20 63 61 6e 22 0d 00 78  |WI which can"..x|
00000110  23 f1 22 20 20 72 6f 74  61 74 65 20 61 20 73 70  |#."  rotate a sp|
00000120  72 69 74 65 20 61 72 6f  75 6e 64 20 69 74 73 22  |rite around its"|
00000130  0d 00 82 24 f1 22 20 20  63 65 6e 74 65 72 20 61  |...$."  center a|
00000140  6e 64 20 61 74 20 74 68  65 20 73 61 6d 65 20 74  |nd at the same t|
00000150  69 6d 65 22 0d 00 8c 25  f1 22 20 20 65 6e 6c 61  |ime"...%."  enla|
00000160  72 67 65 20 6f 72 20 64  69 6d 69 6e 69 73 68 20  |rge or diminish |
00000170  74 68 65 20 73 69 7a 65  22 0d 00 96 17 f1 22 20  |the size"....." |
00000180  20 6f 66 20 74 68 65 20  73 70 72 69 74 65 2e 22  | of the sprite."|
00000190  0d 00 a0 15 e6 30 3a c8  93 20 30 2c 30 2c 35 31  |.....0:.. 0,0,51|
000001a0  31 2c 31 32 37 0d 00 aa  20 c8 99 22 4f 53 5f 53  |1,127... .."OS_S|
000001b0  70 72 69 74 65 4f 70 22  2c 32 35 36 2b 36 30 2c  |priteOp",256+60,|
000001c0  53 50 52 2c 30 0d 00 b4  04 0d 00 be 07 5a 3d 30  |SPR,0........Z=0|
000001d0  0d 00 c8 10 e3 20 41 25  3d 30 b8 33 36 35 88 32  |..... A%=0.365.2|
000001e0  0d 00 d2 0d 5a 3d 5a 2b  30 2e 30 30 35 0d 00 dc  |....Z=Z+0.005...|
000001f0  27 f2 52 4f 54 28 53 50  52 2c 22 53 49 47 4e 22  |'.ROT(SPR,"SIGN"|
00000200  2c 38 30 30 2c 36 30 30  2c 5a 2c 31 2e 35 2a 5a  |,800,600,Z,1.5*Z|
00000210  2c 41 25 29 0d 00 e6 05  ed 0d 00 f0 11 5a 31 3d  |,A%).........Z1=|
00000220  5a 3a 5a 32 3d 31 2e 35  2a 5a 0d 00 fa 3a e3 4e  |Z:Z2=1.5*Z...:.N|
00000230  25 3d 31 b8 35 30 3a 5a  32 3d 5a 32 2b 2e 31 30  |%=1.50:Z2=Z2+.10|
00000240  3a f2 52 4f 54 28 53 50  52 2c 22 53 49 47 4e 22  |:.ROT(SPR,"SIGN"|
00000250  2c 38 30 30 2c 36 30 30  2c 5a 31 2c 5a 32 2c 41  |,800,600,Z1,Z2,A|
00000260  25 29 3a ed 0d 01 04 3b  e3 4e 25 3d 31 b8 35 30  |%):....;.N%=1.50|
00000270  3a 5a 31 3d 5a 31 2b 2e  30 33 32 3a f2 52 4f 54  |:Z1=Z1+.032:.ROT|
00000280  28 53 50 52 2c 22 53 49  47 4e 22 2c 38 30 30 2c  |(SPR,"SIGN",800,|
00000290  36 30 30 2c 5a 31 2c 5a  32 2c 41 25 29 3a ed 0d  |600,Z1,Z2,A%):..|
000002a0  01 0e 05 f5 0d 01 18 44  5a 31 3d 2e 35 2b 31 2e  |.......DZ1=.5+1.|
000002b0  35 2a b3 28 31 29 3a 5a  32 3d 2e 35 2b 31 2e 35  |5*.(1):Z2=.5+1.5|
000002c0  2a b3 28 31 29 3a 41 25  3d b3 28 36 30 29 2b 33  |*.(1):A%=.(60)+3|
000002d0  33 30 3a 58 25 3d b3 28  31 36 30 30 29 3a 59 25  |30:X%=.(1600):Y%|
000002e0  3d b3 28 31 32 30 30 29  0d 01 22 23 f2 52 4f 54  |=.(1200).."#.ROT|
000002f0  28 53 50 52 2c 22 53 49  47 4e 22 2c 58 25 2c 59  |(SPR,"SIGN",X%,Y|
00000300  25 2c 5a 31 2c 5a 32 2c  41 25 29 0d 01 2c 06 fd  |%,Z1,Z2,A%)..,..|
00000310  30 0d 01 36 04 0d 01 40  05 e0 0d 01 4a 04 0d 01  |0..6...@....J...|
00000320  54 20 dd f2 52 4f 54 28  53 50 52 2c 4e 24 2c 58  |T ..ROT(SPR,N$,X|
00000330  25 2c 59 25 2c 53 58 2c  53 59 2c 41 25 29 0d 01  |%,Y%,SX,SY,A%)..|
00000340  5e 13 ea 20 58 52 25 2c  59 52 25 2c 57 25 2c 48  |^.. XR%,YR%,W%,H|
00000350  25 0d 01 68 2c c8 99 22  4f 53 5f 53 70 72 69 74  |%..h,.."OS_Sprit|
00000360  65 4f 70 22 2c 32 35 36  2b 34 30 2c 53 50 52 2c  |eOp",256+40,SPR,|
00000370  4e 24 20 b8 20 2c 2c 2c  57 25 2c 48 25 0d 01 72  |N$ . ,,,W%,H%..r|
00000380  15 53 58 3d 53 58 2a 57  25 3a 53 59 3d 53 59 2a  |.SX=SX*W%:SY=SY*|
00000390  48 25 0d 01 7c 2c 58 52  25 3d 2d 53 58 2a 9b b2  |H%..|,XR%=-SX*..|
000003a0  41 25 2b 53 59 2a b5 b2  41 25 3a 59 52 25 3d 53  |A%+SY*..A%:YR%=S|
000003b0  59 2a 9b b2 41 25 2b 53  58 2a b5 b2 41 25 0d 01  |Y*..A%+SX*..A%..|
000003c0  86 2b 52 4f 54 21 30 30  3d 28 58 52 25 2b 58 25  |.+ROT!00=(XR%+X%|
000003d0  29 2a 32 35 36 3a 52 4f  54 21 30 34 3d 28 59 52  |)*256:ROT!04=(YR|
000003e0  25 2b 59 25 29 2a 32 35  36 0d 01 90 2b 58 52 25  |%+Y%)*256...+XR%|
000003f0  3d 53 58 2a 9b b2 41 25  2b 53 59 2a b5 b2 41 25  |=SX*..A%+SY*..A%|
00000400  3a 59 52 25 3d 53 59 2a  9b b2 41 25 2d 53 58 2a  |:YR%=SY*..A%-SX*|
00000410  b5 b2 41 25 0d 01 9a 2b  52 4f 54 21 30 38 3d 28  |..A%...+ROT!08=(|
00000420  58 52 25 2b 58 25 29 2a  32 35 36 3a 52 4f 54 21  |XR%+X%)*256:ROT!|
00000430  31 32 3d 28 59 52 25 2b  59 25 29 2a 32 35 36 0d  |12=(YR%+Y%)*256.|
00000440  01 a4 2c 58 52 25 3d 53  58 2a 9b b2 41 25 2d 53  |..,XR%=SX*..A%-S|
00000450  59 2a b5 b2 41 25 3a 59  52 25 3d 2d 53 59 2a 9b  |Y*..A%:YR%=-SY*.|
00000460  b2 41 25 2d 53 58 2a b5  b2 41 25 0d 01 ae 2b 52  |.A%-SX*..A%...+R|
00000470  4f 54 21 31 36 3d 28 58  52 25 2b 58 25 29 2a 32  |OT!16=(XR%+X%)*2|
00000480  35 36 3a 52 4f 54 21 32  30 3d 28 59 52 25 2b 59  |56:ROT!20=(YR%+Y|
00000490  25 29 2a 32 35 36 0d 01  b8 2d 58 52 25 3d 2d 53  |%)*256...-XR%=-S|
000004a0  58 2a 9b b2 41 25 2d 53  59 2a b5 b2 41 25 3a 59  |X*..A%-SY*..A%:Y|
000004b0  52 25 3d 2d 53 59 2a 9b  b2 41 25 2b 53 58 2a b5  |R%=-SY*..A%+SX*.|
000004c0  b2 41 25 0d 01 c2 2b 52  4f 54 21 32 34 3d 28 58  |.A%...+ROT!24=(X|
000004d0  52 25 2b 58 25 29 2a 32  35 36 3a 52 4f 54 21 32  |R%+X%)*256:ROT!2|
000004e0  38 3d 28 59 52 25 2b 59  25 29 2a 32 35 36 0d 01  |8=(YR%+Y%)*256..|
000004f0  cc 2a c8 99 22 4f 53 5f  53 70 72 69 74 65 4f 70  |.*.."OS_SpriteOp|
00000500  22 2c 32 35 36 2b 35 36  2c 53 50 52 2c 4e 24 2c  |",256+56,SPR,N$,|
00000510  31 2c 2c 38 2c 52 4f 54  0d 01 d6 05 e1 0d ff     |1,,8,ROT.......|
0000051f