Exception Handler

From en64 wiki
Jump to navigation Jump to search

The "interrupt vector table" is a data structure that associates a list of interrupt handlers with a list of interrupt requests. Put simply, an interrupt and exception handler both alter program flow. Interrupts handle external event, e.g. cartridge issue (peripheral interrupt), Pre-nmi (reset type), etc. Exceptions handle instruction faults, e.g. dividing by zero, etc. One thing to note about interrupts and exceptions with the Nintendo 64 that the R4300i architecture doesn't distinguish between them as there's essentially a single handler for them and the two merely have unique masks. However, in applications outside of this situation, they have individual handlers.

GameShark/PAR WatchLo Enablers

located by zoinkity

Retail N64
0xAA3E0 F00A97E1 0000   007 - The World Is Not Enough (Europe) (En,Fr,De).n64
0xA5FA0 F00A53A1 0000   007 - The World Is Not Enough (USA) (Proto).n64
0xA9E40 F00A9241 0000   007 - The World Is Not Enough (USA).n64
0x54AD0 F00796D1 0000   64 Hanafuda - Tenshi no Yakusoku (Japan).n64
0x72B34 F0071F35 0000   Baku Bomber Man 2 (Japan).n64
0x31B90 F0056791 0000   Bass Rush - ECOGEAR PowerWorm Championship (Japan).n64
0x152C0 F01942C1 0000   Batman Beyond - Return of the Joker (USA).n64
0x152C0 F01942C1 0000   Batman of the Future - Return of the Joker (Europe) (En,Fr,De).n64
0x1100  F0000581 0000   Biohazard 2 (Japan).n64
0x39C70 F0238C71 0000   Bomber Man 64 (Japan) (Arcade Edition).n64
0x74AE4 F0073EE5 0000   Bomberman 64 - The Second Attack! (USA).n64
0x48600 F0047A01 0000   Cruis'n Exotica (USA).n64
0x3A4B0 F005F0B1 0000   Custom Robo (Japan).n64
0x3A110 F005ED11 0000   Custom Robo V2 (Japan).n64
0x37120 F005BD21 0000   Densha de Go! 64 (Japan).n64
0x50B10 F00CCF11 0000   Derby Stallion 64 (Japan) (Proto).n64
0x54390 F00F5F91 0000   Derby Stallion 64 (Japan).n64
0x3B890 F0060491 0000   Doraemon 3 - Nobita no Machi SOS! (Japan).n64
0x16D50 F003B951 0000   Doubutsu no Mori (Japan).n64
0xDEE0  F000D2E1 0000   Dr. Mario 64 (USA).n64
0xB49A0 F00D95A1 0000   Dragon Sword 64 (NTSC) (Proto).n64
0x9C410 F00C1011 0000   Dragon Sword 64 (PAL) (Proto).n64
0xD210  F000C611 0000   Excitebike 64 (Europe).n64
0xD130  F000C531 0000   Excitebike 64 (Japan).n64
0xD220  F000C621 0000   Excitebike 64 (USA) (Demo) (Kiosk).n64
0xD230  F000C621 0000   Excitebike 64 (USA) (Rev A).n64
0xD230  F000C631 0000   Excitebike 64 (USA).n64
0x28EB0 F00282B1 0000   Fighter Destiny 2 (USA).n64
0xD640  F0032241 0000   Fushigi no Dungeon - Fuurai no Shiren 2 - Oni Shuurai! Shiren Jou! (Japan) - Hardlink.n64
0x2B5A0 F002A9A1 0000   Ganbare! Nippon! Olympics 2000 (Japan).n64
0x2FE50 F0054A51 0000   Hamster Monogatari 64 (Japan).n64
0x58150 F0057551 0000   Hey You, Pikachu! (USA).n64
0x85920 F00E4D21 0000   Hot Wheels - Turbo Racing (USA).n64
0xA77C0 F02500C1 0000   Hydro Thunder (Europe).n64
0xA77C0 F02500C1 0000   Hydro Thunder (France).n64
0xA76A0 F024FFA1 0000   Hydro Thunder (USA).n64
0x68450 F0067851 0000   International Superstar Soccer 2000 (Europe) (En,De).n64
0x68470 F0067871 0000   International Superstar Soccer 2000 (Europe) (Fr,It).n64
0x67BD0 F0066FD1 0000   International Superstar Soccer 2000 (USA) (En,Es).n64
0x2B680 F002AA81 0000   International Track & Field - Summer Games (Europe) (En,Fr,De).n64
0x2B640 F002AA41 0000   International Track & Field 2000 (USA).n64
0x68C10 F0068011 0000   Jikkyou J.League 1999 - Perfect Striker 2 (Japan) (Rev A).n64
0x68C10 F0068011 0000   Jikkyou J.League 1999 - Perfect Striker 2 (Japan).n64
0x26CB0 F00260B1 0000   Jikkyou Powerful Pro Yakyuu 2000 (Japan) (Rev A).n64
0x26CC0 F00260C1 0000   Jikkyou Powerful Pro Yakyuu 2000 (Japan).n64
0x26C40 F0026041 0000   Jikkyou Powerful Pro Yakyuu Basic Ban 2001 (Japan) (Rev A).n64
0x26CB0 F00260B1 0000   Jikkyou Powerful Pro Yakyuu Basic Ban 2001 (Japan).n64
0xBB80  F018FB81 0000   John Romero's Daikatana (Europe) (En,Fr,De).n64
0xBB80  F018FB81 0000   John Romero's Daikatana (Japan).n64
0xBB80  F018FB81 0000   John Romero's Daikatana (USA).n64
0x20220 F009F221 0000   Legend of Zelda, The - Majora's Mask (Europe) (En,Fr,De,Es) (Debug Edition).n64
0x179C0 F00969C1 0000   Legend of Zelda, The - Majora's Mask (Europe) (En,Fr,De,Es) (Rev A).n64
0x17880 F0096881 0000   Legend of Zelda, The - Majora's Mask (Europe) (En,Fr,De,Es).n64
0x17E80 F0096E81 0000   Legend of Zelda, The - Majora's Mask (Europe) (GC Collector's Edition) (En,Fr,De,Es,It) (Rev B).n64
0x17D80 F0096D81 0000   Legend of Zelda, The - Majora's Mask (USA) (Demo).n64
0x17E80 F0096E81 0000   Legend of Zelda, The - Majora's Mask (USA) (GC Collector's Edition).n64
0x17820 F0096821 0000   Legend of Zelda, The - Majora's Mask (USA).n64
0x6BB0  F0005FB1 0000   Legend of Zelda, The - Ocarina of Time (Europe) (GC Collector's Edition) (En,Fr,De,Es,It).n64
0x9F10  F0009311 0000   Legend of Zelda, The - Ocarina of Time (Europe) (GC Collector's Edition) (Proto).n64
0x6BB0  F0005FB1 0000   Legend of Zelda, The - Ocarina of Time (USA) (GC Collector's Edition).n64
0x6BB0  F0005FB1 0000   Legend of Zelda, The - Ocarina of Time - Master Quest (Europe).n64
0x9F10  F0009311 0000   Legend of Zelda, The - Ocarina of Time - Master Quest (USA) (Debug Edition).n64
0x6BB0  F0005FB1 0000   Legend of Zelda, The - Ocarina of Time - Master Quest (USA) (GC).n64
0x1360  F0025F61 0000   Major League Baseball featuring Ken Griffey Jr. (Australia).n64
0x1330  F0025F31 0000   Major League Baseball featuring Ken Griffey Jr. (USA).n64
0x8CD20 F00B1921 0000   Mario Golf (Europe).n64
0x8CA70 F00B1671 0000   Mario Golf (USA).n64
0x87290 F00ABE91 0000   Mario Golf 64 (Japan) (Rev A).n64
0x87270 F00ABE71 0000   Mario Golf 64 (Japan).n64
0xAE290 F00AD691 0000   Mario Party 2 (Europe) (En,Fr,De,Es,It).n64
0xAEA50 F00ADE51 0000   Mario Party 2 (Japan).n64
0xAE980 F00ADD81 0000   Mario Party 2 (USA).n64
0x82F30 F0082331 0000   Mario Party 3 (Europe) (En,Fr,De,Es).n64
0x81010 F0080411 0000   Mario Party 3 (Japan).n64
0x830D0 F00824D1 0000   Mario Party 3 (USA).n64
0x47A90 F006C691 0000   Mario Story (Japan).n64
0x7CA80 F00A1681 0000   Mega Man 64 (USA).n64
0x118E0 F00118E1 0000   mgc_2011.n64
0x5B4B0 F005A8B1 0000   Midway's Greatest Arcade Hits - Volume 1 (USA).n64
0x23460 F0022861 0000   NBA in the Zone 2000 (Europe).n64
0x23860 F0022C61 0000   NBA in the Zone 2000 (USA).n64
0x32530 F00C7931 0000   Neon Genesis Evangelion (Japan).n64
0x1DAE0 F00426E1 0000   Nushi Zuri 64 - Shiokaze ni Notte (Japan).n64
0x2A8F0 F009A4F1 0000   Ogre Battle 64 - Person of Lordly Caliber (Japan) (Rev A).n64
0x2A8F0 F009A4F1 0000   Ogre Battle 64 - Person of Lordly Caliber (Japan).n64
0x2AB30 F009A731 0000   Ogre Battle 64 - Person of Lordly Caliber (USA) (Rev A).n64
0x2AB30 F009A731 0000   Ogre Battle 64 - Person of Lordly Caliber (USA).n64
0x48A50 F006D651 0000   Paper Mario (Europe) (En,Fr,De,Es).n64
0x47AB0 F006C6B1 0000   Paper Mario (USA).n64
0xA07B0 F009FBB1 0000   PD Ultraman Battle Collection 64 (Japan).n64
0x87670 F0086A71 0000   Pocket Monsters Stadium 3 Kin Gin (Japan).n64
0x3E360 F003D761 0000   Pokemon Snap (Australia).n64
0x3E1A0 F003D5A1 0000   Pokemon Snap (Europe).n64
0x3E1A0 F003D5A1 0000   Pokemon Snap (France).n64
0x3E1A0 F003D5A1 0000   Pokemon Snap (Germany).n64
0x3E1A0 F003D5A1 0000   Pokemon Snap (Italy).n64
0x3E1A0 F003D5A1 0000   Pokemon Snap (Spain).n64
0x3E4A0 F003D8A1 0000   Pokemon Snap (USA).n64
0x3E4A0 F003D8A1 0000   Pokemon Snap Station (USA) (Promo).n64
0x85EF0 F00852F1 0000   Pokemon Stadium 2 (Europe).n64
0x85EB0 F00852B1 0000   Pokemon Stadium 2 (France).n64
0x85FF0 F00853F1 0000   Pokemon Stadium 2 (Germany).n64
0x860D0 F00854D1 0000   Pokemon Stadium 2 (Italy).n64
0x860B0 F00854B1 0000   Pokemon Stadium 2 (Spain).n64
0x85D90 F0085191 0000   Pokemon Stadium 2 (USA).n64
0x612E0 F00606E1 0000   Power Rangers - Lightspeed Rescue (Europe).n64
0x61320 F0060721 0000   Power Rangers - Lightspeed Rescue (USA).n64
0xD3530 F00D2931 0000   Puyo Puyo 4 - Puyo Puyon Party (Japan).n64
0x7A270 F009EE71 0000   Razor Freestyle Scooter (USA).n64
0x1070  F00004F1 0000   Resident Evil 2 (Europe) (En,Fr).n64
0x1070  F00004F1 0000   Resident Evil 2 (USA) (Rev A).n64
0x1070  F00004F1 0000   Resident Evil 2 (USA).n64
0x7D8A0 F007CCA1 0000   Robot Ponkottsu 64 - 7tsu no Umi no Caramel (Japan).n64
0x7ED30 F00A3931 0000   Rockman 64 (Japan) (Proto).n64
0x7C740 F00A1341 0000   Rockman Dash - Hagane no Boukenshin (Japan).n64
0x532B0 F00526B1 0000   Rugrats in Paris - The Movie (Europe).n64
0x531F0 F00525F1 0000   Rugrats in Paris - The Movie (USA).n64
0x461B0 F007D9B1 0000   Scooby-Doo! - Classic Creep Capers (Europe).n64
0x46110 F0045511 0000   Scooby-Doo! - Classic Creep Capers (USA) (Rev A).n64
0x460B0 F00454B1 0000   Scooby-Doo! - Classic Creep Capers (USA).n64
0x79450 F009E051 0000   Shadowgate 64 - Trials of the Four Towers (Europe) (Es,It).n64
0x79450 F009E051 0000   Shadowgate 64 - Trials of the Four Towers (Europe) (Fr,De,Nl).n64
0x79450 F009E051 0000   Shadowgate 64 - Trials of the Four Towers (Europe).n64
0x78DE0 F009D9E1 0000   Shadowgate 64 - Trials of the Four Towers (Japan).n64
0x78950 F0077D51 0000   Shadowgate 64 - Trials of the Four Towers (USA) (En,Es).n64
0x21550 F0046151 0000   Sin and Punishment (USA).n64
0x6F470 F006E871 0000   South Park Rally (Europe).n64
0x6F470 F006E871 0000   South Park Rally (USA).n64
0x2EFF0 F0053BF1 0000   Super Bowling (USA).n64
0x4B9D0 F00C0FE1 0000   Super Robot Taisen 64 (Japan).n64
0x3A8B0 F0039CB1 0000   Super Smash Bros. (Australia).n64
0x3A2B0 F00396B1 0000   Super Smash Bros. (USA).n64
0x38310 F0037711 0000   Sydney 2000 (Europe) (Proto).n64
0x38310 F0037711 0000   Sydney 2000 (USA) (Proto).n64
0x459C0 F0044DC1 0000   Tarzan (Europe).n64
0x45A60 F0044E61 0000   Tarzan (France).n64
0x45A40 F0044E41 0000   Tarzan (Germany).n64
0x45B60 F0044F61 0000   Tarzan (USA).n64
0x87D40 F0087141 0000   Tigger's Honey Hunt (Europe) (En,Fr,De,Es,It,Nl,Da).n64
0x87FA0 F00873A1 0000   Tigger's Honey Hunt (USA).n64
0x20F20 F00B6321 0000   Toon Panic (Japan) (Proto).n64
0xC33F0 F00E7FF1 0000   Transformers - Beast Wars Metals 64 (Japan).n64
0xC4CF0 F00E98F1 0000   Transformers - Beast Wars Transmetals (USA).n64
0x21550 F0046151 0000   Tsumi to Batsu - Hoshi no Keishousha (Japan).n64
0x59090 F0180091 0000   Vigilante 8 - 2nd Offense (Europe).n64
0x59140 F017D941 0000   Vigilante 8 - 2nd Offense (USA).n64
0x390C0 F00384C1 0000   Virtual Pro Wrestling 2 - Oudou Keishou (Japan).n64
0x3EDC0 F003E1C1 0000   WWF No Mercy (Europe) (Rev A).n64
0x3EF60 F003E361 0000   WWF No Mercy (Europe).n64
0x3EEC0 F003E2C1 0000   WWF No Mercy (USA) (Rev A).n64
0x3EF60 F003E361 0000   WWF No Mercy (USA).n64
0x382E0 F00376E1 0000   WWF WrestleMania 2000 (Europe).n64
0x35CA0 F00350A1 0000   WWF WrestleMania 2000 (Japan).n64
0x382E0 F00376E1 0000   WWF WrestleMania 2000 (USA).n64
0x2D0E0 F00C24E1 0000   Yakouchuu II - Satsujin Kouro (Japan).n64
0x17E80 F0096E81 0000   Zelda no Densetsu - Mujura no Kamen (Japan) (GC Collector's Edition).n64
0x18720 F0097721 0000   Zelda no Densetsu - Mujura no Kamen (Japan) (Rev A).n64
0x187E0 F00977E1 0000   Zelda no Densetsu - Mujura no Kamen (Japan).n64
0x6BB0  F0005FB1 0000   Zelda no Densetsu - Toki no Ocarina (Japan) (GC Collector's Edition).n64
0x6BB0  F0005FB1 0000   Zelda no Densetsu - Toki no Ocarina (Japan) (GC).z64
0x6BB0  F0005FB1 0000   Zelda no Densetsu - Toki no Ocarina URA (Japan) (GC).n64


Exceptions

****Exceptions


Reset - External Cold Reset asserted

Soft - Reset External Reset asserted

NMI - External NMI asserted

Machine Check Exception - Internal processor inconsistency

EJTAG Debug

Address Error - Exception Unaligned memory access or wrong privileges

TLB Exceptions - TLB Refill, TLB Invalid, TLB Modified

Cache Error Exception - Data error on cache or ecc error on bus during a cache miss

Bus Error Exception - Data transfer error

Integer Overflow Exception - Trap Exception

A trap instruction executed

System Call Exception - SYSCALL instruction executed

Breakpoint Exception - BREAK instruction executed

Reserved Instruction Exception - Invalid or reserved instruction executed

Coprocessor Unusable Exception 
    Coprocessor C0 accessed in user mode with CU[0]=0
    Coprocessor Ci accessed with CU[i]=0  (i≠0)

Floating Point Exception

Watch Exception - Access (instruction or data) to a watchpoint
    a watchpoint is regulated through registers WatchHi and WatchLo in C0

Interrupt Exception - One (or more) interrupt is pending




****Interrupts

++Software interrupts

2 interrupts (0 and 1)

Generated by writing in bits IP1 or IP0 in Cause register

Masked through bits IM1 and IM0 in Status register


++Hardware interrupts

6 interrupts (from 0 to 5)

Generated by:

  Implementation dependent external lines (0 to 5)

  Timer or Performance counter interrupt (5)

Identified by testing bits IP2 to IP7 in Cause register

Masked through bits IM2 to IM7 in Status register


=====Behavior=====

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
RESET TYPES


  RP          Reduced power mode (implementation dependent)
  RE          Reverse-endian enables (for user mode)
  BEV         Normal/Bootstrap exception vectors location
  TS          Multiple matches on TLB
  SR          Soft Reset
  ERL         Error Level
  EXL         Exception Level

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Behavior (Reset Exception):

Load Config registers with default values

Reset registers: Random, Watchpoints, PerfCnts

Set Status fields

  RP <= 0 , BEV <= 1 , TS <= 0 , SR <= 0 , NMI <= 0 , ERL <= 1

Load ErrorEPC

Jump to exception vector: 0xBFC0_0000



Behavior (Soft Reset Exception):

Reset registers: Watchpoints, PerfCnts

Set Status fields

  RP <= 0 , BEV <= 1 , TS <= 0 , SR <= 1 , NMI <= 0 , ERL <= 1

Load ErrorEPC

  CP0 register 30

Jump to exception vector: 0xBFC0_0000
  
  
  
Behavior (NMI Exception):

Set Status fields

  RP <= 0 , BEV <= 1 , TS <= 0 , SR <= 0 , NMI <= 1 , ERL <= 1

Load ErrorEPC

Jump to exception vector: 0xBFC0_0000
  
  
  
  
  
  
  
Behavior (Cache error):

Set Statusfields

  ERL <= 1

Load CacheErr(

  CP0 register 27 (meaning is implementation dependent)

Load ErrorEPC

Jump to exception vector:

  0xBFC0_0200 + 0x100   if BEV=1

  0xA000_0000 + 0x100   if BEV=0 
  
  
  
Behavior (other exceptions):

If not in exception level (i.e., if Status.EXL = 0)

  Load EPC and Cause.BD

    If not in branch delay slot: EPC <= PC ; Cause.BD <= 0

    If in branch delay slot:       EPC <= PC-4 ; Cause.BD <= 1

Load Cause.CE and Cause.ExcCode

  Cause.CE value is defined only for coprocessor unusable exception

Set Status.EXL

Load exception specific information into registers

Jump to exception vector
 ________________________________
|                                |
|                                |
|     WILL PUT TABLE HERE        |
|                                |
|________________________________|


Interrupt Exceptions

Only taken if

  The pending interrupt is not masked
  and
  The global interrupt enable (Status.IE) is set
  and
  Status.EXL = 0
  and
  Status.ERL = 0