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 ; sysgetmsg(&inregs,&outregs);
14 ; sysdispmsg(&inregs,&outregs);
19 ;-------------------------------------------------------------------
21 INCLUDE SYSMSG
.INC ;PERMIT SYSTEM MESSAGE HANDLER DEFINITION ;AN000;
23 MSG_UTILNAME
<REPLACE
> ;IDENTIFY THE COMPONENT ;AN000;
26 _TEXT
SEGMENT BYTE PUBLIC 'CODE' ;AN000;
28 _DATA
SEGMENT WORD PUBLIC 'DATA' ;AN000;
30 CONST
SEGMENT WORD PUBLIC 'CONST' ;AN000;
32 _BSS
SEGMENT WORD PUBLIC 'BSS' ;AN000;
34 DGROUP GROUP CONST
, _BSS
, _DATA
;AN000;
35 ASSUME
CS: _TEXT
, DS: _TEXT
, SS: DGROUP
, ES: DGROUP
;AN000;
38 public _sysloadmsg
;AN000;
39 public _sysgetmsg
;AN000;
40 public _sysdispmsg
;AN000;
42 ;-------------------------------------------------------------------
43 ;-------------------------------------------------------------------
48 MSG_SERVICES
<MSGDATA
> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000;
56 ;-------------------------------------------------------------------
58 ; = = = = = = = = = = = =
60 ;DEFAULT=CHECK DOS VERSION ;AN000;
61 ;DEFAULT=NEARmsg ;AN000;
62 ;DEFAULT=INPUTmsg ;AN000;
63 ;DEFAULT=NUMmsg ;AN000;
64 ;DEFAULT=NO TIMEmsg ;AN000;
65 ;DEFAULT=NO DATEmsg ;AN000;
66 ; MSG_SERVICES <LOADmsg,GETmsg,DISPLAYmsg,CHARmsg,NUMmsg,TIMEmsg,DATEmsg,INPUTmsg,FARmsg>;AN000;
67 ; MSG_SERVICES <REPLACE.CLA,REPLACE.CL1,REPLACE.CL2> ;MSG TEXT ;AN000;
70 ; MSG_SERVICES <MSGDATA> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000;
71 MSG_SERVICES
<LOADmsg
,GETmsg
,DISPLAYmsg
,CHARmsg
,NUMmsg
,TIMEmsg
,DATEmsg
,INPUTmsg
,FARmsg
>;AN000;
72 MSG_SERVICES
<REPLACE
.CLA
,REPLACE
.CL1
,REPLACE
.CL2
> ;MSG TEXT ;AN000;
75 ;------------------------------------------------------------------- ;AN000;
77 _sysloadmsg proc
near ;AN000;
79 push bp ; save user's base pointer ;AN000;
80 mov bp,sp ; set bp to current sp ;AN000;
81 push di ; save some registers ;AN000;
84 ; copy C inregs into proper registers ;AN000;
86 mov di,[bp+4] ; fix di (arg 0) ;AN000;
88 ;-------------------------------------------------------------------
90 mov ax,[di+0ah] ; load di ;AN000;
91 push ax ; the di value from inregs is now on stack;AN000;
93 mov ax,[di+00] ; get inregs.x.ax ;AN000;
94 mov bx,[di+02] ; get inregs.x.bx ;AN000;
95 mov cx,[di+04] ; get inregs.x.cx ;AN000;
96 mov dx,[di+06] ; get inregs.x.dx ;AN000;
97 mov si,[di+08] ; get inregs.x.si ;AN000;
98 pop di ; get inregs.x.di from stack ;AN000;
100 push bp ; save base pointer ;AN000;
102 ;-------------------------------------------------------------------
103 call sysloadmsg
; call the message retriever ;AN000;
104 ;-------------------------------------------------------------------
106 pop bp ; restore base pointer ;AN000;
107 push di ; the di value from call is now on stack;AN000;
108 mov di,[bp+6] ; fix di (arg 1) ;AN000;
110 mov [di+00],ax ; load outregs.x.ax ;AN000;
111 mov [di+02],bx ; load outregs.x.bx ;AN000;
112 mov [di+04],cx ; load outregs.x.cx ;AN000;
113 mov [di+06],dx ; load outregs.x.dx ;AN000;
114 mov [di+08],si ; load outregs.x.si ;AN000;
116 lahf ; get flags into ax ;AN000;
117 mov al,ah ; move into low byte ;AN000;
118 mov [di+0ch],ax ; load outregs.x.cflag ;AN000;
120 pop ax ; get di from stack ;AN000;
121 mov [di+0ah],ax ; load outregs.x.di ;AN000;
123 ;-------------------------------------------------------------------
125 pop si ; restore registers ;AN000;
127 mov sp,bp ; restore sp ;AN000;
128 pop bp ; restore user's bp ;AN000;
131 _sysloadmsg endp
;AN000;
134 _sysgetmsg proc
near ;AN000;
136 push bp ; save user's base pointer ;AN000;
137 mov bp,sp ; set bp to current sp ;AN000;
138 push di ; save some registers ;AN000;
141 ; copy C inregs into proper registers ;AN000;
143 mov di,[bp+4] ; fix di (arg 0) ;AN000;
145 ;-------------------------------------------------------------------
147 mov ax,[di+0ah] ; load di ;AN000;
148 push ax ; the di value from inregs is now on stack;AN000;
150 mov ax,[di+00] ; get inregs.x.ax ;AN000;
151 mov bx,[di+02] ; get inregs.x.bx ;AN000;
152 mov cx,[di+04] ; get inregs.x.cx ;AN000;
153 mov dx,[di+06] ; get inregs.x.dx ;AN000;
154 mov si,[di+08] ; get inregs.x.si ;AN000;
155 pop di ; get inregs.x.di from stack ;AN000;
157 push bp ; save base pointer ;AN000;
159 ;-------------------------------------------------------------------
160 call sysgetmsg
; call the message retriever ;AN000;
161 ;-------------------------------------------------------------------
163 pop bp ; restore base pointer ;AN000;
164 push di ; the di value from call is now on stack;AN000;
165 mov di,[bp+6] ; fix di (arg 1) ;AN000;
167 mov [di+00],ax ; load outregs.x.ax ;AN000;
168 mov [di+02],bx ; load outregs.x.bx ;AN000;
169 mov [di+04],cx ; load outregs.x.cx ;AN000;
170 mov [di+06],dx ; load outregs.x.dx ;AN000;
171 mov [di+08],si ; load outregs.x.si ;AN000;
173 lahf ; get flags into ax ;AN000;
174 mov al,ah ; move into low byte ;AN000;
175 mov [di+0ch],ax ; load outregs.x.cflag ;AN000;
177 pop ax ; get di from stack ;AN000;
178 mov [di+0ah],ax ; load outregs.x.di ;AN000;
180 ;-------------------------------------------------------------------
182 pop si ; restore registers ;AN000;
184 mov sp,bp ; restore sp ;AN000;
185 pop bp ; restore user's bp ;AN000;
188 _sysgetmsg endp
;AN000;
190 _sysdispmsg proc
near ;AN000;
192 push bp ; save user's base pointer ;AN000;
193 mov bp,sp ; set bp to current sp ;AN000;
194 push di ; save some registers ;AN000;
197 ; copy C inregs into proper registers ;AN000;
199 mov di,[bp+4] ; fix di (arg 0) ;AN000;
201 ;-------------------------------------------------------------------
203 mov ax,[di+0ah] ; load di ;AN000;
204 push ax ; the di value from inregs is now on stack;AN000;
206 mov ax,[di+00] ; get inregs.x.ax ;AN000;
207 mov bx,[di+02] ; get inregs.x.bx ;AN000;
208 mov cx,[di+04] ; get inregs.x.cx ;AN000;
209 mov dx,[di+06] ; get inregs.x.dx ;AN000;
210 mov si,[di+08] ; get inregs.x.si ;AN000;
211 pop di ; get inregs.x.di from stack ;AN000;
213 push bp ; save base pointer ;AN000;
215 ;-------------------------------------------------------------------
216 call sysdispmsg
; call the message retriever ;AN000;
217 ;-------------------------------------------------------------------
219 pop bp ; restore base pointer ;AN000;
220 push di ; the di value from call is now on stack;AN000;
221 mov di,[bp+6] ; fix di (arg 1) ;AN000;
223 mov [di+00],ax ; load outregs.x.ax ;AN000;
224 mov [di+02],bx ; load outregs.x.bx ;AN000;
225 mov [di+04],cx ; load outregs.x.cx ;AN000;
226 mov [di+06],dx ; load outregs.x.dx ;AN000;
227 mov [di+08],si ; load outregs.x.si ;AN000;
229 lahf ; get flags into ax ;AN000;
230 mov al,ah ; move into low byte ;AN000;
231 mov [di+0ch],ax ; load outregs.x.cflag ;AN000;
233 pop ax ; get di from stack ;AN000;
234 mov [di+0ah],ax ; load outregs.x.di ;AN000;
236 ;-------------------------------------------------------------------
238 pop si ; restore registers ;AN000;
240 mov sp,bp ; restore sp ;AN000;
241 pop bp ; restore user's bp ;AN000;
244 _sysdispmsg endp
;AN000;
248 _TEXT ends
; end code segment ;AN000;