aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxgpu/drawotag.s
blob: 8a5ff0c9dc4fa2cd9db7421e697f765b6ca12e4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
.set noreorder

.include "hwregs_a.h"

.section .text


.global DrawOTag
.type DrawOTag, @function
DrawOTag:
	addiu	$sp, -4
	sw		$ra, 0($sp)

	lui		$a3, 0x1f80			# I/O segment base

.gpu_wait:						# Wait for GPU to be ready for commands & DMA
	jal		ReadGPUstat
	nop
	srl		$v0, 26
	andi	$v0, 1
	beqz	$v0, .gpu_wait
	nop

	lui		$v0, 0x0400			# Set DMA direction to CPUtoGPU
	ori		$v0, 0x2
	sw		$v0, GP1($a3)

	sw		$a0, D2_MADR($a3)	# Set DMA base address to specified OT
	sw		$0, D2_BCR($a3)

	lui		$v0, 0x0100			# Begin OT transfer!
	ori		$v0, 0x0401
	sw		$v0, D2_CHCR($a3)

	lw		$ra, 0($sp)
	addiu	$sp, 4
	jr		$ra
	nop