diff options
Diffstat (limited to 'v4.0/src/CMD/SUBST/_PARSE.ASM')
| -rw-r--r-- | v4.0/src/CMD/SUBST/_PARSE.ASM | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/v4.0/src/CMD/SUBST/_PARSE.ASM b/v4.0/src/CMD/SUBST/_PARSE.ASM new file mode 100644 index 0000000..8c44df5 --- /dev/null +++ b/v4.0/src/CMD/SUBST/_PARSE.ASM | |||
| @@ -0,0 +1,121 @@ | |||
| 1 | page 60,132 | ||
| 2 | name _parse | ||
| 3 | title C to PARSER interface | ||
| 4 | ;------------------------------------------------------------------- | ||
| 5 | ; | ||
| 6 | ; MODULE: _parse | ||
| 7 | ; | ||
| 8 | ; PURPOSE: Supplies an interface between C programs and | ||
| 9 | ; the DOS 3.3 parser | ||
| 10 | ; | ||
| 11 | ; **(Customized for the SUBST utility) | ||
| 12 | ; | ||
| 13 | ; CALLING FORMAT: | ||
| 14 | ; parse(&inregs,&outregs); | ||
| 15 | ; | ||
| 16 | ; DATE: 5-21-87 | ||
| 17 | ; | ||
| 18 | ;------------------------------------------------------------------- | ||
| 19 | |||
| 20 | ; extrn sysparse:far | ||
| 21 | |||
| 22 | public _parse ;AN000; | ||
| 23 | |||
| 24 | ;------------------------------------------------------------------- | ||
| 25 | |||
| 26 | ; set for SUBST | ||
| 27 | ; ------------- | ||
| 28 | |||
| 29 | FarSW equ 0 ; make sysparse be a NEAR proc ;AN000; | ||
| 30 | TimeSW equ 0 ; Check time format ;AN000; | ||
| 31 | FileSW equ 1 ; Check file specification ;AN000; | ||
| 32 | CAPSW equ 1 ; Perform CAPS if specified ;AN000; | ||
| 33 | CmpxSW equ 0 ; Check complex list ;AN000; | ||
| 34 | NumSW equ 0 ; Check numeric value ;AN000; | ||
| 35 | KeySW equ 0 ; Support keywords ;AN000; | ||
| 36 | SwSW equ 1 ; Support switches ;AN000; | ||
| 37 | Val1SW equ 0 ; Support value definition 1 ;AN000; | ||
| 38 | Val2SW equ 0 ; Support value definition 2 ;AN000; | ||
| 39 | Val3SW equ 0 ; Support value definition 3 ;AN000; | ||
| 40 | DrvSW equ 1 ; Support drive only format ;AN000; | ||
| 41 | QusSW equ 0 ; Support quoted string format ;AN000; | ||
| 42 | ;------------------------------------------------------------------- | ||
| 43 | |||
| 44 | DGROUP GROUP _DATA | ||
| 45 | PGROUP GROUP _TEXT | ||
| 46 | |||
| 47 | _DATA segment byte public 'DATA' ;AN000; | ||
| 48 | BASESW = 1 ;SPECIFY, PSDATA POINTED TO BY "DS" | ||
| 49 | INCSW = 0 ;PSDATA.INC IS ALREADY INCLUDED | ||
| 50 | INCLUDE PSDATA.INC ;PARSER'S WORK SPACE | ||
| 51 | _DATA ends ;AN000; | ||
| 52 | |||
| 53 | _TEXT segment byte public 'CODE' ;AN000; | ||
| 54 | |||
| 55 | ASSUME CS: PGROUP ;AN000; | ||
| 56 | ASSUME DS: DGROUP ;AN000; | ||
| 57 | |||
| 58 | ;------------------------------------------------------------------- | ||
| 59 | include parse.asm ; include the parser ;AN000; | ||
| 60 | ;------------------------------------------------------------------- | ||
| 61 | |||
| 62 | _parse proc near ;AN000; | ||
| 63 | |||
| 64 | push bp ; save user's base pointer ;AN000; | ||
| 65 | mov bp,sp ; set bp to current sp ;AN000; | ||
| 66 | push di ; save some registers ;AN000; | ||
| 67 | push si ;AN000; | ||
| 68 | |||
| 69 | ; copy C inregs into proper registers | ||
| 70 | |||
| 71 | mov di,[bp+4] ; fix di (arg 0) ;AN000; | ||
| 72 | |||
| 73 | ;------------------------------------------------------------------- | ||
| 74 | |||
| 75 | mov ax,[di+0ah] ; load di ;AN000; | ||
| 76 | push ax ; the di value from inregs is now on stack;AN000; | ||
| 77 | |||
| 78 | mov ax,[di+00] ; get inregs.x.ax ;AN000; | ||
| 79 | mov bx,[di+02] ; get inregs.x.bx ;AN000; | ||
| 80 | mov cx,[di+04] ; get inregs.x.cx ;AN000; | ||
| 81 | mov dx,[di+06] ; get inregs.x.dx ;AN000; | ||
| 82 | mov si,[di+08] ; get inregs.x.si ;AN000; | ||
| 83 | pop di ; get inregs.x.di from stack ;AN000; | ||
| 84 | |||
| 85 | push bp ; save base pointer ;AN000; | ||
| 86 | |||
| 87 | ;------------------------------------------------------------------- | ||
| 88 | call sysparse ; call the parser ;AN000; | ||
| 89 | ;------------------------------------------------------------------- | ||
| 90 | |||
| 91 | pop bp ; restore base pointer ;AN000; | ||
| 92 | push di ; the di value from call is now on stack;AN000; | ||
| 93 | mov di,[bp+6] ; fix di (arg 1) ;AN000; | ||
| 94 | |||
| 95 | mov [di+00],ax ; load outregs.x.ax ;AN000; | ||
| 96 | mov [di+02],bx ; load outregs.x.bx ;AN000; | ||
| 97 | mov [di+04],cx ; load outregs.x.cx ;AN000; | ||
| 98 | mov [di+06],dx ; load outregs.x.dx ;AN000; | ||
| 99 | mov [di+08],si ; load outregs.x.si ;AN000; | ||
| 100 | |||
| 101 | lahf ; get flags into ax ;AN000; | ||
| 102 | mov al,ah ; move into low byte ;AN000; | ||
| 103 | mov [di+0ch],ax ; load outregs.x.cflag ;AN000; | ||
| 104 | |||
| 105 | pop ax ; get di from stack ;AN000; | ||
| 106 | mov [di+0ah],ax ; load outregs.x.di ;AN000; | ||
| 107 | |||
| 108 | ;------------------------------------------------------------------- | ||
| 109 | |||
| 110 | pop si ; restore registers ;AN000; | ||
| 111 | pop di ;AN000; | ||
| 112 | mov sp,bp ; restore sp ;AN000; | ||
| 113 | pop bp ; restore user's bp ;AN000; | ||
| 114 | ret ;AN000; | ||
| 115 | |||
| 116 | _parse endp ;AN000; | ||
| 117 | |||
| 118 | _TEXT ends ; end code segment ;AN000; | ||
| 119 | end ;AN000; | ||
| 120 | |||
| 121 | \ No newline at end of file | ||