
181
A routine to increment the minute counter should process both memory locations. A program for that,
using DA A instruction, may be developed as follows.
; Program to update the BCD minute (and hour, if necessary) counter of a clock.
UPCLK: MOV A, 30H ; old BCD minute count in A
ADD A, #01H ; increment it by one
DA A ; adjust for BCD increment
MOV 30H, A ; update minute count
CJNE A, #60H, GOBAK ; yet to complete an hour
MOV 30H, #00H ; 1 h over, set minute as 00
MOV A, 31H ; get hour count in A
ADD A, #01H ; increment hour by one
DA A ; adjust for BCD increment
MOV 31H, A ; store back hour ...