; WS25.ASM  -  Display WS Key Defs on Kaypro's 25th Line

; Steve Sanders  7/2/85

; I modified John's program so that folks with ASM.COM could
; re-do it for their own key definitions.  Also set it for dim
; video (1/2 intensity) as I hate glaring inverse video displays.
; I added comments all over the code so others could figure out
; what we do to use the Kaypro video calls.
;----------------------------------------------------------------
; adapted from WS25.MAC
; by John C. Smith
; 6/10/85

; This file writes the key definition to the 25th line
; of the Kaypro 10 display.  It is used in conjunction with
; setkey and the appropriate key file.

; Note: SETKEY is a BIOSMMR utility found in BIOSMMR.LBR which
;       is a super-BIOS replacement for the Kaypro 10 with
;       ZCPR3 support.  SETKEY allows you to re-define the
;       numeric keypad and may be used without BIOSMMR on any
;       Kaypro 10.

;       If you want to auto-clear the 25th line on exit from
;       Wordstar, just use WINSTALL and patch WS.COM
;       to use the following calls on terminal de-init.

;       27 43 37 1A

;       This is hex for ESC C7 (disable 25th line)
;                           1A (clear screen)

;                         - Steve
;----------------------------------------------------------------

; 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 command line message:

msg:	db	esc,'B6'	;save cursor position
	db	esc,'B7'	;enable 25th line
	db	esc,'=8 '	;position cursor to 25,0
	db	esc,'B1'	;dim video on
	db	'1'		;first label number
	db	esc,'B0'	;inverse video on

	db	'HELP  '	;first label

	db	esc,'C0 '	;inverse video off
	db	'2',esc,'B0'

	db	'INDENT'

	db	esc,'C0 '
	db	'3',esc,'B0'

	db	'SET LM'

	db	esc,'C0 '
	db	'4',esc,'B0'

	db	'SET RM'

	db	esc,'C0 '
	db	'5',esc,'B0'

	db	'UNDLIN'

	db	esc,'C0 '
	db	'6',esc,'B0'

	db	'BLDFCE'

	db	esc,'C0 '
	db	'7',esc,'B0'

	db	'BEGBLK'

	db	esc,'C0 '
	db	'8',esc,'B0'

	db	'ENDBLK'

	db	esc,'C0 '
	db	'9',esc,'B0'

	db	'WRTBLK'

	db	esc,'C0 '
	db	'0',esc,'B0'

	db	'ENDFIL'

	db	esc,'C0'	;inverse video off
	db	esc,'C1'	;dim video off
	db	esc,'C6'	;recall 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			;that's all folks
