;----------------------------------------------------------------------
;
; PATCH10H.ASM
;    Creates a patch for CONFIG.COM in Lifeboat CP/M 2.2 to make
;    the IMSAI SIO-2 console selection use a port base of 10h
;    instead of 00h.
;
;  A>DDT CONFIG.COM
;  DDT VERS 2.2
;  NEXT  PC
;  1900 0100
;  -IPATCH10H.HEX
;  -R
;  NEXT  PC
;  1900 0000
;  -G0
;  A>SAVE 24 CONFIG.COM
;
;-----------------------------------------------------------------------

SIOBASE	EQU	10h		;Port base address (10h vs 00h)

SIOACR	EQU	SIOBASE+3	;Port A Control Register (main serial)
SIOADR	EQU	SIOBASE+2	;Port A Data Register
SIOBCR	EQU	SIOBASE+5	;Port B Control Register (secondary serial)
SIOBDR	EQU	SIOBASE+4	;Port B Data Register


XMTMASK	EQU	1		;MASK TO ISOLATE XMIT READY BIT
XMTRDY	EQU	1		;VALUE WHEN READY
RCVMASK	EQU	2		;MASK TO ISOLATE RECEIVE READY BIT
RCVRDY	EQU	2		;VALUE WHEN READY

	org	1558h
	

	db	SIOACR		;input status port
	db	RCVMASK		;input ready mask
	db	RCVRDY		;input polarity
	db	SIOADR		;input data port

	db	SIOACR		;output status port
	db	XMTMASK		;output ready mask
	db	XMTRDY		;output polarity
	db	SIOADR		;output data port

	db	initEnd-$	;length of init code
	mvi	a,0AAh
	out	SIOACR
	mvi	a,040h
	out	SIOACR
	mvi	a,0CEh
	out	SIOACR
	mvi	a,037h
	out	SIOACR
	in	SIOADR
initEnd	ret

	end
