From e049bf2dcece0ff663a3cddbac135a2b764c6c52 Mon Sep 17 00:00:00 2001 From: Veikko Sariola Date: Tue, 26 May 2020 18:58:49 +0300 Subject: [PATCH] Change loadnote to load values from [-1,1], to allow using notes for both positive and negative modulations. Also change SPEED to take this change into account. --- src/opcodes/arithmetic.asm | 4 +++- src/opcodes/flowcontrol.asm | 2 -- tests/expected_output/test_loadnote.raw | Bin 846720 -> 846720 bytes .../expected_output/test_loadnote_stereo.raw | Bin 846720 -> 846720 bytes 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/opcodes/arithmetic.asm b/src/opcodes/arithmetic.asm index ef629c0..210aeb1 100644 --- a/src/opcodes/arithmetic.asm +++ b/src/opcodes/arithmetic.asm @@ -65,7 +65,7 @@ su_op_addp_mono: %endif ;------------------------------------------------------------------------------- -; LOADNOTE opcode: load the current note, scaled to [0,1] +; LOADNOTE opcode: load the current note, scaled to [-1,1] ;------------------------------------------------------------------------------- ; Mono: (empty) -> n, where n is the note ; Stereo: (empty) -> n n @@ -80,6 +80,8 @@ su_op_loadnote_mono: %endif fild dword [INP-su_voice.inputs+su_voice.note] do fmul dword [,c_i128,] + do fsub dword [,c_0_5,] ; s-.5 + fadd st0, st0 ; 2*s-1 ret %endif diff --git a/src/opcodes/flowcontrol.asm b/src/opcodes/flowcontrol.asm index bd8111e..be419c8 100644 --- a/src/opcodes/flowcontrol.asm +++ b/src/opcodes/flowcontrol.asm @@ -47,8 +47,6 @@ su_op_advance_finish: SECT_TEXT(suspeed) EXPORT MANGLE_FUNC(su_op_speed,0) - do fsub dword [,c_0_5,] ; s-.5 - fadd st0, st0 ; 2*s-1 do fmul dword [,c_bpmscale,] ; (2*s-1)*64/24, let's call this p from now on call MANGLE_FUNC(su_power,0) ; 2^p, this is how many ticks we should be taking fld1 ; 1 2^p diff --git a/tests/expected_output/test_loadnote.raw b/tests/expected_output/test_loadnote.raw index 218c659d76d4069b1bd9698f40fe8a17135ec2cb..8307f4af184da5bd53094dc04107b6a0df1bed86 100644 GIT binary patch literal 846720 zcmeIwK@ET~00hC6gaN7rDRqXmdMFRlWG*=an<-O30R