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
(added Carr page)
(28 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''RTI''' (Return from INterrupt) is a 65x instruction used to return control from an [[interrupt handler]].
{| class="wikitable" style="float:right;clear:right;width:40%"
 
{| class="wikitable" style="float:right;clear:right;width:30%"
!colspan="8"|Basic Info
!colspan="8"|Basic Info
|+
|+
Line 9: Line 7:
|'''Speed'''
|'''Speed'''
|+
|+
|stack
|[[Stack Addressing | Stack]] (RTI)
|40
|40
|1 byte
|1 byte
|6 cycles
|7 cycles*
|}
|}


{| class="wikitable" style="float:right;clear:right;width:30%"
{| class="wikitable" style="float:right;clear:right;width:30%"
!colspan="9"|Flags Clobbered
!colspan="9"|Flags Affected
|+
|+
|N
|
|V
|[[N Flag|N]]
|M
|[[V Flag|V]]
|X
|[[M Flag|M]]
|D
|[[X Flag|X]]
|I
|[[D Flag|D]]
|Z
|[[I Flag|I]]
|C
|[[Z Flag|Z]]
|[[C Flag|C]]
|+
|+
|[[65c816 native mode]]
|
|
|
|
|
|
|
|
|
|
|+
|[[6502 emulation mode]]
|
|
|
|
|.
|.
|
|
|
|
Line 36: Line 46:
|
|
|}
|}
'''RTI''' (Return from INterrupt) is a 65x instruction used to return control from an [[interrupt handler]].
===== 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
===== 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 ===
* [[BRK]]
* [[RTS]]
* [[RTL]]
* [[RETI]]


=== External Links ===
=== External Links ===
* [[Eyes & Lichty]] page on RTI: https://archive.org/details/0893037893ProgrammingThe65816/page/n518
* [[Eyes & Lichty]] page 492, on RTI: https://archive.org/details/0893037893ProgrammingThe65816/page/n518
* [[Labiak]] page on RTI: https://archive.org/details/Programming_the_65816/page/n186
* [[Labiak]] page 176 on RTI: https://archive.org/details/Programming_the_65816/page/n186
* [[MCS6500 Manual]] page 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]] page on RTI: https://archive.org/details/6502UsersManual/page/n283
* [[Carr]] page 270 on RTI: https://archive.org/details/6502UsersManual/page/n283
* [[Leventhal]] page 3-89 on RTI: https://archive.org/details/6502-assembly-language-programming/page/n138
* 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


[[Category:ASM]]
[[Category:ASM]]
[[Category:Inherited from 6502]]
[[Category:Inherited from 6502]]
[[Category:Unconditional Branches]]
[[Category:One-byte Instructions]]
[[Category:Single Admode Mnemonics]]

Revision as of 12:42, 14 December 2023

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
6502 emulation mode . .

RTI (Return from INterrupt) is a 65x instruction used to return control from an interrupt handler.

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
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