Figure 4-5 Outputopen Function Using The Xbus - Nintendo Ultra64 Programmer's Manual

Rsp
Table of Contents

Advertisement

RSP Coprocessor 0
102
OutputOpen Function Using the XBUS
Figure 4-5
.name
dmemp,
.name
dramp,
.name
outsz,
# open(size)
#
#
#
#
OutputOpen: # check if the packet will fit in the buffer
WrapBuffer: # packet won't fit, wait for current to wrap
AdvanceCurrent:
CurrentFit:
# done if current_address <= outp
# loop if current_address <= (outp + outsz)
OpenDone:
$20
$19
$18 # caller sets to max size of write
- wait for size avail in
ring buffer.
- possibly handle wrap
- wait for 'current' to get
out of the way
.ent
OutputOpen
addi
dramp, zero, (RSP_OUTPUT_OFFSET
+ RSP_OUTPUT_SIZE8)
add
dmemp, outp, outsz
sub
dramp, dramp, dmemp
bgez
dramp, CurrentFit
nop
mfc0
dramp, CMD_STATUS
andi
dramp, dramp, 0x0400
bne
dramp, zero, WrapBuffer
# wait for current to advance
mfc0
dramp, CMD_CURRENT
addi
outp, zero, RSP_OUTPUT_OFFSET
beq
dramp, outp, AdvanceCurrent
nop
mtc0
outp, CMD_START
mfc0
dramp, CMD_CURRENT
sub
dmemp, outp, dramp
bgez
dmemp, OpenDone
add
dmemp, outp, outsz
sub
dramp, dmemp, dramp
bgez
dramp, CurrentFit
nop
jr
return
nop
.end
OutputOpen
# reset START

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents