zznop / ghidra_scripts

My open source Ghidra scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create RAM blocks (memory map)

greg-kennedy opened this issue · comments

Is it possible to have the init script also set up the memory banks for Z80 RAM, 68K RAM, hardware mem-mapped ports etc? Based on the memory map here:
https://www.chibiakumas.com/68000/genesis.php

This does break the checksum routine (see issue #1) but would be helpful for some of the other labels, which don't always function right until the appropriate block is added.

EDIT: the labels also seem to be wrong:

  • Z80 address space (according to this map) is 0x00a00000 - 0x00a0ffff, but the Z80_ADDRESS_SPACE label begins at 0x00a10000 instead (this is where the I/O block should begin... at 0x00a10000)

Yes, the loader script should be improved to create those segments. The only reason I haven't updated the loader to add RAM segments is because Ghidra's 68000 module doesn't support 24-bit addressing. So even if you create RAM segments, cross references to data types in those segments aren't resolved correctly for many instructions. I explain the issue in some more detail here:
https://zznop.github.io/romhacking/2019/07/14/hooking-golden-axe-vblanks.html

There are Ghidra issues here NationalSecurityAgency/ghidra#766 and here NationalSecurityAgency/ghidra#230 that I'm hoping are resolved soon. Although, there's no reason that we can't still add the segment creation to the loader script in the meantime.