Dk'tronics Joystick Interface

Another British joystick interface which utilises the expansion port
from a well known firm in Essex.

Joystick Interface Instructions
Warning* Disconnect power supply before plugging the interface into the expansion socket.

There are two joystick ports on the interface and they are both read in the same way. The first port is read from address 784, the second from 800. They will both return the same values for the relevant directions.

To read port 1, type into the computer;10 PRINT PEEK (784): GOTO 10
To read port 2, type into the computer:10 PRINT PEEK (800): GOTO 10
They should return the following values:

0= NOTHING
1=UP
2= DOWN
4= FIRE
8= LEFT
16= RIGHT

The four directions and the fire button give combined readings, thus giving 8 directions, I.E. a port value of-
22= 16 (RIGHT)+2 (DOWN) +4 (FIRE).

Special Feature
When writing your own programs, you can incorporate both of the ports simultaneously, thus giving you the options of using two joysticks controlling two separate objects on the screen at the same time.

Example Programs Joystick Routine

5 PRINT CHR$(17) :REM SWITCH CURSOR OFF
10 X=10: Y=10:P=0: I=1
15 PAPER P: INKI:CLS
20 A= PEEK (784) :REM READ PORT 1
25 B= PEEK (800) :REM READ PORT 2
30 IF A=1 OR B=1 THENGOTO100
40 IF A=2 OR B=2 THEN GOTO 200
50 IF A=8 OR B=8 THEN GOTO 300
60 IF A= l6 OR B=16THENGOTO400
70 IF A= 4 OR B= 4 THEN GOTO 500
80 GOTO 700
100 REM JOYSTICK UP
110 IF Y=0 THEN GOTO20:REM TOP LINE
120 GOSUB600
130 Y=Y-1:REM MOVE UP 1 SPACE
140 GOTO 700
200 REM JOYSTICK DOWN
210 IF Y=24 THEN GOTO 20: REM BOTTOM LINE
220 GOSUB 600
230 Y=Y+1:REM MOVE DOWN 1 SPACE
240 GOTO 700
300 REM JOYSTICK LEFT
310 IF X=2 THEN GOTO 20:REM LEFT EDGE
320 GOSUB 600
330 X=X-1 :RF.M MOVE LEFT 1 SPACE
340 GOTO 700
400 REM JOYSTICK RIGHT
410 IF X=39 THEN GOTO 20:REM RIGHT EDGE
420 GOSUB600
430 X=X+1:REM MOVE RIGHT 1 SPACE
440 GOTO 700
500 REM FIRE BUTTON PRESSED
510 P=P+1 :REM NEXT PAPER COLOUR
520 IF P=8 THENP=0:REM RESET
530 I=I+1:REM NEXT INK COLOUR
540 IF I=8THEN I=0:REM RESET
550 GOTO 15
600 REMOVE OLD CHARACTER
610 PLOTX,Y," ":RETURN
700 REM DISPLAY NEW CHARACTER
710 PLOTX,Y,"A":GOTO20

Joystick Hires Draw Program

5 HIRES
10 PRINT CHR$( 17) :REM SWITCH CURSOR OFF
15 X=100:Y=100:I=1
20 A = PEEK (784):REM READ PORT 1
25 B= PEEK (800) :REM READ PORT 2
30 IF A=1 OR B= 1 THEN GOTO 100
40 IF A=2 OR B= 2 THEN GOTO 200
50 IF A=8 OR B= 8 THEN GOTO 300
60 IF A=16 OR B=16 THEN GOTO 400
70 IF A= 17 OR B=17 THEN GOTO 500
75 IF A= 18 OR B=18 THEN GOTO 600
80 IF A= 9 OR B= 9 THEN GOTO 700
85 IF A= 10 OR B=10 THEN GOTO 800
90 IF A= 4 OR B= 4 THEN GOTO 900
95 GOTO 1000
100 REM JOYSTICK UP
110 IF Y=0 THEN GOTO 20:REM TOP LINE
120 Y=Y-1:REM MOVE UP1 SPACE
130 GOTO 1000
200 REM JOYSTICK DOWN
210 IF Y= 199 THEN GOTO 20 :REM BOTTON LINE
220 Y=Y+1 : REM MOVE DOWN 1 SPACE
230 GOTO 1000
300 REM JOYSTICK LEFT
310 1FX=0 THEN GOTO20:REM LEFT EDGE
320 X=X-1 :REM MOVE LEFT 1 SPACE
330 GOTO 1000
400 REM JOYSTICK RIGHT
410 IF X= 239 THEN GOTO 20: REM RIGHT EDGE
420 X=X+1:REM MOVE RIGHT 1 SPACE
430 GOTO 1000
500 REM JOYSTICK UP/RIGHT
510 IFX=239 0RY=0THENGOTO20:REM EDGE HIT
520 X=X+1:Y-Y 1 :REM MOVE IN DIRECTION
530 GOTO 1000
600 REM JOYSTICK DOWN/RIGHT
610 IF X= 239 OR Y= 199 THEN GOTO 20:REM EDGE HIT
620 X=X+1:Y=Y+1:REM MOVE IN DIRECTION
630 GOTO 1000
700 REM JOYSTICK UP/LEFT
710 IF X=0 OR Y=0THEN GOTO 20:REM EDGE HIT
720 X=X-1:Y=Y-1 :REM MOVE IN DIRECTION
730 GOTO 1000
800 REM JOYSTICK DOWN/LEFT
810 IF X= 239 OR Y=0 THEN GOTO 20:REM EDGE HIT
820 X= X+ 1 :Y= Y-1 :REM MOVE IN DIRECTION
830 GOTO1000
900 REM FIRE BUTTON PRESSED
910 I=I+1: REM NEXT INK
920 IF I=2THENI=0:REM RESET
1000 REM DRAW
1010 CURSETX,Y,1:GOTO20

Altai Interface

PASE Interface

O.P.E.L Interface

IJK and MCP Interfaces

Protek programmable Interface

Downsway Programmable Interface

Joysticks & Rare Orics

 

back to main page


© Copyright 2000 by S.D.Marshall email me