3 title C to PARSER interface
;AN000;
4 ;------------------------------------------------------------------- ;AN000;
6 ; MODULE: _parse ;AN000;
8 ; PURPOSE: Supplies an interface between C programs and ;AN000;
9 ; the DOS parser ;AN000;
11 ; CALLING FORMAT: ;AN000;
12 ; parse(&inregs,&outregs); ;AN000;
14 ; DATE: 5-21-87 ;AN000;
16 ;------------------------------------------------------------------- ;AN000;
18 ; extrn sysparse:far ;AN000;
22 ;------------------------------------------------------------------- ;AN000;
23 FarSW equ
0 ; make sysparse be a NEAR proc ;AN000;
24 TimeSW equ
0 ; Check time format ;AN000;
25 FileSW equ
1 ; Check file specification ;AN000;
26 CAPSW equ
1 ; Perform CAPS if specified ;AN000;
27 CmpxSW equ
0 ; Check complex list ;AN000;
28 NumSW equ
1 ; Check numeric value ;AN000;
29 KeySW equ
1 ; Support keywords ;AN000;
30 SwSW equ
1 ; Support switches ;AN000;
31 Val1SW equ
1 ; Support value definition 1 ;AN000;
32 Val2SW equ
1 ; Support value definition 2 ;AN000;
33 Val3SW equ
1 ; Support value definition 3 ;AN000;
34 DrvSW equ
0 ; Support drive only format ;AN000;
35 QusSW equ
1 ; Support quoted string format ;AN000;
36 ;------------------------------------------------------------------- ;AN000;
40 _DATA
segment byte public 'DATA' ;AN000;
41 BASESW
= 1 ;SPECIFY, PSDATA POINTED TO BY "DS"
42 INCSW
= 0 ;PSDATA.INC IS ALREADY INCLUDED
43 INCLUDE PSDATA
.INC ;PARSER'S WORK SPACE
46 _TEXT
segment byte public 'CODE' ;AN000;
48 ASSUME
CS: PGROUP
;AN000;
49 ASSUME
DS: DGROUP
;AN000;
50 ;------------------------------------------------------------------- ;AN000;
52 include parse
.asm
; include the parser ;AN000;
54 ;------------------------------------------------------------------- ;AN000;
56 _parse proc
near ;AN000;
57 push bp ; save user's base pointer ;AN000;
58 mov bp,sp ; set bp to current sp ;AN000;
59 push di ; save some registers ;AN000;
62 ; copy C inregs into proper registers ;AN000;
64 mov di,[bp+4] ; fix di (arg 0) ;AN000;
66 mov ax,[di+0ah] ; load di ;AN000;
67 push ax ; the di value from inregs is now on stack ;AN000;
69 mov ax,[di+00] ; get inregs.x.ax ;AN000;
70 mov bx,[di+02] ; get inregs.x.bx ;AN000;
71 mov cx,[di+04] ; get inregs.x.cx ;AN000;
72 mov dx,[di+06] ; get inregs.x.dx ;AN000;
73 mov si,[di+08] ; get inregs.x.si ;AN000;
74 pop di ; get inregs.x.di from stack ;AN000;
76 push bp ; save base pointer ;AN000;
78 ;------------------------------------------------------------------- ;AN000;
79 call sysparse
; call the parser ;AN000;
80 ;------------------------------------------------------------------- ;AN000;
82 pop bp ; restore base pointer ;AN000;
83 push di ; the di value from call is now on stack ;AN000;
84 mov di,[bp+6] ; fix di (arg 1) ;AN000;
86 mov [di+00],ax ; load outregs.x.ax ;AN000;
87 mov [di+02],bx ; load outregs.x.bx ;AN000;
88 mov [di+04],cx ; load outregs.x.cx ;AN000;
89 mov [di+06],dx ; load outregs.x.dx ;AN000;
90 mov [di+08],si ; load outregs.x.si ;AN000;
92 lahf ; get flags into ax ;AN000;
93 mov al,ah ; move into low byte ;AN000;
94 mov [di+0ch],ax ; load outregs.x.cflag ;AN000;
96 pop ax ; get di from stack ;AN000;
97 mov [di+0ah],ax ; load outregs.x.di ;AN000;
99 pop si ; restore registers ;AN000;
101 mov sp,bp ; restore sp ;AN000;
102 pop bp ; restore user's bp ;AN000;
105 _TEXT ends
; end code segment ;AN000;