; ADVCLK.ASM  -  Display the clock on Kaypro's 25th Line

; John T. Brown  2/21/87

;----------------------------------------------------------------

; equates

bdos	equ	5		;CP/M's BDOS entry point
esc	equ	1bh		;ESCape for Kaypro video sequences

	org	100h		;CP/M's program area

start:	lxi	h,0		;save CP/M's stack by adding it
	dad	sp		;to the stack pointer and
	shld	cpmstk		;storing it in a safe place
	lxi	sp,stack+20	;to generate a new stack for use
				;by this program

	lxi	d,msg		;point at message
	mvi	c,9		;print string function
	call	bdos		;do it

	lhld	cpmstk		;get the old stack back
	sphl			;switch into stack pointer
	ret			;and return to CP/M

; The clock message:

msg:	db      esc,'B7'        ;enable 25th line
        db      esc,'B8'        ;turn on the clock

	db	esc,'B6'	;save cursor position
	db	esc,'=8W '	;position cursor to 25,60

	db	esc,'B1'	;dim video on
	db	' Current time is:'	;first label
	db	esc,'C1'	;dim video off
        db	esc,'C6'        ;restore cursor position
	db	'$'		;end of msg

cpmstk	dw	0		;old stack saved here

	ds	20		;stack grows down
stack	equ	$		; ds must be BEFORE label stack

	end
