;	TIME RSX
; Reads or sets the internal clock (tick)
; Usage:
;	Assemble, HEXCOM and GENCOM this file to a NULL COM file
;	Before using, load it by calling TIME
;	
;	In calling program
;	To set clock to 00 call BDOS with DE = 0
;	To read clock call BDOS function 60 with DE > 0
;
;RSX HEADER
;
SERIAL	DB	0,0,0,0,0,0
START	JMP	MAIN
NEXT	DB	0C3H
	DW	0
PREV	DW	0
REM	DB	0
NON	DB	0
NAM	DB	'TIME   '
LOD	DB	0,0,0
;
MAIN:
	MOV	A,C		;Is this func 60
	CPI	60
	JNZ	NEXT
	JNZ	ZERO
	MVI	A,81H		;Bank 8
	OUT	0
	SUB	A
	CMP	E
	JZ	ZERO
	LHLD	23E8H		;load clock bits
	JMP	ONE
ZERO	LXI	H,0
	SHLD	23E8H	
ONE	MVI	A,01		;Bank 1
	OUT	0
	MOV	D,H		;DE=HL
	MOV	E,L
	RET



;
