<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">;-----------------------------------------------------------------------
;
;	     ++++ Install your TIME routine here ++++
;
; If you have a clock and wish to use TIMEON or RSPEED, please replace
; the following code with your clock read code.  Use as many instruc-
; tions as you need but make sure you store binary, not BCD values in
; CCHOUR and CCMIN.  Use RTCBUF to store BCD clock data, then use BCDBIN
; to convert it to binary for CCHOUR and CCMIN.  See B5C-QXnn.INS as an
; example of handling a BCD clock, or B5C-SDS.INS for a BIOS interrupt-
; driven clock that runs in binary (hex).  All registers are saved before
; TIME is called, so you don't have to save them.
;
; NOTE... Set BCD2BIN to YES if your clock routine calls BCDBIN
;	  ** FOR THE EVE SPEECH SYNTHESIZER/CLOCK CALENDAR **
;
;
; (Replace the following code with your own clock subroutine)
;
;
;**************************************************************
;
; B5C-EVE.INS A TIME INSERT FOR BYE500 AND UP
;             NOTE:  THIS IS AN INSERT -- NOT AN OVERLAY
; ADAPTED BY ROBERT BAKER FOR THE COLECO ADAM
;
; ADAPTED FROM:
;   A CLOCK INSERT FOR BYE AND MBYE WRITTEN BY DONALD E ROTH, DENVER.
;
; B5C-OKI1.INS FOR BYE500 AND UP
;  08/14/85    NOTE:  THIS IS AN INSERT -- NOT AN OVERLAY
;			BUCKY CARR
;			DENHUG (ZBBS) RCP/M, 303-423-3224
;
; ADAPTED FROM:
;   A CLOCK INSERT FOR BYE AND MBYE WRITTEN BY DONALD E ROTH, DENVER.
;
;   THIS IS AN INSERT FOR ADDRESSING AND READING FROM THE OKI MSM5832
;   CLOCK CHIP AS ADDRESSED BY AN 8255 USART.  IN OUR SETUP, IT HAPPENS
;   TO BE CONNECTED TO A HEATHKIT H89 AND IS ADDRESSED AT PORT 320Q.
;
;   IT SHOULD BE POSSIBLE TO USE THIS CODE FOR ANY PORTED SYSTEM, AND
;   THE 8255 AND 5832 LEND THEMSELVES TO RELATIVELY INEXPENSIVE WIRE-
;   WRAPPING SHOULD ONE DESIRE TO ROLL HIS OWN CLOCK BOARD.  SCHEMATICS
;   ARE AVAILABLE, AND PERHAPS SOMEWHERE DOWN THE LINE I WILL INCLUDE
;   A SCHEMATIC WITH THIS INSERT....
;
;   TO SET THE CLOCK INITIALLY WE USE A CLOCK SETTING PROGRAM WRITTEN FOR
;   THAT SPECIFIC PURPOSE (WHICH I CANNOT LAY MY HANDS ON AT THE MOMENT,
;   BUT WILL SEARCH FOR, FOR THE TRULY INTERESTED.  IT IS WRITTEN IN BASIC.
;
;   IF YOU ALSO DESIRE THE MBASIC CODE TO READ THE CLOCK FROM WITHIN
;   A BBS PROGRAM, LET ME KNOW AND I WILL OFFER THAT UP, TOO.
;
;
;
;   WHEN CALLED THIS ROUTINE WILL CHECK THE RTCBUF.  IF A '99H' IS IN
;   THE FIRST BYTE, THEN CLOCK IS INITIALIZED.	NEXT, THE SECONDS ARE
;   CHECKED, AND IF CHANGED SINCE LAST UPDATE OF RTC BUFFER, THE CLOCK
;   IS READ AND NEW DATA COPIED TO THE RTCBUF.	THE BCD HOURS AND
;   MINUTES ARE CONVERTED TO BINARY AND STORED IN CCMIN AND CCHOUR.
Š;
;
;				    - BUCKY CARR, SYSOP,
;					WORLD PEACE (ZBBS) RCP/M, 303-320-4822
;							AND
;					DENHUG (ZBBS) RCP/M, 303-423-3224
;
;**********************************************************************
;
;THESE EQUATES ARE NEEDED TO SET UP THE 8255 PPI TO READ FROM
;THE OKI MSM5832 REAL TIME CLOCK CHIP

CLKD	EQU	048H	;SET MODE BIT
CLKA	EQU	049H		;GROUP A MODE 0
INPT	EQU	04AH	;GROUP A MODE 1
PPIX	EQU	04BH	;GROUP A MODE 2
EOS	EQU	'$'		;GROUP B MODE 0
CS	EQU	0	;GROUP B MODE 1
CSNOT	EQU	80H	;PORT A INPUT
CENTURY EQU	19H		
;
	 IF CLOCK
TIME:	MVI	A,081H
	OUT	PPIX
	MVI	A,00H
	OUT	CLKD
	MVI	A,08FH
	OUT	CLKA
	MVI	A,0FH
	OUT	CLKA
CREAD:	PUSH	PSW
	PUSH	B
	PUSH	D
	PUSH	H
	MVI	A,00H
	STA	SPCFLG
	MVI	A,91H			;SET 8255 CONTROL REG
	OUT	PPIX			
	MVI	B,00H			;5832 ADDRESS COUNTER
	LXI	H,TSTG			;PUT ADDR OF 1ST MEM
	MVI	A,10H+CS		;HOLD HIGH &amp; CS HI
	OUT	INPT
	PUSH	PSW			;150 MICRO SECOND DELAY
	MVI	A,11H		
LOOP:	DCR	A
	NOP
	JNZ	LOOP	
	POP	PSW	
LOPI:	MVI	A,30H+CS		;SET HOLD &amp; READ
	OUT	INPT
	MOV	A,B
	OUT	CLKA			;ADDRS TO 5832
	NOP				;NOP &amp; INR B MAKE UP
	INR	B			;6 USEC DELAY
	IN	CLKD			;INPUT DATA INTO ACCUM
	ANI	0FH
	MOV	M,A			
	INX	H
	MOV	A,B			;LAST 5832 ADDRESS?
	CPI	0DH			;IF NOT, NEXT ADDRESS
	JNZ	LOPI		;SET HOLD LOW, READ LOW
Š	MVI	A,00H+CSNOT			
	OUT	INPT
	LXI	H,HRS10
	MVI	A,00H			;SET FLAGS TSTG+13,14
	STA	MOD24			;15,  TO ZERO
	STA	AMPM
	STA	LEAPYR
	 MOV	 A,M			 ;H10 DATA INTO ACCUM
	LDA	HRS10
	ANI	08H			;IS 24 HOUR MODE SET?
	CPI	00H
	JZ	TWLV			;IF NOT, SKIP TO TWLV
	MVI	A,01H			;IF SO, SET FLAG
	STA	MOD24
TWLV:
	MOV	A,M			;IS PM BIT SET?
	LDA	HRS10
	ANI	04H			;IF NOT, SKIP TO CORVL
	CPI	00H
	JZ	CORVL			
	MVI	A,01H			;IF SO, SET FLAG
	STA	AMPM
CORVL:
	MOV	A,M			;PUT CORRECT VALUE OF
	LDA	HRS10
	ANI	03H			;H10 INTO TSTG+5
	MOV	M,A			
	STA	HRS10
	LXI	H, TSTG+08H
	MOV	A,M			;LEAP YEAR?
	LDA	MON10
	ANI	04H			
	JZ	RLVL			;IF NOT, SKIP TO RLVL
	MVI	A, 01H			;IF SO, SET FLAG
	STA	LEAPYR
RLVL:
	MOV	A,M
	LDA	MON10
	ANI	03H			;PUT CORRECT VALUE OF
	MOV	M,A			;D10 INTO TSTG+8
	STA	MON10
	POP	H
	POP	D			
	POP	B
	POP	PSW
;
CNVRTD: LDA	HRS10
	MOV	H,A
	LDA	HRS01
	ADD	H
	STA	RTCBUF		;SAVE IT
	CALL	BCDBIN		;CONVERT IT TO BINARY
	STA	CCHOUR		;STUFF IT IN HERE FOR BYE5XX TO USE
	LDA	MIN10
	MOV	H,A
	LDA	MIN01
	ADD	H
	STA	RTCBUF+1	;SAVE IT
	CALL	BCDBIN		;CONVERT TO BINARY
	STA	CCMIN		;STUFF IT HERE FOR BYE5XX TO USE
	LDA	SEC10
Š	MOV	H,A
	LDA	SEC01
	ADD	H
	STA	RTCBUF+2	;SAVE IT
	LDA	YRS10
	MOV	H,A
	LDA	YRS01
	ADD	H
	STA	RTCBUF+4	;SAVE IT
	LDA	MON10
	MOV	H,A
	LDA	MON01
	ADD	H
	STA	RTCBUF+5	;SAVE....
	LDA	DAY10
	MOV	H,A
	LDA	DAY01
	ADD	H
	STA	RTCBUF+6	;SAVE....
	MVI	A,CENTURY	;GET CENTURY VALUE (19XX)
	STA	RTCBUF+3	;SAVE....
      RET		      ;WHEW....
	 ENDIF
;
;
;-----------------------------------------------------------------------
</pre></body></html>