So if I use this routine in my program without ZXpand it will crash because I don't have ZXpand?

Yes, as configured it's calling a ZXpand specific ROM routine to get the joystick value. If this was to be made general purpose then a number of strategies could be used. The interface type could be detected at run-time, the joystick could be configured by the user either in code or in-game, or indeed removed completely. In fact going straight to the hardware would insulate the user from crashes and provide a useful default if no hardware was present.

As a general question to the wider community - would it seem more useful if code was plug and play or is it reasonable to assume that an end user would modify it to their needs?

As a general question to the wider community - would it seem more useful if code was plug and play or is it reasonable to assume that an end user would modify it to their needs?

I would guess that someone in the need of an input routine is a programmer...
So he/she/it would modify it to their needs.
For the less capable (me?) some examples would be helpful...
If you would add this to your commander, it would be helpful (in EO) if the cursor wouldn't jump several steps at once. I have to press it VERY VERY short to go up or down one line.
As far as I understand this routine could prevent this?

In theory, there is no difference between theory and practice. But, in practice, there is.

If you genuinely need a j/stk interface I have a pukka Kempston speccy one and a no-name ZX81 interface with ZX81 edge connector, you can have with my blessings.
Never used them so have to guess they are ok.

If you genuinely need a j/stk interface I have a pukka Kempston speccy one and a no-name ZX81 interface with ZX81 edge connector, you can have with my blessings.
Never used them so have to guess they are ok.

Testing a Kempston (or compatible) joystick interface using BASIC on a ZX Spectrum is easy. It's slightly more tricky on a Zeddy, as the program has to put a very short machine code routine in a line 1 REM line.

Testing a Kempston (or compatible) joystick interface using BASIC on a ZX Spectrum is easy. It's slightly more tricky on a Zeddy, as the program has to put a very short machine code routine in a line 1 REM line.

Mark

Or you use PowerBasic from. Math123

In theory, there is no difference between theory and practice. But, in practice, there is.