Using my hexsearch tool it is possible to identify byte seqences in snapshots files
used by many Spectrum Emulators. For simplicity we can use the .sna snapshot file format.
Some emulators do not allow memory to be searched but some allow the memory to be changed by the poke command.
The problem is translating a virtual address as an offset in the .sna file to a physical memory address. A lot of games store their variables if the 48k region, so that in 48k and 128k mode they will be at the same address.
The specification for the .sna format says:
Offset Size Description ------------------------------------------------------------------------ 0 27 bytes SNA header (see above) 27 16Kb bytes RAM bank 5 \ 16411 16Kb bytes RAM bank 2 } - as standard 48Kb SNA file
So for a quick calculation to calculate the physical address within the 48k RAM area the equation is:
address = (file_offset - 27) + 16384
For quickness it's a good idea to put this formula into an Excel spreadsheet.
Reference: WOS
|
Continue the game. Score 20 so the score is now 481. Take a snapshot.
481 in hex is 0x1e1. In little endian format this is 0xe101
This gives us an address comparison to find addresses where the score may be stored.
|
By checking the 2 snapshot we can see that offset 23354 contains the values we are looking for in both cases. This is probably where the score is held. To convert the snapshot offset to a real address we must recalculate it.
address = (file_offset - 27) + 16384
(23354 - 27) + 16384 = 39711
since this is a 16-bit word we poke 39711 and 39712.
In the game 180 we should:
poke 39711, 2
poke 39712, 0
to be able to end the game in double 1.
This makes the final very easy!
Save a snapshot with 20 on the board,
Save a snapshot with 19 on the board,
Use file compare to diff the 2 files 20 (0x14), 19 (0x13).
|
Just for testing we convert 0x5b48 to a real address:
poke 39725,1
Hit 1. It works!
Save a snapshot with 5 lives (4 yellow dashes shown at the top),
Save a snapshot with 4 lives (3 yellow dashes shown at the top).
|
Just for testing we convert 0x2f0b to a real address:
0x2f0b=12043
12043->28400
poke 28400,255
On futher investigation this is actually the player 1 lives counter, players 2-4 are in 28401, 28402 and 28303. A nicer poke is actually to do a ret (0xc9, 201) before it decrements the counter.
Back to index.