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 status register and how can he check that we are going in negative numbers?

For example, in this code

  MOVLW b'00000000 '; The value in W is 0 SUBLW b'00000001 ';   

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

  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)   

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> results carry zero positive 1 zero zero 1 negative 0



Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -