02-27-2021, 05:53 AM
I converted this code to C2 code to avoid using the Exception Vector Area.
(NTSC-U)
c2579dcc 00000006
3d808078 618cf6a8
7d8803a6 4e800021
3c60809b 8803f0b1
2c000000 4182000c
38600008 3880000c
60000000 00000000
(PAL)
c2580630 00000006
3d808079 618c86b4
7d8803a6 4e800021
3c60809c 880338b9
2c000000 4182000c
38600008 3880000c
60000000 00000000
(NTSC-J)
c257ffb0 00000006
3d808079 618c7d20
7d8803a6 4e800021
3c60809c 88032919
2c000000 4182000c
38600008 3880000c
60000000 00000000
(NTSC-K)
C256E688 00000006
3d808078 618c6a74
7d8803a6 4e800021
3c60809b 88031ef9
2c000000 4182000c
38600008 3880000c
60000000 00000000
Source
#inject at 0x80579DCC (NTSC-U)
#inject at 0x80580630 (PAL)
#inject at 0x8057FFB0 (NTSC-J)
#inject at 0x8056E688 (NTSC-K)
.set region, '' #Fill in E, P, J, or K within the quotes for your region when Compiling! Lowercase letters can also be used.
.if (region == 'E' || region == 'e') # RMCE
.set func_addr, 0x8078F6A8
.set val_addr, 0x809BF0B1
.elseif (region == 'P' || region == 'p') # RMCP
.set func_addr, 0x807986B4
.set val_addr, 0x809C38B9
.elseif (region == 'J' || region == 'j') # RMCJ
.set func_addr, 0x80797D20
.set val_addr, 0x809C2919
.elseif (region == 'K' || region == 'k') # RMCK
.set func_addr, 0x80786A74
.set val_addr, 0x809B1EF9
.else # Invalid Region
.abort
.endif
lis r12,func_addr@h
ori r12, r12,func_addr@l
mtlr r12
blrl
lis r3,val_addr@h
lbz r0,val_addr@l(r3)
cmpwi r0,0
beq- branch
li r3,8
li r4,12
branch:
(NTSC-U)
c2579dcc 00000006
3d808078 618cf6a8
7d8803a6 4e800021
3c60809b 8803f0b1
2c000000 4182000c
38600008 3880000c
60000000 00000000
(PAL)
c2580630 00000006
3d808079 618c86b4
7d8803a6 4e800021
3c60809c 880338b9
2c000000 4182000c
38600008 3880000c
60000000 00000000
(NTSC-J)
c257ffb0 00000006
3d808079 618c7d20
7d8803a6 4e800021
3c60809c 88032919
2c000000 4182000c
38600008 3880000c
60000000 00000000
(NTSC-K)
C256E688 00000006
3d808078 618c6a74
7d8803a6 4e800021
3c60809b 88031ef9
2c000000 4182000c
38600008 3880000c
60000000 00000000
Source
#inject at 0x80579DCC (NTSC-U)
#inject at 0x80580630 (PAL)
#inject at 0x8057FFB0 (NTSC-J)
#inject at 0x8056E688 (NTSC-K)
.set region, '' #Fill in E, P, J, or K within the quotes for your region when Compiling! Lowercase letters can also be used.
.if (region == 'E' || region == 'e') # RMCE
.set func_addr, 0x8078F6A8
.set val_addr, 0x809BF0B1
.elseif (region == 'P' || region == 'p') # RMCP
.set func_addr, 0x807986B4
.set val_addr, 0x809C38B9
.elseif (region == 'J' || region == 'j') # RMCJ
.set func_addr, 0x80797D20
.set val_addr, 0x809C2919
.elseif (region == 'K' || region == 'k') # RMCK
.set func_addr, 0x80786A74
.set val_addr, 0x809B1EF9
.else # Invalid Region
.abort
.endif
lis r12,func_addr@h
ori r12, r12,func_addr@l
mtlr r12
blrl
lis r3,val_addr@h
lbz r0,val_addr@l(r3)
cmpwi r0,0
beq- branch
li r3,8
li r4,12
branch: