JOY81 - Programmable Joystick Interface for ZX81

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: JOY81 - Programmable Joystick Interface for ZX81

Post by kmurta »

Hi Siggi

I see that I don't understand your question completely.

You are right, only six keys can be assigned to the joystick and all the relevant combinations between them can be handled by the game.

So games that use more than 4 keys for directions can not be completely supported by the JOY81. But there are only some few games in that situation and I consider that this lack is not relevant.
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: JOY81 - Programmable Joystick Interface for ZX81

Post by kmurta »

Siggi

Thinking better, the limitation to handle 8 diferentes keys for directions is due to software, indeed the JOY81 hardware are able to work with it. :)

At night I will work in a new piece of code, get me a time to get something to you.
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
User avatar
siggi
Posts: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: JOY81 - Programmable Joystick Interface for ZX81

Post by siggi »

Great news!
Thanks for thinking again :D

Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: JOY81 - Programmable Joystick Interface for ZX81

Post by kmurta »

Hi Siggi

This special version of configuration tool will handle 10 keys, 8 for directions and 2 for the buttons:
SJ10Keys.P
(535 Bytes) Downloaded 304 times
You need to assign the keys to BASIC variable J$ in the sequence UP/DW/RG/LF/UR/DR/DL/UL/B1/B2 and then run the program with GOTO 1 (or direct command RAND USR 16514). For the keys you mentioned before + 'L' and 'P' (for buttons):

Code: Select all

Q W E
A   D
Z X C      L  P
you will need to type in Zeddy:

Code: Select all

LET J$="WXADECZQLP"
GOTO 1   (or RAND USR 16514)
For the keys SHIFT, BREAK and ENTER you will use the characters '?', '*' and '<' respectively. Use the character '-' if you don't want to assign a key.

I'm in travel far of my Zeddy, then I ask you to test if the program works as expected.
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
User avatar
siggi
Posts: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: JOY81 - Programmable Joystick Interface for ZX81

Post by siggi »

Works great as expected (using INKEY). :mrgreen:

But using INPUT only the main directions (UP DOWN LEFT RIGHT) can be input. If you press the joystick UP+RIGHT, one of the joystick's switches closes first, so you get the key of the first closed switch (UP or RIGHT). Due to debouncing, closing the other switch some milliseconds later has no effect.

But INKEY is the typical usage, to that is no problem :)

Here is a game I wrote 1983, which uses that keys (if you answer the question about joystick usage with NO!):
AUTORENN.P
(5.81 KiB) Downloaded 302 times
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
User avatar
siggi
Posts: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: JOY81 - Programmable Joystick Interface for ZX81

Post by siggi »

Here is another game, which uses a lot of keys and also 8 keys for navigation:
STARTRK.P
(13.68 KiB) Downloaded 299 times
And here my basic program setup the 10 keys:
SETJOY10.P
(1.69 KiB) Downloaded 291 times
Have fun :mrgreen:
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
User avatar
siggi
Posts: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: JOY81 - Programmable Joystick Interface for ZX81

Post by siggi »

kmurta wrote: Sun Dec 01, 2013 8:45 pm
To help you find where the problem may be, follow the source code of the JOY81 configuration routine (poorly commented, sorry):

Code: Select all

;Define keys characters. Note that the keys SHIFT, SPACE and NEWLINE are assigned
;to characters '?', '*' and '<' to allow them to be declared in a BASIC statement.

; Keyboard row addresses table (msb byte)
key_row_addr:
        db  $fe,$fd,$fb,$f7,$ef,$df,$bf,$7f


; Ports to access the joystick RAM to store the key codes
joy_ram_ports:
        db  12,$11,$15,$13,$31,$51,$35,$33,$55,$53,$71,$75,$73     ;UP
        db  12,$09,$0d,$0b,$29,$49,$2d,$2b,$4d,$4c,$69,$6d,$6b     ;DOWN
        db  12,$05,$15,$0d,$25,$45,$35,$2d,$55,$4d,$65,$75,$6d     ;LEFT
        db  12,$03,$13,$0b,$23,$43,$33,$2b,$53,$4b,$63,$73,$6b     ;RIGHT
        db  18,$21,$23,$25,$29,$31,$2b,$33,$2d,$35,$61,$63,$65     ;BUTTON 1
        db  $69,$71,$6b,$73,$6d,$75
        db  18,$41,$43,$45,$49,$51,$4b,$53,$4d,$55,$61,$63,$65     ;BUTTON 2
        db  $69,$71,$6b,$73,$6d,$75

