
;
;
; RTC variables
;
        RSEG    DATA_SEG
RTC_DATA:
RTC_SECOND:
        DS      1                   ; seconds value
RTC_MINUTE:
        DS      1                   ; minutes value
RTC_HOUR:
        DS      1                   ; hour value
;                                                           
;
; manage HH:MM:SS time clock counter. This counts minutes, seconds and
; hours in the normal manner. 
;
RTC_INC:
        MOV     R0, #RTC_DATA       ; point at the RTC data block
        INC     @R0                 ; increment the seconds value       
        CJNE    @R0, #60, $+3
        JC      RTC_DONE            ; exit if sec <= 59
        MOV     @R0, #0             ; reset seconds to 00
        INC     R0
        INC     @R0                 ; increment the minutes value       
        CJNE    @R0, #60, $+3
        JC      RTC_DONE            ; exit if min <= 59
        MOV     @R0, #0             ; reset minutes to 00
        INC     R0
        INC     @R0                 ; increment the hours value
        CJNE    @R0, #24, $+3
        JC      RTC_DONE            ; exit if hour <= 23
        MOV     @R0, #0             ; reset hours to 00
RTC_DONE:
        ....
