Joystick and Joystick Interface Testing

Post Reply
User avatar
1024MAK
Posts: 2536
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Joystick and Joystick Interface Testing

Post by 1024MAK » Sat Jun 09, 2018 4:06 pm

The simplest Kempston joystick interface test program is:-

Code: Select all

10 PRINT AT 0,0;IN 31,
20 GO TO 10
A more sophisticated program is this one:-

Code: Select all

 1 REM A 1024MAK program
 5 PRINT "Kempston Joystick Testing"
10 LET J=IN 31
20 IF J>31 THEN LET J=J-32: GO TO 20
30 PRINT AT 2,0;J,
40 IF J=1 THEN PRINT "Right",
50 IF J=2 THEN PRINT "Left",
60 IF J=4 THEN PRINT "Down",
70 IF J=8 THEN PRINT "Up",
80 IF J=16 THEN PRINT "Fire",
90 PRINT ,
100 GO TO 10
900 SAVE "Kempston"
To test a joystick interface that uses the Sinclair standard, use:

Code: Select all

 1 REM A 1024MAK program
 5 PRINT "Sinclair Joystick Testing"
10 LET J$=INKEY$
20 IF J$<"0" OR J$>"9" THEN PRINT AT 2,0,,: GO TO 10
30 PRINT AT 2,0;J$,
40 IF J$="1" OR J$="6" THEN PRINT "Left"
50 IF J$="2" OR J$="7" THEN PRINT "Right"
60 IF J$="3" OR J$="8" THEN PRINT "Down"
70 IF J$="4" OR J$="9" THEN PRINT "Up"
80 IF J$="5" OR J$="0" THEN PRINT "Fire"
100 GO TO 10
900 SAVE "Sinclair"
This will also test Cursor joystick interfaces, but the directions/fire button details will be wrong.

Some years ago I also wrote this test program:-

This is useful for testing interfaces that conform to the Sinclair Interface 2 standard:

Code: Select all

   1 REM A 1024MAK program
   5 PRINT AT 3,0;"76543210            76543210"
  10 LET a=IN 61438
  11 LET b=IN 63486
  12 LET k$=INKEY$
  13 IF k$="Q" OR k$="q" THEN GO TO 9999
  14 LET num=a
  15 GO SUB 1000
  16 LET c$=b$
  22 LET num=b
  24 GO SUB 1000
  50 PRINT AT 4,0 ;c$;" ";a;"  ";
  55 PRINT AT 4,20 ;b$;" ";b;"  ";
  70 GO TO 10
1000 REM convert to bin
1010 REM takes number in num and returns bin number in b$
1020 LET b$="00000000"
1030 IF num<1 OR num >255 THEN RETURN 
1040 IF num>=128 THEN LET num=INT (num-128) : LET b$(1)="1"
1050 IF num>=64 THEN LET num=INT (num-64) : LET b$(2)="1"
1060 IF num>=32 THEN LET num=INT (num-32) : LET b$(3)="1"
1070 IF num>=16 THEN LET num=INT (num-16) : LET b$(4)="1"
1080 IF num>=8 THEN LET num=INT (num-8) : LET b$(5)="1"
1090 IF num>=4 THEN LET num=INT (num-4) : LET b$(6)="1"
1100 IF num>=2 THEN LET num=INT (num-2) : LET b$(7)="1"
1110 IF num=1 THEN LET b$(8)="1"
1170 RETURN 
Mark

User avatar
1024MAK
Posts: 2536
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Joystick and Joystick Interface Testing

Post by 1024MAK » Sat Jun 09, 2018 5:53 pm

All but the simple Kempston test program in the above post are included in the attached file (Joystick and Interface Testing.tap.zip) plus two bonus programs :D

Mark
Attachments
Joystick and Interface Testing.tap.zip
Joystick and Interface Testing.tap
(1.3 KiB) Downloaded 133 times

McKlaud
Posts: 255
Joined: Tue Dec 19, 2017 10:02 pm
Location: St Albans, UK

Re: Joystick and Joystick Interface Testing

Post by McKlaud » Sat Jun 09, 2018 10:15 pm

Hi Mark :)

Small but useful items, thanks.
Claudius
----------

albertusj
Posts: 58
Joined: Sat Aug 18, 2012 12:44 am
Location: Somerset-West, South-Africa
Contact:

Re: Joystick and Joystick Interface Testing

Post by albertusj » Sun Jul 07, 2019 2:59 pm

How would one alter the KEMPSTON test program for 4K BASIC on the ZX80?
ZX80/ZX81/ZX Spectrum

User avatar
1024MAK
Posts: 2536
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Joystick and Joystick Interface Testing

Post by 1024MAK » Mon Jul 08, 2019 1:20 am

albertusj wrote:
Sun Jul 07, 2019 2:59 pm
How would one alter the KEMPSTON test program for 4K BASIC on the ZX80?
You need some machine code, because neither ZX80 or ZX81 BASIC has the IN function.
By some, I think it is just two or three lines of machine code. I have done it for the ZX81 in the past, back when I confirmed that a Kempston joystick interface would work with a ZX81.

I’ll get back to you on this, but it will not be until Tuesday or Wednesday.

Mark

albertusj
Posts: 58
Joined: Sat Aug 18, 2012 12:44 am
Location: Somerset-West, South-Africa
Contact:

Re: Joystick and Joystick Interface Testing

Post by albertusj » Mon Jul 08, 2019 10:33 am

That's fine. Thank you.
ZX80/ZX81/ZX Spectrum

albertusj
Posts: 58
Joined: Sat Aug 18, 2012 12:44 am
Location: Somerset-West, South-Africa
Contact:

Re: Joystick and Joystick Interface Testing

Post by albertusj » Mon Jul 08, 2019 3:18 pm

I think I found what I need to use:
http://www.myprius.co.za/projects.zip
Easy Add-on Projects for Spectrum, ZX81 and Ace
pages 27, 174
ZX80/ZX81/ZX Spectrum

albertusj
Posts: 58
Joined: Sat Aug 18, 2012 12:44 am
Location: Somerset-West, South-Africa
Contact:

Re: Joystick and Joystick Interface Testing

Post by albertusj » Mon Jul 08, 2019 7:57 pm

I tried the program on page 175, but only get 16514 printed on the screen. I had to add brackets to the USR command, so perhaps there are other ZX80 4K BASIC specific things I'm missing. The address for the joystick is 1F=31.

Maybe I should just test it on my ZX81 or Spectrum.... ;)
ZX80/ZX81/ZX Spectrum

albertusj
Posts: 58
Joined: Sat Aug 18, 2012 12:44 am
Location: Somerset-West, South-Africa
Contact:

Re: Joystick and Joystick Interface Testing

Post by albertusj » Tue Jul 09, 2019 12:42 pm

Tested and it works beautifully on my Spectrum. I'd still like to test it on my ZX80. Obviously, the hardware works but I'd still like to see how one would do it on a ZX80 with 4K BASIC.
ZX80/ZX81/ZX Spectrum

Post Reply