refactor(asm): Implement the Stereo IN opcode with less bytes & entropy.

This commit is contained in:
Veikko Sariola 2020-12-08 10:57:48 +02:00
parent 2106ebde56
commit 8ec3a1208b

View File

@ -407,22 +407,17 @@ SECT_TEXT(suopin)
EXPORT MANGLE_FUNC(su_op_in,0) EXPORT MANGLE_FUNC(su_op_in,0)
lodsb lodsb
%ifdef INCLUDE_STEREO_IN
mov _DI, [_SP + su_stack.synth] mov _DI, [_SP + su_stack.synth]
%ifdef INCLUDE_STEREO_IN
jnc su_op_in_mono jnc su_op_in_mono
call su_op_in_right xor ecx, ecx ; we cannot xor before jnc, so we have to do it mono & stereo. LAHF / SAHF could do it, but is the same number of bytes with more entropy
su_op_in_mono:
sub _DI, 4
su_op_in_right:
xor ecx, ecx
fld dword [_DI + su_synthworkspace.right + _AX*4] fld dword [_DI + su_synthworkspace.right + _AX*4]
mov dword [_DI + su_synthworkspace.right + _AX*4], ecx mov dword [_DI + su_synthworkspace.right + _AX*4], ecx
%else su_op_in_mono:
%endif
xor ecx, ecx xor ecx, ecx
mov _DI, [_SP + su_stack.synth]
fld dword [_DI + su_synthworkspace.left + _AX*4] fld dword [_DI + su_synthworkspace.left + _AX*4]
mov dword [_DI + su_synthworkspace.left + _AX*4], ecx mov dword [_DI + su_synthworkspace.left + _AX*4], ecx
%endif
ret ret
%endif ; SU_IN_ID > -1 %endif ; SU_IN_ID > -1