diff options
Diffstat (limited to 'v4.0/src/CMD/MEM/_MSGRET.ASM')
| -rw-r--r-- | v4.0/src/CMD/MEM/_MSGRET.ASM | 263 |
1 files changed, 263 insertions, 0 deletions
diff --git a/v4.0/src/CMD/MEM/_MSGRET.ASM b/v4.0/src/CMD/MEM/_MSGRET.ASM new file mode 100644 index 0000000..0b982f7 --- /dev/null +++ b/v4.0/src/CMD/MEM/_MSGRET.ASM | |||
| @@ -0,0 +1,263 @@ | |||
| 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 | ; msgret(&inregs,&outregs); | ||
| 13 | ; | ||
| 14 | ; DATE: 5-21-87 | ||
| 15 | ; | ||
| 16 | ;------------------------------------------------------------------- | ||
| 17 | |||
| 18 | INCLUDE SYSMSG.INC ;PERMIT SYSTEM MESSAGE HANDLER DEFINITION ;AN000; | ||
| 19 | |||
| 20 | MSG_UTILNAME <MEM> ;IDENTIFY THE COMPONENT ;AN000; | ||
| 21 | |||
| 22 | ;------------------------------------------------------------------- | ||
| 23 | ;------------------------------------------------------------------- | ||
| 24 | |||
| 25 | |||
| 26 | _TEXT SEGMENT BYTE PUBLIC 'CODE' | ||
| 27 | _TEXT ENDS | ||
| 28 | _DATA SEGMENT WORD PUBLIC 'DATA' | ||
| 29 | _DATA ENDS | ||
| 30 | CONST SEGMENT WORD PUBLIC 'CONST' | ||
| 31 | CONST ENDS | ||
| 32 | _BSS SEGMENT WORD PUBLIC 'BSS' | ||
| 33 | _BSS ENDS | ||
| 34 | |||
| 35 | DGROUP GROUP CONST, _BSS, _DATA | ||
| 36 | ASSUME CS: DGROUP, DS: DGROUP, SS: DGROUP, ES: NOTHING | ||
| 37 | |||
| 38 | public data_sysloadmsg | ||
| 39 | public data_sysdispmsg | ||
| 40 | public data_sysgetmsg | ||
| 41 | |||
| 42 | _DATA SEGMENT | ||
| 43 | |||
| 44 | MSG_SERVICES <MSGDATA> | ||
| 45 | MSG_SERVICES <LOADmsg,FARmsg> | ||
| 46 | MSG_SERVICES <DISPLAYmsg,GETmsg,CHARmsg,NUMmsg> | ||
| 47 | MSG_SERVICES <MEM.CLA,MEM.CLB,MEM.CL1,MEM.CL2,MEM.CTL> ;AN000; | ||
| 48 | |||
| 49 | |||
| 50 | data_sysloadmsg proc far | ||
| 51 | |||
| 52 | push bp ; save user's base pointer | ||
| 53 | mov bp,sp ; set bp to current sp | ||
| 54 | push di ; save some registers | ||
| 55 | push si | ||
| 56 | |||
| 57 | ; copy C inregs into proper registers | ||
| 58 | |||
| 59 | mov di,[bp+4+4] ; fix di (arg 0) | ||
| 60 | |||
| 61 | ;------------------------------------------------------------------- | ||
| 62 | |||
| 63 | mov ax,[di+0ah] ; load di | ||
| 64 | push ax ; the di value from inregs is now on stack | ||
| 65 | |||
| 66 | mov ax,[di+00] ; get inregs.x.ax | ||
| 67 | mov bx,[di+02] ; get inregs.x.bx | ||
| 68 | mov cx,[di+04] ; get inregs.x.cx | ||
| 69 | mov dx,[di+06] ; get inregs.x.dx | ||
| 70 | mov si,[di+08] ; get inregs.x.si | ||
| 71 | pop di ; get inregs.x.di from stack | ||
| 72 | |||
| 73 | push bp ; save base pointer | ||
| 74 | |||
| 75 | ;------------------------------------------------------------------- | ||
| 76 | |||
| 77 | call sysloadmsg ; call the message retriever | ||
| 78 | |||
| 79 | ;------------------------------------------------------------------- | ||
| 80 | |||
| 81 | pop bp ; restore base pointer | ||
| 82 | push di ; the di value from call is now on stack | ||
| 83 | mov di,[bp+6+4] ; fix di (arg 1) | ||
| 84 | |||
| 85 | mov [di+00],ax ; load outregs.x.ax | ||
| 86 | mov [di+02],bx ; load outregs.x.bx | ||
| 87 | mov [di+04],cx ; load outregs.x.cx | ||
| 88 | mov [di+06],dx ; load outregs.x.dx | ||
| 89 | mov [di+08],si ; load outregs.x.si | ||
| 90 | |||
| 91 | lahf ; get flags into ax | ||
| 92 | mov al,ah ; move into low byte | ||
| 93 | mov [di+0ch],ax ; load outregs.x.cflag | ||
| 94 | |||
| 95 | pop ax ; get di from stack | ||
| 96 | mov [di+0ah],ax ; load outregs.x.di | ||
| 97 | |||
| 98 | ;------------------------------------------------------------------- | ||
| 99 | |||
| 100 | pop si ; restore registers | ||
| 101 | pop di | ||
| 102 | mov sp,bp ; restore sp | ||
| 103 | pop bp ; restore user's bp | ||
| 104 | ret | ||
| 105 | |||
| 106 | data_sysloadmsg endp | ||
| 107 | |||
| 108 | |||
| 109 | data_sysdispmsg proc far | ||
| 110 | |||
| 111 | push bp ; save user's base pointer | ||
| 112 | mov bp,sp ; set bp to current sp | ||
| 113 | push di ; save some registers | ||
| 114 | push si | ||
| 115 | |||
| 116 | ; copy C inregs into proper registers | ||
| 117 | |||
| 118 | mov di,[bp+4+4] ; fix di (arg 0) | ||
| 119 | |||
| 120 | ;------------------------------------------------------------------- | ||
| 121 | |||
| 122 | mov ax,[di+0ah] ; load di | ||
| 123 | push ax ; the di value from inregs is now on stack | ||
| 124 | |||
| 125 | mov ax,[di+00] ; get inregs.x.ax | ||
| 126 | mov bx,[di+02] ; get inregs.x.bx | ||
| 127 | mov cx,[di+04] ; get inregs.x.cx | ||
| 128 | mov dx,[di+06] ; get inregs.x.dx | ||
| 129 | mov si,[di+08] ; get inregs.x.si | ||
| 130 | pop di ; get inregs.x.di from stack | ||
| 131 | |||
| 132 | push bp ; save base pointer | ||
| 133 | |||
| 134 | ;------------------------------------------------------------------- | ||
| 135 | |||
| 136 | call sysdispmsg | ||
| 137 | |||
| 138 | ;------------------------------------------------------------------- | ||
| 139 | |||
| 140 | pop bp ; restore base pointer | ||
| 141 | push di ; the di value from call is now on stack | ||
| 142 | mov di,[bp+6+4] ; fix di (arg 1) | ||
| 143 | |||
| 144 | mov [di+00],ax ; load outregs.x.ax | ||
| 145 | mov [di+02],bx ; load outregs.x.bx | ||
| 146 | mov [di+04],cx ; load outregs.x.cx | ||
| 147 | mov [di+06],dx ; load outregs.x.dx | ||
| 148 | mov [di+08],si ; load outregs.x.si | ||
| 149 | |||
| 150 | lahf ; get flags into ax | ||
| 151 | mov al,ah ; move into low byte | ||
| 152 | mov [di+0ch],ax ; load outregs.x.cflag | ||
| 153 | |||
| 154 | pop ax ; get di from stack | ||
| 155 | mov [di+0ah],ax ; load outregs.x.di | ||
| 156 | |||
| 157 | ;------------------------------------------------------------------- | ||
| 158 | |||
| 159 | pop si ; restore registers | ||
| 160 | pop di | ||
| 161 | mov sp,bp ; restore sp | ||
| 162 | pop bp ; restore user's bp | ||
| 163 | ret | ||
| 164 | |||
| 165 | data_sysdispmsg endp | ||
| 166 | |||
| 167 | |||
| 168 | data_sysgetmsg proc far | ||
| 169 | |||
| 170 | push bp ; save user's base pointer | ||
| 171 | mov bp,sp ; set bp to current sp | ||
| 172 | push di ; save some registers | ||
| 173 | push si | ||
| 174 | |||
| 175 | ; copy C inregs into proper registers | ||
| 176 | |||
| 177 | mov di,[bp+4+4] ; fix di (arg 0) | ||
| 178 | |||
| 179 | ;------------------------------------------------------------------- | ||
| 180 | |||
| 181 | mov ax,[di+0ah] ; load di | ||
| 182 | push ax ; the di value from inregs is now on stack | ||
| 183 | |||
| 184 | mov ax,[di+00] ; get inregs.x.ax | ||
| 185 | mov bx,[di+02] ; get inregs.x.bx | ||
| 186 | mov cx,[di+04] ; get inregs.x.cx | ||
| 187 | mov dx,[di+06] ; get inregs.x.dx | ||
| 188 | mov si,[di+08] ; get inregs.x.si | ||
| 189 | pop di ; get inregs.x.di from stack | ||
| 190 | |||
| 191 | push bp ; save base pointer | ||
| 192 | |||
| 193 | ;------------------------------------------------------------------- | ||
| 194 | |||
| 195 | call sysgetmsg ; call the message retriever | ||
| 196 | |||
| 197 | ;------------------------------------------------------------------- | ||
| 198 | |||
| 199 | pop bp ; restore base pointer | ||
| 200 | push di ; the di value from call is now on stack | ||
| 201 | mov di,[bp+6+4] ; fix di (arg 1) | ||
| 202 | |||
| 203 | push ax ; save ax | ||
| 204 | mov [di+00],es ; load segregs.es | ||
| 205 | mov [di+06],ds ; load outregs.ds | ||
| 206 | pop ax ; restore ax | ||
| 207 | |||
| 208 | pop di ; restore di | ||
| 209 | push di ; save it | ||
| 210 | mov di,[bp+8+4] ; fix di (arg 2) | ||
| 211 | mov [di+00],ax ; load outregs.x.ax | ||
| 212 | mov [di+02],bx ; load outregs.x.bx | ||
| 213 | mov [di+04],cx ; load outregs.x.cx | ||
| 214 | mov [di+06],dx ; load outregs.x.dx | ||
| 215 | mov [di+08],si ; load outregs.x.si | ||
| 216 | |||
| 217 | lahf ; get flags into ax | ||
| 218 | mov al,ah ; move into low byte | ||
| 219 | mov [di+0ch],ax ; load outregs.x.cflag | ||
| 220 | |||
| 221 | pop ax ; get di from stack | ||
| 222 | mov [di+0ah],ax ; load outregs.x.di | ||
| 223 | |||
| 224 | ;------------------------------------------------------------------- | ||
| 225 | |||
| 226 | pop si ; restore registers | ||
| 227 | pop di | ||
| 228 | mov sp,bp ; restore sp | ||
| 229 | pop bp ; restore user's bp | ||
| 230 | ret | ||
| 231 | |||
| 232 | data_sysgetmsg endp | ||
| 233 | |||
| 234 | include msgdcl.inc | ||
| 235 | |||
| 236 | _DATA ends ; end code segment | ||
| 237 | |||
| 238 | _TEXT SEGMENT | ||
| 239 | |||
| 240 | assume cs:_TEXT | ||
| 241 | |||
| 242 | public _sysdispmsg | ||
| 243 | public _sysloadmsg | ||
| 244 | public _sysgetmsg | ||
| 245 | |||
| 246 | _sysdispmsg proc near | ||
| 247 | call data_sysdispmsg | ||
| 248 | ret | ||
| 249 | _sysdispmsg endp | ||
| 250 | |||
| 251 | _sysloadmsg proc near | ||
| 252 | call data_sysloadmsg | ||
| 253 | ret | ||
| 254 | _sysloadmsg endp | ||
| 255 | |||
| 256 | _sysgetmsg proc near | ||
| 257 | call data_sysgetmsg | ||
| 258 | ret | ||
| 259 | _sysgetmsg endp | ||
| 260 | |||
| 261 | _TEXT ENDS | ||
| 262 | end | ||
| 263 | |||