3 title C to Message Retriever
4 ;-------------------------------------------------------------------
8 ; PURPOSE: Supplies an interface between C programs and
9 ; the DOS 3.30 message retriever
12 ; sysloadmsg(&inregs,&outregs);
13 ; sysdispmsg(&inregs,&outregs);
14 ; sysgetmsg(&inregs,&outregs);
18 ;-------------------------------------------------------------------
20 INCLUDE SYSMSG
.INC ;PERMIT SYSTEM MESSAGE HANDLER DEFINITION ;AN000;
22 MSG_UTILNAME
<BACKUP
> ;IDENTIFY THE COMPONENT ;AN000;
25 _TEXT
SEGMENT BYTE PUBLIC 'CODE'
27 _DATA
SEGMENT WORD PUBLIC 'DATA'
29 CONST
SEGMENT WORD PUBLIC 'CONST'
31 _BSS
SEGMENT WORD PUBLIC 'BSS'
33 DGROUP GROUP CONST
, _BSS
, _DATA
34 ASSUME
CS: _TEXT
, DS: _TEXT
, SS: DGROUP
, ES: DGROUP
39 public _update_logfile
41 ;-------------------------------------------------------------------
42 ;-------------------------------------------------------------------
47 MSG_SERVICES
<MSGDATA
> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000;
56 ;-------------------------------------------------------------------
57 ;DEFAULT=CHECK DOS VERSION
65 MSG_SERVICES
<LOADmsg
,DISPLAYmsg
,GETmsg
,INPUTmsg
,CHARmsg
,NUMmsg
,TIMEmsg
,DATEmsg
,FARmsg
> ;AN000;
66 MSG_SERVICES
<BACKUP
.CTL
,BACKUP
.CLA
,BACKUP
.CL1
,BACKUP
.CL2
> ;AN000;
69 ;-------------------------------------------------------------------
73 push bp ; save user's base pointer
74 mov bp,sp ; set bp to current sp
75 push di ; save some registers
78 ; copy C inregs into proper registers
80 mov di,[bp+4] ; fix di (arg 0)
82 ;-------------------------------------------------------------------
84 mov ax,[di+0ah] ; load di
85 push ax ; the di value from inregs is now on stack
87 mov ax,[di+00] ; get inregs.x.ax
88 mov bx,[di+02] ; get inregs.x.bx
89 mov cx,[di+04] ; get inregs.x.cx
90 mov dx,[di+06] ; get inregs.x.dx
91 mov si,[di+08] ; get inregs.x.si
92 pop di ; get inregs.x.di from stack
94 push bp ; save base pointer
96 ;-------------------------------------------------------------------
97 call sysloadmsg
; call the message retriever
98 ;-------------------------------------------------------------------
100 pop bp ; restore base pointer
101 push di ; the di value from call is now on stack
102 mov di,[bp+6] ; fix di (arg 1)
104 mov [di+00],ax ; load outregs.x.ax
105 mov [di+02],bx ; load outregs.x.bx
106 mov [di+04],cx ; load outregs.x.cx
107 mov [di+06],dx ; load outregs.x.dx
108 mov [di+08],si ; load outregs.x.si
110 lahf ; get flags into ax
111 mov al,ah ; move into low byte
112 mov [di+0ch],ax ; load outregs.x.cflag
114 pop ax ; get di from stack
115 mov [di+0ah],ax ; load outregs.x.di
117 ;-------------------------------------------------------------------
119 pop si ; restore registers
121 mov sp,bp ; restore sp
122 pop bp ; restore user's bp
128 ;============================================================================
129 ;============================================================================
130 ;============================================================================
133 _update_logfile proc
near
135 push bp ; save user's base pointer
136 mov bp,sp ; set bp to current sp
137 push di ; save some registers
140 mov di,[bp+4] ; fix di (arg 0)
141 ;-------------------------------------------------------------------
142 mov ax,[di+0ah] ; load di
143 push ax ; the di value from inregs is now on stack
145 mov ax,[di+00] ; get inregs.x.ax
146 mov bx,[di+02] ; get inregs.x.bx
147 mov cx,[di+04] ; get inregs.x.cx
148 mov dx,[di+06] ; get inregs.x.dx
149 mov si,[di+08] ; get inregs.x.si
150 pop di ; get inregs.x.di from stack
152 push bp ; save base pointer
153 ;-------------------------------------------------------------------
154 mov dh,-1 ; Message class, Utility message
155 mov cs:handle
,bx ;AN000;9 Save logfile handle
156 mov cs:len
,cx ;AN000;9 Save write length
158 pop cs:save_ds
;AN000;9
159 call sysgetmsg
; call the message retriever
160 ;-------------------------------------------------------------------
161 pop bp ; restore base pointer
162 push di ; the di value from call is now on stack
163 mov di,[bp+6] ; fix di (arg 1)
165 mov [di+00],ax ; load outregs.x.ax
166 mov [di+02],bx ; load outregs.x.bx
167 mov [di+04],cx ; load outregs.x.cx
168 mov [di+06],dx ; load outregs.x.dx
169 mov [di+08],si ; load outregs.x.si
171 lahf ; get flags into ax
172 mov al,ah ; move into low byte
173 mov [di+0ch],ax ; load outregs.x.cflag
175 pop ax ; get di from stack
176 mov [di+0ah],ax ; load outregs.x.di
177 mov cs:offst
,si ;AN000;9
179 pop si ; restore registers
181 mov sp,bp ; restore sp
182 pop bp ; restore user's bp
184 mov ah,040h ;AN000;9 Write the message to logfile
185 mov bx,cs:handle
;AN000;9
186 mov cx,cs:len
;AN000;9
187 mov dx,cs:offst
;AN000;9
189 push cs:save_ds
;AN000;9
196 save_ds dw ?
;AN000;9
199 ;============================================================================
200 ;============================================================================
201 ;============================================================================
204 _sysdispmsg proc
near
206 push bp ; save user's base pointer
207 mov bp,sp ; set bp to current sp
208 push di ; save some registers
211 ; copy C inregs into proper registers
213 mov di,[bp+4] ; fix di (arg 0)
214 ;-------------------------------------------------------------------
215 mov ax,[di+0ah] ; load di
216 push ax ; the di value from inregs is now on stack
218 mov ax,[di+00] ; get inregs.x.ax
219 mov bx,[di+02] ; get inregs.x.bx
220 mov cx,[di+04] ; get inregs.x.cx
221 mov dx,[di+06] ; get inregs.x.dx
222 mov si,[di+08] ; get inregs.x.si
223 pop di ; get inregs.x.di from stack
225 push bp ; save base pointer
226 ;-------------------------------------------------------------------
227 call sysdispmsg
; call the message retriever
228 ;-------------------------------------------------------------------
229 pop bp ; restore base pointer
230 push di ; the di value from call is now on stack
231 mov di,[bp+6] ; fix di (arg 1)
233 mov [di+00],ax ; load outregs.x.ax
234 mov [di+02],bx ; load outregs.x.bx
235 mov [di+04],cx ; load outregs.x.cx
236 mov [di+06],dx ; load outregs.x.dx
237 mov [di+08],si ; load outregs.x.si
239 lahf ; get flags into ax
240 mov al,ah ; move into low byte
241 mov [di+0ch],ax ; load outregs.x.cflag
243 pop ax ; get di from stack
244 mov [di+0ah],ax ; load outregs.x.di
245 ;-------------------------------------------------------------------
246 pop si ; restore registers
248 mov sp,bp ; restore sp
249 pop bp ; restore user's bp
254 ;============================================================================
255 ;============================================================================
256 ;============================================================================
258 ;============================================================================
259 ;============================================================================
260 ;============================================================================
265 _TEXT ends
; end code segment