From: kub Date: Mon, 3 Jul 2023 21:45:46 +0000 (+0200) Subject: sound, some ym2612 arm cleanup X-Git-Tag: v2.00~193 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae4d881a2f0d14b0af3b4c7642b72daaf990cdb9;p=picodrive.git sound, some ym2612 arm cleanup --- diff --git a/pico/sound/ym2612_arm.S b/pico/sound/ym2612_arm.S index 4d630dd3..b899559d 100644 --- a/pico/sound/ym2612_arm.S +++ b/pico/sound/ym2612_arm.S @@ -171,22 +171,19 @@ subge r0, r0, #1 movge r3, #EG_OFF strgeb r3, [r5,#0x17] @ state + ldrh r3, [r5,#0x18] @ tl + b 11f 10: @ finish ldrb r2, [r5,#0x30] @ ssg - ldrb r3, [r5,#0x17] @ state - strh r0, [r5,#0x1a] @ volume - cmp r2, #0x0c @ if ( ssg&0x04 && state > EG_REL ) - cmpge r3, #EG_REL+1 ldrh r3, [r5,#0x18] @ tl - rsbge r0, r0, #0x200 @ volume = (0x200-volume) & MAX_ATT - movge r0, r0, lsl #22 - movge r0, r0, lsr #22 + strh r0, [r5,#0x1a] @ volume + recalc_volume_ssg r0 r2 11: -#endif add r0, r0, r3 @ volume += tl strh r0, [r5,#0x34] @ vol_out +#endif 0: @ EG_OFF .endm @@ -247,31 +244,19 @@ 9: ldrb r0, [r5,#0x30] @ ssg ldrh r2, [r5,#0x18] @ tl - cmp r0, #0x0c - rsbge r3, r3, #0x200 @ volume = (0x200-volume) & MAX_ATT - movge r3, r3, lsl #22 - movge r3, r3, lsr #22 + recalc_volume_ssg r3 r0 add r3, r3, r2 @ volume += tl strh r3, [r5,#0x34] @ vol_out 10: .endm -@ r5=slot, trashes: r0,r2,r3 -.macro recalc_volout - ldrb r2, [r5,#0x30] @ ssg - ldrb r3, [r5,#0x17] @ state - ldrh r0, [r5,#0x1a] @ volume - -@ and r2, r2, #0x0c - cmp r2, #0x0c @ if ( ~ssg&0x0c && state > EG_REL ) - cmpge r3, #EG_REL+1 - ldrh r3, [r5,#0x18] @ tl - rsbge r0, r0, #0x200 @ volume = (0x200-volume) & MAX_ATT - movge r0, r0, lsl #22 - movge r0, r0, lsr #22 - - add r0, r0, r3 @ volume += tl - strh r0, [r5,#0x34] @ vol_out +@ r5=slot +.macro recalc_volume_ssg vol ssg +@ and \ssg, \ssg, #0x0c + cmp \ssg, #0x0c @ if (~ssg&0x0c) + rsbge \vol, \vol, #0x200 @ volume = (0x200-volume) & MAX_ATT + movge \vol, \vol, lsl #22 + movge \vol, \vol, lsr #22 .endm #endif @@ -708,8 +693,11 @@ ssg_upd_loop: @ use lr as a pointer to the slot phases stored in the context update_ssg_eg #if 0 + tst r6, #1 + addeq lr, lr, #2*4 + subne lr, lr, #4 subs r6, r6, #1 - addne lr, lr, #4 + addeq lr, lr, #4 addne r5, r5, #SLOT_STRUCT_SIZE #else add lr, lr, #4