addpl r0, r0, r2, asr #4
cmp r0, #0 @ if (volume <= MIN_ATT_INDEX)
bgt 10f
- ldr r2, [r5,#0x1c]
+ ldr r2, [r5,#0x1c] @ sl
mov r0, #0
cmp r2, #0
movne r3, #EG_DEC
b 10f
1: @ EG_REL
- mov r2, #0x200
- cmp r0, r2 @ if ( volume >= 0x200 )
+ cmp r0, #0x200 @ if ( volume >= 0x200 )
movge r0, #1024
subge r0, #1
movge r3, #EG_OFF
eorne r0, r0, #0x400 @ ssgn ^= 4
strneh r0, [r5,#0x30]
moveq r0, #0
- streq r0, [r5,#0x0c] @ phase = 0
+ streq r0, [lr,#0x10] @ phase = 0
cmp r2, #EG_ATT @ if ( state != EG_ATT )
beq 9f
cmp r0, #32+62 @ if ( ar+ksr >= 32+62 )
movge r3, #0
strgeh r3, [r5,#0x1a] @ volume = MIN_ATT
- bge 9f
+ bge 8f
cmp r3, #0
movgt r2, #EG_ATT
- strb r2, [r5,#0x17] @ state
+8: strb r2, [r5,#0x17] @ state
9:
.endm
rsbge r0, r0, #0x200 @ volume = (0x200-volume) & MAX_ATT
lslge r0, r0, #22
lsrge r0, r0, #22
- ldrh r0, [r5,#0x1a] @ volume
- ldrh r3, [r5,#0x18] @ tl
add r0, r0, r3 @ volume += tl
strh r0, [r5,#0x34] @ vol_out
ssg_loop:
mov r6, #4
+ bic r4, r4, #0x10 @ ssg_update
ssg_upd_loop:
+ @ use lr as a pointer to the slot phases stored in the context
update_ssg_eg
#if 0
subs r6, r6, #1
+ addne lr, lr, #4
addne r5, r5, #SLOT_STRUCT_SIZE
#else
+ add lr, lr, #4*2
add r5, r5, #SLOT_STRUCT_SIZE*2
update_ssg_eg
subs r6, r6, #2
+ subne lr, lr, #4
subne r5, r5, #SLOT_STRUCT_SIZE
#endif
bne ssg_upd_loop
+ sub lr, lr, #4*3
sub r5, r5, #SLOT_STRUCT_SIZE*3
subs r7, r7, #1<<EG_SH
@ -- EG --
add r8, r8, r9
cmp r8, #EG_TIMER_OVERFLOW
- bcc volout_upd
+ blo volout_upd
ldr r1, [lr, #0x3c] @ eg_cnt
eg_loop:
sub r8, r8, #EG_TIMER_OVERFLOW