0

Is it possible to have a symbol file with different names for an address based on whether a instruction is accessing the address read or write?

For example, I have a hardware address $FF8800 for a sound chip.

In read access, it is PSG Read Data. In write access, it is PSG Register Select.

I would like the disassmbly to reflect the name in context.

Possible?

1 Answer 1

1

You can use ghidra's Overlay memory blocks to achieve this. How much work this involves will depend on how many such memory locations are involved and whether they are in contiguous range(s).

To get you started for your specific case, the following instructions should help:

  • Using the Memory Map window, create two Overlay memory blocks, both located at 0xFF8800, allocating to each the larger number of bytes (if they aren't the same) required for either the read or the write version of the register, making the block names something like PSGRead and PSGwrite,

  • In the Listing window:

    • Press g (for "go to address") and enter PSGRead::FF8800, then,
    • Press l (for "label") and enter a label name of your choice--perhaps ReadData.
  • Repeat those two steps in the Listing window using the address PSGWrite::FF8800 and a label something like RegisterSelect.

  • For each instruction in the Listing window that accesses address FF8800:

    • Click on the operand that references that address.
    • Press r (for "reference") to open the Reference Editor window, where, depending on whether the access is a read or a write, you can either:
      • Alter an existing reference to the corresponding label, or,
      • Add a new reference to the corresponding label.

If that, supplemented by Ghidra's built-in help, doesn't get you there, reply here and either I or someone else can give additional help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.