Author Topic: FV-1 Pot Skp Routine Issues  (Read 997 times)

Zerikin

FV-1 Pot Skp Routine Issues
« on: June 04, 2018, 10:43:56 AM »
I've been working on a tremolo program with a pot to select the wave using skp commands. It works fine except for one baffling issue. The ramp waves click, but only if they are selected with a pot. If I drop all the code but one of the ramp waves it functions as expected, if I make if the final jump (jumping after a clear with ZRO) it works. In the code below RAMP_DOWN has weird noise when flashed but RAMP_UP works fine. I can switch them in the select code and it would be the opposite. Any idea what the heck is going on? Maybe it's a hardware issue on my end? Can someone flash this program and see if they have the same issue?

Pot0 is rate
Pot1 is depth
Pot2 is wave select by 20% of the amount with
0: Sine(works)
1: Ramp down(clicky)
2: Triangle(works)
3/4: Ramp up(works)

Whichever ramp routine get's the jump at 3 works. I've tried using clr after to make sure that wasn't the issue, as well as altering the skp logic to skp over a skp for it and do a ZRO skp instead for 1 and it doesn't change it.

Code: [Select]
; Tremolo.spcd
; null
; Pot 0:
; Pot 1:
; Pot 2:
;
;
; ----------------------------
;------ Input
;------ Pot 0
;------ Pot 1
;------ Pot 2
;------ Tremolo
SKP RUN ,12
SOF 0.0000000000,-1.0000000000
SOF -1.0000000000,0.0000000000
WRAX REG2,1.0000000000
WRAX REG3,1.0000000000
WRAX REG4,0.0000000000
OR $00000100
WRAX REG1,0.0000000000
OR $00030000
WRAX REG5,0.0000000000
WLDS 0,51,32767
WLDR 0, 10, 4096
WLDR 1, 10, 4096
LDAX REG1
RDAX POT0,1.0000000000
SOF 1.0000000000,0.0010000000
WRAX SIN0_RATE,1.0000000000
WRAX RMP0_RATE,0.5000000000
WRAX RMP1_RATE,0.0000000000
RDAX POT1,-1.0000000000
WRAX REG3,1.0000000000
SOF 1.0000000000,0.9990000000
WRAX REG7,0.0000000000
RDAX POT2,1.0000000000
RDFX REG8,0.0100000000
WRAX REG8,1.0000000000
SOF 1.0000000000,-0.2000000000
SKP NEG,6
SOF 1.0000000000,-0.2000000000
SKP NEG,29
SOF 1.0000000000,-0.2000000000
SKP NEG,8
CLR
SKP ZRO,15
CHO RDAL,0
SOF 0.5000000000,0.5000000000
MULX REG3
RDAX REG4,1.0000000000
WRAX REG2,0.0000000000
SKP ZRO,53
CHO RDAL,3
SOF 1.0000000000,-0.2500000000
ABSA
SOF -2.0000000000,0.0000000000
SOF -1.9990000000,0.0000000000
MULX REG3
RDAX REG4,1.0000000000
WRAX REG2,0.0000000000
SKP ZRO,44
CHO RDAL,2
SOF 1.9990000000,0.0000000000
WRAX REG6,1.0000000000
SOF -1.0000000000,0.0200000000
SKP GEZ,24
LDAX REG6
MULX REG3
RDAX REG4,1.0000000000
WRAX REG2,0.0000000000
SKP ZRO,34
CHO RDAL,2
SOF 1.0000000000,-0.5000000000
ABSA
SOF 1.9990000000,0.0000000000
WRAX REG6,1.0000000000
SOF 1.0000000000,-0.0200000000
SKP NEG,20
LDAX REG6
MULX REG3
RDAX REG4,1.0000000000
WRAX REG2,0.0000000000
SKP ZRO,22
LDAX REG3
SOF 1.0000000000,0.5000000000
WRAX REG3,0.0000000000
WRAX REG7,0.0000000000
CHO RDAL,0
RDAX REG3,-2.0000000000
SKP GEZ,8
LDAX REG2
RDAX REG5,-1.0000000000
WRAX REG2,1.0000000000
RDAX REG7,-1.0000000000
SKP GEZ,10
LDAX REG7
WRAX REG2,0.0000000000
SKP ZRO,7
LDAX REG2
RDAX REG5,1.0000000000
WRAX REG2,1.0000000000
SOF 1.0000000000,-1.0000000000
SKP NEG,2
LDAX REG4
WRAX REG2,0.0000000000
LDAX ADCL
SOF 1.9990000000,0.0000000000
MULX REG2
WRAX REG0,0.0000000000
;------ Output
RDAX REG0,1.0000000000
WRAX DACL,1.0000000000
WRAX DACR,0.0000000000

Digital Larry

Re: FV-1 Pot Skp Routine Issues
« Reply #1 on: June 04, 2018, 10:28:35 PM »
Could you highlight the section that doesn't work?  Just mark it off with e.g.

;================== THIS PART DOESN'T WORK START
...
;================== THIS PART DOESN'T WORK END

too hard to trace otherwise since the code window doesn't show it all at once.
Digital Larry
DSP tinkerer and former transistor twister

Zerikin

Re: FV-1 Pot Skp Routine Issues
« Reply #2 on: June 05, 2018, 12:11:57 AM »
Added some comments to this one, most of them got eaten when I exported from spincad and I forgot to add them back.

