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

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / RESTORE / _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 ; sysdispmsg(&inregs,&outregs);
14 ;
15 ; DATE: 5-21-87
16 ;
17 ;-------------------------------------------------------------------
18
19 INCLUDE SYSMSG.INC ;PERMIT SYSTEM MESSAGE HANDLER DEFINITION ;AN000;
20
21 MSG_UTILNAME <RESTORE> ;IDENTIFY THE COMPONENT ;AN000;
22
23 .8087
24 _TEXT SEGMENT BYTE PUBLIC 'CODE'
25 _TEXT ENDS
26 _DATA SEGMENT WORD PUBLIC 'DATA'
27 _DATA ENDS
28 CONST SEGMENT WORD PUBLIC 'CONST'
29 CONST ENDS
30 _BSS SEGMENT WORD PUBLIC 'BSS'
31 _BSS ENDS
32 DGROUP GROUP CONST, _BSS, _DATA
33 ASSUME CS: _TEXT, DS: _TEXT, SS: DGROUP, ES: DGROUP
34
35
36 public _sysloadmsg
37 public _sysdispmsg
38
39 ;-------------------------------------------------------------------
40 ;-------------------------------------------------------------------
41
42 _DATA segment
43 .XLIST
44 .XCREF
45 MSG_SERVICES <MSGDATA> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000;
46 .LIST
47 .CREF
48 _DATA ends
49
50
51 _TEXT segment
52
53 ;-------------------------------------------------------------------
54 ;DEFAULT=CHECK DOS VERSION
55 ;DEFAULT=NEARmsg
56 ;DEFAULT=INPUTmsg
57 ;DEFAULT=NUMmsg
58 ;DEFAULT=NO TIMEmsg
59 ;DEFAULT=NO DATEmsg
60 .XLIST
61 .XCREF
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
64 .LIST
65 .CREF
66 ;-------------------------------------------------------------------
67
68 _sysloadmsg proc near
69
70 push bp ; save user's base pointer
71 mov bp,sp ; set bp to current sp
72 push di ; save some registers
73 push si
74
75 ; copy C inregs into proper registers
76
77 mov di,[bp+4] ; fix di (arg 0)
78
79 ;-------------------------------------------------------------------
80
81 mov ax,[di+0ah] ; load di
82 push ax ; the di value from inregs is now on stack
83
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
90
91 push bp ; save base pointer
92
93 ;-------------------------------------------------------------------
94 call sysloadmsg ; call the message retriever
95 ;-------------------------------------------------------------------
96
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)
100
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
106
107 lahf ; get flags into ax
108 mov al,ah ; move into low byte
109 mov [di+0ch],ax ; load outregs.x.cflag
110
111 pop ax ; get di from stack
112 mov [di+0ah],ax ; load outregs.x.di
113
114 ;-------------------------------------------------------------------
115
116 pop si ; restore registers
117 pop di
118 mov sp,bp ; restore sp
119 pop bp ; restore user's bp
120 ret
121
122 _sysloadmsg endp
123
124
125 ;_sysgetmsg proc near
126 ;
127 ; push bp ; save user's base pointer
128 ; mov bp,sp ; set bp to current sp
129 ; push di ; save some registers
130 ; push si
131 ;
132 ;; copy C inregs into proper registers
133 ;
134 ; mov di,[bp+4] ; fix di (arg 0)
135 ;
136 ;;-------------------------------------------------------------------
137 ;
138 ; mov ax,[di+0ah] ; load di
139 ; push ax ; the di value from inregs is now on stack
140 ;
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
147 ;
148 ; push bp ; save base pointer
149 ;
150 ;;-------------------------------------------------------------------
151 ; call sysgetmsg ; call the message retriever
152 ;;-------------------------------------------------------------------
153 ;
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)
157 ;
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
163 ;
164 ; lahf ; get flags into ax
165 ; mov al,ah ; move into low byte
166 ; mov [di+0ch],ax ; load outregs.x.cflag
167 ;
168 ; pop ax ; get di from stack
169 ; mov [di+0ah],ax ; load outregs.x.di
170 ;
171 ;;-------------------------------------------------------------------
172 ;
173 ; pop si ; restore registers
174 ; pop di
175 ; mov sp,bp ; restore sp
176 ; pop bp ; restore user's bp
177 ; ret
178 ;
179 ;_sysgetmsg endp
180
181 _sysdispmsg proc near
182
183 push bp ; save user's base pointer
184 mov bp,sp ; set bp to current sp
185 push di ; save some registers
186 push si
187
188 ; copy C inregs into proper registers
189
190 mov di,[bp+4] ; fix di (arg 0)
191
192 ;-------------------------------------------------------------------
193
194 mov ax,[di+0ah] ; load di
195 push ax ; the di value from inregs is now on stack
196
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
203
204 push bp ; save base pointer
205
206 ;-------------------------------------------------------------------
207 call sysdispmsg ; call the message retriever
208 ;-------------------------------------------------------------------
209
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)
213
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
219
220 lahf ; get flags into ax
221 mov al,ah ; move into low byte
222 mov [di+0ch],ax ; load outregs.x.cflag
223
224 pop ax ; get di from stack
225 mov [di+0ah],ax ; load outregs.x.di
226
227 ;-------------------------------------------------------------------
228
229 pop si ; restore registers
230 pop di
231 mov sp,bp ; restore sp
232 pop bp ; restore user's bp
233 ret
234
235 _sysdispmsg endp
236
237 include msgdcl.inc
238
239 _TEXT ends ; end code segment
240 end
241
242 \1a