Page 3 of 3

Re: How hard would it be to hack these racers?

Posted: Thu Mar 14, 2024 11:34 pm
by Old-User
Found this useful poke: 39204,0 (stops timer).
Perhaps this could help to improve performance a little.

Re: How hard would it be to hack these racers?

Posted: Thu Mar 14, 2024 11:40 pm
by ParadigmShifter
I doubt it, it's just counting the number of times it has redrawn the screen sounds like (every 10 times = 1 second of Out Run time, as others mentioned it is variable though since it doesn't often draw at 10fps).

All that's involved there is incrementing a counter (will probably be a 16 bit counter. Might be 24 bits I suppose).

You could post the code where you hacked Space to be the M key but it didn't work properly, that is probably easy to fix.

Re: How hard would it be to hack these racers?

Posted: Fri Mar 15, 2024 12:06 pm
by Old-User
ParadigmShifter wrote: Thu Mar 14, 2024 11:40 pm I doubt it, it's just counting the number of times it has redrawn the screen sounds like (every 10 times = 1 second of Out Run time, as others mentioned it is variable though since it doesn't often draw at 10fps).

All that's involved there is incrementing a counter (will probably be a 16 bit counter. Might be 24 bits I suppose).

You could post the code where you hacked Space to be the M key but it didn't work properly, that is probably easy to fix.
Still, when demo mode kicks in, the absence of the timer and the engine sound seem to make the game work faster. :?:

Sure! Poke 32127,1 sets Space instead of M key but it reverts to M if controls are changed to somethinhg else and to keyboard back again. It seems to me somewhere in the code there is a table (?)/database (?) storing all those preset AND values used for Cursor, Sinclair and Keyboard keys. :?

Edit: I wonder if what's going on at addresses 31879~31885 relates to this somehow?

Re: How hard would it be to hack these racers?

Posted: Fri Mar 15, 2024 8:22 pm
by Old-User
ParadigmShifter wrote: Thu Mar 14, 2024 11:40 pm
You could post the code where you hacked Space to be the M key but it didn't work properly, that is probably easy to fix.
You asked me for the code and I read poke... :roll:

Anyway, it's this here:

Image

Re: How hard would it be to hack these racers?

Posted: Fri Mar 15, 2024 8:40 pm
by ParadigmShifter
Do those AND's get changed when it resets then? In which case they are probably self modified to write the values from the control type (keyboard/joystick) when the game starts again from the menu? If that is the case you need to find where those values get written to those addresses. You can probably search through for the addresses that get modified, so that would be 32127 there.

Re: How hard would it be to hack these racers?

Posted: Fri Mar 15, 2024 8:52 pm
by Old-User
ParadigmShifter wrote: Fri Mar 15, 2024 8:40 pm Do those AND's get changed when it resets then? In which case they are probably self modified to write the values from the control type (keyboard/joystick) when the game starts again from the menu?
Yes, I think that's what happens.
If I don't return to control selection then that's fine but once I do, it resets back to default values.

Re: How hard would it be to hack these racers?

Posted: Fri Mar 15, 2024 9:05 pm
by ParadigmShifter
So you need to find where that happens in the code then. The addresses it looks like it modifies aren't contiguous so they probably overwrite them one at a time? Another possibility if the addresses modified are all a set number of bytes apart it may do it in a loop so maybe look at the address of the operand of the first AND instruction which would be 32087.

I don't think you can do a break on data write with Spin which is a shame, would be easy to find then.

I don't know if you can dump the disassembly as a text file and search through that for the numbers you are interested in though.

Look for either

LD (32127), A

or anywhere that HL gets set to 32127 (or 32087).

It may modify some bytes around the addresses as well first so you may have to look for writes to addresses within that function. But try looking for easy stuff first.

Re: How hard would it be to hack these racers?

Posted: Fri Mar 15, 2024 10:17 pm
by Old-User
I remembered something.

If I load the main block code (the game .tzx file) in tapir and then view it as dump I find this:

Image

Is that a coincidence? Those are the game keys Q, A, O, P, M, R, H...

Re: How hard would it be to hack these racers?

Posted: Fri Mar 15, 2024 10:26 pm
by ParadigmShifter
I dunno. It's reading the keyboard directly in the routine you posted earlier so it doesn't use the ASCII representation or anything. Maybe it prints the keys out somewhere? Sounds like you can't redefine the keys so it won't be the defaults.

Re: How hard would it be to hack these racers?

Posted: Fri Mar 15, 2024 10:54 pm
by Old-User
Hey, I think I have found it! :)

I selected the memory view tab of the debugger and suddenly some sequences of numbers started making some sense to me... :geek:

Image

Let's see if I change the 4's to 1's what happens to keys.

Yup, Poke 31895,1 sets Space instead of M permanently. ;)

Beginner's luck and your help made it! 8-)

Re: How hard would it be to hack these racers?

Posted: Sun Mar 17, 2024 8:19 pm
by Old-User
Decided to to some experimentation with colors using paint:


Image


Could the real zx spectrum display the car sprite in red like that?
But when things started to move there would be color clash like in WEC le mans or Cisco Heat?

Re: How hard would it be to hack these racers?

Posted: Sun Mar 17, 2024 8:29 pm
by ParadigmShifter
Yeah there would be colour clash.

It looks like it never draws any attribs either so that would make the drawing a bit slower. Maybe it draws some attribs if you go up and down hills though, but the ink colour is the same for everything looks like.