PAGE	66,132
;
;
;
;
;
;
;
;
;  wrtvct.asm
;
;  usage:
;	    extern wrtvct();
;	    wrtvct( vectnum, offset, segment );
;
;  Function to allow a C program to set an interrupt vector
;
;  (c) 1984 University of Waterloo,
;           Faculty of Engineering,
;           Engineering Microcomputer Network Development Office
;
;  version
;
	include masmdefs.hsm
	include	model.hsm

codedef WRTVCT
datadef

cstart  WRTVCT
cpublic wrtvct

	push	si
	push	ES

	mov	SI,+@AB+0[BP]		;get vector number
	shl	SI,1
	shl	SI,1			;* 4
	xor	AX,AX
	mov	ES,AX			;ES:SI now pointer to the vector
	mov	AX,+@AB+2[BP]		;offset
	mov	BX,+@AB+4[BP]		;segment

	pushf
	cli				;disable interrupts
	mov	ES:[SI],AX
	mov	ES:+2[SI],BX
	popf				;restore ints

	pop	ES
	pop	si

creturn wrtvct
cend    WRTVCT

        end
