Home » Archimedes archive » Acorn User » AU 1998-03 A.adf » Features » RTR/FeedTest2

RTR/FeedTest2

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: RTR/FeedTest2
Read OK:
File size: 075B bytes
Load address: 0000
Exec address: 0000
File contents
   10REM> Virtual Screw feedback test
   20CLS
   30PRINT"Virtual screw pot test"
   40PRINT"IIC Bus Digital Input Device &70"
   50PRINT"By Mike Cook"
   60DIM PBK% 3,cw%(3),acw%(3)
   70DIM PBC% 3
   80
   90PROC_init
  100REM SET ALL BITS HIGH
  110?PBK%=&FF
  120SYS "IIC_Control",&70,PBK%,1
  130REM Read current value
  140SYS "IIC_Control",&71,PBK%,1
  150CV%=?PBK% AND 3
  160pos%=0:ppos%=15
  170PROCdraw(ppos%,pos%)
  180ppost%=TIME
  190PROCbreak(0)
  200bon%=FALSE
  210
  220REPEAT
  230REM Hold until a change
  240REPEAT
  250IF Roll% THEN
  260IF bon% AND TIME>bt% THEN bon%=FALSE:PROCbreak(0)
  270PROCeball
  280dRoll%+=binc%
  290PROCball
  300IF dRoll%>1000 OR dRoll%<-600 THEN Roll%=FALSE:dRoll%=0:PROCball
  310*FX19
  320ENDIF
  330SYS "IIC_Control",&71,PBK%,1
  340NV%=?PBK% AND 3
  350UNTIL CV%<>NV%
  360
  370post%=TIME
  380dir%=0
  390IF cw%(CV%)=NV% THEN dir%=-1
  400IF acw%(CV%)=NV% THEN dir%=1
  410pos%+=dir%
  420IF pos%>15 THEN pos%=0
  430IF pos%<0 THEN pos%=15
  440IF Roll%=FALSE AND pos%=4 AND ppos%=3 THEN PROCspeed(1)
  450IF Roll%=FALSE AND pos%=4 AND ppos%=5 THEN PROCspeed(-1)
  460PROCdraw(ppos%,pos%)
  470PRINTpos%,post%-ppost%
  480ppos%=pos%
  490ppost%=post%
  500CV%=NV%
  510UNTIL FALSE
  520
  530DEF PROCspeed(n%)
  540LOCAL w%
  550
  560bon%=TRUE
  570bt%=TIME+8
  580w%=post%-ppost%
  590Roll%=TRUE
  600IF w%<=5 THEN binc%=32:PROCbreak(255)
  610IF w%>5  THEN binc%=16:PROCbreak(190)
  620IF w%>10 THEN binc%=8:PROCbreak(150)
  630IF w%>20 THEN binc%=4:PROCbreak(100)
  640binc%=binc%*n%
  650ENDPROC
  660
  670DEF PROC_init
  680cw%(0)=2:cw%(1)=0:cw%(2)=3:cw%(3)=1
  690acw%(0)=1:acw%(1)=3:acw%(2)=0:acw%(3)=2
  700tp=2*PI
  710r%=200
  720s%=r%*2
  730MODE 20
  740Roll%=FALSE
  750dRoll%=0
  760ENDPROC
  770
  780DEF PROCdraw(o%,n%)
  790REM GCOL 0,0
  800REM PROCrd(o%)
  810CLS
  820GCOL 0,7
  830PROCrd(n%)
  840PROCball
  850ENDPROC
  860
  870DEF PROCball
  880LOCAL d%
  890GCOL 0,7
  900d%=30
  910CIRCLE s%+d%+dRoll%,r%,d%
  920ENDPROC
  930
  940DEF PROCeball
  950LOCAL d%
  960GCOL 0,0
  970d%=30
  980CIRCLE s%+d%+dRoll%,r%,d%
  990ENDPROC
 1000
 1010DEF PROCrd(p%)
 1020LOCAL rr%
 1030rr%=r%*.7
 1040th=(p%/16)*tp
 1050x%=s%+rr%*COS(th)
 1060y%=s%+rr%*SIN(th)
 1070MOVE x%,y%
 1080th+=PI
 1090x%=s%+r%*COS(th)
 1100y%=s%+r%*SIN(th)
 1110DRAW x%,y%
 1120ENDPROC
 1130
 1140DEF PROCbreak(b%)
 1150b%=&FF-(b% AND &FF)
 1160?PBC%=&40
 1170PBC%?1=b%
 1180SYS "IIC_Control",&90,PBC%,2
 1190ENDPROC
 1200

