diff --git a/templates/amd64-386/sinks.asm b/templates/amd64-386/sinks.asm index 49f54de..9f83171 100644 --- a/templates/amd64-386/sinks.asm +++ b/templates/amd64-386/sinks.asm @@ -89,6 +89,14 @@ su_op_aux_mono: {{.Func "su_op_send" "Opcode"}} lodsw mov {{.CX}}, [{{.Stack "Voice"}}] ; load pointer to voice +{{- if .SupportsParamValueOtherThan "send" "voice" 0}} + pushf ; uh ugly: we save the flags just for the stereo carry bit. Doing the .CX loading later crashed the synth for stereo sends as loading the synth address from stack was f'd up by the "call su_op_send_mono" + test {{.AX}}, 0x8000 + jz su_op_send_skipglobal + mov {{.CX}}, [{{.Stack "Synth"}} + {{.PTRSIZE}}] +su_op_send_skipglobal: + popf +{{- end}} {{- if .StereoAndMono "send"}} jnc su_op_send_mono {{- end}} @@ -102,12 +110,6 @@ su_op_aux_mono: jnz su_op_send_mono fxch ; swap them back: l r su_op_send_mono: -{{- end}} -{{- if .SupportsParamValueOtherThan "send" "voice" 0}} - test {{.AX}}, 0x8000 - jz su_op_send_skipglobal - mov {{.CX}}, [{{.Stack "Synth"}}] -su_op_send_skipglobal: {{- end}} test {{.AX}}, 0x8 ; if the SEND_POP bit is not set jnz su_op_send_skippush diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a9fe48b..6617c50 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,7 +6,7 @@ function(regression_test testname) else() set(source ${ARGV3}.yml) endif() - + set(asmfile ${testname}.asm) set (headerfile ${CMAKE_CURRENT_BINARY_DIR}/${testname}.h) @@ -66,7 +66,8 @@ regression_test(test_invgain LOADVAL INVGAIN) regression_test(test_invgain_stereo INVGAIN) regression_test(test_send LOADVAL SEND) regression_test(test_send_stereo SEND) -regression_test(test_send_global SEND) +regression_test(test_send_global SEND SEND_GLOBAL) +regression_test(test_send_global_stereo SEND_GLOBAL) regression_test(test_receive SEND RECEIVE) regression_test(test_receive_stereo RECEIVE) regression_test(test_in LOADVAL IN) diff --git a/tests/expected_output/test_send_global_stereo.raw b/tests/expected_output/test_send_global_stereo.raw new file mode 100644 index 0000000..75b7b51 Binary files /dev/null and b/tests/expected_output/test_send_global_stereo.raw differ diff --git a/tests/test_send_global_stereo.yml b/tests/test_send_global_stereo.yml new file mode 100644 index 0000000..1dc6132 --- /dev/null +++ b/tests/test_send_global_stereo.yml @@ -0,0 +1,33 @@ +bpm: 100 +rowsperpattern: 16 +rowsperbeat: 4 +tracks: + - numvoices: 1 + sequence: [0] + patterns: [[64, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]] +patch: + instruments: + - numvoices: 1 + units: + - type: loadval + parameters: {stereo: 0, value: 64} + - type: loadval + parameters: {stereo: 0, value: 96} + - type: send + parameters: {amount: 128, port: 0, sendpop: 1, stereo: 1, unit: 3, voice: 2} + - type: receive + parameters: {stereo: 1} + - type: out + parameters: {gain: 128, stereo: 1} + - numvoices: 1 + units: + - type: loadval + parameters: {stereo: 0, value: 0} + - type: loadval + parameters: {stereo: 0, value: 64} + - type: send + parameters: {amount: 96, port: 0, sendpop: 1, stereo: 1, unit: 3, voice: 1} + - type: receive + parameters: {stereo: 1} + - type: out + parameters: {gain: 128, stereo: 1}