mirror of
https://github.com/vsariola/sointu.git
synced 2025-12-02 07:23:24 -05:00
Add tests for opcode stereo variants, squashing several bugs in the process. Implement receive opcode to test stereo sending.
This commit is contained in:
@ -31,7 +31,7 @@ EXPORT MANGLE_FUNC(su_op_add,0)
|
||||
fadd st0, st3
|
||||
fxch
|
||||
ret
|
||||
su_op_pop_mono:
|
||||
su_op_add_mono:
|
||||
%endif
|
||||
fadd st1
|
||||
ret
|
||||
@ -146,7 +146,7 @@ EXPORT MANGLE_FUNC(su_op_xch,0)
|
||||
jnc su_op_xch_mono
|
||||
fxch st0, st2 ; c b a d
|
||||
fxch st0, st1 ; b c a d
|
||||
fxch st0, st2 ; d c a b
|
||||
fxch st0, st3 ; d c a b
|
||||
su_op_xch_mono:
|
||||
%endif
|
||||
fxch st0, st1
|
||||
|
||||
@ -140,7 +140,7 @@ endstruc
|
||||
USE_HOLD
|
||||
%xdefine CMDS CMDS HOLD_ID + %1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_DISTORT
|
||||
%define INCLUDE_STEREO_HOLD
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
|
||||
@ -79,8 +79,7 @@ SECT_TEXT(sunoise)
|
||||
EXPORT MANGLE_FUNC(su_op_noise,0)
|
||||
%ifdef INCLUDE_STEREO_NOISE
|
||||
jnc su_op_noise_mono
|
||||
clc
|
||||
call dword [esp]
|
||||
call su_op_noise_mono
|
||||
su_op_noise_mono:
|
||||
%endif
|
||||
call MANGLE_FUNC(FloatRandomNumber,0)
|
||||
@ -287,22 +286,22 @@ SECT_DATA(suconst)
|
||||
%endif
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; LOAD_VAL opcode
|
||||
; LOADVAL opcode
|
||||
;-------------------------------------------------------------------------------
|
||||
; Input: WRK : pointer to unit workspace
|
||||
; VAL : pointer to unit values as bytes
|
||||
; Output: st0 : 2*v-1, where v is the loaded value
|
||||
; Dirty: eax, edx
|
||||
; Input: edx : pointer to unit ports
|
||||
;
|
||||
; Mono version: push 2*v-1 on stack, where v is the input to port "value"
|
||||
; Stereo version: push 2*v-1 twice on stack
|
||||
;-------------------------------------------------------------------------------
|
||||
%if LOAD_VAL_ID > -1
|
||||
%if LOADVAL_ID > -1
|
||||
|
||||
SECT_TEXT(suloadvl)
|
||||
|
||||
EXPORT MANGLE_FUNC(su_op_loadval,0)
|
||||
%ifdef INCLUDE_STEREO_LOAD_VAL
|
||||
jnc su_op_loadval_mono
|
||||
call su_loadval_mono
|
||||
su_loadval_mono:
|
||||
call su_op_loadval_mono
|
||||
su_op_loadval_mono:
|
||||
%endif
|
||||
fld dword [edx+su_load_val_ports.value] ; v
|
||||
fsub dword [c_0_5] ; v-.5
|
||||
@ -310,3 +309,31 @@ su_loadval_mono:
|
||||
ret
|
||||
|
||||
%endif ; SU_USE_LOAD_VAL
|
||||
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; RECEIVE opcode
|
||||
;-------------------------------------------------------------------------------
|
||||
; Mono version: push l on stack, where l is the left channel received
|
||||
; Stereo version: push l r on stack
|
||||
;-------------------------------------------------------------------------------
|
||||
%if RECEIVE_ID > -1
|
||||
|
||||
SECT_TEXT(sureceiv)
|
||||
|
||||
EXPORT MANGLE_FUNC(su_op_receive,0)
|
||||
lea ecx, dword [WRK+su_unit.ports]
|
||||
%ifdef INCLUDE_STEREO_RECEIVE
|
||||
jnc su_op_receive_mono
|
||||
xor eax,eax
|
||||
fld dword [ecx+su_receive_ports.right]
|
||||
mov dword [ecx+su_receive_ports.right],eax
|
||||
su_op_receive_mono:
|
||||
%else
|
||||
xor eax,eax
|
||||
%endif
|
||||
fld dword [ecx+su_receive_ports.left]
|
||||
mov dword [ecx+su_receive_ports.left],eax
|
||||
ret
|
||||
|
||||
%endif ; RECEIVE_ID > -1
|
||||
|
||||
@ -154,10 +154,10 @@ endstruc
|
||||
;-------------------------------------------------------------------------------
|
||||
; LOAD_VAL structs
|
||||
;-------------------------------------------------------------------------------
|
||||
%assign LOAD_VAL_ID -1
|
||||
%assign LOADVAL_ID -1
|
||||
%macro USE_LOAD_VAL 0
|
||||
%if LOAD_VAL_ID == -1
|
||||
%assign LOAD_VAL_ID CUR_ID
|
||||
%if LOADVAL_ID == -1
|
||||
%assign LOADVAL_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_loadval,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 1,
|
||||
@ -167,7 +167,7 @@ endstruc
|
||||
%macro SU_LOADVAL 2
|
||||
db %2
|
||||
USE_LOAD_VAL
|
||||
%xdefine CMDS CMDS LOAD_VAL_ID+%1,
|
||||
%xdefine CMDS CMDS LOADVAL_ID+%1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_LOAD_VAL
|
||||
%endif
|
||||
@ -183,3 +183,30 @@ endstruc
|
||||
struc su_load_val_wrk
|
||||
.size
|
||||
endstruc
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; RECEIVE structs
|
||||
;-------------------------------------------------------------------------------
|
||||
%assign RECEIVE_ID -1
|
||||
%macro USE_RECEIVE 0
|
||||
%if RECEIVE_ID == -1
|
||||
%assign RECEIVE_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_receive,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_RECEIVE 1
|
||||
USE_RECEIVE
|
||||
%xdefine CMDS CMDS RECEIVE_ID+%1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_RECEIVE
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
struc su_receive_ports
|
||||
.params ; receive does not actually have params, left and right only through send
|
||||
.left resd 1
|
||||
.right resd 1
|
||||
endstruc
|
||||
|
||||
Reference in New Issue
Block a user