Professional Documents
Culture Documents
Decrementing A 24-Bit Counter
Decrementing A 24-Bit Counter
AINSHAMS UNIVERSITY
FACULTY OF ENGINEERING
Assignment 2
Decrementing a 24-bit counter
Supervised By: Prof. Dr. Ayman Wahba
By:Ahmed Abd-Elshakour Allam
Solution
Movf COUNTL,F ; Set Z if lower byte=0
Btfsc STATUS,Z ; if so, skip decrementing COUNTL
Goto L_EQ_ZERO
Decf COUNTL,F
Goto END
L_EQ_ZERO:
Movf COUNTM,F ;Set Z if medium byte=0
Btfsc STATUS,Z
Decf COUNTH,F
Decf COUNTM,F
END: