Home » Personal collection » Acorn tapes » Electron_User » Electron_User_tape06a_acorn_eu_1989_december.wav » JOY

JOY

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 » Personal collection » Acorn tapes » Electron_User » Electron_User_tape06a_acorn_eu_1989_december.wav
Filename: JOY
Read OK:
File size: 0628 bytes
Load address: 2000
Exec address: 1900
Duplicates

There are 4 duplicate copies of this file in the archive:

File contents
   10REM Keyboard->Joystick
   20REM By R.A.Waddilove
   30REM (c) Electron User
   40MODE 6
   50*KEY10 OLD|MRUN|M
   60IF ?&20B<&80 CALL!-4
   70PRINT'"Keyboard to Joystick Converter"
   80L%=FNkey("LEFT")
   90R%=FNkey("RIGHT")
  100U%=FNkey("UP")
  110D%=FNkey("DOWN")
  120F%=FNkey("FIRE")
  130PRINT'"Where shall I store the code?"
  140PRINT"(Hit RETURN if you're not sure)":*FX21
  150INPUT "Address=&"a$
  160IF a$="" a=&110 ELSE a=EVAL("&"+a$)
  170vector=&20A
  180FOR i=0 TO 2 STEP 2
  190P%=a
  200[OPT i
  210SEI
  220LDA vector
  230STA osbyte+1
  240LDA vector+1
  250STA osbyte+2
  260LDA #joystick MOD 256
  270STA vector
  280LDA #joystick DIV 256
  290STA vector+1
  300CLI
  310RTS
  320 
  330.joystick
  340CMP #&81
  350BNE osbyte  \INKEY?
  360CPY #&FF
  370BNE osbyte  \INKEY(-n)?
  380TXA:PHA:TYA:PHA
  390LDA #&80
  400CPX #256-F%
  410BNE left
  420.fire
  430LDX #0
  440JSR osbyte
  450TXA:AND #&3
  460BNE pressed
  470.not_pressed
  480LDX #0
  490LDY #0
  500BEQ here
  510.pressed
  520LDX #&FF
  530LDY #&FF
  540.here
  550PLA:PLA
  560RTS
  570 
  580.left
  590CPX #256-L%
  600BNE right
  610LDX #1
  620.read1
  630JSR osbyte
  640CPY #200
  650BCS pressed
  660BCC not_pressed
  670 
  680.right
  690CPX #256-R%
  700BNE up
  710LDX #1
  720.read2
  730JSR osbyte
  740CPY #32
  750BCC pressed
  760BCS not_pressed
  770 
  780.up
  790CPX #256-U%
  800BNE down
  810LDX #2
  820BNE read1
  830 
  840.down
  850CPX #256-D%
  860BNE exit
  870LDX #2
  880BNE read2
  890 
  900.exit
  910PLA:TAY:PLA:TAX
  920LDA #&81
  930.osbyte
  940JMP 0
  950]
  960NEXT
  970CALL a
  980CLS
  990PRINT'"Now load and run the game,"
 1000PRINT'"BREAK disables the routine."
 1010END
 1020 
 1030DEF FNkey(a$)
 1040PRINT'"Hold down the "a$" key:";
 1050K%=0
 1060K%=K%+1:IF K%=127 K%=1
 1070IF INKEY-K% ELSE 1060
 1080PRINT"ok"CHR$7:*FX21
 1090IF INKEY-K% GOTO 1090
 1100=K%

