The IDA Pro tools for the Sega Genesis/MegaDrive romhackers
- ROM files loader
- Z80 sound drivers loader
- IDA Pro debugger for Sega Mega Drive/Genesis roms and Z80 sound drivers
- Edit paths to your IDA/SDK installation according to your real paths (
IDA_DIR,IDA_SDK) - Install
vcpkgas described in the Tutorial: Install and use packages with MSBuild in Visual Studio step 1. - Download and unpack IDA Pro QT distro: qt-5.15.2-full-IDA83.tar.bz2
- Install Perl from: https://strawberryperl.com/
- Edit
build.pyfrom IDA Pro QT distro. Add:"-nomake", "examples",after"-nomake", "tests", - Install and add to PATH
jomfrom: https://ftp.funet.fi/pub/mirrors/download.qt-project.org/official_releases/jom/jom_1_1_4.zip - Build IDA Pro QT (using Visual Studio Developement Command Prompt):
python build.py -j 16 -v - Compile solution with Visual Studio 2022 or newer
- Edit path to your SDK installation according to your real path
IDA_SDK - Download and unpack IDA Pro QT distro: qt-5.15.2-full-IDA83.tar.bz2
- Edit
build.pyfrom IDA Pro QT distro. Add:"-nomake", "examples",after"-nomake", "tests", - Build IDA Pro QT:
python3 build.py -j 16 -v ./build_proto_68k.sh./build_proto_z80.sh./compile_loaders.sh./compile_gensida.shcp ./linux_loaders/* ~/ida-pro-9.x/loaders/cp ./linux_gensida/* ~/ida-pro-9.x/plugins/
- Put files from the
loadersdir into the corresponding IDA folder - Put files from the
pluginsdir into the corresponding IDA folder - Open ROM in IDA
- Choose
GensIDA debugger pluginorZ80 debugger plugindebugger - Press
F9to start a debugging process - Run
[wine] gens_68k.exeor[wine] gens_z80.exefromgensfolder, choose a ROM - Debug!
- Press
Shift+Jto choose how to mark your data range. Or mark it by yourself using available methods (listed below) - Press
File->Produce file->Create LST file.... Save.lstlisting file - Use any of AS/VASM/ASM68K assemblers to compile your
.lstfile. You can also useassemble_as.bat,assemble_vasm.batorassemble_asm68k.batfor that
All methods are specified like START_TAG - END_TAG (except ORG tag), where START_TAG must be specified using Anterior comment (Ins) at the first line of your data, and END_TAG must be inserted using Posterior comment (Shift+Ins).
Available TAGS:
BIN "relative/path.bin". This tag allows you to save some data array (or even code) to the"relative/path.bin"during the extraction. It also insertsbinclude "relative/path.bin"line to your listing.INC_START "relative/path.inc"-INC_END. The same as the previous item, except it just stores copies all lines between these tags as is and inserts the following line:include "relative/path.inc".DEL_START-DEL_END. These tags can be used if you want to cut some lines from the resulting asm listing.ORG $SIZE. This tag insertsorg $sizedirective line in the output.
NOTE: this works for DMA operations as well.
Once you are debugging, in the IDA View click 'g' and go to either:
| Memory type | Address | Alternative address |
|---|---|---|
| VRAM | 0x00D00000 | DBG_VDP_VRAM:00D00000 |
| CRAM | 0x00D10000 | DBG_VDP_CRAM:00D10000 |
| VSRAM | 0x00D20000 | DBG_VDP_VSRAM:00D20000 |
Find the address or addresses you want, offsetted from the above. Then select it / them . Right click. a prompt will come up. Click "Add Beakpoint" , or press F2 after selecting. A "Breakpoint Settings" window will come up. Select either read or write or both under Hardware breakpoint mode and set the size. You can enable other settings like actions etc.
General Registers can be seen while running the debugger in IDA Pro by going to Debugger -> Debugger Windows -> General Registers.
D0-D7, A0-A7, PC, SP, SR, DMA_LEN, DMA_SRC and VDP_DST are all shown here
VDP Registers can be seen while running the debugger in IDA pro by doign to Debugger -> Debugger Windows -> VDP Registers
Pass -nodebug 1 to gens_xxx.exe.