diff options
| author | John Wilbert M. Villamor <lameguy64@gmail.com> | 2019-06-23 07:42:16 +0800 |
|---|---|---|
| committer | John Wilbert M. Villamor <lameguy64@gmail.com> | 2019-06-23 07:42:16 +0800 |
| commit | 7be9178c0f9b0e698a305ecc5c0c41fcc596a4fc (patch) | |
| tree | e98c627e1da5c764563774b89b0c06d7ac5ad0a4 /libpsn00b/psxgpu/drawsynccallback.s | |
| parent | ae9e545c3ed33d39ce21ae13ceb8337fa34901b8 (diff) | |
| download | psn00bsdk-7be9178c0f9b0e698a305ecc5c0c41fcc596a4fc.tar.gz | |
LibPSn00b officially v0.10b, added psxsio library, better DrawSync() and VSync(), better reference manual.
Diffstat (limited to 'libpsn00b/psxgpu/drawsynccallback.s')
| -rw-r--r-- | libpsn00b/psxgpu/drawsynccallback.s | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/libpsn00b/psxgpu/drawsynccallback.s b/libpsn00b/psxgpu/drawsynccallback.s new file mode 100644 index 0000000..c1e28fe --- /dev/null +++ b/libpsn00b/psxgpu/drawsynccallback.s @@ -0,0 +1,103 @@ +.set noreorder + +.include "hwregs_a.h" + +.text + +.global DrawSyncCallback +.type DrawSyncCallback, @function +DrawSyncCallback: + + addiu $sp, -8 + sw $ra, 0($sp) + sw $a0, 4($sp) + + jal EnterCriticalSection + nop + + beqz $a0, .Luninstall + nop + la $a1, _drawsync_handler + jal DMACallback + li $a0, 2 + b .Lcontinue + nop + +.Luninstall: + + move $a1, $0 + jal DMACallback + li $a0, 2 + +.Lcontinue: + + lw $a0, 4($sp) + la $v1, _drawsync_func + lw $v0, 0($v1) + sw $a0, 0($v1) + sw $v0, 4($sp) + +.Lexit: + + jal ExitCriticalSection + nop + + lw $ra, 0($sp) + lw $v0, 4($sp) + jr $ra + addiu $sp, 8 + + +.type _drawsync_handler, @function +_drawsync_handler: + +.Ldma_wait: + + la $v0, _drawsync_func + lw $v0, 0($v0) + nop + beqz $v0, .Lskip + nop + + addiu $sp, -4 + sw $ra, 0($sp) + + lw $v0, D2_CHCR($a0) + nop + srl $v0, 24 + andi $v0, 0x1 + + bnez $v0, .Ldma_wait + nop + +.Lgpu_wait: + jal ReadGPUstat + nop + srl $v0, 28 + andi $v0, 0x1 + beqz $v0, .Lgpu_wait + nop + + la $v1, _drawsync_func + lw $v1, 0($v1) + + lui $v0, 0x0400 # Set DMA direction to off + sw $v0, GP1($a0) + + jalr $v1 + nop + + lw $ra, 0($sp) + addiu $sp, 4 + +.Lskip: + + jr $ra + nop + + +.data + +_drawsync_func: + .word 0 +
\ No newline at end of file |
