diff options
Diffstat (limited to 'v4.0/src/CMD/SUBST/_MSGRET.ASM')
| -rw-r--r-- | v4.0/src/CMD/SUBST/_MSGRET.ASM | 250 |
1 files changed, 250 insertions, 0 deletions
diff --git a/v4.0/src/CMD/SUBST/_MSGRET.ASM b/v4.0/src/CMD/SUBST/_MSGRET.ASM new file mode 100644 index 0000000..cded0ff --- /dev/null +++ b/v4.0/src/CMD/SUBST/_MSGRET.ASM | |||
| @@ -0,0 +1,250 @@ | |||
| 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 | ; DATE: 5-21-87 | ||
| 17 | ; | ||
| 18 | ;------------------------------------------------------------------- | ||
| 19 | |||
| 20 | INCLUDE SYSMSG.INC ;PERMIT SYSTEM MESSAGE HANDLER DEFINITION;AN000; | ||
| 21 | |||
| 22 | MSG_UTILNAME <SUBST> ;IDENTIFY THE COMPONENT ;AN000; | ||
| 23 | |||
| 24 | .8087 ;AN000; | ||
| 25 | _TEXT SEGMENT BYTE PUBLIC 'CODE' ;AN000; | ||
| 26 | _TEXT ENDS ;AN000; | ||
| 27 | _DATA SEGMENT WORD PUBLIC 'DATA' ;AN000; | ||
| 28 | _DATA ENDS ;AN000; | ||
| 29 | CONST SEGMENT WORD PUBLIC 'CONST' ;AN000; | ||
| 30 | CONST ENDS ;AN000; | ||
| 31 | _BSS SEGMENT WORD PUBLIC 'BSS' ;AN000; | ||
| 32 | _BSS ENDS ;AN000; | ||
| 33 | DGROUP GROUP CONST, _BSS, _DATA ;AN000; | ||
| 34 | ASSUME CS: _TEXT, DS: _TEXT, SS: DGROUP, ES: DGROUP ;AN000; | ||
| 35 | |||
| 36 | |||
| 37 | public _sysloadmsg ;AN000; | ||
| 38 | public _sysgetmsg ;AN000; | ||
| 39 | public _sysdispmsg ;AN000; | ||
| 40 | |||
| 41 | ;------------------------------------------------------------------- | ||
| 42 | ;------------------------------------------------------------------- | ||
| 43 | |||
| 44 | _DATA segment ;AN000; | ||
| 45 | .XLIST ;AN000; | ||
| 46 | .XCREF ;AN000; | ||
| 47 | MSG_SERVICES <MSGDATA> ;DATA AREA FOR THE MESSAGE HANDLER ;AN000; | ||
| 48 | .LIST ;AN000; | ||
| 49 | .CREF ;AN000; | ||
| 50 | _DATA ends ;AN000; | ||
| 51 | |||
| 52 | |||
| 53 | _TEXT segment ;AN000; | ||
| 54 | |||
| 55 | ;------------------------------------------------------------------- | ||
| 56 | |||
| 57 | ; = = = = = = = = = = = = | ||
| 58 | |||
| 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 <SUBST.CLA,SUBST.CL1,SUBST.CL2> ;MSG TEXT ;AN000; | ||
| 67 | .XLIST ;AN000; | ||
| 68 | .XCREF ;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 <SUBST.CLA,SUBST.CL1,SUBST.CL2> ;MSG TEXT ;AN000; | ||
| 72 | .LIST ;AN000; | ||
| 73 | .CREF ;AN000; | ||
| 74 | ;------------------------------------------------------------------- | ||
| 75 | |||
| 76 | _sysloadmsg proc near ;AN000; | ||
| 77 | |||
| 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; | ||
| 81 | push si ;AN000; | ||
| 82 | |||
| 83 | ; copy C inregs into proper registers | ||
| 84 | |||
| 85 | mov di,[bp+4] ; fix di (arg 0) ;AN000; | ||
| 86 | |||
| 87 | ;------------------------------------------------------------------- | ||
| 88 | |||
| 89 | mov ax,[di+0ah] ; load di ;AN000; | ||
| 90 | push ax ; the di value from inregs is now on stack;AN000; | ||
| 91 | |||
| 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; | ||
| 98 | |||
| 99 | push bp ; save base pointer ;AN000; | ||
| 100 | |||
| 101 | ;------------------------------------------------------------------- | ||
| 102 | call sysloadmsg ; call the message retriever ;AN000; | ||
| 103 | ;------------------------------------------------------------------- | ||
| 104 | |||
| 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; | ||
| 108 | |||
| 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; | ||
| 114 | |||
| 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; | ||
| 118 | |||
| 119 | pop ax ; get di from stack ;AN000; | ||
| 120 | mov [di+0ah],ax ; load outregs.x.di ;AN000; | ||
| 121 | |||
| 122 | ;------------------------------------------------------------------- | ||
| 123 | |||
| 124 | pop si ; restore registers ;AN000; | ||
| 125 | pop di ;AN000; | ||
| 126 | mov sp,bp ; restore sp ;AN000; | ||
| 127 | pop bp ; restore user's bp ;AN000; | ||
| 128 | ret ;AN000; | ||
| 129 | |||
| 130 | _sysloadmsg endp ;AN000; | ||
| 131 | |||
| 132 | |||
| 133 | _sysgetmsg proc near ;AN000; | ||
| 134 | |||
| 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; | ||
| 138 | push si ;AN000; | ||
| 139 | ;AN000; | ||
| 140 | ; copy C inregs into proper registers | ||
| 141 | |||
| 142 | mov di,[bp+4] ; fix di (arg 0) ;AN000; | ||
| 143 | |||
| 144 | ;------------------------------------------------------------------- | ||
| 145 | |||
| 146 | mov ax,[di+0ah] ; load di ;AN000; | ||
| 147 | push ax ; the di value from inregs is now on stack;AN000; | ||
| 148 | |||
| 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; | ||
| 155 | |||
| 156 | push bp ; save base pointer ;AN000; | ||
| 157 | |||
| 158 | ;------------------------------------------------------------------- | ||
| 159 | call sysgetmsg ; call the message retriever ;AN000; | ||
| 160 | ;------------------------------------------------------------------- | ||
| 161 | |||
| 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; | ||
| 165 | |||
| 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; | ||
| 171 | |||
| 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; | ||
| 175 | |||
| 176 | pop ax ; get di from stack ;AN000; | ||
| 177 | mov [di+0ah],ax ; load outregs.x.di ;AN000; | ||
| 178 | |||
| 179 | ;------------------------------------------------------------------- | ||
| 180 | |||
| 181 | pop si ; restore registers ;AN000; | ||
| 182 | pop di ;AN000; | ||
| 183 | mov sp,bp ; restore sp ;AN000; | ||
| 184 | pop bp ; restore user's bp ;AN000; | ||
| 185 | ret ;AN000; | ||
| 186 | |||
| 187 | _sysgetmsg endp ;AN000; | ||
| 188 | |||
| 189 | _sysdispmsg proc near ;AN000; | ||
| 190 | |||
| 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; | ||
| 194 | push si ;AN000; | ||
| 195 | |||
| 196 | ; copy C inregs into proper registers | ||
| 197 | |||
| 198 | mov di,[bp+4] ; fix di (arg 0) ;AN000; | ||
| 199 | |||
| 200 | ;------------------------------------------------------------------- | ||
| 201 | |||
| 202 | mov ax,[di+0ah] ; load di ;AN000; | ||
| 203 | push ax ; the di value from inregs is now on stack;AN000; | ||
| 204 | |||
| 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; | ||
| 211 | |||
| 212 | push bp ; save base pointer ;AN000; | ||
| 213 | |||
| 214 | ;------------------------------------------------------------------- | ||
| 215 | call sysdispmsg ; call the message retriever ;AN000; | ||
| 216 | ;------------------------------------------------------------------- | ||
| 217 | |||
| 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; | ||
| 221 | |||
| 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; | ||
| 227 | |||
| 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; | ||
| 231 | |||
| 232 | pop ax ; get di from stack ;AN000; | ||
| 233 | mov [di+0ah],ax ; load outregs.x.di ;AN000; | ||
| 234 | |||
| 235 | ;------------------------------------------------------------------- | ||
| 236 | |||
| 237 | pop si ; restore registers ;AN000; | ||
| 238 | pop di ;AN000; | ||
| 239 | mov sp,bp ; restore sp ;AN000; | ||
| 240 | pop bp ; restore user's bp ;AN000; | ||
| 241 | ret ;AN000; | ||
| 242 | |||
| 243 | _sysdispmsg endp ;AN000; | ||
| 244 | |||
| 245 | include msgdcl.inc | ||
| 246 | |||
| 247 | _TEXT ends ; end code segment ;AN000; | ||
| 248 | end ;AN000; | ||
| 249 | |||
| 250 | \ No newline at end of file | ||