CLOCKMNTFOR`CLOCKMNTZ80pCLOCKMNTCOMAre you tired of having to manually change the year on your Kenmore clock every January 1st, or fix the day-of-the-week after the 29th of February? CLOCKMNT eliminates both these annoyances. All you have to do is run it when you start up your system, or just after midnight each day on your BBS. The base address of the clock may be changed as required. Version 1.1 runs independently of DOS. See CLOCKMNT.Z80 for details.  TITLE CLOCKMNT ; Version 1.1 ; by Steve Dresser ; 01/30/92 ; ; For use with Kenmore real-time clock and ZS/ZdDOS ; ; Gets current date directly from the clock registers. ; Compares current month to month of the previous run, and ; increments the year register if current month is less. ; Saves month in unused latch (base address of chip + 00FH) ; for future reference. ; Computes day-of-week for current date and ; sets the Kenmore's day-of-week register. ; ;=============================================================== EXTRN WDAY0 ; Convert BCD date to weekday (0-6) .REQUEST ZSLIB,SYSLIB ; CLOCK EQU 0E0H ; Base address of Kenmore RTC WEEK EQU CLOCK+5 ; Day-of-week stored here DAY EQU CLOCK+6 ; Day-of-month stored here MONTH EQU CLOCK+7 ; Month stored here YEAR EQU CLOCK+9 ; Year stored here PRVMON EQU CLOCK+0FH ; Month on last clock access CLOCKMNT: LD (STACK),SP ; Save stack pointer LD SP,STACK ; SP points to new stack IN A,(PRVMON) ; Month saved at last run LD B,A ; Save it in B IN A,(MONTH) ; = Current Month OUT (PRVMON),A ; Update previous month latch CP B ; Is Current < Previous? JR NC,SETWKDAY ; If not, don't change the year IN A,(YEAR) ; = Year. ADD A,1 ; Bump it up DAA ; Adjust for packed BCD. OUT (YEAR),A ; Store Year in chip. SETWKDAY: LD HL,DATTIM ; ADDR DATE/TIME STRING PUSH HL ; Save on stack LD C,YEAR ; Point to port addr of year INI ; Read port and bump HL LD BC,256*2+MONTH ; B=2, C to address of month RDLOOP: INI ; Read data and increment HL DEC BC ; Decrement C, flags unchanged JR NZ,RDLOOP ; Do until B = 0 POP HL ; Point to start of DATTIM CALL WDAY0 ; Put number of weekday in A OR A ; Set Z-flag if 0 JR NZ,SET ; Don't change it if not 0 ADD A,7 ; Change Saturday to 7 SET: OUT (WEEK),A ; Set weekday LD SP,(STACK) ; Get old stack RET DSEG DATTIM: DS 6 ; Date/time storage DS 48 ; Stack area STACK: DS 2 ; Value of stack ptr saved here END s%1%G0'! 8 {%I}'~ͧ#~#N#!N(0dG>m< # y8#A͡͡o$W_z;;;BK!>jB0 ?j=