-
Notifications
You must be signed in to change notification settings - Fork 31
Description
The PEA instruction operand can be treated as an immediate value or a 16-bit absolute address. In practice, both are used. As of v1.9.2 the default behavior is to treat it as an immediate, so that we don't generate auto-labels at unexpected locations, but it would be nice to be able to override this decision.
One approach would be to add an "address" format to the instruction operand editor, similar to the one in the data operand editor. The effect would be the same: the operand becomes a 16-bit address, and we either generate an auto-label or reference an existing label.
The trouble is that PEA is often used to push a 24-bit address onto the stack in two adjacent instructions. Further, if we're pushing an RTL, the address will be offset 1 byte. It would be better to have a separate "addressify" action that operates on 1 or 2 PEA instructions. It would determine the 24-bit target address, find or create a label (probably Txxxxxx), and then format the instruction(s) with the low/bank parts of the symbol. This would be done in a pop-up dialog with an "offset by 1 for RTS/RTL" checkbox. As with the current Format Address Table feature, this would simply be a formatting shortcut.
cf. issue #172
(Side note: I tried allowing signed-decimal format. Merlin 32 accepted it, 64tass rejected it despite allowing negative immediate operand elsewhere, and cc65 generally dislikes negative operands.)