We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

RTI: Difference between revisions

From SnesLab
Jump to: navigation, search
(→‎External Links: hid archive URL for Carr)
(→‎External Links: hid archive URL for Leventhal)
Line 74: Line 74:
* [[MCS6500 Manual]] page 132 on RTI: https://archive.org/details/mos_microcomputers_programming_manual/page/n152
* [[MCS6500 Manual]] page 132 on RTI: https://archive.org/details/mos_microcomputers_programming_manual/page/n152
* [[Carr]], [https://archive.org/details/6502UsersManual/page/n283 page 270] on RTI
* [[Carr]], [https://archive.org/details/6502UsersManual/page/n283 page 270] on RTI
* [[Leventhal]] page 3-89 on RTI: https://archive.org/details/6502-assembly-language-programming/page/n138
* [[Leventhal]], [https://archive.org/details/6502-assembly-language-programming/page/n138 page 3-89] on RTI
* snes9x implementation of RTI: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L3272
* snes9x implementation of RTI: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L3272
* undisbeliever on RTI: https://undisbeliever.net/snesdev/65816-opcodes.html#rti-return-from-interrupt
* undisbeliever on RTI: https://undisbeliever.net/snesdev/65816-opcodes.html#rti-return-from-interrupt

Revision as of 03:42, 8 August 2024

Basic Info
Addressing Mode Opcode Length Speed
Stack (RTI) 40 1 byte 7 cycles*
Flags Affected
N V M X D I Z C
65c816 native mode N V M X D I Z C
6502 emulation mode N V . . D I Z C

RTI (ReTurn from Interrupt) is a 65x instruction used to return control from an interrupt handler. It does this by first pulling the status flags off of the stack and then the program counter too. In native mode, the program bank register is pulled after that for a total of 4 bytes. In emulation mode, 3 bytes are pulled.

Syntax

RTI
Pitfalls
  • RTI should only be run when the e flag is in the same state as when the interrupt fired
  • RTI cannot even tell whether the interrupt actually occurred or not
  • RTI does not increment the program counter after pulling it like RTS and RTL do
Cycle Skipped

RTI takes one fewer cycle in emulation mode as the program bank register doesn't need to be pulled from the stack.

See Also

External Links