Clean up the op_advance code&comments and remove one unnecessary jump.

This commit is contained in:
Veikko Sariola 2020-05-26 18:13:16 +03:00
parent 91b8912015
commit ceae6ffcba

View File

@ -10,28 +10,24 @@
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
SECT_TEXT(suopadvn) SECT_TEXT(suopadvn)
EXPORT MANGLE_FUNC(su_op_advance,0)
%ifdef INCLUDE_POLYPHONY %ifdef INCLUDE_POLYPHONY
mov WRK, [_SP+su_stack.wrk] ; WRK points to start of current voice
EXPORT MANGLE_FUNC(su_op_advance,0) ; Stack: addr voice wrkptr valptr comptr
mov WRK, [_SP+su_stack.wrk] ; WRK = wrkptr
add WRK, su_voice.size ; move to next voice add WRK, su_voice.size ; move to next voice
mov [_SP+su_stack.wrk], WRK ; update stack mov [_SP+su_stack.wrk], WRK ; update the pointer in the stack to point to the new voice
mov ecx, [_SP+su_stack.voiceno] ; ecx = voice mov ecx, [_SP+su_stack.voiceno] ; ecx = how many voices remain to process
dec ecx ; decrement number of voices to process dec ecx ; decrement number of voices to process
bt dword [_SP+su_stack.polyphony], ecx ; if voice bit of su_polyphonism not set bt dword [_SP+su_stack.polyphony], ecx ; if voice bit of su_polyphonism not set
jnc su_op_advance_next_instrument ; goto next_instrument jnc su_op_advance_next_instrument ; goto next_instrument
mov VAL, PTRWORD [_SP+su_stack.val] ; rollback to where we were earlier mov VAL, PTRWORD [_SP+su_stack.val] ; if it was set, then repeat the opcodes for the current voice
mov COM, PTRWORD [_SP+su_stack.com] mov COM, PTRWORD [_SP+su_stack.com]
jmp short su_op_advance_finish
su_op_advance_next_instrument: su_op_advance_next_instrument:
mov PTRWORD [_SP+su_stack.val], VAL ; save current VAL as a checkpoint mov PTRWORD [_SP+su_stack.val], VAL ; save current VAL as a checkpoint
mov PTRWORD [_SP+su_stack.com], COM ; save current COM as a checkpoint mov PTRWORD [_SP+su_stack.com], COM ; save current COM as a checkpoint
su_op_advance_finish: su_op_advance_finish:
mov [_SP+su_stack.voiceno], ecx mov [_SP+su_stack.voiceno], ecx
ret ret
%else %else
EXPORT MANGLE_FUNC(su_op_advance,0) ; Stack: addr voice wrkptr valptr comptr
mov WRK, PTRWORD [_SP+su_stack.wrk] ; WRK = wrkptr mov WRK, PTRWORD [_SP+su_stack.wrk] ; WRK = wrkptr
add WRK, su_voice.size ; move to next voice add WRK, su_voice.size ; move to next voice
mov PTRWORD [_SP+su_stack.wrk], WRK ; update stack mov PTRWORD [_SP+su_stack.wrk], WRK ; update stack