� Keyboard->Joystick
� By R.A.Waddilove
� (c) Electron User
(� 6
2*KEY10 OLD|MRUN|M
<� ?&20B<&80 �!-4
F&�'"Keyboard to Joystick Converter"
PL%=�key("LEFT")
ZR%=�key("RIGHT")
dU%=�key("UP")
nD%=�key("DOWN")
xF%=�key("FIRE")
�%�'"Where shall I store the code?"
�,�"(Hit RETURN if you're not sure)":*FX21
�� "Address=&"a$
� � a$="" a=&110 � a=�("&"+a$)
�vector=&20A
�� i=0 � 2 � 2
�P%=a
�
[OPT i
�SEI
�LDA vector
�STA osbyte+1
�LDA vector+1
�STA osbyte+2
LDA #joystick � 256
STA vector
LDA #joystick � 256
"STA vector+1
,CLI
6RTS
@ 
J
.joystick
TCMP #&81
^BNE osbyte  \�?
hCPY #&FF
rBNE osbyte  \�(-n)?
|TXA:PHA:TYA:PHA
�LDA #&80
�CPX #256-F%
�BNE left
�	.fire
�
LDX #0
�JSR osbyte
�
TXA:� #&3
�BNE pressed
�.not_pressed
�
LDX #0
�
LDY #0
�BEQ here
�.pressed
LDX #&FF
LDY #&FF
	.here
&PLA:PLA
0RTS
: 
D	.left
NCPX #256-L%
X
BNE right
b
LDX #1
l
.read1
vJSR osbyte
�CPY #200
�BCS pressed
�BCC not_pressed
� 
�
.right
�CPX #256-R%
�
BNE up
�
LDX #1
�
.read2
�JSR osbyte
�CPY #32
�BCC pressed
�BCS not_pressed
 
.up
CPX #256-U%
 BNE down
*
LDX #2
4
BNE read1
> 
H	.down
RCPX #256-D%
\BNE exit
f
LDX #2
p
BNE read2
z 
�	.exit
�PLA:TAY:PLA:TAX
�LDA #&81
�.osbyte
�	JMP 0
�]
��
�� a
��
�"�'"Now load and run the game,"
�#�'"BREAK disables the routine."
��
� 
� �key(a$)
 �'"Hold down the "a$" key:";
K%=0
$K%=K%+1:� K%=127 K%=1
.� �-K% � �TdD
8�"ok"�7:*FX21
B� �-K% � �DBD
L=K%
�
00000000  0d 00 0a 18 f4 20 4b 65  79 62 6f 61 72 64 2d 3e  |..... Keyboard->|
00000010  4a 6f 79 73 74 69 63 6b  0d 00 14 16 f4 20 42 79  |Joystick..... By|
00000020  20 52 2e 41 2e 57 61 64  64 69 6c 6f 76 65 0d 00  | R.A.Waddilove..|
00000030  1e 17 f4 20 28 63 29 20  45 6c 65 63 74 72 6f 6e  |... (c) Electron|
00000040  20 55 73 65 72 0d 00 28  07 eb 20 36 0d 00 32 15  | User..(.. 6..2.|
00000050  2a 4b 45 59 31 30 20 4f  4c 44 7c 4d 52 55 4e 7c  |*KEY10 OLD|MRUN||
00000060  4d 0d 00 3c 14 e7 20 3f  26 32 30 42 3c 26 38 30  |M..<.. ?&20B<&80|
00000070  20 d6 21 2d 34 0d 00 46  26 f1 27 22 4b 65 79 62  | .!-4..F&.'"Keyb|
00000080  6f 61 72 64 20 74 6f 20  4a 6f 79 73 74 69 63 6b  |oard to Joystick|
00000090  20 43 6f 6e 76 65 72 74  65 72 22 0d 00 50 13 4c  | Converter"..P.L|
000000a0  25 3d a4 6b 65 79 28 22  4c 45 46 54 22 29 0d 00  |%=.key("LEFT")..|
000000b0  5a 14 52 25 3d a4 6b 65  79 28 22 52 49 47 48 54  |Z.R%=.key("RIGHT|
000000c0  22 29 0d 00 64 11 55 25  3d a4 6b 65 79 28 22 55  |")..d.U%=.key("U|
000000d0  50 22 29 0d 00 6e 13 44  25 3d a4 6b 65 79 28 22  |P")..n.D%=.key("|
000000e0  44 4f 57 4e 22 29 0d 00  78 13 46 25 3d a4 6b 65  |DOWN")..x.F%=.ke|
000000f0  79 28 22 46 49 52 45 22  29 0d 00 82 25 f1 27 22  |y("FIRE")...%.'"|
00000100  57 68 65 72 65 20 73 68  61 6c 6c 20 49 20 73 74  |Where shall I st|
00000110  6f 72 65 20 74 68 65 20  63 6f 64 65 3f 22 0d 00  |ore the code?"..|
00000120  8c 2c f1 22 28 48 69 74  20 52 45 54 55 52 4e 20  |.,."(Hit RETURN |
00000130  69 66 20 79 6f 75 27 72  65 20 6e 6f 74 20 73 75  |if you're not su|
00000140  72 65 29 22 3a 2a 46 58  32 31 0d 00 96 13 e8 20  |re)":*FX21..... |
00000150  22 41 64 64 72 65 73 73  3d 26 22 61 24 0d 00 a0  |"Address=&"a$...|
00000160  20 e7 20 61 24 3d 22 22  20 61 3d 26 31 31 30 20  | . a$="" a=&110 |
00000170  8b 20 61 3d a0 28 22 26  22 2b 61 24 29 0d 00 aa  |. a=.("&"+a$)...|
00000180  0f 76 65 63 74 6f 72 3d  26 32 30 41 0d 00 b4 11  |.vector=&20A....|
00000190  e3 20 69 3d 30 20 b8 20  32 20 88 20 32 0d 00 be  |. i=0 . 2 . 2...|
000001a0  08 50 25 3d 61 0d 00 c8  0a 5b 4f 50 54 20 69 0d  |.P%=a....[OPT i.|
000001b0  00 d2 07 53 45 49 0d 00  dc 0e 4c 44 41 20 76 65  |...SEI....LDA ve|
000001c0  63 74 6f 72 0d 00 e6 10  53 54 41 20 6f 73 62 79  |ctor....STA osby|
000001d0  74 65 2b 31 0d 00 f0 10  4c 44 41 20 76 65 63 74  |te+1....LDA vect|
000001e0  6f 72 2b 31 0d 00 fa 10  53 54 41 20 6f 73 62 79  |or+1....STA osby|
000001f0  74 65 2b 32 0d 01 04 17  4c 44 41 20 23 6a 6f 79  |te+2....LDA #joy|
00000200  73 74 69 63 6b 20 83 20  32 35 36 0d 01 0e 0e 53  |stick . 256....S|
00000210  54 41 20 76 65 63 74 6f  72 0d 01 18 17 4c 44 41  |TA vector....LDA|
00000220  20 23 6a 6f 79 73 74 69  63 6b 20 81 20 32 35 36  | #joystick . 256|
00000230  0d 01 22 10 53 54 41 20  76 65 63 74 6f 72 2b 31  |..".STA vector+1|
00000240  0d 01 2c 07 43 4c 49 0d  01 36 07 52 54 53 0d 01  |..,.CLI..6.RTS..|
00000250  40 05 20 0d 01 4a 0d 2e  6a 6f 79 73 74 69 63 6b  |@. ..J..joystick|
00000260  0d 01 54 0c 43 4d 50 20  23 26 38 31 0d 01 5e 13  |..T.CMP #&81..^.|
00000270  42 4e 45 20 6f 73 62 79  74 65 20 20 5c a6 3f 0d  |BNE osbyte  \.?.|
00000280  01 68 0c 43 50 59 20 23  26 46 46 0d 01 72 17 42  |.h.CPY #&FF..r.B|
00000290  4e 45 20 6f 73 62 79 74  65 20 20 5c a6 28 2d 6e  |NE osbyte  \.(-n|
000002a0  29 3f 0d 01 7c 13 54 58  41 3a 50 48 41 3a 54 59  |)?..|.TXA:PHA:TY|
000002b0  41 3a 50 48 41 0d 01 86  0c 4c 44 41 20 23 26 38  |A:PHA....LDA #&8|
000002c0  30 0d 01 90 0f 43 50 58  20 23 32 35 36 2d 46 25  |0....CPX #256-F%|
000002d0  0d 01 9a 0c 42 4e 45 20  6c 65 66 74 0d 01 a4 09  |....BNE left....|
000002e0  2e 66 69 72 65 0d 01 ae  0a 4c 44 58 20 23 30 0d  |.fire....LDX #0.|
000002f0  01 b8 0e 4a 53 52 20 6f  73 62 79 74 65 0d 01 c2  |...JSR osbyte...|
00000300  0d 54 58 41 3a 80 20 23  26 33 0d 01 cc 0f 42 4e  |.TXA:. #&3....BN|
00000310  45 20 70 72 65 73 73 65  64 0d 01 d6 10 2e 6e 6f  |E pressed.....no|
00000320  74 5f 70 72 65 73 73 65  64 0d 01 e0 0a 4c 44 58  |t_pressed....LDX|
00000330  20 23 30 0d 01 ea 0a 4c  44 59 20 23 30 0d 01 f4  | #0....LDY #0...|
00000340  0c 42 45 51 20 68 65 72  65 0d 01 fe 0c 2e 70 72  |.BEQ here.....pr|
00000350  65 73 73 65 64 0d 02 08  0c 4c 44 58 20 23 26 46  |essed....LDX #&F|
00000360  46 0d 02 12 0c 4c 44 59  20 23 26 46 46 0d 02 1c  |F....LDY #&FF...|
00000370  09 2e 68 65 72 65 0d 02  26 0b 50 4c 41 3a 50 4c  |..here..&.PLA:PL|
00000380  41 0d 02 30 07 52 54 53  0d 02 3a 05 20 0d 02 44  |A..0.RTS..:. ..D|
00000390  09 2e 6c 65 66 74 0d 02  4e 0f 43 50 58 20 23 32  |..left..N.CPX #2|
000003a0  35 36 2d 4c 25 0d 02 58  0d 42 4e 45 20 72 69 67  |56-L%..X.BNE rig|
000003b0  68 74 0d 02 62 0a 4c 44  58 20 23 31 0d 02 6c 0a  |ht..b.LDX #1..l.|
000003c0  2e 72 65 61 64 31 0d 02  76 0e 4a 53 52 20 6f 73  |.read1..v.JSR os|
000003d0  62 79 74 65 0d 02 80 0c  43 50 59 20 23 32 30 30  |byte....CPY #200|
000003e0  0d 02 8a 0f 42 43 53 20  70 72 65 73 73 65 64 0d  |....BCS pressed.|
000003f0  02 94 13 42 43 43 20 6e  6f 74 5f 70 72 65 73 73  |...BCC not_press|
00000400  65 64 0d 02 9e 05 20 0d  02 a8 0a 2e 72 69 67 68  |ed.... .....righ|
00000410  74 0d 02 b2 0f 43 50 58  20 23 32 35 36 2d 52 25  |t....CPX #256-R%|
00000420  0d 02 bc 0a 42 4e 45 20  75 70 0d 02 c6 0a 4c 44  |....BNE up....LD|
00000430  58 20 23 31 0d 02 d0 0a  2e 72 65 61 64 32 0d 02  |X #1.....read2..|
00000440  da 0e 4a 53 52 20 6f 73  62 79 74 65 0d 02 e4 0b  |..JSR osbyte....|
00000450  43 50 59 20 23 33 32 0d  02 ee 0f 42 43 43 20 70  |CPY #32....BCC p|
00000460  72 65 73 73 65 64 0d 02  f8 13 42 43 53 20 6e 6f  |ressed....BCS no|
00000470  74 5f 70 72 65 73 73 65  64 0d 03 02 05 20 0d 03  |t_pressed.... ..|
00000480  0c 07 2e 75 70 0d 03 16  0f 43 50 58 20 23 32 35  |...up....CPX #25|
00000490  36 2d 55 25 0d 03 20 0c  42 4e 45 20 64 6f 77 6e  |6-U%.. .BNE down|
000004a0  0d 03 2a 0a 4c 44 58 20  23 32 0d 03 34 0d 42 4e  |..*.LDX #2..4.BN|
000004b0  45 20 72 65 61 64 31 0d  03 3e 05 20 0d 03 48 09  |E read1..>. ..H.|
000004c0  2e 64 6f 77 6e 0d 03 52  0f 43 50 58 20 23 32 35  |.down..R.CPX #25|
000004d0  36 2d 44 25 0d 03 5c 0c  42 4e 45 20 65 78 69 74  |6-D%..\.BNE exit|
000004e0  0d 03 66 0a 4c 44 58 20  23 32 0d 03 70 0d 42 4e  |..f.LDX #2..p.BN|
000004f0  45 20 72 65 61 64 32 0d  03 7a 05 20 0d 03 84 09  |E read2..z. ....|
00000500  2e 65 78 69 74 0d 03 8e  13 50 4c 41 3a 54 41 59  |.exit....PLA:TAY|
00000510  3a 50 4c 41 3a 54 41 58  0d 03 98 0c 4c 44 41 20  |:PLA:TAX....LDA |
00000520  23 26 38 31 0d 03 a2 0b  2e 6f 73 62 79 74 65 0d  |#&81.....osbyte.|
00000530  03 ac 09 4a 4d 50 20 30  0d 03 b6 05 5d 0d 03 c0  |...JMP 0....]...|
00000540  05 ed 0d 03 ca 07 d6 20  61 0d 03 d4 05 db 0d 03  |....... a.......|
00000550  de 22 f1 27 22 4e 6f 77  20 6c 6f 61 64 20 61 6e  |.".'"Now load an|
00000560  64 20 72 75 6e 20 74 68  65 20 67 61 6d 65 2c 22  |d run the game,"|
00000570  0d 03 e8 23 f1 27 22 42  52 45 41 4b 20 64 69 73  |...#.'"BREAK dis|
00000580  61 62 6c 65 73 20 74 68  65 20 72 6f 75 74 69 6e  |ables the routin|
00000590  65 2e 22 0d 03 f2 05 e0  0d 03 fc 05 20 0d 04 06  |e."......... ...|
000005a0  0e dd 20 a4 6b 65 79 28  61 24 29 0d 04 10 20 f1  |.. .key(a$)... .|
000005b0  27 22 48 6f 6c 64 20 64  6f 77 6e 20 74 68 65 20  |'"Hold down the |
000005c0  22 61 24 22 20 6b 65 79  3a 22 3b 0d 04 1a 08 4b  |"a$" key:";....K|
000005d0  25 3d 30 0d 04 24 19 4b  25 3d 4b 25 2b 31 3a e7  |%=0..$.K%=K%+1:.|
000005e0  20 4b 25 3d 31 32 37 20  4b 25 3d 31 0d 04 2e 11  | K%=127 K%=1....|
000005f0  e7 20 a6 2d 4b 25 20 8b  20 8d 54 64 44 0d 04 38  |. .-K% . .TdD..8|
00000600  11 f1 22 6f 6b 22 bd 37  3a 2a 46 58 32 31 0d 04  |.."ok".7:*FX21..|
00000610  42 11 e7 20 a6 2d 4b 25  20 e5 20 8d 44 42 44 0d  |B.. .-K% . .DBD.|
00000620  04 4c 07 3d 4b 25 0d ff                           |.L.=K%..|
00000628
JOY.m0
JOY.m1
JOY.m2
JOY.m4
JOY.m5