I have a practical problem.
Let's suppose I want to find all chosen sequences of bytes in Zx Spectrum memory.
As you may guess it is related to code debugging. I'd like to find all appearances of
instructions like LD A,(30000) OR CALL 40000 which may mean in the game losing a life, increasing the score etc.
As a result I'd like to get a list of memory addressess where my instruction appears like:
25246
37547
49232
60071
It is possible with any existing tool?
Find all chosen sequences of bytes in memory
- Lethargeek
- Manic Miner
- Posts: 743
- Joined: Wed Dec 11, 2019 6:47 am
- bob_fossil
- Manic Miner
- Posts: 659
- Joined: Mon Nov 13, 2017 6:09 pm
Re: Find all chosen sequences of bytes in memory
Maybe a bit overkill for what you need but you can search for opcode sequences in the Z80 loader for Ghidra. You could save the memory out from the emulator and import it in. I've used it for disassembling and annotating esxdos commands. You can label functions and data as well.
Re: Find all chosen sequences of bytes in memory
I hoped for functionality built into some emulator.for snapshots try using hexed.it
Hex editors probably would work but it wouldn't be friendly. You would have to do calculations
which would convert position of some bytes in the file to their position in Spectrum memory.
Well, I have some my own dirty tools working on .sna snapshots and could add such option to one of them.
I guess it could be written in an hour or so and may be actually the easiest way for me.
- Lethargeek
- Manic Miner
- Posts: 743
- Joined: Wed Dec 11, 2019 6:47 am
Re: Find all chosen sequences of bytes in memory
or you can make a converter to extract just the memory contents from snapshots
unfortunately the original sna format was developed without considering hex editing
everything would be so much easier if it kept all the regs and other extra info at the end
(it is possible to write a 2-way converter for this however)
unfortunately the original sna format was developed without considering hex editing
everything would be so much easier if it kept all the regs and other extra info at the end
(it is possible to write a 2-way converter for this however)
Re: Find all chosen sequences of bytes in memory
Over the years I´ve read about some utilites which may help you. But I can´t remember them yet.
Via GOOGLE "zx spectrum poke finder"
I found this:
https://www.worldofspectrum.org/pfw/ - Poke Finder Wizard Homepage - World of Spectrum
The Poke Finder Wizard is an add-on to ZX32, a Windows 32-bit ZX Spectrum emulator by Vaggelis Kapartzianis. What the wizard will do basically is to help you ...
Fuse Emulator may have a Poke Finder: http://manpages.ubuntu.com/manpages/eoa ... e%20finder
Tutorial: https://www.benmayersohn.com/2019/01/di ... -nohzdyve/
And SpecEmu (Menu Monitor/Cheats Finder) too. I´m sure there are more and with bytes-search-abililty you asked for, but we have to look for them.
Re: Find all chosen sequences of bytes in memory
If you have a SNA, SZX or Z80 snapshot, you could use the --find option of snapinfo.py in SkoolKit. For example:
Code: Select all
$ snapinfo.py --find 195,0,0 game.z80 # Find 'JP 0' anywhere in the snapshot