Page 1 of 2

Hallo from Poland

Posted: Thu Jul 27, 2017 11:39 am
by ilyad731214
Hello.
After more than 25 years, I began to re-engage with the ZX-81. I also bought ZX-Pand recently. It is good that there are so many enthusiasts of this equipment. To the top of the question: Which ports do ZX81 read the keyboard? I want to try to modify the game to work with ZX-Pand joystick.

Re: Hallo from Poland

Posted: Thu Jul 27, 2017 12:12 pm
by mrtinb

Re: Hallo from Poland

Posted: Thu Jul 27, 2017 12:26 pm
by dr beep
Keyboard can be read with IN 254 and the line of the keyboard in highbyte, however it can also be read met sysvar LASTK.
So a game will not by default read from IO ports, also a derivate of the ports can be used for control.

Re: Hallo from Poland

Posted: Thu Jul 27, 2017 1:17 pm
by sirmorris
Hi!

Adding joystick support to existing games was a hobby of mine for a little while. The results are here:

viewtopic.php?f=4&t=833

I now write a patch program that in turn loads the game to be patched and inserts hooks into the input routines. Pretty much every game I've ever seen has been different which is where the fun, and EO's debugger, comes in ;) It's actually easier than modifying a game in-place a lot of the time. Also it is better this way as it prevents lots of different copies of the program making their way out into the world.

All of the patches that I've developed come with source code to study.

I will be very happy to assist you in your efforts :D

Re: Hallo from Poland

Posted: Thu Jul 27, 2017 2:19 pm
by ilyad731214
Thanks for the reply.
Sorry for the question:
How can an example keyboard read procedure look like? I would like to know where to start ...

Re: Hallo from Poland

Posted: Thu Jul 27, 2017 2:33 pm
by sirmorris

Re: Hallo from Poland

Posted: Thu Jul 27, 2017 2:41 pm
by sirmorris
There are basically 2 types of input routine.

'typing' - one key code is read at a time using the ROM routines.
'gaming' - direct reading of the keyboard rows using the IN instruction.

You need to load the target game into an emulator and identify where the movement code is located. This is the hardest bit.

Do you have a particular game in mind?

*note to self - perhaps add a feature in the EO debugger which breaks on an IO operation? Or a ROM call?

Re: Hallo from Poland

Posted: Thu Jul 27, 2017 5:34 pm
by Andy Rea
sirmorris wrote: Thu Jul 27, 2017 2:41 pm

*note to self - perhaps add a feature in the EO debugger which breaks on an IO operation? Or a ROM call?
a break on IO ($xx),r would b e ace and would most likely speed up finding user input routines

reagards

Re: Hallo from Poland

Posted: Thu Jul 27, 2017 10:48 pm
by dr beep
Andy Rea wrote: Thu Jul 27, 2017 5:34 pm
sirmorris wrote: Thu Jul 27, 2017 2:41 pm

*note to self - perhaps add a feature in the EO debugger which breaks on an IO operation? Or a ROM call?
a break on IO ($xx),r would b e ace and would most likely speed up finding user input routines

reagards
But then it would also break when in intrupt reading the keyboard.

Re: Hallo from Poland

Posted: Thu Jul 27, 2017 10:54 pm
by Andy Rea
yes but as a debugging tool, it would of course not be enabled all the time

regards