
;*****************************************************
;*
;*	Character I/O Interface
;*
;*****************************************************

	CSEG
	org	0

	jmp init
	jmp entry

sysdat		dw	0	;SYSDAT segment
supervisor	equ	(offset $)
		rw	2

		db	'COPYRIGHT (C) 1981,'
		db	' DIGITAL RESEARCH '
serial		db	'654321'

;====
init:
;====
	mov sysdat,ds
	mov bx,offset supmod ! mov si,supervisor
	mov ax,[bx]
	mov cs:[si],ax
	mov ax,2[bx]
	mov cs:2[si],ax
	retf

;*****************************************************
;*
;*	CIO function table
;*
;*****************************************************

functab	dw	conin_entry	; 0 - Console Input
	dw	conout_entry	; 1 - Console Output
	dw	rconin_entry	; 2 - raw console input
	dw	rconout_entry	; 3 - raw console output
	dw	listout_entry	; 4 - list output
	dw	dirio_entry	; 5 - direct console I/O
	dw	conwrite_entry	; 6 - print string
	dw	conread_entry	; 7 - read buffer
	dw	constat_entry	; 8 - console status
	dw	conattach_entry	; 9 - attach console
	dw	condetach_entry	; 10- detach console
	dw	setdefcon_entry	; 11- set default console
	dw	conassign_entry	; 12- assign console
	dw	getdefcon_entry	; 13- get default console
	dw	conprint_entry	; 14- print string (internal)
	dw	lstattach_entry	; 15- attach list
	dw	lstdetach_entry ; 16- detach list
	dw	setdeflst_entry	; 17- set default list
	dw	clstattch_entry ; 18- cond list attach
	dw	cconattch_entry ; 19- cond list detach
	dw	getdeflst_entry ; 20- get default list
	dw	mimic_entry	; 21- mimic device
	dw	unmimic_entry	; 22- unmimic device

;=====		=================
entry:		; CIO entry point
;=====		=================
	mov ch,0 ! shl cx,1 ! mov si,cx 
	call cs:functab[si] ! retf

;=====		===============
mpmif:		; MPM interface
;=====		===============
	callf cs:dword ptr .supervisor ! ret

;======		================
xiosif:		; XIOS interface
;======		================
	callf dword ptr .xiosmod ! ret
