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);
18 ;-------------------------------------------------------------------
20 INCLUDE SYSMSG
.INC ;PERMIT SYSTEM MESSAGE HANDLER DEFINITION;AN000;
22 MSG_UTILNAME
<JOIN
> ;IDENTIFY THE COMPONENT ;AN000;
25 _TEXT
SEGMENT BYTE PUBLIC 'CODE' ;AN000;
27 _DATA
SEGMENT WORD PUBLIC 'DATA' ;AN000;
29 CONST
SEGMENT WORD PUBLIC 'CONST' ;AN000;
31 _BSS
SEGMENT WORD PUBLIC 'BSS' ;AN000;
33 DGROUP GROUP CONST
, _BSS
, _DATA
;AN000;
34 ASSUME
CS: _TEXT
, DS: _TEXT
, SS: DGROUP
, ES: DGROUP
;AN000;
37 public _sysloadmsg
;AN000;
38 public _sysgetmsg
;AN000;
39 public _sysdispmsg
;AN000;
41 ;-------------------------------------------------------------------
42 ;-------------------------------------------------------------------
47 MSG_SERVICES
<MSGDATA
> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000;
55 ;-------------------------------------------------------------------
57 ; = = = = = = = = = = = =
59 ;DEFAULT=CHECK DOS VERSION ;AN000;
60 ;DEFAULT=NEARmsg ;AN000;
61 ;DEFAULT=INPUTmsg ;AN000;
62 ;DEFAULT=NUMmsg ;AN000;
63 ;DEFAULT=NO TIMEmsg ;AN000;
64 ;DEFAULT=NO DATEmsg ;AN000;
65 ; MSG_SERVICES <LOADmsg,GETmsg,DISPLAYmsg,CHARmsg,NUMmsg,TIMEmsg,DATEmsg,INPUTmsg,FARmsg>;AN000;
66 ; MSG_SERVICES <JOIN.CLA,JOIN.CL1,JOIN.CL2> ;MSG TEXT ;AN000;
69 ; MSG_SERVICES <MSGDATA> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000;
70 MSG_SERVICES
<LOADmsg
,GETmsg
,DISPLAYmsg
,CHARmsg
,NUMmsg
,TIMEmsg
,DATEmsg
,INPUTmsg
,FARmsg
>;AN000;
71 MSG_SERVICES
<JOIN
.CLA
,JOIN
.CL1
,JOIN
.CL2
> ;MSG TEXT ;AN000;
74 ;-------------------------------------------------------------------
76 _sysloadmsg proc
near ;AN000;
78 push bp ; save user's base pointer ;AN000;
79 mov bp,sp ; set bp to current sp ;AN000;
80 push di ; save some registers ;AN000;
83 ; copy C inregs into proper registers
85 mov di,[bp+4] ; fix di (arg 0) ;AN000;
87 ;-------------------------------------------------------------------
89 mov ax,[di+0ah] ; load di ;AN000;
90 push ax ; the di value from inregs is now on stack;AN000;
92 mov ax,[di+00] ; get inregs.x.ax ;AN000;
93 mov bx,[di+02] ; get inregs.x.bx ;AN000;
94 mov cx,[di+04] ; get inregs.x.cx ;AN000;
95 mov dx,[di+06] ; get inregs.x.dx ;AN000;
96 mov si,[di+08] ; get inregs.x.si ;AN000;
97 pop di ; get inregs.x.di from stack ;AN000;
99 push bp ; save base pointer ;AN000;
101 ;-------------------------------------------------------------------
102 call sysloadmsg
; call the message retriever ;AN000;
103 ;-------------------------------------------------------------------
105 pop bp ; restore base pointer ;AN000;
106 push di ; the di value from call is now on stack;AN000;
107 mov di,[bp+6] ; fix di (arg 1) ;AN000;
109 mov [di+00],ax ; load outregs.x.ax ;AN000;
110 mov [di+02],bx ; load outregs.x.bx ;AN000;
111 mov [di+04],cx ; load outregs.x.cx ;AN000;
112 mov [di+06],dx ; load outregs.x.dx ;AN000;
113 mov [di+08],si ; load outregs.x.si ;AN000;
115 lahf ; get flags into ax ;AN000;
116 mov al,ah ; move into low byte ;AN000;
117 mov [di+0ch],ax ; load outregs.x.cflag ;AN000;
119 pop ax ; get di from stack ;AN000;
120 mov [di+0ah],ax ; load outregs.x.di ;AN000;
122 ;-------------------------------------------------------------------
124 pop si ; restore registers ;AN000;
126 mov sp,bp ; restore sp ;AN000;
127 pop bp ; restore user's bp ;AN000;
130 _sysloadmsg endp
;AN000;
133 _sysgetmsg proc
near ;AN000;
135 push bp ; save user's base pointer ;AN000;
136 mov bp,sp ; set bp to current sp ;AN000;
137 push di ; save some registers ;AN000;
140 ; copy C inregs into proper registers
142 mov di,[bp+4] ; fix di (arg 0) ;AN000;
144 ;-------------------------------------------------------------------
146 mov ax,[di+0ah] ; load di ;AN000;
147 push ax ; the di value from inregs is now on stack;AN000;
149 mov ax,[di+00] ; get inregs.x.ax ;AN000;
150 mov bx,[di+02] ; get inregs.x.bx ;AN000;
151 mov cx,[di+04] ; get inregs.x.cx ;AN000;
152 mov dx,[di+06] ; get inregs.x.dx ;AN000;
153 mov si,[di+08] ; get inregs.x.si ;AN000;
154 pop di ; get inregs.x.di from stack ;AN000;
156 push bp ; save base pointer ;AN000;
158 ;-------------------------------------------------------------------
159 call sysgetmsg
; call the message retriever ;AN000;
160 ;-------------------------------------------------------------------
162 pop bp ; restore base pointer ;AN000;
163 push di ; the di value from call is now on stack;AN000;
164 mov di,[bp+6] ; fix di (arg 1) ;AN000;
166 mov [di+00],ax ; load outregs.x.ax ;AN000;
167 mov [di+02],bx ; load outregs.x.bx ;AN000;
168 mov [di+04],cx ; load outregs.x.cx ;AN000;
169 mov [di+06],dx ; load outregs.x.dx ;AN000;
170 mov [di+08],si ; load outregs.x.si ;AN000;
172 lahf ; get flags into ax ;AN000;
173 mov al,ah ; move into low byte ;AN000;
174 mov [di+0ch],ax ; load outregs.x.cflag ;AN000;
176 pop ax ; get di from stack ;AN000;
177 mov [di+0ah],ax ; load outregs.x.di ;AN000;
179 ;-------------------------------------------------------------------
181 pop si ; restore registers ;AN000;
183 mov sp,bp ; restore sp ;AN000;
184 pop bp ; restore user's bp ;AN000;
187 _sysgetmsg endp
;AN000;
189 _sysdispmsg proc
near ;AN000;
191 push bp ; save user's base pointer ;AN000;
192 mov bp,sp ; set bp to current sp ;AN000;
193 push di ; save some registers ;AN000;
196 ; copy C inregs into proper registers
198 mov di,[bp+4] ; fix di (arg 0) ;AN000;
200 ;-------------------------------------------------------------------
202 mov ax,[di+0ah] ; load di ;AN000;
203 push ax ; the di value from inregs is now on stack;AN000;
205 mov ax,[di+00] ; get inregs.x.ax ;AN000;
206 mov bx,[di+02] ; get inregs.x.bx ;AN000;
207 mov cx,[di+04] ; get inregs.x.cx ;AN000;
208 mov dx,[di+06] ; get inregs.x.dx ;AN000;
209 mov si,[di+08] ; get inregs.x.si ;AN000;
210 pop di ; get inregs.x.di from stack ;AN000;
212 push bp ; save base pointer ;AN000;
214 ;-------------------------------------------------------------------
215 call sysdispmsg
; call the message retriever ;AN000;
216 ;-------------------------------------------------------------------
218 pop bp ; restore base pointer ;AN000;
219 push di ; the di value from call is now on stack;AN000;
220 mov di,[bp+6] ; fix di (arg 1) ;AN000;
222 mov [di+00],ax ; load outregs.x.ax ;AN000;
223 mov [di+02],bx ; load outregs.x.bx ;AN000;
224 mov [di+04],cx ; load outregs.x.cx ;AN000;
225 mov [di+06],dx ; load outregs.x.dx ;AN000;
226 mov [di+08],si ; load outregs.x.si ;AN000;
228 lahf ; get flags into ax ;AN000;
229 mov al,ah ; move into low byte ;AN000;
230 mov [di+0ch],ax ; load outregs.x.cflag ;AN000;
232 pop ax ; get di from stack ;AN000;
233 mov [di+0ah],ax ; load outregs.x.di ;AN000;
235 ;-------------------------------------------------------------------
237 pop si ; restore registers ;AN000;
239 mov sp,bp ; restore sp ;AN000;
240 pop bp ; restore user's bp ;AN000;
243 _sysdispmsg endp
;AN000;
247 _TEXT ends
; end code segment ;AN000;