aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxetc/restartcallback.s
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2020-09-19 20:43:05 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2020-09-19 20:43:05 +0800
commit9f4891f95070c66ea9f1aba99d72724d4ab24e5a (patch)
tree723e3ef2118a3d1a9e6dafa811ed1b8b1bc9196e /libpsn00b/psxetc/restartcallback.s
parent6762c39551ded059450d17d8bb0cb80642c8aaab (diff)
downloadpsn00bsdk-9f4891f95070c66ea9f1aba99d72724d4ab24e5a.tar.gz
Revised makefiles, added strtok(), command line arguments, SetHeapSize(), moved ISR and callback system to psxetc, moved debug font to psxgpu, fixed CD-ROM library crashing on PSIO, fixed interrupt callback setup to fix crashing on ResetGraph()
Diffstat (limited to 'libpsn00b/psxetc/restartcallback.s')
-rw-r--r--libpsn00b/psxetc/restartcallback.s54
1 files changed, 54 insertions, 0 deletions
diff --git a/libpsn00b/psxetc/restartcallback.s b/libpsn00b/psxetc/restartcallback.s
new file mode 100644
index 0000000..151d78e
--- /dev/null
+++ b/libpsn00b/psxetc/restartcallback.s
@@ -0,0 +1,54 @@
+.set noreorder
+
+.include "hwregs_a.h"
+
+.section .text
+
+.global RestartCallback
+.type RestartCallback, @function
+RestartCallback:
+
+ addiu $sp, -4
+ sw $ra, 0($sp)
+
+ la $a0, _custom_exit
+ jal SetCustomExitFromException
+ addiu $sp, -4
+ addiu $sp, 4
+
+ move $a0, $0
+ jal ChangeClearPAD
+ addiu $sp, -4
+ addiu $sp, 4
+
+ li $a0, 3
+ move $a1, $0
+ jal ChangeClearRCnt
+ addiu $sp, -8
+ addiu $sp, 8
+
+ la $a0, _irq_func_table
+ move $a1, $0
+ move $v0, $0
+
+.Lcheck_cbs: # Set up the interrupt masks
+ lw $v1, 0($a0)
+ nop
+ beqz $v1, .Lno_cb
+ addiu $a0, 4
+ li $v1, 1
+ sll $v1, $a1
+ or $v0, $v1
+.Lno_cb:
+ blt $a1, 10, .Lcheck_cbs
+ addiu $a1, 1
+
+ lui $a0, IOBASE
+ sw $0 , ISTAT($a0)
+ sw $v0, IMASK($a0)
+
+ lw $ra, 0($sp)
+ addiu $sp, 4
+ jr $ra
+ nop
+ \ No newline at end of file