Is there an ANDN equivalent in Spin2?
Alexander (Sandy) Hapgood
Posts: 360
in Propeller 2
In PASM, the ANDN instruction is quite handy for clearing individual bit(s) in a register. I can't find a similar function in Spin2. I'm thinking about how you would change the output of an individual pin from 1 to 0.
Sandy
Sandy
Comments
But for individual pins there are much better instructions now:
OUTH, OUTL sets the output High or Low
DIRH, DIRL sets the direction of the pin
DRVL, DRVH sets the direction and output with one instruction.
The parameter is direct the pin number, this works for all 64 pins, not only for Port A or B.
Andy
Here's a simple bit-bang RX UART that takes in the bits LSB first -- using bitc (C has the new bit) and putting it where it belongs means no mask is needed, and no byte clean-up is required after. Note, too, that the RX pin is directly sampled into C using testp -- again, no mask required for IO access.
Things like Pinhigh()
But maybe &NOT would work in Spin2?
As I become familiar with the P2 I'm learning that launching PASM code is not particularly hard so I can return to my usual methods.
Thanks for your input.
Sandy
With an org and end block.
Makes using assembly in Spin2 easy.
Inline PASM2 is my favorite thing about the P2. As Ray points out, it makes using small sections (that don't need to run in a cog) very easy. It also facilitates learning PASM2. I use this method for testing PASM2 instructions and code snippets:
Sandy
Thing is, you will rarely if ever need more than 128 longs. Less than 64 for most things you're going to launch into another cog. Starting with that and adjusting up and down depending on need is barely an issue.