Quote Originally Posted by richard View Post
mike would you like to provide some pbp code that demonstrates use of status register following pbp addition or subtraction


the status reg here is not in any way influenced by the subtraction result

i = byte

Code:
j=8
i=6
while j
status=1
i=i-1
s=status
debug 13,10,"status ",bin8 s ,"  i ",    dec i
j=j-1
wend
result

status 00011001 i 5
status 00011001 i 4
status 00011001 i 3
status 00011001 i 2
status 00011001 i 1
status 00011101 i 0
status 00011001 i 255
status 00011001 i 254
You don't state what PIC this is for, so I randomly grabbed the data sheet for a PIC16F1824; STATUS Register 3-1, page 24.

STATUS <7:5> = Unimplemented, read as 0
STATUS.4 = TO: Time-Out bit
STATUS.3 = PD: Power-Down bit
STATUS.2 = Z: Zero bit
STATUS.1 = DC: Digit Carry
STATUS.0 = C: Carry

You can see when you reached zero the STATUS.Z reflected that. However, you alter the STATUS Register in your code. About the only thing you can change is the C bit. Delete the "status=1" line and try again.