waitpne/peq and carry flag
mirror
Posts: 322
The propeller manual states that for waitpne and waitpeq, wether the INA or INB port is read depends on the state of the carry flag. For the P8X32 this doesn't matter, as INA is always read. BUT, if I'm trying to write "future proof" assembly code, then is there a quick method to set/clear the carry flag?
The best I can come up with is two instructions (multiple variations) eg:
· mov t1,#0
· rcr t1,#1 wc
But that effectively turns waitpne and waitpeq into a 13+ clocks instruction on the new Propeller (if it has the same number of clocks).
Can I do better than this?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's not all that hard to count the number of grains of sand on the beach. The hardest part is making a start - after that it just takes time.·· Mirror - 15 May 2007
The best I can come up with is two instructions (multiple variations) eg:
· mov t1,#0
· rcr t1,#1 wc
But that effectively turns waitpne and waitpeq into a 13+ clocks instruction on the new Propeller (if it has the same number of clocks).
Can I do better than this?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's not all that hard to count the number of grains of sand on the beach. The hardest part is making a start - after that it just takes time.·· Mirror - 15 May 2007
Comments
Neither are very elegant though.
XOR t1, t1 wc
But hey, thanks for that, you could also eliminate the side effect by doing
XOR t1, t1 wc nr
Now I just need a single instruction way of setting the carry bit.
You're right though - not very elegant.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's not all that hard to count the number of grains of sand on the beach. The hardest part is making a start - after that it just takes time.·· Mirror - 15 May 2007
I forgot about the NR option. I've never found a use for it before. Given that, best to make it obvious the operands are irrelevant.
XOR 0,0 wc,nr
You could make it
XOR 0-0, 0-0 wc,nr
but perhaps it's better to reserve that convention for self modifying code.
EDIT: Perhaps this would this work?
SUBX 0,0 wc,nr
Post Edited (CardboardGuru) : 6/16/2007 11:10:01 AM GMT
:here SUB :here, true wc nr
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax Forums - If you're ready to learn, we're ready to help.
:here SHR :here, #1 WC NR
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax Forums - If you're ready to learn, we're ready to help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's not all that hard to count the number of grains of sand on the beach. The hardest part is making a start - after that it just takes time.·· Mirror - 15 May 2007
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
Second it is always useful to investigate the possibilities of a very new processor to the fullest to improve your understanding. Cf. the suggestions above for instructions for setting "C".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.