50 lines
941 B
ArmAsm
50 lines
941 B
ArmAsm
.set rPad, 9
|
|
.set r817F, 10
|
|
.set addrTimer, 0x817F0478
|
|
.set addrDuration, 0x817F0479
|
|
.set addrCount, 0x817F04A4
|
|
|
|
.direct:
|
|
.checkController:
|
|
## R+X
|
|
lis rPad, mPadButton+2@ha
|
|
lhzu r0, mPadButton+2@l(rPad)
|
|
andi. r0, r0, 0xFFF0
|
|
cmplwi r0, 0x420
|
|
bne+ .done
|
|
## effective D-Pad
|
|
lbz rPad, -2+0x18+3(rPad)
|
|
### skip if no D-Pad pressed
|
|
rlwinm. r0, rPad, 0, 0xF
|
|
beq .done
|
|
.prepare:
|
|
lis r817F, 0x817F
|
|
## set display timer
|
|
lbz r0, addrDuration@l(r817F)
|
|
stb r0, addrTimer@l(r817F)
|
|
|
|
.update.success:
|
|
lhz r12, addrCount@l(r817F)
|
|
### DD(0x4)
|
|
rlwinm r0, rPad, 32-2, 0x1
|
|
sub r12, r12, r0
|
|
### DU(0x8)
|
|
rlwinm r0, rPad, 32-3, 0x1
|
|
add r12, r12, r0
|
|
## write back
|
|
sth r12, addrCount@l(r817F)
|
|
|
|
.update.attempt:
|
|
lhz r12, addrCount+2@l(r817F)
|
|
### DL(0x1)
|
|
rlwinm r0, rPad, 0, 0x1
|
|
sub r12, r12, r0
|
|
### DR(0x2)
|
|
rlwinm r0, rPad, 32-1, 0x1
|
|
add r12, r12, r0
|
|
## write back
|
|
sth r12, addrCount+2@l(r817F)
|
|
|
|
.done:
|
|
## orig
|
|
li r6, 0
|