We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS
BRK: Difference between revisions
From SnesLab
(→External Links: hid archive URL for MCS) |
(→See Also: CLD, SEI) |
||
Line 71: | Line 71: | ||
* [[COP]] | * [[COP]] | ||
* [[WDM]] | * [[WDM]] | ||
* [[CLD]] | |||
* [[SEI]] | |||
=== External Links === | === External Links === |
Revision as of 23:51, 8 August 2024
Basic Info | |||||||
---|---|---|---|---|---|---|---|
Addressing Mode | Opcode | Length | Speed | ||||
Stack (Interrupt) | 00 | 2 bytes | 8 cycles* |
Flags Affected | ||||||||
---|---|---|---|---|---|---|---|---|
N | V | M | X / B | D | I | Z | C | |
65c816 native mode | . | . | . | . | 0 | 1 | . | . |
6502 emulation mode | . | . | . | 1 | 0 | 1 | . | . |
BRK (Break) is a 65x instruction designed to trigger a software interrupt. The byte following the opcode is called the signature byte. The state of the interrupt disable flag has no effect on the behavior of BRK. In other words, BRK causes an NMI.
Control is routed to the BRK handler, whose address is stored at the BRK vector:
- In native mode, this vector is at $00:FFE6.
- In emulation mode, this vector is at $FFFE.
The PBR is cleared, but in native mode its previous value is pushed to the stack.
Syntax
BRK BRK sig
Cycle Skipped
BRK takes one fewer cycle in emulation mode as it doesn't need to push the program counter bank register to the stack.
See Also
External Links
- Eyes & Lichty, page 436 on BRK
- Figure 13.3. illustration. Lbid. page 256
- Labiak, page 126 on BRK
- 9.11 on MCS6500 Manual, page 144 on BRK
- Carr, page 252 on BRK
- Leventhal, page 3-49 on BRK
- snes9x implementation of BRK: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L2547
- Pickens, John. http://www.6502.org/tutorials/6502opcodes.html#BRK
- https://undisbeliever.net/snesdev/65816-opcodes.html#software-interrupts