aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxcd/_cd_control.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/psxcd/_cd_control.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/psxcd/_cd_control.s')
-rw-r--r--libpsn00b/psxcd/_cd_control.s35
1 files changed, 35 insertions, 0 deletions
diff --git a/libpsn00b/psxcd/_cd_control.s b/libpsn00b/psxcd/_cd_control.s
index 7f69266..c4153ff 100644
--- a/libpsn00b/psxcd/_cd_control.s
+++ b/libpsn00b/psxcd/_cd_control.s
@@ -15,6 +15,24 @@ _cd_control:
# a1 - pointer to parameters
# a2 - length of parameters
+ addiu $sp, -16
+ sw $ra, 0($sp)
+ sw $a0, 4($sp)
+ sw $a1, 8($sp)
+ sw $a2, 12($sp)
+
+# move $a3, $a2 # Debug
+# move $a2, $a1
+# move $a1, $a0
+# la $a0, _cd_control_msg
+# jal printf
+# addiu $sp, -16
+# addiu $sp, 16
+
+ lw $a0, 4($sp)
+ lw $a1, 8($sp)
+ lw $a2, 12($sp)
+
li $v0, 1 # Set acknowledge wait flag
la $v1, _cd_ack_wait
sb $v0, 0($v1)
@@ -80,6 +98,15 @@ _cd_control:
li $v0, 0x40
sb $v0, CD_REG3($v1)
+#.Lflush_response: # Flush response FIFO
+# lbu $v0, CD_REG1($v1)
+# nop
+# lbu $v0, CD_REG0($v1)
+# nop
+# andi $v0, 0x20
+# beqz $v0, .Lflush_response
+# nop
+
.Lcmd_wait: # Wait for CD to become ready for commands
lbu $v0, CD_REG0($v1)
nop
@@ -104,6 +131,14 @@ _cd_control:
sb $0 , CD_REG0($v1) # Feed command value
sb $a0, CD_REG1($v1)
+ lw $ra, 0($sp)
+ addiu $sp, 16
jr $ra
nop
+
+
+#.section .data
+
+#_cd_control_msg:
+# .asciiz "CdControl(%d, %x, %d)\n"
\ No newline at end of file