I am trying to learn assembler so I can incorporate a bit of assembler code in my C code.
I wrote a simple loop to loop through a 16bit word:
I quickly realized there is a flaw in my code. It works fine if delay_ms is 256 or greater but if it is 255 or less, the value in decfsz delay_ms+1 gets decremented to FF . How do I test if FF is zero before decrementing it?
I wrote a simple loop to loop through a 16bit word:
Rich (BB code):
unsigned int delay_ms= 10;
void main()
{
_asm loop: decfsz delay_ms,1,1
goto loop
decfsz delay_ms+1,1,1
goto loop
_endasm
while(1);
}