From 9f4891f95070c66ea9f1aba99d72724d4ab24e5a Mon Sep 17 00:00:00 2001 From: "John Wilbert M. Villamor" Date: Sat, 19 Sep 2020 20:43:05 +0800 Subject: 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() --- libpsn00b/psxcd/_cd_control.s | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'libpsn00b/psxcd/_cd_control.s') 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 -- cgit v1.2.3