Signature byte: Difference between revisions

From SNESdev Wiki
Jump to navigationJump to search
(created page)
 
(some people think BRK is a one-byte instruction)
Line 10: Line 10:


The signature byte following WDM was originally intended to extend the 65c816's opcode space and allow for up to 256 more unique instructions, but this was never implemented.  As of 2023 when using Mesen for SNES homebrew, WDM can be used as an even simpler (because it does not need a handler routine) breakpoint by checking the "Break on.." WDM checkbox in the debugger.
The signature byte following WDM was originally intended to extend the 65c816's opcode space and allow for up to 256 more unique instructions, but this was never implemented.  As of 2023 when using Mesen for SNES homebrew, WDM can be used as an even simpler (because it does not need a handler routine) breakpoint by checking the "Break on.." WDM checkbox in the debugger.
Some literature (such as the Eyes & Lichty manual) describes BRK as a one-byte instruction because some assemblers do not require the programmer to specify the signature byte.  This way of thinking about BRK has the disadvantage of needing to pad the following byte with a dummy value, or remember that the program counter was incremented by two before returning from an interrupt.

Revision as of 04:58, 24 February 2023

In 65x parlance, a signature byte is the second byte of certain two-byte instructions, including:

  • BRK
  • COP
  • WDM

When a programmer has sprinkled many BRKs throughout a large codebase, it can be difficult to tell which BRK breakpoint has been tripped. That is why it can be useful to specify a unique signature byte after BRK, allowing up to 256 unique breakpoints.

For co-processor empowerment, the signature byte can be used to specify which command the co-processor should run.

The signature byte following WDM was originally intended to extend the 65c816's opcode space and allow for up to 256 more unique instructions, but this was never implemented. As of 2023 when using Mesen for SNES homebrew, WDM can be used as an even simpler (because it does not need a handler routine) breakpoint by checking the "Break on.." WDM checkbox in the debugger.

Some literature (such as the Eyes & Lichty manual) describes BRK as a one-byte instruction because some assemblers do not require the programmer to specify the signature byte. This way of thinking about BRK has the disadvantage of needing to pad the following byte with a dummy value, or remember that the program counter was incremented by two before returning from an interrupt.