3 title C to Message Retriever
4 ;-------------------------------------------------------------------
8 ; PURPOSE: Supplies an interface between C programs and
9 ; the DOS 3.3 message retriever
12 ; sysloadmsg(&inregs,&outregs);
13 ; sysdispmsg(&inregs,&outregs);
17 ;-------------------------------------------------------------------
19 INCLUDE SYSMSG
.INC ;PERMIT SYSTEM MESSAGE HANDLER DEFINITION ;AN000;
21 MSG_UTILNAME
<RESTORE> ;IDENTIFY THE COMPONENT ;AN000;
24 _TEXT
SEGMENT BYTE PUBLIC 'CODE'
26 _DATA
SEGMENT WORD PUBLIC 'DATA'
28 CONST
SEGMENT WORD PUBLIC 'CONST'
30 _BSS
SEGMENT WORD PUBLIC 'BSS'
32 DGROUP GROUP CONST
, _BSS
, _DATA
33 ASSUME
CS: _TEXT
, DS: _TEXT
, SS: DGROUP
, ES: DGROUP
39 ;-------------------------------------------------------------------
40 ;-------------------------------------------------------------------
45 MSG_SERVICES
<MSGDATA
> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000;
53 ;-------------------------------------------------------------------
54 ;DEFAULT=CHECK DOS VERSION
62 MSG_SERVICES
<LOADmsg
,INPUTmsg
,DISPLAYmsg
,CHARmsg
,NUMmsg
,DATEmsg
,FARmsg
> ;AN000;6
63 MSG_SERVICES
<RESTORE.CTL
,RESTORE.CLA
,RESTORE.CL1
,RESTORE.CL2
> ;AN000;6
66 ;-------------------------------------------------------------------
70 push bp ; save user's base pointer
71 mov bp,sp ; set bp to current sp
72 push di ; save some registers
75 ; copy C inregs into proper registers
77 mov di,[bp+4] ; fix di (arg 0)
79 ;-------------------------------------------------------------------
81 mov ax,[di+0ah] ; load di
82 push ax ; the di value from inregs is now on stack
84 mov ax,[di+00] ; get inregs.x.ax
85 mov bx,[di+02] ; get inregs.x.bx
86 mov cx,[di+04] ; get inregs.x.cx
87 mov dx,[di+06] ; get inregs.x.dx
88 mov si,[di+08] ; get inregs.x.si
89 pop di ; get inregs.x.di from stack
91 push bp ; save base pointer
93 ;-------------------------------------------------------------------
94 call sysloadmsg
; call the message retriever
95 ;-------------------------------------------------------------------
97 pop bp ; restore base pointer
98 push di ; the di value from call is now on stack
99 mov di,[bp+6] ; fix di (arg 1)
101 mov [di+00],ax ; load outregs.x.ax
102 mov [di+02],bx ; load outregs.x.bx
103 mov [di+04],cx ; load outregs.x.cx
104 mov [di+06],dx ; load outregs.x.dx
105 mov [di+08],si ; load outregs.x.si
107 lahf ; get flags into ax
108 mov al,ah ; move into low byte
109 mov [di+0ch],ax ; load outregs.x.cflag
111 pop ax ; get di from stack
112 mov [di+0ah],ax ; load outregs.x.di
114 ;-------------------------------------------------------------------
116 pop si ; restore registers
118 mov sp,bp ; restore sp
119 pop bp ; restore user's bp
125 ;_sysgetmsg proc near
127 ; push bp ; save user's base pointer
128 ; mov bp,sp ; set bp to current sp
129 ; push di ; save some registers
132 ;; copy C inregs into proper registers
134 ; mov di,[bp+4] ; fix di (arg 0)
136 ;;-------------------------------------------------------------------
138 ; mov ax,[di+0ah] ; load di
139 ; push ax ; the di value from inregs is now on stack
141 ; mov ax,[di+00] ; get inregs.x.ax
142 ; mov bx,[di+02] ; get inregs.x.bx
143 ; mov cx,[di+04] ; get inregs.x.cx
144 ; mov dx,[di+06] ; get inregs.x.dx
145 ; mov si,[di+08] ; get inregs.x.si
146 ; pop di ; get inregs.x.di from stack
148 ; push bp ; save base pointer
150 ;;-------------------------------------------------------------------
151 ; call sysgetmsg ; call the message retriever
152 ;;-------------------------------------------------------------------
154 ; pop bp ; restore base pointer
155 ; push di ; the di value from call is now on stack
156 ; mov di,[bp+6] ; fix di (arg 1)
158 ; mov [di+00],ax ; load outregs.x.ax
159 ; mov [di+02],bx ; load outregs.x.bx
160 ; mov [di+04],cx ; load outregs.x.cx
161 ; mov [di+06],dx ; load outregs.x.dx
162 ; mov [di+08],si ; load outregs.x.si
164 ; lahf ; get flags into ax
165 ; mov al,ah ; move into low byte
166 ; mov [di+0ch],ax ; load outregs.x.cflag
168 ; pop ax ; get di from stack
169 ; mov [di+0ah],ax ; load outregs.x.di
171 ;;-------------------------------------------------------------------
173 ; pop si ; restore registers
175 ; mov sp,bp ; restore sp
176 ; pop bp ; restore user's bp
181 _sysdispmsg proc
near
183 push bp ; save user's base pointer
184 mov bp,sp ; set bp to current sp
185 push di ; save some registers
188 ; copy C inregs into proper registers
190 mov di,[bp+4] ; fix di (arg 0)
192 ;-------------------------------------------------------------------
194 mov ax,[di+0ah] ; load di
195 push ax ; the di value from inregs is now on stack
197 mov ax,[di+00] ; get inregs.x.ax
198 mov bx,[di+02] ; get inregs.x.bx
199 mov cx,[di+04] ; get inregs.x.cx
200 mov dx,[di+06] ; get inregs.x.dx
201 mov si,[di+08] ; get inregs.x.si
202 pop di ; get inregs.x.di from stack
204 push bp ; save base pointer
206 ;-------------------------------------------------------------------
207 call sysdispmsg
; call the message retriever
208 ;-------------------------------------------------------------------
210 pop bp ; restore base pointer
211 push di ; the di value from call is now on stack
212 mov di,[bp+6] ; fix di (arg 1)
214 mov [di+00],ax ; load outregs.x.ax
215 mov [di+02],bx ; load outregs.x.bx
216 mov [di+04],cx ; load outregs.x.cx
217 mov [di+06],dx ; load outregs.x.dx
218 mov [di+08],si ; load outregs.x.si
220 lahf ; get flags into ax
221 mov al,ah ; move into low byte
222 mov [di+0ch],ax ; load outregs.x.cflag
224 pop ax ; get di from stack
225 mov [di+0ah],ax ; load outregs.x.di
227 ;-------------------------------------------------------------------
229 pop si ; restore registers
231 mov sp,bp ; restore sp
232 pop bp ; restore user's bp
239 _TEXT ends
; end code segment