.ENABL LC .TITLE STIME Set Calendar Clock Date/Time .MCALL .DATE,.EXIT,.GTIM .IDENT /1.1/ .GLOBL CVTTIM,RTIME,WTIME ; ; NOTES ; ; o This program does not change the calendar clock's day of ; the week parameter; you may add code to solicit or compute ; the day of the week. ; o If no date has been set in RT, the calendar clock's ; date information will be left unchanged. ; o Documentation for RTIME and WTIME is in CCSUBS.MAC. ; ; ; If your board has non-standard clock addresses, you should ; change the next line ... ; $CLOK == 177300 ; 1st of 16 calendar clock registers ; ; If your board has a watchdog timer, you should disable the ; next line, and enable the one following it; if your watchdog ; reset register is at a non-standard address, change "177342" to ; the appropriate value ... ; $WDOG == 177560 ; Read a "safe" address ;$WDOG == 177342 ; Reset the w'dog by reading this address ; ; If your board does not have CMOS RAM, the following lines ; can be left as they are; if it has CMOS RAM with standard ; addressing, they can be left as they are; if it has CMOS RAM ; with non-standard addressing, you must change the following ; lines ... ; RAM = 166000 ; 1st location of CMOS RAM $YEAR == RAM + 776 ; Two parameters used $INCY == RAM + 772 ; to maintain the year in 58174s $PAGE == 177342 ; CMOS RAM page select register BEGIN: MOV #ARGWTI,R5 ; Get current date/time from calendar clock, JSR PC,RTIME ; for day of week, and in case RT doesn't ; have date set. MOV #TICKS,R1 ; Get time into TICKS .GTIM #AREA,R1 ; as ticks past midnight MOV #ARGCVT,R5 ; Convert 2-word time to binary JSR PC,CVTTIM ; and store it in DATIME array .DATE ; Get date in R0 MOV R0,R2 ; Save the encrypted information BEQ 10$ ; If EQ "No Date" in RT BIC #^C37,R2 ; Clear all but year ADD #72.,R2 ; Add RT's assinine offset MOV R0,R1 ; ASL R1 ; Align bits ASL R1 ; ASL R1 ; SWAB R1 ; BIC #^C37,R1 ; Clear all but day SWAB R0 ; Align bits ASR R0 ; ASR R0 ; BIC #^C37,R0 ; Clear all but month MOV R0,DATIME+2 ; Store month, MOV R1,DATIME+4 ; day, and MOV R2,DATIME ; year in DATIME array 10$: MOV #ARGWTI,R5 ; R5 --> argument list JSR PC,WTIME ; Call WTIME routine to set calendar clock .EXIT AREA: .BLKW 2 TICKS: .BLKW 2 ARGCVT: .BYTE 5,0 .WORD TICKS .WORD DATIME+6 .WORD DATIME+10 .WORD DATIME+12 .WORD DATIME+14 ARGWTI: .BYTE 1,0 .WORD DATIME DATIME: .BLKW 9. .END BEGIN