list p=pic16f73
#include "p16f73.inc
cblock 0x20 ; specify user register
r0,r1,r2,r3
endc
org 0x00 ; start location
movlw 0x0ff ; move h FF into register r0/1/2/&3
movwf r0
movlw 0x0ff
movwf r1
movlw 0x0ff
movwf r2
movlw 0x0ff
movwf r3
movf r0,w ; load r0 into W
addwf r2,1 ; add W to r2 and store back in r2
btfss status,0 ; test the Status Carry bit 0 to see if a carry
; has occured during the Add operation
goto x ; if no carry tgto x
movlw 0x01 ; there was a Carry so Add 1 to r1
addwf r1,1
x: Movf r1,w ; add r1 to r3
addwf r3,1
goto $ ; loop here, avoid the $ use a label loop goto loop
end