Compucolor.org – Virtual Media

Listing of file='GTDATE.MAC;04' on disk='vmedia/asm_utility_3-sector.ccvf'

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;	GTDATE - GET THE DATE AS MM/DD/YY
;
;	VALUES ON ENTRY:
;	   HL => BUFFER FOR INFO
;
;	RETURNS:
;	   HL => NEXT FREE CHARACTER IN BUFFER
;
;	DESTROYS:
;	   ALL REGISTERS
;
;	NOTE: IF THE DATE HAS NOT BEEN SET, THE ROUTINE WILL
;	ABORT THE PROGRAM.
;
	EXTRN	DECOUT	;ROUTINE TO CONVERT A BYTE TO ASCII
	EXTRN	OSTR	;OUTPUT A STRING
	EXTRN	FCSSP	;FCS STACK POINTER
;
;	THESE ADDRESSES ARE FOR BOTH V6.78 AND V8.79
;
MONTH	EQU	81BCH
DAY	EQU	81BDH
YEAR	EQU	81BEH	;YEAR IS LAST TWO DIGITS ONLY

	ENTRY	GTDATE

GTDATE:	MOV	A,M
	STA	TEMP
	LDA	MONTH	;CONVERT THE MONTH
	CPI	13
	JNC	BAD	;NOT A VALID MONTH - BOMB PROGRAM
	CALL	DECOUT
	DCX	H
	DCX	H
	LDA	TEMP
	MOV	M,A
	INX	H
	INX	H
	INX	H

	LDA	DAY	;CONVERT THE DAY
	CALL	DECOUT
	DCX	H
	DCX	H
	MVI	M,'/'	;PUT '/' BETWEEN MONTH AND DAY
	INX	H
	INX	H
	INX	H

	LDA	YEAR	;CONVERT THE YEAR
	CALL	DECOUT
	DCX	H
	DCX	H
	MVI	M,'/'	;PUT '/' BETWEEN DAY AND YEAR
	INX	H
	INX	H
	INX	H
	RET
;
;	RETURN TO FCS BECAUSE OF BAD DATE
;
BAD:	LXI	H,BADMSG
	CALL	OSTR
	LHLD	FCSSP
	SPHL
	MVI	B,0
	RET

TEMP:	DB	0
BADMSG:	DB	6,1,13,10,'*** DATE NOT SET ***',13,10,239

	END