ipatix/gba-hq-mixer

R5 is overwritten in C_channel_state_loop

Closed this issue · 4 comments

LDRB R5, [R3, #WAVE_TYPE]

LSL R5, R5, #31

LDRB R5, [R4, #CHN_MODE]

LDRB    R5, [R3, #WAVE_TYPE]
LSL     R5, R5, #31
LDRB    R5, [R4, #CHN_MODE]

For compressed wav data, it prvents the routine from choosing the correct branch C_channel_init_comp and causes #7

This is intentional. R5 is shifted by 31 to the left in order to set the Sign Flag which is then evaluated here:

BMI C_channel_init_comp

The result of R5 is intentionally discarded and it is a common way to do this (gcc also does this) to check for single bits in a value.

#7 Is caused by the code simply not supporting compressed samples which are not aligned to 64 samples.

Good to learn that. Thx.