h61090
s 00032/00000/00000
d D 1.1 83/03/24 15:05:37 lib 1 0
c date and time created 83/03/24 15:05:37 by lib
e
u
4
U
t
T
I 1
UtilCPM_Code	CSeg	Byte	Public

; Unsigned*2 Function Divid(I,J,K)
; Unsigned*2 I,J,K
; Divid = I/J
; K = rem of above

I	Equ	Ss:(Dword Ptr .14)[Bp]
J	Equ	Ss:(Dword Ptr .10)[Bp]
K	Equ	Ss:(Dword Ptr .6)[Bp]

	Public	Divid
Divid:	Push	Bp			; Save caller's Bp
	Mov	Bp,Sp			; Point into stack

	Les	Si,I			; Get pointer to dividend
	Mov	Ax,Es:(Word Ptr .0)[Si]	; Get dividend
	Mov	Dx,0			; High half of zero

	Les	Si,J			; Get pointer to divisor
	Div	Es:(Word Ptr .0)[Si]	; Divide dividend by divisor

	Les	Si,K			; Get pointer to place for remainder
	Mov	Es:(Word Ptr .0)[Si],Dx	; Stuff remainder

	Pop	Bp			; Restore caller's Bp
	Retf	12			; Return, trashing 3 pointers

Stack	SSeg
	Rs	2			; Space for Bp

	End
E 1
