Vector Info

From SMWiki
Jump to: navigation, search

Vectors are various pointers for various interrupts, such as RESET, NMI, IRQ, and so on. The vectors are located at $00:FFE0-$00:FFFF. Interrupts cause the program to jump immediately to one of the vectors, such as NMI and IRQ. The first 16 bytes are vectors for the native mode while the last 16 bytes are for the emulation mode. Every vector points to somewhere in bank $00. This makes it possible to point vectors to WRAM $7E:0000-$7E:1FFF too (because this area is mirrored in bank $00. You can also use an interrupt outside bank $00 if you make good use of JSL and/or JML.

Keep in mind that the RESET vector in native mode is NOT used, because the SNES always resets in emulation mode.

Contents

Misc. Explanations

Program break vector

The BRK vector executes when the instruction BRK #xx is executed. It was originally meant to get used with a debugging program called "DEBUG16".

Coprocessor empowerment vector

The COP vector is essentially a second software interrupt, similar to BRK, with its own vector. Although it can be used in a manner similar to BRK, it is intended particularly for use with co-processors, such as floating-point processors. Like BRK, it is a two-byte instruction with the second available as a signature byte.

ABORT Vector

The ABORT input pin, when it is asserted, causes the current instruction to be aborted. Unlike an interrupt, none of the registers are updated and the instruction quits execution from the cycle where the ABORT signal was received. No registers are modified. In other words, the processor is left in the state it was in before the instruction that was aborted. Control is shifted to the ABORT vector after an interrupt-like context-saving cycle. The ABORT signal lets external hardware abort instructions on the basis of undesirable address bus conditions; memory protection and page virtual memory systems can be fully implemented using this signal. ABORT should be held low for only one cycle; if held low during the ABORT interrupt sequence, the ABORT interrupt will be aborted.

Reset vector

When the reset button is pressed, or the power has been turned on, SNES automatically jumps to the pointer in the emulation vector, because the SNES always starts up in emulation mode.

NMI

NMI stands for non-maskable interrupt. It runs every V-Blank.

IRQ

IRQ stands for interrupt request. It runs at a certain time while the screen is being drawn. The time is defined by a couple of registers and can be at the start of one scanline being drawn, in the middle of all scanlines being drawn, or in the middle of one scanline being drawn.

Vector ROM Map

Here is a small ROM Map for the vectors:

ROM Addresses
PC (headered) SNES Length Description (native mode)
0x0081E0 $00:FFE0 4 bytes Unused
0x0081E4 $00:FFE4 2 bytes Coprocessor Empowerment
0x0081E6 $00:FFE6 2 bytes Program Break
0x0081E8 $00:FFE8 2 bytes ABORT
0x0081EA $00:FFEA 2 bytes Non-maskable Interrupt
0x0081EC $00:FFEC 2 bytes Reset (unused)
0x0081EE $00:FFEE 2 bytes Interrupt request
ROM Addresses
PC (headered) SNES Length Description (emulation mode)
0x0081F0 $00:FFF0 4 bytes Unused
0x0081F4 $00:FFF4 2 bytes Coprocessor Empowerment
0x0081F6 $00:FFF6 2 bytes Program Break
0x0081F8 $00:FFF8 2 bytes ABORT
0x0081FA $00:FFFA 2 bytes Non-maskable Interrupt
0x0081FC $00:FFFC 2 bytes Reset (used)
0x0081FE $00:FFFE 2 bytes Interrupt request

The unused vectors are $FFFF $FFFF 99% of the times.

Personal tools