;/*
;	this routine is based on William James Hunt,
;	The C Tool Box (Addison Wesley, 1985), chap. 7.
;*/
regs	struc
reg_ax	dw	0
reg_bx	dw	0
reg_cx	dw	0
reg_dx	dw	0
reg_si	dw	0
reg_di	dw	0
reg_bp	dw	0
reg_sp	dw	0
reg_ds	dw	0
reg_es	dw	0
reg_ss	dw	0
reg_cs	dw	0
regs	ends
;
;
include		dataseg.h
include		enddseg.h
;
;
include		progseg.h
;
;
vid_args	struc
		dw	0
		dw	0
fun_no	dw	0
vid_sreg	dw	0
vid_dreg	dw	0
vid_args	ends
;
;
	public	_vidint
_vidint:
	push	bp
	mov		bp,sp
	push	si
	push	di
	mov		bx, word ptr vid_sreg[bp]
	mov		ax, word ptr reg_ax[bx]
	mov		cx, word ptr reg_cx[bx]
	mov		dx, word ptr reg_dx[bx]
	mov		bx, word ptr reg_bx[bx]
	mov		ah, byte ptr fun_no[bp]
	int		16	;	change to 16
	mov		di, word ptr vid_dreg[bp]
	mov		word ptr reg_ax[di],ax
	mov		word ptr reg_bx[di],bx
	mov		word ptr reg_cx[di],cx
	mov		word ptr reg_dx[di],dx
	pop		di
	pop		si
	pop		sp
	ret
;
;
swint_args	struc
		dw	0
		dw	0
int_no	dw	0
sw_sreg	dw	0
sw_dreg	dw	0
swint_args	ends
;
;	
	public	_swint
_swint:
	push	bp
	mov		bp, sp
	push	ds
	push	es
	push	si
	push	di
	mov		al, byte ptr int_no[bp]
	mov		cs: byte ptr int_instr[1],al
	mov		bx, word ptr sw_sreg[bp]
	mov		ax, word ptr reg_ax[bx]
	mov		cx, word ptr reg_cx[bx]
	mov		dx, word ptr reg_dx[bx]
	mov		si, word ptr reg_si[bx]
	mov		di, word ptr reg_di[bx]
	mov		es, word ptr reg_es[bx]
	mov		ds, word ptr reg_ds[bx]
	mov		bx, ss:word ptr reg_bx[bx]
int_instr:
	int		10	;	change to 32
	mov		bp, word ptr sw_dreg[bp]
	mov		word ptr reg_ax[bp], ax
	mov		word ptr reg_bx[bp], bx
	mov		word ptr reg_cx[bp], cx
	mov		word ptr reg_dx[bp], dx
	mov		word ptr reg_si[bp], si
	mov		word ptr reg_di[bp], di
	mov		word ptr reg_ds[bp], ds
	mov		word ptr reg_es[bp], es
	pushf
	pop		ax
	cld
	pop		di
	pop		si
	pop		es
	pop		ds
	pop		bp
	ret
;
;
include		endpseg.h
end