"�> Virtual Screw feedback test
�
�"Virtual screw pot test"
('�"IIC Bus Digital Input Device &70"
2�"By Mike Cook"
<� PBK% 3,cw%(3),acw%(3)
F� PBC% 3
P
Z
�_init
d� SET ALL BITS HIGH
n
?PBK%=&FF
xș "IIC_Control",&70,PBK%,1
�� Read current value
�ș "IIC_Control",&71,PBK%,1
�CV%=?PBK% � 3
�pos%=0:ppos%=15
��draw(ppos%,pos%)
�ppost%=�
�
�break(0)
�
bon%=�
�
��
�� Hold until a change
��
�
� Roll% �
%� bon% � �>bt% � bon%=�:�break(0)

�eball
dRoll%+=binc%
"	�ball
,8� dRoll%>1000 � dRoll%<-600 � Roll%=�:dRoll%=0:�ball
6	*FX19
@�
Jș "IIC_Control",&71,PBK%,1
TNV%=?PBK% � 3
^� CV%<>NV%
h
rpost%=�
|
dir%=0
�� cw%(CV%)=NV% � dir%=-1
�� acw%(CV%)=NV% � dir%=1
�pos%+=dir%
�� pos%>15 � pos%=0
�� pos%<0 � pos%=15
�,� Roll%=� � pos%=4 � ppos%=3 � �speed(1)
�-� Roll%=� � pos%=4 � ppos%=5 � �speed(-1)
��draw(ppos%,pos%)
��pos%,post%-ppost%
�ppos%=pos%
�ppost%=post%
�CV%=NV%
�� �

� �speed(n%)
� w%
&
0
bon%=�
:bt%=�+8
Dw%=post%-ppost%
NRoll%=�
X"� w%<=5 � binc%=32:�break(255)
b"� w%>5  � binc%=16:�break(190)
l!� w%>10 � binc%=8:�break(150)
v!� w%>20 � binc%=4:�break(100)
�binc%=binc%*n%
��
�
�� �_init
�'cw%(0)=2:cw%(1)=0:cw%(2)=3:cw%(3)=1
�+acw%(0)=1:acw%(1)=3:acw%(2)=0:acw%(3)=2
�
tp=2*�
�
r%=200
�s%=r%*2
�� 20
�Roll%=�
�dRoll%=0
��

� �draw(o%,n%)
� GCOL 0,0
 � PROCrd(o%)
*�
4	� 0,7
>�rd(n%)
H	�ball
R�
\
f� �ball
p� d%
z	� 0,7
�	d%=30
�ȏ s%+d%+dRoll%,r%,d%
��
�
�� �eball
�� d%
�	� 0,0
�	d%=30
�ȏ s%+d%+dRoll%,r%,d%
��
�
�
� �rd(p%)
�	� rr%

rr%=r%*.7
th=(p%/16)*tp
x%=s%+rr%*�(th)
$y%=s%+rr%*�(th)
.� x%,y%
8	th+=�
Bx%=s%+r%*�(th)
Ly%=s%+r%*�(th)
V� x%,y%
`�
j
t� �break(b%)
~b%=&FF-(b% � &FF)
�
?PBC%=&40
�
PBC%?1=b%
�ș "IIC_Control",&90,PBC%,2
��
�
�
00000000  0d 00 0a 22 f4 3e 20 56  69 72 74 75 61 6c 20 53  |...".> Virtual S|
00000010  63 72 65 77 20 66 65 65  64 62 61 63 6b 20 74 65  |crew feedback te|
00000020  73 74 0d 00 14 05 db 0d  00 1e 1d f1 22 56 69 72  |st.........."Vir|
00000030  74 75 61 6c 20 73 63 72  65 77 20 70 6f 74 20 74  |tual screw pot t|
00000040  65 73 74 22 0d 00 28 27  f1 22 49 49 43 20 42 75  |est"..('."IIC Bu|
00000050  73 20 44 69 67 69 74 61  6c 20 49 6e 70 75 74 20  |s Digital Input |
00000060  44 65 76 69 63 65 20 26  37 30 22 0d 00 32 13 f1  |Device &70"..2..|
00000070  22 42 79 20 4d 69 6b 65  20 43 6f 6f 6b 22 0d 00  |"By Mike Cook"..|
00000080  3c 1b de 20 50 42 4b 25  20 33 2c 63 77 25 28 33  |<.. PBK% 3,cw%(3|
00000090  29 2c 61 63 77 25 28 33  29 0d 00 46 0c de 20 50  |),acw%(3)..F.. P|
000000a0  42 43 25 20 33 0d 00 50  04 0d 00 5a 0a f2 5f 69  |BC% 3..P...Z.._i|
000000b0  6e 69 74 0d 00 64 17 f4  20 53 45 54 20 41 4c 4c  |nit..d.. SET ALL|
000000c0  20 42 49 54 53 20 48 49  47 48 0d 00 6e 0d 3f 50  | BITS HIGH..n.?P|
000000d0  42 4b 25 3d 26 46 46 0d  00 78 1f c8 99 20 22 49  |BK%=&FF..x... "I|
000000e0  49 43 5f 43 6f 6e 74 72  6f 6c 22 2c 26 37 30 2c  |IC_Control",&70,|
000000f0  50 42 4b 25 2c 31 0d 00  82 18 f4 20 52 65 61 64  |PBK%,1..... Read|
00000100  20 63 75 72 72 65 6e 74  20 76 61 6c 75 65 0d 00  | current value..|
00000110  8c 1f c8 99 20 22 49 49  43 5f 43 6f 6e 74 72 6f  |.... "IIC_Contro|
00000120  6c 22 2c 26 37 31 2c 50  42 4b 25 2c 31 0d 00 96  |l",&71,PBK%,1...|
00000130  11 43 56 25 3d 3f 50 42  4b 25 20 80 20 33 0d 00  |.CV%=?PBK% . 3..|
00000140  a0 13 70 6f 73 25 3d 30  3a 70 70 6f 73 25 3d 31  |..pos%=0:ppos%=1|
00000150  35 0d 00 aa 15 f2 64 72  61 77 28 70 70 6f 73 25  |5.....draw(ppos%|
00000160  2c 70 6f 73 25 29 0d 00  b4 0c 70 70 6f 73 74 25  |,pos%)....ppost%|
00000170  3d 91 0d 00 be 0d f2 62  72 65 61 6b 28 30 29 0d  |=......break(0).|
00000180  00 c8 0a 62 6f 6e 25 3d  a3 0d 00 d2 04 0d 00 dc  |...bon%=........|
00000190  05 f5 0d 00 e6 19 f4 20  48 6f 6c 64 20 75 6e 74  |....... Hold unt|
000001a0  69 6c 20 61 20 63 68 61  6e 67 65 0d 00 f0 05 f5  |il a change.....|
000001b0  0d 00 fa 0d e7 20 52 6f  6c 6c 25 20 8c 0d 01 04  |..... Roll% ....|
000001c0  25 e7 20 62 6f 6e 25 20  80 20 91 3e 62 74 25 20  |%. bon% . .>bt% |
000001d0  8c 20 62 6f 6e 25 3d a3  3a f2 62 72 65 61 6b 28  |. bon%=.:.break(|
000001e0  30 29 0d 01 0e 0a f2 65  62 61 6c 6c 0d 01 18 11  |0).....eball....|
000001f0  64 52 6f 6c 6c 25 2b 3d  62 69 6e 63 25 0d 01 22  |dRoll%+=binc%.."|
00000200  09 f2 62 61 6c 6c 0d 01  2c 38 e7 20 64 52 6f 6c  |..ball..,8. dRol|
00000210  6c 25 3e 31 30 30 30 20  84 20 64 52 6f 6c 6c 25  |l%>1000 . dRoll%|
00000220  3c 2d 36 30 30 20 8c 20  52 6f 6c 6c 25 3d a3 3a  |<-600 . Roll%=.:|
00000230  64 52 6f 6c 6c 25 3d 30  3a f2 62 61 6c 6c 0d 01  |dRoll%=0:.ball..|
00000240  36 09 2a 46 58 31 39 0d  01 40 05 cd 0d 01 4a 1f  |6.*FX19..@....J.|
00000250  c8 99 20 22 49 49 43 5f  43 6f 6e 74 72 6f 6c 22  |.. "IIC_Control"|
00000260  2c 26 37 31 2c 50 42 4b  25 2c 31 0d 01 54 11 4e  |,&71,PBK%,1..T.N|
00000270  56 25 3d 3f 50 42 4b 25  20 80 20 33 0d 01 5e 0e  |V%=?PBK% . 3..^.|
00000280  fd 20 43 56 25 3c 3e 4e  56 25 0d 01 68 04 0d 01  |. CV%<>NV%..h...|
00000290  72 0b 70 6f 73 74 25 3d  91 0d 01 7c 0a 64 69 72  |r.post%=...|.dir|
000002a0  25 3d 30 0d 01 86 1c e7  20 63 77 25 28 43 56 25  |%=0..... cw%(CV%|
000002b0  29 3d 4e 56 25 20 8c 20  64 69 72 25 3d 2d 31 0d  |)=NV% . dir%=-1.|
000002c0  01 90 1c e7 20 61 63 77  25 28 43 56 25 29 3d 4e  |.... acw%(CV%)=N|
000002d0  56 25 20 8c 20 64 69 72  25 3d 31 0d 01 9a 0e 70  |V% . dir%=1....p|
000002e0  6f 73 25 2b 3d 64 69 72  25 0d 01 a4 16 e7 20 70  |os%+=dir%..... p|
000002f0  6f 73 25 3e 31 35 20 8c  20 70 6f 73 25 3d 30 0d  |os%>15 . pos%=0.|
00000300  01 ae 16 e7 20 70 6f 73  25 3c 30 20 8c 20 70 6f  |.... pos%<0 . po|
00000310  73 25 3d 31 35 0d 01 b8  2c e7 20 52 6f 6c 6c 25  |s%=15...,. Roll%|
00000320  3d a3 20 80 20 70 6f 73  25 3d 34 20 80 20 70 70  |=. . pos%=4 . pp|
00000330  6f 73 25 3d 33 20 8c 20  f2 73 70 65 65 64 28 31  |os%=3 . .speed(1|
00000340  29 0d 01 c2 2d e7 20 52  6f 6c 6c 25 3d a3 20 80  |)...-. Roll%=. .|
00000350  20 70 6f 73 25 3d 34 20  80 20 70 70 6f 73 25 3d  | pos%=4 . ppos%=|
00000360  35 20 8c 20 f2 73 70 65  65 64 28 2d 31 29 0d 01  |5 . .speed(-1)..|
00000370  cc 15 f2 64 72 61 77 28  70 70 6f 73 25 2c 70 6f  |...draw(ppos%,po|
00000380  73 25 29 0d 01 d6 16 f1  70 6f 73 25 2c 70 6f 73  |s%).....pos%,pos|
00000390  74 25 2d 70 70 6f 73 74  25 0d 01 e0 0e 70 70 6f  |t%-ppost%....ppo|
000003a0  73 25 3d 70 6f 73 25 0d  01 ea 10 70 70 6f 73 74  |s%=pos%....ppost|
000003b0  25 3d 70 6f 73 74 25 0d  01 f4 0b 43 56 25 3d 4e  |%=post%....CV%=N|
000003c0  56 25 0d 01 fe 07 fd 20  a3 0d 02 08 04 0d 02 12  |V%..... ........|
000003d0  10 dd 20 f2 73 70 65 65  64 28 6e 25 29 0d 02 1c  |.. .speed(n%)...|
000003e0  08 ea 20 77 25 0d 02 26  04 0d 02 30 0a 62 6f 6e  |.. w%..&...0.bon|
000003f0  25 3d b9 0d 02 3a 0b 62  74 25 3d 91 2b 38 0d 02  |%=...:.bt%=.+8..|
00000400  44 13 77 25 3d 70 6f 73  74 25 2d 70 70 6f 73 74  |D.w%=post%-ppost|
00000410  25 0d 02 4e 0b 52 6f 6c  6c 25 3d b9 0d 02 58 22  |%..N.Roll%=...X"|
00000420  e7 20 77 25 3c 3d 35 20  8c 20 62 69 6e 63 25 3d  |. w%<=5 . binc%=|
00000430  33 32 3a f2 62 72 65 61  6b 28 32 35 35 29 0d 02  |32:.break(255)..|
00000440  62 22 e7 20 77 25 3e 35  20 20 8c 20 62 69 6e 63  |b". w%>5  . binc|
00000450  25 3d 31 36 3a f2 62 72  65 61 6b 28 31 39 30 29  |%=16:.break(190)|
00000460  0d 02 6c 21 e7 20 77 25  3e 31 30 20 8c 20 62 69  |..l!. w%>10 . bi|
00000470  6e 63 25 3d 38 3a f2 62  72 65 61 6b 28 31 35 30  |nc%=8:.break(150|
00000480  29 0d 02 76 21 e7 20 77  25 3e 32 30 20 8c 20 62  |)..v!. w%>20 . b|
00000490  69 6e 63 25 3d 34 3a f2  62 72 65 61 6b 28 31 30  |inc%=4:.break(10|
000004a0  30 29 0d 02 80 12 62 69  6e 63 25 3d 62 69 6e 63  |0)....binc%=binc|
000004b0  25 2a 6e 25 0d 02 8a 05  e1 0d 02 94 04 0d 02 9e  |%*n%............|
000004c0  0c dd 20 f2 5f 69 6e 69  74 0d 02 a8 27 63 77 25  |.. ._init...'cw%|
000004d0  28 30 29 3d 32 3a 63 77  25 28 31 29 3d 30 3a 63  |(0)=2:cw%(1)=0:c|
000004e0  77 25 28 32 29 3d 33 3a  63 77 25 28 33 29 3d 31  |w%(2)=3:cw%(3)=1|
000004f0  0d 02 b2 2b 61 63 77 25  28 30 29 3d 31 3a 61 63  |...+acw%(0)=1:ac|
00000500  77 25 28 31 29 3d 33 3a  61 63 77 25 28 32 29 3d  |w%(1)=3:acw%(2)=|
00000510  30 3a 61 63 77 25 28 33  29 3d 32 0d 02 bc 0a 74  |0:acw%(3)=2....t|
00000520  70 3d 32 2a af 0d 02 c6  0a 72 25 3d 32 30 30 0d  |p=2*.....r%=200.|
00000530  02 d0 0b 73 25 3d 72 25  2a 32 0d 02 da 08 eb 20  |...s%=r%*2..... |
00000540  32 30 0d 02 e4 0b 52 6f  6c 6c 25 3d a3 0d 02 ee  |20....Roll%=....|
00000550  0c 64 52 6f 6c 6c 25 3d  30 0d 02 f8 05 e1 0d 03  |.dRoll%=0.......|
00000560  02 04 0d 03 0c 12 dd 20  f2 64 72 61 77 28 6f 25  |....... .draw(o%|
00000570  2c 6e 25 29 0d 03 16 0e  f4 20 47 43 4f 4c 20 30  |,n%)..... GCOL 0|
00000580  2c 30 0d 03 20 10 f4 20  50 52 4f 43 72 64 28 6f  |,0.. .. PROCrd(o|
00000590  25 29 0d 03 2a 05 db 0d  03 34 09 e6 20 30 2c 37  |%)..*....4.. 0,7|
000005a0  0d 03 3e 0b f2 72 64 28  6e 25 29 0d 03 48 09 f2  |..>..rd(n%)..H..|
000005b0  62 61 6c 6c 0d 03 52 05  e1 0d 03 5c 04 0d 03 66  |ball..R....\...f|
000005c0  0b dd 20 f2 62 61 6c 6c  0d 03 70 08 ea 20 64 25  |.. .ball..p.. d%|
000005d0  0d 03 7a 09 e6 20 30 2c  37 0d 03 84 09 64 25 3d  |..z.. 0,7....d%=|
000005e0  33 30 0d 03 8e 19 c8 8f  20 73 25 2b 64 25 2b 64  |30...... s%+d%+d|
000005f0  52 6f 6c 6c 25 2c 72 25  2c 64 25 0d 03 98 05 e1  |Roll%,r%,d%.....|
00000600  0d 03 a2 04 0d 03 ac 0c  dd 20 f2 65 62 61 6c 6c  |......... .eball|
00000610  0d 03 b6 08 ea 20 64 25  0d 03 c0 09 e6 20 30 2c  |..... d%..... 0,|
00000620  30 0d 03 ca 09 64 25 3d  33 30 0d 03 d4 19 c8 8f  |0....d%=30......|
00000630  20 73 25 2b 64 25 2b 64  52 6f 6c 6c 25 2c 72 25  | s%+d%+dRoll%,r%|
00000640  2c 64 25 0d 03 de 05 e1  0d 03 e8 04 0d 03 f2 0d  |,d%.............|
00000650  dd 20 f2 72 64 28 70 25  29 0d 03 fc 09 ea 20 72  |. .rd(p%)..... r|
00000660  72 25 0d 04 06 0d 72 72  25 3d 72 25 2a 2e 37 0d  |r%....rr%=r%*.7.|
00000670  04 10 11 74 68 3d 28 70  25 2f 31 36 29 2a 74 70  |...th=(p%/16)*tp|
00000680  0d 04 1a 13 78 25 3d 73  25 2b 72 72 25 2a 9b 28  |....x%=s%+rr%*.(|
00000690  74 68 29 0d 04 24 13 79  25 3d 73 25 2b 72 72 25  |th)..$.y%=s%+rr%|
000006a0  2a b5 28 74 68 29 0d 04  2e 0b ec 20 78 25 2c 79  |*.(th)..... x%,y|
000006b0  25 0d 04 38 09 74 68 2b  3d af 0d 04 42 12 78 25  |%..8.th+=...B.x%|
000006c0  3d 73 25 2b 72 25 2a 9b  28 74 68 29 0d 04 4c 12  |=s%+r%*.(th)..L.|
000006d0  79 25 3d 73 25 2b 72 25  2a b5 28 74 68 29 0d 04  |y%=s%+r%*.(th)..|
000006e0  56 0b df 20 78 25 2c 79  25 0d 04 60 05 e1 0d 04  |V.. x%,y%..`....|
000006f0  6a 04 0d 04 74 10 dd 20  f2 62 72 65 61 6b 28 62  |j...t.. .break(b|
00000700  25 29 0d 04 7e 15 62 25  3d 26 46 46 2d 28 62 25  |%)..~.b%=&FF-(b%|
00000710  20 80 20 26 46 46 29 0d  04 88 0d 3f 50 42 43 25  | . &FF)....?PBC%|
00000720  3d 26 34 30 0d 04 92 0d  50 42 43 25 3f 31 3d 62  |=&40....PBC%?1=b|
00000730  25 0d 04 9c 1f c8 99 20  22 49 49 43 5f 43 6f 6e  |%...... "IIC_Con|
00000740  74 72 6f 6c 22 2c 26 39  30 2c 50 42 43 25 2c 32  |trol",&90,PBC%,2|
00000750  0d 04 a6 05 e1 0d 04 b0  04 0d ff                 |...........|
0000075b