Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Custom Exception Handler
- This code will display exception information on the television screen when an exception occurs. After the console is finished scrolling, you will be returned to the Wii System Menu.
- (NTSC-U)
- C20235F4 00000011
- 9421FF80 BC410008
- 48000055 2A2A2A2A
- 2A2A2043 7573746F
- 6D204578 63657074
- 696F6E20 48616E64
- 6C657220 2A2A2A2A
- 2A0A2A2A 2A2A2A2A
- 2A2A2A20 62792053
- 74617220 26205269
- 69646566 69202A2A
- 2A2A2A2A 2A2A2A0A
- 00000000 7C6802A6
- 4CC63182 3D808002
- 618C3500 7D8803A6
- 4E800021 B8410008
- 38210080 28030011
- 60000000 00000000
- 040238A8 281E0005
- C20238BC 0000000D
- 9421FF80 BC410008
- 48000039 596F7520
- 77696C6C 206E6F77
- 20626520 72657475
- 726E6564 20746F20
- 74686520 57696920
- 53797374 656D204D
- 656E752E 00000000
- 7C6802A6 4CC63182
- 3D808002 618C3500
- 7D8803A6 4E800021
- B8410008 38210080
- 39610020 00000000
- 04226160 48000090
- C2226260 00000003
- 3D808000 618CB0E8
- 7D8803A6 4E800020
- 60000000 00000000
- 022A3090 00000023
- (PAL)
- C2023694 00000011
- 9421FF80 BC410008
- 48000055 2A2A2A2A
- 2A2A2043 7573746F
- 6D204578 63657074
- 696F6E20 48616E64
- 6C657220 2A2A2A2A
- 2A0A2A2A 2A2A2A2A
- 2A2A2A20 62792053
- 74617220 26205269
- 69646566 69202A2A
- 2A2A2A2A 2A2A2A0A
- 00000000 7C6802A6
- 4CC63182 3D808002
- 618C35A0 7D8803A6
- 4E800021 B8410008
- 38210080 28030011
- 60000000 00000000
- 04023948 281E0005
- C202395C 0000000D
- 9421FF80 BC410008
- 48000039 596F7520
- 77696C6C 206E6F77
- 20626520 72657475
- 726E6564 20746F20
- 74686520 57696920
- 53797374 656D204D
- 656E752E 00000000
- 7C6802A6 4CC63182
- 3D808002 618C35A0
- 7D8803A6 4E800021
- B8410008 38210080
- 39610020 00000000
- 042264E4 48000090
- C22265E4 00000003
- 3D808000 618CB188
- 7D8803A6 4E800020
- 60000000 00000000
- 022A7410 00000023
- (NTSC-J)
- C20235B4 00000011
- 9421FF80 BC410008
- 48000055 2A2A2A2A
- 2A2A2043 7573746F
- 6D204578 63657074
- 696F6E20 48616E64
- 6C657220 2A2A2A2A
- 2A0A2A2A 2A2A2A2A
- 2A2A2A20 62792053
- 74617220 26205269
- 69646566 69202A2A
- 2A2A2A2A 2A2A2A0A
- 00000000 7C6802A6
- 4CC63182 3D808002
- 618C34C0 7D8803A6
- 4E800021 B8410008
- 38210080 28030011
- 60000000 00000000
- 04023868 281E0005
- C202387C 0000000D
- 9421FF80 BC410008
- 48000039 596F7520
- 77696C6C 206E6F77
- 20626520 72657475
- 726E6564 20746F20
- 74686520 57696920
- 53797374 656D204D
- 656E752E 00000000
- 7C6802A6 4CC63182
- 3D808002 618C34C0
- 7D8803A6 4E800021
- B8410008 38210080
- 39610020 00000000
- 04226404 48000090
- C2226504 00000003
- 3D808000 618CB0AC
- 7D8803A6 4E800020
- 60000000 00000000
- 022A6D90 00000023
- (NTSC-K)
- C20236F4 00000011
- 9421FF80 BC410008
- 48000055 2A2A2A2A
- 2A2A2043 7573746F
- 6D204578 63657074
- 696F6E20 48616E64
- 6C657220 2A2A2A2A
- 2A0A2A2A 2A2A2A2A
- 2A2A2A20 62792053
- 74617220 26205269
- 69646566 69202A2A
- 2A2A2A2A 2A2A2A0A
- 00000000 7C6802A6
- 4CC63182 3D808002
- 618C3600 7D8803A6
- 4E800021 B8410008
- 38210080 28030011
- 60000000 00000000
- 040239A8 281E0005
- C20239BC 0000000D
- 9421FF80 BC410008
- 48000039 596F7520
- 77696C6C 206E6F77
- 20626520 72657475
- 726E6564 20746F20
- 74686520 57696920
- 53797374 656D204D
- 656E752E 00000000
- 7C6802A6 4CC63182
- 3D808002 618C3600
- 7D8803A6 4E800021
- B8410008 38210080
- 39610020 00000000
- 04226858 48000090
- C2226958 00000003
- 3D808000 618CB234
- 7D8803A6 4E800020
- 60000000 00000000
- 02295410 00000023
- #============================================================#
- # Source #
- #------------------------------------------------------------#
- # PrintContext_ Exception Type Address Ports: #
- # RMCE - 0x800235F4 #
- # RMCP - 0x80023694 #
- # RMCJ - 0x800235B4 #
- # RMCK - 0x800236F4 #
- #============================================================#
- .macro push_stack size, registers
- stwu r1, \size(r1) # Make space for 30 registers
- stmw r2, 8(r1) # Push r2-r31 onto the stack
- .endm
- .macro absolute_bl register, address
- lis \register, \address@h
- ori \register, \register, \address@l
- mtlr \register
- blrl
- .endm
- .macro pop_stack registers, size
- lmw \registers, 8(r1) # Pop r2-r31 off the stack
- addi r1, r1, \size # Release the space
- .endm
- .set region, ''
- .if (region == 'E' || region == 'e') # RMCE
- .set nw4r_db_Exception_Printf_, 0x80023500
- .elseif (region == 'P' || region == 'p') # RMCP
- .set nw4r_db_Exception_Printf_, 0x800235A0
- .elseif (region == 'J' || region == 'j') # RMCJ
- .set nw4r_db_Exception_Printf_, 0x800234C0
- .elseif (region == 'K' || region == 'k') # RMCK
- .set nw4r_db_Exception_Printf_, 0x80023600
- .else # Invalid Region
- .abort
- .endif
- # Function Prologue...
- push_stack -128, r2
- bl branch_link_write_exception_printf_statement
- .string "****** Custom Exception Handler *****\n********* by Star & Riidefi *********\n\0\0\0"
- branch_link_write_exception_printf_statement:
- mflr r3 # Store the pointer to the String into r3
- # Call nw4r_db_Exception_Printf_
- crclr 4*cr1+eq # Zero out Condition Register 1, indicating the Floating-Point Registers do not need to be preserved
- absolute_bl r12, nw4r_db_Exception_Printf_
- # Function Epilogue...
- pop_stack r2, 128
- # Original Instruction
- cmplwi r3, 0x11 # if ( error < OS_ERROR_MAX )
- #============================================================#
- # ShowStackTrace_ #
- #============================================================#
- # Display a back trace of up to 5 levels of the stack. #
- #============================================================#
- (NTSC-U)
- 040238A8 281E0005
- (PAL)
- 04023948 281E0005
- (NTSC-J)
- 04023868 281E0005
- (NTSC-K)
- 040239A8 281E0005
- #============================================================#
- # Source #
- #------------------------------------------------------------#
- # PrintContext_ Function Return Address Ports: #
- # RMCE - 0x800238BC #
- # RMCP - 0x8002395C #
- # RMCJ - 0x8002387C #
- # RMCK - 0x800239BC #
- #============================================================#
- .macro push_stack size, registers
- stwu r1, \size(r1) # Make space for 30 registers
- stmw r2, 8(r1) # Push r2-r31 onto the stack
- .endm
- .macro absolute_bl register, address
- lis \register, \address@h
- ori \register, \register, \address@l
- mtlr \register
- blrl
- .endm
- .macro pop_stack registers, size
- lmw \registers, 8(r1) # Pop r2-r31 off the stack
- addi r1, r1, \size # Release the space
- .endm
- .set region, ''
- .if (region == 'E' || region == 'e') # RMCE
- .set nw4r_db_Exception_Printf_, 0x80023500
- .elseif (region == 'P' || region == 'p') # RMCP
- .set nw4r_db_Exception_Printf_, 0x800235A0
- .elseif (region == 'J' || region == 'j') # RMCJ
- .set nw4r_db_Exception_Printf_, 0x800234C0
- .elseif (region == 'K' || region == 'k') # RMCK
- .set nw4r_db_Exception_Printf_, 0x80023600
- .else # Invalid Region
- .abort
- .endif
- # Function Prologue...
- push_stack -128, r2
- bl branch_link_write_exception_printf_statement
- .string "You will now be returned to the Wii System Menu.\0\0\0"
- branch_link_write_exception_printf_statement:
- mflr r3 # Store the pointer to the String into r3
- # Call nw4r_db_Exception_Printf_
- crclr 4*cr1+eq # Zero out Condition Register 1, indicating the Floating-Point Registers do not need to be preserved
- absolute_bl r12, nw4r_db_Exception_Printf_
- # Function Epilogue...
- pop_stack r2, 128
- # Original Instruction
- addi r11, r1, 32
- #============================================================#
- # EGG::ExceptionCallBack #
- #============================================================#
- # Automatically display the console and it's contents. #
- #============================================================#
- (NTSC-U)
- 04226160 48000090
- (PAL)
- 042264E4 48000090
- (NTSC-J)
- 04226404 48000090
- (NTSC-K)
- 04226858 48000090
- #============================================================#
- # Source #
- #------------------------------------------------------------#
- # offset = Console_GetBufferHeadLine(console) Address Ports: #
- # RMCE - 0x80226260 #
- # RMCP - 0x802265E4 #
- # RMCJ - 0x80226504 #
- # RMCK - 0x80226958 #
- #============================================================#
- .macro absolute_b register, address
- lis \register, \address@h
- ori \register, \register, \address@l
- mtlr \register
- blr
- .endm
- .set region, ''
- .if (region == 'E' || region == 'e') # RMCE
- .set System_SystemManager_returnToMenu, 0x8000B0E8
- .elseif (region == 'P' || region == 'p') # RMCP
- .set System_SystemManager_returnToMenu, 0x8000B188
- .elseif (region == 'J' || region == 'j') # RMCJ
- .set System_SystemManager_returnToMenu, 0x8000B0AC
- .elseif (region == 'K' || region == 'k') # RMCK
- .set System_SystemManager_returnToMenu, 0x8000B234
- .else # Invalid Region
- .abort
- .endif
- # Call System::SystemManager::returnToMenu()
- absolute_b r12, System_SystemManager_returnToMenu
- #============================================================#
- # Note #
- #------------------------------------------------------------#
- # Since we never return from the function call, we do not #
- # need to preserve any registers. #
- #============================================================#
- #============================================================#
- # nw4r::db::exception .bss #
- #============================================================#
- # enum #
- # { #
- # EXCEPTION_INFO_MAIN = 0x1, #
- # EXCEPTION_INFO_GPR = 0x2, #
- # EXCEPTION_INFO_GPRMAP = 0x4, #
- # EXCEPTION_INFO_SRR0MAP = 0x8, #
- # EXCEPTION_INFO_FPR = 0x10, #
- # EXCEPTION_INFO_TRACE = 0x20, #
- # #
- # EXCEPTION_INFO_ALL = 0x3F, #
- # }; #
- # #
- # Set the information flag to display the Main Information, #
- # General Purpose Registers, and a Stack Trace. #
- #============================================================#
- (NTSC-U)
- 022A3090 00000023
- (PAL)
- 022A7410 00000023
- (NTSC-J)
- 022A6D90 00000023
- (NTSC-K)
- 02295410 00000023
- Code Creators: Star, Riidefi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement