;This patch is for any Morrow MicroDecision MD-1, 2, or 3.  The only 
;changes which need to be made is to make sure you have the right
;location for GOCPM for your revision of the BIOS.	
;							BSL - 11/21/84
;
;  PATCH:  Z3PATMD.ASM
;	   originally Z2PATCH.ASM
; AUTHOR:  Richard Conn
;  NOTE:  This is a Patch to the MicroDecision BIOS (Rev. 1.6 or 2.3)
;
; Modified 11-21-84 for 59k ZCPR3 system (BIOS 1.6 or 2.3)
; 						       by Brian Leyton	 
; Modified 9-4-84 for 62k ZCPR3 system (1.x BIOS).     by Ted Silveira
; Modified 12-7-83 for Morrow BIOS rev 2.2 for ZCPR2 by Isaac Salzman
;
;  ZCPR Equates
;
zcpr3	equ	0c800h	;Base Address of ZCPR3 Itself for a 59K system
gocpm	equ	0dea3h	;GOCPM Entry Point in BIOS (Rev. 2.x)
;gocpm	equ	0dea0h	;GOCPM Entry Point in BIOS (Rev. 1.x)
mclbuf	equ	0Fd00h	;Beginning of Multiple Command Line Buffer
path	equ	40h	;Base Address of External Path
patch	equ	0e700h	;Patch Begins Here

;
;  Patch --
;
;

;
	org	patch
;
	mvi	b,32		;this zeroes high memory from 0ec00h to 0fbffh
	lxi	h,0ec00h

zloop:	push	b
	call	zero128
	pop	b
	dcr	b
	jnz	zloop	
;
;
;
	lxi	h,clbase	;init command line
	lxi	d,mclbuf	;copy into buffer
	mvi	b,40		;40 chars
	call	move
;
	lxi	h,pathbase	;init default path
	lxi	d,path
	mvi	b,10		;10 bytes
	call	move

	mvi	a,0ffh		;set wheel byte non-zero
	sta	3eh		

	lxi	h,zcpr3		;set pointer
	jmp	gocpm
;
;
;

zero128:				
	mvi	b,128			
zerom:
	mvi	m,0
	inx	h
	dcr	b
	jnz	zerom
	ret

;
; Move Routine
;
move:
	mov	a,m	;get
	stax	d	;put
	inx	h	;pt to next
	inx	d
	dcr	b	;count down
	jnz	move
	ret
;
;  Default Values
;
clbase:
	dw	mclbuf+4	;pt to first char
	db	255		;255 chars
	db	0
	db	'STARTUP'	;default command
	db	0
pathbase:
	db	'A'-'@',0	;goto A0
	db	0

;
;  End of Patch
;
	end
