h20351
s 00024/00011/00039
d D 1.2 83/03/18 20:00:00 mrk 2 1
c fix pc bug
e
s 00050/00000/00000
d D 1.1 83/03/15 21:23:55 tes 1 0
c date and time created 83/03/15 21:23:55 by tes
e
u
4
U
t
T
I 1
D 2
	Extrn	DDIDS		:Far
E 2
I 2
	Extrn	DDids		:Far
E 2

CGroup	Group	DdCode
DdCode	CSeg
	Public	Driver
Driver:	Mov	Ax,Sp			; Save caller's stack pointers
	Mov	Bx,Ss

I 2
	Pushf                           ; Save interupt status
	Pop     Si                      ;   and turn interupts off
	Cli                             ;   to protect changing the stack

E 2
	Mov	Ss,StackBase		; Switch to driver's stack
	Mov	Sp,Offset Top_Stack

I 2
	Push    Si                      ; Restore the callers interupt state
	Popf

E 2
	Push	Bx			; Push caller's stack pointer
	Push	Ax
	Push	Bp			; Save caller's frame
	Push	Ds			; Save parameter pointer
	Push	Dx
	Pushf				; Save caller's direction flag

	Mov	Cx,5			; Parameter block is 5 dword pointers
	Mov	Si,Dx			; Make Ds:Si point to parameters
	Cld				; Work up in address

ParamLoop:
	Lodsw				; Offset into Ax
	Xchg	Ax,Bx			;  then into Bx
	Lodsw				; Segment into Ax
	Push	Ax			; Segment gets pushed first
	Push	Bx			;  then offset
	Loop	ParamLoop		; Until 5 dword pointers pushed

D 2
	Callf	DDIDS			; Invoke the driver with PL/M seq
E 2
I 2
	Callf	DDids			; Invoke the driver with PL/M seq
E 2

	Popf				; Restore caller's direction flag
	Pop	Dx			; Restore caller's Ds:Dx
	Pop	Ds
	Pop	Bp			; Restore caller's stack frame
	Pop	Ax			; Restore caller's Ss:Sp
D 2
	Pop	Bx			;  via
	Mov	Ss,Bx			;  Bx
	Mov	Sp,Ax			;  and Ax
E 2
I 2
	Pop	Bx			;  via Bx and Ax

	Pushf                           ; Save interupt status
	Pop     Si                      ;   and turn interupts off
	Cli                             ;   to protect changing the stack

	Mov	Ss,Bx			; Restore callers Ss:Sp
	Mov	Sp,Ax

	Push    Si                      ; Restore the callers interupt state
	Popf
E 2
	Retf

StackBase	Dw	Seg Top_Stack

D 2
Data		DSeg

Stack	SSeg	Para
	Extrn	Top_Stack	:Byte
	Rs	36			; This module pushes 18 words
	End
E 2
I 2
Stack    	SSeg	Word
	        Rs	36		; This module pushes 18 words
Top_Stack       Rw      0
	        End
E 2
E 1
