Decrementing unsigned int with PIC18F assembly language?

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
Say I have an unsigned in defined in C.

Rich (BB code):
unsigned int;

_asm  


_endasm
How do I decrement it in PIC18F assembler? I know I can use DCFSNZ to decrement a file register but that is only 8 bit correct? Do I need to move the lo and hi bytes into 2, 8 bit registers?
 

JDT

Joined Feb 12, 2009
657
I don't know the 18F assembler commands but basically for a two byte decrement:-

Test the low byte for zero.
If it is zero, decrement the high byte, otherwise skip.
Decrement the low byte.
 
Top