For example, program made calculations and need to go to next part,
I am trying "SKP run|gez|neg|zro|zrc , label" for unconditional jump, but program continued.
Why?
I used "SKP run|gez , label" and it woiked fine for this subrotinue, but i want to understand what was wrong.
unconditional SKP
Moderator: frank
Most likely the combination of flags makes no sense to the logic in the instruction decoder. "SKP neg|gez" is illogical to a hardware decoder since we are using the sign bit to decide. "SKP neg|gez" is saying "skip if negative and continue if positive or skip if positive and continue if negative" so which do we do? Do we skip or continue as both states are satisfied? Seems the way I designed it we default to continue.
Frank Thomson
Experimental Noize
Experimental Noize
Yes but we are talking assembly here which is far closer to the hardware than C, a simple logical OR in C may map to multiple assembly instructions not just one.
One thing to consider is if you really need to test for both, when I've needed an unconditional SKP I could usually take advantage of knowing in advance that the value in the ACC was going to be positive or negative then use that as the skip flag. Other times the first thing I did at the label point was clear the acc so i just moved that clearing to just before the skp and did a skp zro or skp gez.
One thing to consider is if you really need to test for both, when I've needed an unconditional SKP I could usually take advantage of knowing in advance that the value in the ACC was going to be positive or negative then use that as the skip flag. Other times the first thing I did at the label point was clear the acc so i just moved that clearing to just before the skp and did a skp zro or skp gez.
Frank Thomson
Experimental Noize
Experimental Noize
Re: unconditional SKP
From my limited testing,
skp 0,target
appears to perform an unconditional skip to target. The value of ACC has no bearing on the outcome, so you can save an instruction - or more importantly: preserve ACC across an unconditional skip.
skp 0,target
appears to perform an unconditional skip to target. The value of ACC has no bearing on the outcome, so you can save an instruction - or more importantly: preserve ACC across an unconditional skip.
Re: unconditional SKP
no flags is testing, but it working?
Great idea, thank you!
Great idea, thank you!
Re: unconditional SKP
I wish this was better documented, I can't believe I went so long without seeing this! It really makes my life easier
I was a bit nervous about using this so i wrote some slightly silly test code to make sure it really does skip, and really does preserve the ACC value. Seems to work perfectly!
I was a bit nervous about using this so i wrote some slightly silly test code to make sure it really does skip, and really does preserve the ACC value. Seems to work perfectly!
Code: Select all
; if skp 0 really skips unconditionally, then should skip regardless of pot value
; if it skips, then input is read to output
; if it doesn't skip, then 0.99 is loaded and we skip to end, with no output
; to confirm that acc is maintained, we multiply input by a rescaled pot1 to control volume
equ outputmult reg1
ldax pot1 ; load pot1, values range 0->1
sof 1,-0.5 ; scale it to -0.5 -> 0.5 to include negative values
skp 0,OUTPUT ; skip to output section regardless of value
skp zro,END ; these are all just to know for sure that this code isn't read
skp gez,END
skp neg,END
sof 0,0.99
skp gez,END
OUTPUT:
sof 0.8,0.6 ; scale from -0.5 -> 0.5 to 0.2 -> 1. this way never totally mute
wrax outputmult,0
ldax adcl
mulx outputmult ; multiply input by saved pot value
WRAX dacl,0
END:
Re: unconditional SKP
great finding! I will use it for sure.