Question about PASM 'MOV' instruction and 'WC' effect
Cabbage
Posts: 37
in Propeller 1
Consider the two following instructions...
mov AAA, #10 WC
mov BBB, #511 WC
The Manual (v1.2) states on page 311:
If the WC effect is specified, the C flag is set to Value’s MSB.
What does this mean for Immediate values? To my mind it is ambiguous. It might mean that bit [8] is copied into the C flag (because immediate values are only 9 bits long). Or else it could mean that the immediate value is implicitly extended to 32 bits and then bit [31] is copied into the C flag. But is that extension signed or unsigned?
After instruction AAA, what is C? I think probably 0.
After instruction BBB, what is C?
When the source is NOT an immediate value this is of course not ambiguous at all.
Comments
None of the instructions behave differently when given an immediate. So MOV with immediate always clears C.
Only when WC is specified.
-Phil
Okay, good to know.
I'm using this to try to reduce the number of instructions that a serial port transmitter uses...
...where "UI_SER_BIT_TIME" is a value that represents the Baud rate.
Thank you both.
Also, just FYI, because the manual doesn't tell you about it, MOVS/MOVD/MOVI and JMP(RET) produce the same C value as a CMP would
@Cabbage
If you are trying to reduce instructions, you should use the smart pin uart.
Also, you can replace
rcl ui_ser_byteTX, #1 'C flag (0, see MOV above) is rotated into the LSB, acts as START BIT
with
shl ui_ser_byteTX, #1 WC '0 is shifted into the LSB, acts as START BIT, C flag =0
It's the P1 he's talking about: no smart pins.
-Phil
That's what I get for opening tabs with both P1 & P2 threads
I could try clipping off a couple of P2 IO pins and gluing them to the end of the P1. I'm pretty sure that would work.
edit: nope
You're right about the SHL instead of the RCL of course. I don't know what I was thinking when I wrote that.
Perhaps something like "Hmm, I need to shift in a zero from somewhere... but where? Zeroes are so hard to find these days aren't they?"
im a stupid