Hi Kelly
is it really necessary to do OUT to all those ports? That causes trouble, when more other cards (not only JOY81) are connected to the Zeddy (e.g. ZeddyNet or sound cards), which are configured via one of these port addresses.

The keyboard is scanned by the ROM routines using only one (low) address during an IN cycle. So would it not be sufficient to write the keyboard scan patterns into ram using also only one address during an OUT cycle (like Wilf did it in his "RAMKEY" joystick interface: https://groups.google.com/forum/?hl=en# ... 13-HUs2uoJ )

Regards
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: JOY81 - Programmable Joystick Interface for ZX81

Post by sirmorris »

ZX printer also goes a little... strange depending on the configuration.
User avatar
siggi
Posts: 988
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: JOY81 - Programmable Joystick Interface for ZX81

Post by siggi »

Hi Kelly
is it possible to configure also keypresses, which are recognized as valid (when a game in M/C scans the keyboard directly), but which do not lead to a valid ZX81 key? Currently the interface can generate a single key, valid for BASIC.

I am thinking of that situation: a m/c game scans the keyboard to detect the FIRE button (e. g. SPACE). At the the same time the joystick "presses" the RIGHT-key to move something right (e. g. key '8'). Currently it is NOT possible to press FIRE at the same time, because pressing SPACE and 8 at the same time is invalid at BASIC level. Currently it is necessary to release the joystick to mid position, then the FIRE button may be pressed to generate a valid key SPACE.

So I think, the SetJoy-programs need to be enhanced to configure that. Any possible combination of keys should be handled:
- main direction (UP, DOWN, LEFT RIGHT): 4
- diagonal (2 switches closed at joystick): 4
- any combination of 2 fire buttons(OFF-OFF,OFF-ON,ON-ON,ON-OFF): 4

The fire buttons may be pressed at the same time as the direction switches: so 4 * (4+4) combinations are possible physically (joystick with 2 fire buttons).

But this 32 combinations are not always valid BASIC keys. So maybe a new SetJoy-program would be necessary to configure that.

What do you think?

Regards
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: JOY81 - Programmable Joystick Interface for ZX81

Post by kmurta »

siggi wrote: Fri Mar 06, 2020 9:46 am Hi Kelly
is it possible to configure also keypresses, which are recognized as valid (when a game in M/C scans the keyboard directly), but which do not lead to a valid ZX81 key? Currently the interface can generate a single key, valid for BASIC.

I am thinking of that situation: a m/c game scans the keyboard to detect the FIRE button (e. g. SPACE). At the the same time the joystick "presses" the RIGHT-key to move something right (e. g. key '8'). Currently it is NOT possible to press FIRE at the same time, because pressing SPACE and 8 at the same time is invalid at BASIC level. Currently it is necessary to release the joystick to mid position, then the FIRE button may be pressed to generate a valid key SPACE.

So I think, the SetJoy-programs need to be enhanced to configure that. Any possible combination of keys should be handled:
- main direction (UP, DOWN, LEFT RIGHT): 4
- diagonal (2 switches closed at joystick): 4
- any combination of 2 fire buttons(OFF-OFF,OFF-ON,ON-ON,ON-OFF): 4

The fire buttons may be pressed at the same time as the direction switches: so 4 * (4+4) combinations are possible physically (joystick with 2 fire buttons).

But this 32 combinations are not always valid BASIC keys. So maybe a new SetJoy-program would be necessary to configure that.

What do you think?

Regards
Siggi
Hi Siggi!

Consider the JOY81 as an extension of the keyboard (and in fact it is), so all the limitations of the keyboard apply to it. So, just as in BASIC it is not possible to identify multiple keys pressed on the keyboard, the same occurs with JOY81.

Only with M/C it is possible to identify all possible combinations of the 6 joystick switches. In fact, almost all of them since the configuration program discard combinations that don't make sense, like LEFT+RIGHT or UP+DOWN.

The only way to get what you want would be by changing the keyboard scan routine in ROM.

I hope I answered your question.
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
Post Reply