VAR long speed, dira_, ctrb_, cnt_ PUB start(pos_pin, neg_pin) dira_ |= (|< pos_pin + |< neg_pin) ctrb_ := $1C000000 + (pos_pin & $3F) + ((neg_pin & $3F) << 9) speed := $01 cnt_ := clkfreq / 20_000 return cognew(@entry, @speed) PUB change(parameter) speed := parameter DAT entry org call #initial jmp #loop retadd long :wait :wait jmpret retadd,#loop jmpret retadd,#loop jmp #:wait ' ##### Vocal Tract Job ##### loop waitcnt cnt_value,cnt_ticks 'wait for sample period mov t1,x 'update duty cycle output for pin driving add t1,h80000000 mov frqb,t1 mov t2,par rdlong t1,t2 shl t1,#24 add x,t1 'add to x jmp retadd 'run segment of frame handler, return to loop '##### Initialize ##### initial mov reserves,#0 'zero all reserved data add initial,d0 djnz clear_cnt,#initial mov t1,par add t1,#4 rdlong dira,t1 add t1,#4 rdlong ctrb,t1 add t1,#4 rdlong cnt_ticks,t1 mov cnt_value,cnt add cnt_value,cnt_ticks initial_ret ret h80000000 long $80000000 'miscellaneous constants greater than 9 bits d0 long $00000200 'destination/source field increments clear_cnt long $1F0 - reserves 'number of reserved registers to clear on startup reserves 'reserved registers that get cleared on startup cnt_ticks res 1 cnt_value res 1 x res 1 t1 res 1 t2 res 1