Understanding vocal tract frame handler code
Eternal-student
Posts: 7
Hi all,
I've been going through the vocaltract code and trying to understand the frame handler routine (included below). I'm a bit of a newbie with the propeller machine code but I'm starting to get most of it now.
I understand that the jmpret statements are used to split processing cycles between the vocal tract loop and the frame handler loop (as per the jmpret manual entry - I hope I'm right about this). However, I'm having difficulty understanding the reference to the cycles in the comments next to the instructions. Do they refer to the number of cycles that are used before the next vocal tract loop is executed? Why are there two values with or/ in between? And how are the number of cycles calculated? I thought each statement used 4 cycles for each statement?
If anyone can offer any guidance, I would appreciate it very much.
Thanks,
Stephen
I've been going through the vocaltract code and trying to understand the frame handler routine (included below). I'm a bit of a newbie with the propeller machine code but I'm starting to get most of it now.
I understand that the jmpret statements are used to split processing cycles between the vocal tract loop and the frame handler loop (as per the jmpret manual entry - I hope I'm right about this). However, I'm having difficulty understanding the reference to the cycles in the comments next to the instructions. Do they refer to the number of cycles that are used before the next vocal tract loop is executed? Why are there two values with or/ in between? And how are the number of cycles calculated? I thought each statement used 4 cycles for each statement?
If anyone can offer any guidance, I would appreciate it very much.
Thanks,
Stephen
:ret long :wait 'pointer to next frame handler routine :wait jmpret :ret,#loop '(6 or 17.5 cycles) mov frame_ptr,par 'check for next frame add frame_ptr,#8*4 'point past miscellaneous data add frame_ptr,frame_index 'point to start of frame rdlong step_size,frame_ptr 'get stepsize and step_size,h00FFFFFF wz 'isolate stepsize and check if not 0 if_nz jmp #:next 'if not 0, next frame ready mov :final1,:finali 'no frame ready, ready to finalize parameters mov frame_cnt,#13 'iterate aa..ff :final jmpret :ret,#loop '(13.5 or 4 cycles) :final1 mov par_curr,par_next 'current parameter = next parameter add :final1,d0s0 'update pointers djnz frame_cnt,#:final 'another parameter? jmp #:wait 'check for next frame :next add step_size,#1 'next frame ready, insure accurate accumulation mov step_acc,step_size 'initialize step accumulator movs :set1,#par_next 'ready to get parameters and steps for aa..ff movd :set2,#par_curr movd :set3,#par_next movd :set4,#par_step add frame_ptr,#3 'point to first parameter mov frame_cnt,#13 'iterate aa..ff :set jmpret :ret,#loop '(19.5 or 46.5 cycles) rdbyte t1,frame_ptr 'get new parameter shl t1,#24 'msb justify :set1 mov t2,par_next 'get next parameter :set2 mov par_curr,t2 'current parameter = next parameter :set3 mov par_next,t1 'next parameter = new parameter sub t1,t2 wc 'get next-current delta with sign in c negc t1,t1 'make delta absolute (by c, not msb) rcl vscl,#1 wz, nr 'save sign into nz (vscl unaffected) mov t2,#8 'multiply delta by step size :mult shl t1,#1 wc if_c add t1,step_size djnz t2,#:mult :set4 negnz par_step,t1 'set signed step add :set1,#1 'update pointers for next parameter+step add :set2,d0 add :set3,d0 add :set4,d0 add frame_ptr,#1 djnz frame_cnt,#:set 'another parameter? :stepframe jmpret :ret,#loop '(47.5 or 8 cycles) mov :step1,:stepi 'ready to step parameters mov frame_cnt,#13 'iterate aa..ff :step jmpret :ret,#loop '(3 or 4 cycles) :step1 add par_curr,par_step 'step parameter add :step1,d0s0 'update pointers for next parameter+step djnz frame_cnt,#:step 'another parameter? add step_acc,step_size 'accumulate frame steps test step_acc,h01000000 wc 'check for frame steps done if_nc jmp #:stepframe 'another frame step? sub frame_ptr,#frame_bytes 'zero stepsize in frame to signal frame done wrlong vscl,frame_ptr add frame_index,#frame_bytes'point to next frame and frame_index,#frame_buffer_bytes - 1 jmp #:wait 'check for next frame :finali mov par_curr,par_next 'instruction used to finalize parameters :stepi add par_curr,par_step 'instruction used to step parameters
Comments
-Phil
-Phil
Will it only be Chip who could answer the question definitively?
Probably. That said, don't get stuck on what might just be an ambiguous comment. Get creative with your own ideas.
Yours perseveringly,
Stephen