]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/REPLACE/_MSGRET.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / REPLACE / _MSGRET.ASM
1 page 60,132
2 name _msgret
3 title C to Message Retriever
4 ;-------------------------------------------------------------------
5 ;
6 ; MODULE: _msgret
7 ;
8 ; PURPOSE: Supplies an interface between C programs and
9 ; the DOS 3.3 message retriever
10 ;
11 ; CALLING FORMAT:
12 ; sysloadmsg(&inregs,&outregs);
13 ; sysgetmsg(&inregs,&outregs);
14 ; sysdispmsg(&inregs,&outregs);
15 ;
16 ;
17 ; DATE: 5-21-87
18 ;
19 ;-------------------------------------------------------------------
20
21 INCLUDE SYSMSG.INC ;PERMIT SYSTEM MESSAGE HANDLER DEFINITION ;AN000;
22
23 MSG_UTILNAME <REPLACE> ;IDENTIFY THE COMPONENT ;AN000;
24
25 .8087 ;AN000;
26 _TEXT SEGMENT BYTE PUBLIC 'CODE' ;AN000;
27 _TEXT ENDS ;AN000;
28 _DATA SEGMENT WORD PUBLIC 'DATA' ;AN000;
29 _DATA ENDS ;AN000;
30 CONST SEGMENT WORD PUBLIC 'CONST' ;AN000;
31 CONST ENDS ;AN000;
32 _BSS SEGMENT WORD PUBLIC 'BSS' ;AN000;
33 _BSS ENDS ;AN000;
34 DGROUP GROUP CONST, _BSS, _DATA ;AN000;
35 ASSUME CS: _TEXT, DS: _TEXT, SS: DGROUP, ES: DGROUP ;AN000;
36
37
38 public _sysloadmsg ;AN000;
39 public _sysgetmsg ;AN000;
40 public _sysdispmsg ;AN000;
41
42 ;-------------------------------------------------------------------
43 ;-------------------------------------------------------------------
44
45 _DATA segment ;AN000;
46 .XLIST ;AN000;
47 .XCREF ;AN000;
48 MSG_SERVICES <MSGDATA> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000;
49 .LIST ;AN000;
50 .CREF ;AN000;
51 _DATA ends ;AN000;
52
53
54 _TEXT segment ;AN000;
55
56 ;-------------------------------------------------------------------
57
58 ; = = = = = = = = = = = =
59
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;
68 .XLIST ;AN000;
69 .XCREF ;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;
73 .LIST ;AN000;
74 .CREF ;AN000;
75 ;------------------------------------------------------------------- ;AN000;
76
77 _sysloadmsg proc near ;AN000;
78
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;
82 push si ;AN000;
83
84 ; copy C inregs into proper registers ;AN000;
85
86 mov di,[bp+4] ; fix di (arg 0) ;AN000;
87
88 ;-------------------------------------------------------------------
89
90 mov ax,[di+0ah] ; load di ;AN000;
91 push ax ; the di value from inregs is now on stack;AN000;
92
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;
99
100 push bp ; save base pointer ;AN000;
101
102 ;-------------------------------------------------------------------
103 call sysloadmsg ; call the message retriever ;AN000;
104 ;-------------------------------------------------------------------
105
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;
109
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;
115
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;
119
120 pop ax ; get di from stack ;AN000;
121 mov [di+0ah],ax ; load outregs.x.di ;AN000;
122
123 ;-------------------------------------------------------------------
124
125 pop si ; restore registers ;AN000;
126 pop di ;AN000;
127 mov sp,bp ; restore sp ;AN000;
128 pop bp ; restore user's bp ;AN000;
129 ret ;AN000;
130
131 _sysloadmsg endp ;AN000;
132
133
134 _sysgetmsg proc near ;AN000;
135
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;
139 push si ;AN000;
140
141 ; copy C inregs into proper registers ;AN000;
142
143 mov di,[bp+4] ; fix di (arg 0) ;AN000;
144
145 ;-------------------------------------------------------------------
146
147 mov ax,[di+0ah] ; load di ;AN000;
148 push ax ; the di value from inregs is now on stack;AN000;
149
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;
156
157 push bp ; save base pointer ;AN000;
158
159 ;-------------------------------------------------------------------
160 call sysgetmsg ; call the message retriever ;AN000;
161 ;-------------------------------------------------------------------
162
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;
166
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;
172
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;
176
177 pop ax ; get di from stack ;AN000;
178 mov [di+0ah],ax ; load outregs.x.di ;AN000;
179
180 ;-------------------------------------------------------------------
181
182 pop si ; restore registers ;AN000;
183 pop di ;AN000;
184 mov sp,bp ; restore sp ;AN000;
185 pop bp ; restore user's bp ;AN000;
186 ret ;AN000;
187
188 _sysgetmsg endp ;AN000;
189
190 _sysdispmsg proc near ;AN000;
191
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;
195 push si ;AN000;
196
197 ; copy C inregs into proper registers ;AN000;
198
199 mov di,[bp+4] ; fix di (arg 0) ;AN000;
200
201 ;-------------------------------------------------------------------
202
203 mov ax,[di+0ah] ; load di ;AN000;
204 push ax ; the di value from inregs is now on stack;AN000;
205
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;
212
213 push bp ; save base pointer ;AN000;
214
215 ;-------------------------------------------------------------------
216 call sysdispmsg ; call the message retriever ;AN000;
217 ;-------------------------------------------------------------------
218
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;
222
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;
228
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;
232
233 pop ax ; get di from stack ;AN000;
234 mov [di+0ah],ax ; load outregs.x.di ;AN000;
235
236 ;-------------------------------------------------------------------
237
238 pop si ; restore registers ;AN000;
239 pop di ;AN000;
240 mov sp,bp ; restore sp ;AN000;
241 pop bp ; restore user's bp ;AN000;
242 ret ;AN000;
243
244 _sysdispmsg endp ;AN000;
245
246 include msgdcl.inc
247
248 _TEXT ends ; end code segment ;AN000;
249 end ;AN000;
250
251 \1a