Code: [Select]
; Tremolo.spcd
; null
; Pot 0:
; Pot 1:
; Pot 2:
;
;
; ----------------------------
;------ Input
;------ Pot 0
;------ Pot 1
;------ Pot 2
;------ Tremolo
SKP RUN ,12
SOF 0.0000000000,-1.0000000000
SOF -1.0000000000,0.0000000000
WRAX REG2,1.0000000000
WRAX REG3,1.0000000000
WRAX REG4,0.0000000000
OR $00000100
WRAX REG1,0.0000000000
OR $00030000
WRAX REG5,0.0000000000
WLDS 0,51,32767
WLDR 0, 10, 4096
WLDR 1, 10, 4096
; Read POT0 and set LFO rates
LDAX REG1
RDAX POT0,1.0000000000
SOF 1.0000000000,0.0010000000
WRAX SIN0_RATE,1.0000000000
WRAX RMP0_RATE,0.5000000000
WRAX RMP1_RATE,0.0000000000
; Read POT and set depth
RDAX POT1,-1.0000000000
WRAX REG3,1.0000000000
SOF 1.0000000000,0.9990000000
WRAX REG7,0.0000000000
; Read POT2 to select wave
RDAX POT2,1.0000000000
RDFX REG8,0.0100000000
WRAX REG8,1.0000000000
SOF 1.0000000000,-0.2000000000
SKP NEG,6 ; Sine
SOF 1.0000000000,-0.2000000000
; #######################################################################
; Here is where things get weird, this wave form pops when selected here
SKP NEG,29 ; Ramp Down
SOF 1.0000000000,-0.2000000000
SKP NEG,8 ; Triangle
; #######################################################################
; But if we do it here it works
CLR
SKP ZRO,15 ; Ramp Up

; Sine Tremolo
CHO RDAL,0
SOF 0.5000000000,0.5000000000
MULX REG3
RDAX REG4,1.0000000000
WRAX REG2,0.0000000000
SKP ZRO,53
; Triangle Tremolo
CHO RDAL,3
SOF 1.0000000000,-0.2500000000
ABSA
SOF -2.0000000000,0.0000000000
SOF -1.9990000000,0.0000000000
MULX REG3
RDAX REG4,1.0000000000
WRAX REG2,0.0000000000
SKP ZRO,44

; Ramp Up Tremolo
CHO RDAL,2
SOF 1.9990000000,0.0000000000
WRAX REG6,1.0000000000
SOF -1.0000000000,0.0200000000
SKP GEZ,24
LDAX REG6
MULX REG3
RDAX REG4,1.0000000000
WRAX REG2,0.0000000000
SKP ZRO,34

; Ramp Down Tremolo
CHO RDAL,2
SOF 1.0000000000,-0.5000000000
ABSA
SOF 1.9990000000,0.0000000000
SOF 1.0000000000,-0.0200000000
SKP NEG,20
LDAX REG6
MULX REG3
RDAX REG4,1.0000000000
WRAX REG2,0.0000000000
SKP ZRO,22

; Square Wave Tremolo
LDAX REG3
SOF 1.0000000000,0.5000000000
WRAX REG3,0.0000000000
WRAX REG7,0.0000000000
CHO RDAL,0
RDAX REG3,-2.0000000000
SKP GEZ,8

; Fade out
LDAX REG2
RDAX REG5,-1.0000000000
WRAX REG2,1.0000000000
RDAX REG7,-1.0000000000
SKP GEZ,10
LDAX REG7
WRAX REG2,0.0000000000
SKP ZRO,7

; Fade in
LDAX REG2
RDAX REG5,1.0000000000
WRAX REG2,1.0000000000
SOF 1.0000000000,-1.0000000000
SKP NEG,2
LDAX REG4
WRAX REG2,0.0000000000

; Input
LDAX ADCL
SOF 1.9990000000,0.0000000000
MULX REG2
WRAX REG0,0.0000000000
;------ Output
RDAX REG0,1.0000000000
WRAX DACL,1.0000000000
WRAX DACR,0.0000000000

edit: Removed extraneous AC
« Last Edit: June 06, 2018, 06:05:06 PM by Zerikin »

Digital Larry

Re: FV-1 Pot Skp Routine Issues
« Reply #3 on: June 06, 2018, 10:14:58 AM »
Only thing I can say in general is that when you do a SKP you need to be mighty sure of the state of ACC when you arrive at your destination.  So most skip blocks probably want to start with a CLR to make sure ACC is zero.  UNLESS you got there by SKP ZRO.
Digital Larry
DSP tinkerer and former transistor twister

Zerikin

Re: FV-1 Pot Skp Routine Issues
« Reply #4 on: June 06, 2018, 03:28:32 PM »
I tried adding an extra clr in front after the labels, it didn't seem to do anything. All of the skp are followed by ldax or cho rdal commands, neither of which should need a clr before. Not had time to try and debug it more yet.

octfrank

Re: FV-1 Pot Skp Routine Issues
« Reply #5 on: June 06, 2018, 04:40:18 PM »
I tried the first code and it seems to work for me, ramp down is faster than other waves but sounds smooth at a slow setting and high depth. No clicks. Note that it does get fast very quickly so I only used it at the slow setting, fast ones were just to fast to hear any issues.

Second code you posted with comments fails to assemble and when I fixed the assembly error does not seem to operate properly.
Error in line 90: SOF 1.9990000000,0.0000000000AC   <--- "AC" at end

Can you post a sound file showing the "clicky" sound?
Frank Thomson
Experimental Noize