ALTD + ALTS on the same instruction?
ManAtWork
Posts: 2,298
in Propeller 2
I'm sure this question has been asked before, but I don't find any clues...
Say, I want to set a field of pins to a field of values. Can I do something like this?
mov axis,#0
rep @RegLoop,#NumAxes ' output all pin states
altd axis,#freq
alts axis,#pinStp0
wypin freq,pinStp0
add axis,#1
RegLoop
I mean, is the first ALTD smart enough to recognize that I want to modify D of the wypin instruction and not the ALTS instruction? If not, how could I solve this?

Comments
nope, can't do it. In that example, ALTD will modify the D slot of ALTS.
The easy fix is to grab the S value separately with ALTS+MOV (+1 insn).
But since you're doing a loop, you can use ALTI instead and it will actually have less instructions in the loop
It'd look something like (untested)
sets axis,#freq setd axis,#pinStp0 rep @RegLoop,#NumAxes ' output all pin states alti axis, #%000_111_111 ' substitute S/D from axis and increment both wypin 0-0,0-0 RegLoopAh yes, thank you very much! I knew I have read something about ALTI, lately. But it was somehow to complex to really stay in my memory. Good to have that external memory = forum
I never remember the magic values it needs to work, but https://p2docs.github.io/indir.html#alti has them all written down