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

RTR/PotTest

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/PotTest
Read OK:
File size: 0253 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM> Virtual Screw pot 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)
   70PROC_init
   80REM SET ALL BITS HIGH
   90?PBK%=&FF
  100SYS "IIC_Control",&70,PBK%,1
  110REM Read current value
  120SYS "IIC_Control",&71,PBK%,1
  130CV%=?PBK% AND 3
  140
  150REPEAT
  160REM Hold until a change
  170REPEAT
  180SYS "IIC_Control",&71,PBK%,1
  190NV%=?PBK% AND 3
  200UNTIL CV%<>NV%
  210dir%=0
  220IF cw%(CV%)=NV% THEN dir%=1
  230IF acw%(CV%)=NV% THEN dir%=2
  240PRINTdir%
  250CV%=NV%
  260UNTIL FALSE
  270
  280DEF PROC_init
  290cw%(0)=2:cw%(1)=0:cw%(2)=3:cw%(3)=1
  300acw%(0)=1:acw%(1)=3:acw%(2)=0:acw%(3)=2
  310ENDPROC

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

� �_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
6�
�
00000000  0d 00 0a 1d f4 3e 20 56  69 72 74 75 61 6c 20 53  |.....> Virtual S|
00000010  63 72 65 77 20 70 6f 74  20 74 65 73 74 0d 00 14  |crew pot test...|
00000020  05 db 0d 00 1e 1d f1 22  56 69 72 74 75 61 6c 20  |......."Virtual |
00000030  73 63 72 65 77 20 70 6f  74 20 74 65 73 74 22 0d  |screw pot test".|
00000040  00 28 27 f1 22 49 49 43  20 42 75 73 20 44 69 67  |.('."IIC Bus Dig|
00000050  69 74 61 6c 20 49 6e 70  75 74 20 44 65 76 69 63  |ital Input Devic|
00000060  65 20 26 37 30 22 0d 00  32 13 f1 22 42 79 20 4d  |e &70"..2.."By M|
00000070  69 6b 65 20 43 6f 6f 6b  22 0d 00 3c 1b de 20 50  |ike Cook"..<.. P|
00000080  42 4b 25 20 33 2c 63 77  25 28 33 29 2c 61 63 77  |BK% 3,cw%(3),acw|
00000090  25 28 33 29 0d 00 46 0a  f2 5f 69 6e 69 74 0d 00  |%(3)..F.._init..|
000000a0  50 17 f4 20 53 45 54 20  41 4c 4c 20 42 49 54 53  |P.. SET ALL BITS|
000000b0  20 48 49 47 48 0d 00 5a  0d 3f 50 42 4b 25 3d 26  | HIGH..Z.?PBK%=&|
000000c0  46 46 0d 00 64 1f c8 99  20 22 49 49 43 5f 43 6f  |FF..d... "IIC_Co|
000000d0  6e 74 72 6f 6c 22 2c 26  37 30 2c 50 42 4b 25 2c  |ntrol",&70,PBK%,|
000000e0  31 0d 00 6e 18 f4 20 52  65 61 64 20 63 75 72 72  |1..n.. Read curr|
000000f0  65 6e 74 20 76 61 6c 75  65 0d 00 78 1f c8 99 20  |ent value..x... |
00000100  22 49 49 43 5f 43 6f 6e  74 72 6f 6c 22 2c 26 37  |"IIC_Control",&7|
00000110  31 2c 50 42 4b 25 2c 31  0d 00 82 11 43 56 25 3d  |1,PBK%,1....CV%=|
00000120  3f 50 42 4b 25 20 80 20  33 0d 00 8c 04 0d 00 96  |?PBK% . 3.......|
00000130  05 f5 0d 00 a0 19 f4 20  48 6f 6c 64 20 75 6e 74  |....... Hold unt|
00000140  69 6c 20 61 20 63 68 61  6e 67 65 0d 00 aa 05 f5  |il a change.....|
00000150  0d 00 b4 1f c8 99 20 22  49 49 43 5f 43 6f 6e 74  |...... "IIC_Cont|
00000160  72 6f 6c 22 2c 26 37 31  2c 50 42 4b 25 2c 31 0d  |rol",&71,PBK%,1.|
00000170  00 be 11 4e 56 25 3d 3f  50 42 4b 25 20 80 20 33  |...NV%=?PBK% . 3|
00000180  0d 00 c8 0e fd 20 43 56  25 3c 3e 4e 56 25 0d 00  |..... CV%<>NV%..|
00000190  d2 0a 64 69 72 25 3d 30  0d 00 dc 1b e7 20 63 77  |..dir%=0..... cw|
000001a0  25 28 43 56 25 29 3d 4e  56 25 20 8c 20 64 69 72  |%(CV%)=NV% . dir|
000001b0  25 3d 31 0d 00 e6 1c e7  20 61 63 77 25 28 43 56  |%=1..... acw%(CV|
000001c0  25 29 3d 4e 56 25 20 8c  20 64 69 72 25 3d 32 0d  |%)=NV% . dir%=2.|
000001d0  00 f0 09 f1 64 69 72 25  0d 00 fa 0b 43 56 25 3d  |....dir%....CV%=|
000001e0  4e 56 25 0d 01 04 07 fd  20 a3 0d 01 0e 04 0d 01  |NV%..... .......|
000001f0  18 0c dd 20 f2 5f 69 6e  69 74 0d 01 22 27 63 77  |... ._init.."'cw|
00000200  25 28 30 29 3d 32 3a 63  77 25 28 31 29 3d 30 3a  |%(0)=2:cw%(1)=0:|
00000210  63 77 25 28 32 29 3d 33  3a 63 77 25 28 33 29 3d  |cw%(2)=3:cw%(3)=|
00000220  31 0d 01 2c 2b 61 63 77  25 28 30 29 3d 31 3a 61  |1..,+acw%(0)=1:a|
00000230  63 77 25 28 31 29 3d 33  3a 61 63 77 25 28 32 29  |cw%(1)=3:acw%(2)|
00000240  3d 30 3a 61 63 77 25 28  33 29 3d 32 0d 01 36 05  |=0:acw%(3)=2..6.|
00000250  e1 0d ff                                          |...|
00000253