PIC Assembly: Decrementing register with 0 -
If there is 0 in the register and I reduce some value from him, what will be the value inside the register? Will he call zero flag in the For example, in this code I am trying to reduce W register, what are the outcomes? The value must be subtracted in SUBLW W, be it zero or not. Course result will be But if W is zero, then it is minus zero Subtract from zero to zero, so zero flag will not start If you need to know if the value is negative or not, use both flag and zeros flag < pre> status register and how can he check that we are going in negative numbers?
MOVLW b'00000000 '; The value in W is 0 SUBLW b'00000001 ';
W = W - literal; If W = 0, then it is a denial if the type is signed, or wraps around if it is not unsigned.
Before: W = 00000000 - 1 after ____________________: w = 11111111 (-1)
results carry zero positive 1 zero zero 1 negative 0
Comments
Post a Comment