Skip to content

Handling of partial instruction trickery #174

@ibrumby

Description

@ibrumby

There are several common 6502 tricks used to skip one or two bytes when executing.

An example is the $C300 firmware:

C305: SEC
C306: BCC (partial instruction)
C307: CLC
C308: (more code)

If you enter at $C305 then it sets the carry, skips the next two bytes, and runs the common code. If you enter at $C307 then it clears the carry, and runs the common code.

This pattern is replicated for BCS, BVC, BVS, for example.

Another example is using BIT. Here is an example from Ultima V:

8D9E: LDA #0
8DA0: BIT-$2C (partial instruction)
8DA1: LDA #3
8DA3: (more code)

If you enter at $8D9E it sets A to zero, skips the next three bytes, and runs the common code. If you enter at $8DA1 it sets A to 3 and runs the common code.

Ok, back to the $C300 firmware.

  1. If I tag $C307 as a "Code Start Point" and then tag $C304 as a "Code Start Point" then I get the correct disassembly but with a label generated that I don't want (it can never branch to that address).
  2. If I tag $C304 as a "Code Start Point", I get the wrong disassembly. I'm not really sure how best to fix the disassembly. I can Undo, which is fantastic, but I'm looking more for a command to mark a section of memory as unknown, i.e. neither code or data, equivalent to the starting state before I started disassembling. I would have expected the "Remove Formatting" command to work, but it doesn't - not sure if this is by design or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions