; B5C-COMP.INS Wayne Masters, Potpourri, (408) 378-7474 ; 08/08/85 ; ; Adapted from code supplied by Don E. Appleby, Bankers & Hackers #2 ;********************************************************************** ; ; Computime S-100 Clock/Calendar board Routine for BYE5 ; ; The Computime ComputerWatch uses the MSM5832 chip. ; ; The ComputerWatch is interfaced to the bus by two latching type ; output ports and one input tristate gate based at 080h. 081h is ; the address port and 082h is the data port. Address is selectable. ; ; Output of 10h to the data port raises the HOLD signal. Output of ; register number (+ offset of 20h) to address port sets the address ; of the register (0 to 12) to be read. Registers are 4 bits each ; SS MM HH W DD MM YY where W is day of week. Bits are 1, 2, 4 & 8. ; Registers begin with units, then tens in each pair. The hours ten ; digit includes option bits for 12/24 hour format and for AM/PM. Bit ; 4 is for AM/PM and bit 8 is used for 12/24 hour format determination. ; Bit 8 on is 24 hour and bit 4 on is PM. The days ten digit includes ; an option bit for leap year determination. If bit 4=0 there are ; 28 days in February, else there are 29 days in February. A 150 micro ; second delay is required after HOLD signal is raised. The HOLD ; signal must be lowered after reading to enable registersto continue ; counting. Days of week values are 0-6 where 0=Sunday. Write data ; plus offset of 16 to data port. Write the address plus 16 to the ; address port to raise the write signal. ; ; ;RTCBUF: Example ; DB 99H,99H,99H ;HH:MM:SS (BCD 24HR TIME) 00:00:00-23:59:59 ; DB 19H,85H,08H,06H ;YY/YY/MM/DD (BCD U.S. DATE) ; ; BYE5 saves and restores registers before/after calling TIME. ; CBASE EQU 128 ; Default i/o address of Computime board CPORT EQU CBASE + 2 ; Data port of clock board ; ; TIME: MVI A,5 ; Hours tens place CALL CREAD ANI 3 ; Strip 12/24, AM/PM bits MOV B,A MVI A,4 ; Hours units place CALL CREAD CALL SHFTIT STA RTCBUF ; Store in BYE5's rtcbuf CALL BCDBIN ; To binary STA CCHOUR ; For current clock hour ; MVI A,3 ; Now the tens of minutes CALL CREAD MOV B,A ; Save it at MVI A,2 ; Minute units CALL CREAD CALL SHFTIT STA RTCBUF+1 ; Minutes to rtcbuf CALL BCDBIN ; And binary STA CCMIN ; To current clock minute ; MVI A,1 ; Now the tens of seconds CALL CREAD MOV B,A MVI A,0 ; Now the ticks CALL SHFTIT STA RTCBUF+2 ; Seconds to rtcbuf ; ; Example: 07H,27H,85H MM/DD/YY (BCD U.S. DATE) ; MVI A,19H ; Century STA RTCBUF+3 ; To rtcbuf MVI A,12 ; Year tens CALL CREAD MOV B,A MVI A,11 ; Year units CALL CREAD CALL SHFTIT STA RTCBUF+4 MVI A,10 ; Month tens CALL CREAD MOV B,A MVI A,9 ; Month units CALL CREAD CALL SHFTIT STA RTCBUF+5 ; MVI A,8 ; Now the day tens CALL CREAD ANI 3 ; Strip leap year bit MOV B,A MVI A,7 ; Days units CALL CREAD CALL SHFTIT STA RTCBUF+6 RET ; And return (for now..) ; SHFTIT: PUSH PSW ; Save the units digit MOV A,B ; Recover the Tens RLC RLC RLC RLC ; Made it the MSN MOV B,A ; Save tens here POP PSW ; Get the units again ANI 00001111B ; And mask crap off ORA B ; OR in the tens place RET ; And return with it in CREAD: ORI 20H ; Add in the offset OUT CPORT NOP ; A short delay NOP IN CPORT ; Read the digit ORA A ; Set the flags RET ; ;********************************************************************** ; ; This is the end of the TIME insert for BYE500 and up. ; Replace the existing BYE5 TIME code with this insert. ; It SHOULD work fine... ; ;********************************************************************** ; END OF B5C-COMP.INS