aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxapi
diff options
context:
space:
mode:
authorlameguy64 <lameguy64@gmail.com>2019-05-23 22:24:56 +0800
committerlameguy64 <lameguy64@gmail.com>2019-05-23 22:24:56 +0800
commit3ffebff2aad2ca438cf76db51fb3459c5639cd67 (patch)
treea234fc6158d3c09904c4c1fb2feee09afb479a4c /libpsn00b/psxapi
parente70cd149f41ea71f9ca9ee86c03d1e59005dad2a (diff)
downloadpsn00bsdk-3ffebff2aad2ca438cf76db51fb3459c5639cd67.tar.gz
Added BIOS Controller, BIOS CD, 2 new examples and custom exit handler in the works
Diffstat (limited to 'libpsn00b/psxapi')
-rw-r--r--libpsn00b/psxapi/fs/_InitCd.s37
-rw-r--r--libpsn00b/psxapi/makefile2
-rw-r--r--libpsn00b/psxapi/pad/initpad.s10
-rw-r--r--libpsn00b/psxapi/pad/startpad.s10
-rw-r--r--libpsn00b/psxapi/pad/stoppad.s10
-rw-r--r--libpsn00b/psxapi/sys/initcard.s10
-rw-r--r--libpsn00b/psxapi/sys/initpad.s11
-rw-r--r--libpsn00b/psxapi/sys/returnfromexception.s10
8 files changed, 78 insertions, 22 deletions
diff --git a/libpsn00b/psxapi/fs/_InitCd.s b/libpsn00b/psxapi/fs/_InitCd.s
new file mode 100644
index 0000000..decf2bd
--- /dev/null
+++ b/libpsn00b/psxapi/fs/_InitCd.s
@@ -0,0 +1,37 @@
+.section .text
+.set noreorder
+
+.include "hwregs_a.h"
+
+.global _InitCd
+.type _InitCd, @function
+_InitCd:
+ addiu $sp, -8
+ sw $ra, 0($sp)
+
+ lui $a0, IOBASE # Load IOBASE value
+
+ lw $v0, DPCR($a0) # Get current DMA settings
+ nop
+ sw $v0, 4($sp) # Save to stack
+
+ jal _96_init # Init CD subsystem
+ nop
+
+ lui $a0, IOBASE # Load IOBASE again
+
+ lw $v0, 4($sp) # Get old DMA control settings
+ lw $v1, DPCR($a0) # Get DMA settings by _96_init()
+
+ lui $a1, 0xffff # Mask out settings for CD DMA
+ ori $a1, 0x0f00
+ and $v0, $a1
+
+ or $v0, $v1 # Merge and set new DMA settings
+ sw $v0, DPCR($a0)
+
+ lw $ra, 0($sp)
+ addiu $sp, 8
+ jr $ra
+ nop
+ \ No newline at end of file
diff --git a/libpsn00b/psxapi/makefile b/libpsn00b/psxapi/makefile
index 30c1522..e97451c 100644
--- a/libpsn00b/psxapi/makefile
+++ b/libpsn00b/psxapi/makefile
@@ -6,7 +6,7 @@ PREFIX = mipsel-unknown-elf-
TARGET = ../libpsxapi.a
-SOURCES = stdio fs sys
+SOURCES = stdio fs sys pad
AFILES = $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.s))
OFILES = $(addprefix build/,$(AFILES:.s=.o))
diff --git a/libpsn00b/psxapi/pad/initpad.s b/libpsn00b/psxapi/pad/initpad.s
new file mode 100644
index 0000000..d983d75
--- /dev/null
+++ b/libpsn00b/psxapi/pad/initpad.s
@@ -0,0 +1,10 @@
+.set noreorder
+.section .text
+
+.global _InitPad
+.type _InitPad, @function
+_InitPad:
+ addiu $t2, $0 , 0xb0
+ jr $t2
+ addiu $t1, $0 , 0x12
+ \ No newline at end of file
diff --git a/libpsn00b/psxapi/pad/startpad.s b/libpsn00b/psxapi/pad/startpad.s
new file mode 100644
index 0000000..c8e7da8
--- /dev/null
+++ b/libpsn00b/psxapi/pad/startpad.s
@@ -0,0 +1,10 @@
+.set noreorder
+.section .text
+
+.global _StartPad
+.type _StartPad, @function
+_StartPad:
+ addiu $t2, $0 , 0xb0
+ jr $t2
+ addiu $t1, $0 , 0x13
+ \ No newline at end of file
diff --git a/libpsn00b/psxapi/pad/stoppad.s b/libpsn00b/psxapi/pad/stoppad.s
new file mode 100644
index 0000000..4465e5a
--- /dev/null
+++ b/libpsn00b/psxapi/pad/stoppad.s
@@ -0,0 +1,10 @@
+.set noreorder
+.section .text
+
+.global _StopPad
+.type _StopPad, @function
+_StopPad:
+ addiu $t2, $0 , 0xb0
+ jr $t2
+ addiu $t1, $0 , 0x14
+ \ No newline at end of file
diff --git a/libpsn00b/psxapi/sys/initcard.s b/libpsn00b/psxapi/sys/initcard.s
deleted file mode 100644
index e589592..0000000
--- a/libpsn00b/psxapi/sys/initcard.s
+++ /dev/null
@@ -1,10 +0,0 @@
-.set noreorder
-.section .text
-
-.global InitCard
-.type InitCard, @function
-InitCard:
- addiu $t2, $0, 0xb0
- jr $t2
- addiu $t1, $0, 0x4a
- \ No newline at end of file
diff --git a/libpsn00b/psxapi/sys/initpad.s b/libpsn00b/psxapi/sys/initpad.s
deleted file mode 100644
index b0f1b6f..0000000
--- a/libpsn00b/psxapi/sys/initpad.s
+++ /dev/null
@@ -1,11 +0,0 @@
-.set noreorder
-.section .text
-
-.include "hwregs_a.h"
-
-.global InitPad
-.type InitPad, @function
-InitPad:
- addiu $t2, $0, 0xb0
- jr $t2
- addiu $t1, $0, 0x12
diff --git a/libpsn00b/psxapi/sys/returnfromexception.s b/libpsn00b/psxapi/sys/returnfromexception.s
new file mode 100644
index 0000000..ec67b64
--- /dev/null
+++ b/libpsn00b/psxapi/sys/returnfromexception.s
@@ -0,0 +1,10 @@
+.set noreorder
+.section .text
+
+.global ReturnFromException
+.type ReturnFromException, @function
+ReturnFromException:
+ addiu $t2, $0, 0xb0
+ jr $t2
+ addiu $t1, $0, 0x17
+ \ No newline at end of file