;**************************************************************************** ; B5C-QX11.INS ( QX-10 RTC clock code for BYE5xx) ; ; 09/02/85 - Fixed ADRTBL so year is in right spot ; Norm Gregory, `downspout' 206-325-1325 ; 08/20/85 - Renamed to B5C-QX10 and updated for BYE501 ; Wayne Masters, Potpourri, 408-378-7474 ; ; This is to be inserted in the BYE5 code right after ; IF TIMEON label following the machine insert. ; ;**************************************************************************** ; BUSY EQU 80H ;Mask to test for clock busy condition CLKADR EQU 3DH ;QX-10 clock command register port CLKDAT EQU 3CH ;QX-10 clock data register port STBYTE EQU 0AH ;Clock memory addr to check for clock busy CENTURY EQU 019H ;Hey, it's the 1900's (for a while). ; TIME: CALL CREAD ; read data from clock chip LDA TBFR+3 STA RTCBUF+0 ; Hour LDA TBFR+4 STA RTCBUF+1 ; Minute LDA TBFR+0 STA RTCBUF+2 ; Second MVI A,CENTURY STA RTCBUF+3 ; Century LDA TBFR+5 STA RTCBUF+4 ; Year LDA TBFR+1 STA RTCBUF+5 ; Month LDA TBFR+2 STA RTCBUF+6 ; Day LDA RTCBUF ; Pick up BCD HH CALL BCDBIN ; And convert to binary STA CCHOUR ; For BYE5 LDA RTCBUF+1 ; BCD MM CALL BCDBIN STA CCMIN ; To binary for BYE5 RET ; And return (for now..) ; ;========= ; ; CREAD: gets date/time directly from the LSI 46818 chip. ; (doing it this way rather than through the QX-10 BIOS ; call makes this overlay independent of the version ; of Epson's CPM (A or B) being used.) ; ; Time/Date buffer consists of 6 bytes of packed BCD-encoded information ; located in buffer TBFR. Time/Date buffer is of the following format: ; ; TBFR + 0 = year ; + 1 = month ; + 2 = day ; + 3 = hour ; + 4 = minute ; + 5 = second ; CREAD: CALL CLKBSY ;Wait till clock is idle LXI H,TBFR ;Point to time/date buffer LXI D,ADRTBL ;Point to clock memory data address table MVI B,6 ;Number of data items to read TDLOOP: LDAX D ;Get next clock memory data address OUT CLKADR ;and send addr to clock port IN CLKDAT ;Read clock data MOV M,A ;and store in time/date buffer INX H ;Set next time/date buffer position INX D ;Set next clock memory data address DCR B ;One less data item JNZ TDLOOP ; - continue read till done RET ; CLKBSY: ;Routine to wait till clock is idle MVI A,STBYTE ;Check if clock is updating OUT CLKADR ;Send address IN CLKDAT ;Read clock ANI BUSY ;Test bit 7 JNZ CLKBSY ;Jump if clock busy RET ; TBFR: DS 6 ;Real-time clock buffer - see above ADRTBL: DB 0,8,7,4,2,9 ;Clock memory addr's for sec,mo,da,hr,min,yr ;