Hacking games to use ZXpand/Chroma/Other joystick

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
User avatar
1024MAK
Posts: 5118
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Hacking games to use ZXpand/Chroma/Other joystick

Post by 1024MAK »

I kinda following (while getting distracted with other things... :roll: ).

You do know that hacked Kempston joystick interfaces (with ZX81 sized edge-connectors) exist that support two fire buttons... and hacked joysticks exist that support two fire buttons... (and of course game pads often have more than one fire button)... let there be mass 🔥

<other hacked joystick interfaces may be available- check your local hardware hacker for availability...>

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Hacking games to use ZXpand/Chroma/Other joystick

Post by sirmorris »

Now it gets interesting. Here's a little program which is a proxy loader.

Copy SCRMPAT.P to your SD card, making sure that SCRMBL81.P is in the same folder.

LOAD "SCRMPAT" and ... scramble loads!

The loader is not modifying anything yet. But it will.

How it works:

The patcher sets memory configuration to its low setting, with 8K RAM at $2000. It copies its machine code there and jumps to it. SCRMBL81 is loaded. The stack is fixed up and then a return to BASIC is executed via SLOW. The effect of this is to RUN the program we just put in memory.

That's pretty much all there is to it for the moment - next up we add some code to alter the program in memory before it's executed.
Attachments
scrmpat.zip
(965 Bytes) Downloaded 165 times
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Hacking games to use ZXpand/Chroma/Other joystick

Post by sirmorris »

1024MAK wrote: Wed Aug 02, 2017 5:32 pmYou do know that hacked Kempston joystick interfaces (with ZX81 sized edge-connectors) exist that support two fire buttons... and hacked joysticks exist that support two fire buttons... (and of course game pads often have more than one fire button)... let there be mass 🔥
I know they exist. Hands up who's got one though? Anyone? Bueller? Anyone?

Thought not ;) :lol:
User avatar
1024MAK
Posts: 5118
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Hacking games to use ZXpand/Chroma/Other joystick

Post by 1024MAK »

sirmorris wrote: Wed Aug 02, 2017 5:51 pm
1024MAK wrote: Wed Aug 02, 2017 5:32 pmYou do know that hacked Kempston joystick interfaces (with ZX81 sized edge-connectors) exist that support two fire buttons... and hacked joysticks exist that support two fire buttons... (and of course game pads often have more than one fire button)... let there be mass 🔥
I know they exist. Hands up who's got one though? Anyone? Bueller? Anyone?

Thought not ;) :lol:
IMG_5066.JPG
(181.05 KiB) Downloaded 354 times
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
User avatar
mrtinb
Posts: 1910
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Hacking games to use ZXpand/Chroma/Other joystick

Post by mrtinb »

It seems like all your patches will work with ZxPand only.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Hacking games to use ZXpand/Chroma/Other joystick

Post by sirmorris »

Here is the patch and its source. Would some kind soul please try it out for me? Believe it or not I don't actually have a device to try it with :oops:
mrtinb wrote: Wed Aug 02, 2017 8:22 pmIt seems like all your patches will work with ZxPand only.
This is true. That's because I wrote them for ZXpand. If you want to adapt it for another system then feel free - I have explained very clearly how to do it and supplied the source code!
Attachments
scrmblpat.zip
(1.2 KiB) Downloaded 155 times
ilyad731214
Posts: 15
Joined: Thu Jul 27, 2017 9:43 am

Re: Hacking games to use ZXpand/Chroma/Other joystick

Post by ilyad731214 »

Thank you sirmorris for these tips. I'm going to try it out. Next game I will try to rewrite myself, but do not offend as I asked something. ;)
ZX-81, ZX-Pand AY, 48k "Rubber", 48K+, 128K + "Toastrack", +2 "grey" 1024k Profi, Masakrator FM, DivIDE 2K11, ZX Evolution rev. C, ZX-Uno, C64, C16 64K, Plus4 + 1541 Ultimate II + SD2IEC
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Hacking games to use ZXpand/Chroma/Other joystick

Post by sirmorris »

Please ask as many questions as you wish. The first 5 are free, the next five are ¢99 each :lol:

This was actually a very easy game to convert. Many are not so easy. Every one is different, that's for sure.

My other patchers were evidently becoming quite sophisticated. I removed a lot of the code from this one to make it easy to understand. Unfortunately I'm discovering a few bugs in ZX-IDE so some of the code was necessarily ugly. LD (HL),DE doesn't compile for instance, and there is a spurious opcode randomly inserted :shock: I've mailed Karl, I'm sure he will sort it out though.

The other patchers do things like check the ROM version and perform a CRC check on the hosted program to ensure it's right before running it. I will add these things back. Check out the source for PROTECTOR.
ilyad731214
Posts: 15
Joined: Thu Jul 27, 2017 9:43 am

Re: Hacking games to use ZXpand/Chroma/Other joystick

Post by ilyad731214 »

sirmorris wrote: Wed Aug 02, 2017 5:49 pm Now it gets interesting. Here's a little program which is a proxy loader.

Copy SCRMPAT.P to your SD card, making sure that SCRMBL81.P is in the same folder.

LOAD "SCRMPAT" and ... scramble loads!

The loader is not modifying anything yet. But it will.

How it works:

The patcher sets memory configuration to its low setting, with 8K RAM at $2000. It copies its machine code there and jumps to it. SCRMBL81 is loaded. The stack is fixed up and then a return to BASIC is executed via SLOW. The effect of this is to RUN the program we just put in memory.

That's pretty much all there is to it for the moment - next up we add some code to alter the program in memory before it's executed.
I tried yesterday to run the SCRAMBLE81 version and after running SCRAMBLPAT.P from the Commander, it reboots the system with the standby "K" without the ZXPand information. It seems that the computer is no longer "seeing" the ZXpand interface, because when you press "Z" Get the word "COPY" and you need to reset your computer. As a guide, SCRAMBLE81 is in the same directory as your path. Did I do something wrong?
ZX-81, ZX-Pand AY, 48k "Rubber", 48K+, 128K + "Toastrack", +2 "grey" 1024k Profi, Masakrator FM, DivIDE 2K11, ZX Evolution rev. C, ZX-Uno, C64, C16 64K, Plus4 + 1541 Ultimate II + SD2IEC
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Hacking games to use ZXpand/Chroma/Other joystick

Post by sirmorris »

Check the write-protect setting of the files. If a file is write protected ZXpand disables the overlay ROM. Remove the flag and things will work.

I was considering removing this feature because it causes a lot of confusion. My mind is now made up! ByeBye 'feature' :twisted:

*edit*

Code: Select all

        // hack to make programs auto-disable ROM if read-only attribute is set
        if (filinfo.fattrib & AM_RDO)
        {
            flags |= 1;
        }
Removed. The fact it was labelled a hack really says it all.
Post Reply