From CloudModding OoT Wiki

I (spinout) did this forever ago, I kinda just cleaned it up.

.org 80070ED0

j 80600000
nop

.org 80600000

IsPlaying:
lui at, 0x8060
lw at, 0x0200(at)
beqz at, ZTargeting
nop
b XYZCopy
nop

ZTargeting:
lui gp, 0x8021
lw at, 0x3CEC(gp)
beq at, r0, Quit
nop
beq r0, r0, DPadCheck
nop

DPadCheck:
lui gp, 0x8016
lw gp, 0x65C0(gp)
lui at, 0x0800
beq at, gp, SetUpData
nop
b Quit
nop

SetUpData:
lui gp, 0x8060
lui at, 0x0000
addiu at, at, 0x0001
sw at, 0x0200(gp)
lui at, 0x8021
lw at, 0x3CEC(at)
sw at, 0x0204(gp)
sw v0, 0x0004(at)
lui at, 0x8022
lw at, 0x46E4(at)
sw at, 0x0208(gp)
lui at, 0x8022
sw r0, 0x46E4(at)
b XYZCopy
nop

ClearData:
lui gp, 0x8060
sw r0, 0x0200(gp)
sw r0, 0x0204(gp)
lw at, 0x0208(gp)
lui gp, 0x8022
sw at, 0x46E4(gp)
b Quit
nop

XYZCopy:
lui t4, 0x8060
lw t4, 0x0204(t4)
lui at, 0x8022
lw gp, 0x45D4(at)
sw gp, 0x0024(t4)
lw gp, 0x45D8(at)
sw gp, 0x0028(t4)
lw gp, 0x45DC(at)
sw gp, 0x002C(t4)
lw gp, 0x4664(at)
sw gp, 0x00B4(t4)

QuitCheck:
lui gp, 0x8016
lw gp, 0x65C0(gp)
lui at, 0x0400
beq at, gp, ClearData
nop

Quit:
j 80070ED8
nop