]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/INC/_PARSE.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / INC / _PARSE.ASM
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.30 parser
10 ;
11 ; CALLING FORMAT:
12 ; parse(&inregs,&outregs);
13 ;
14 ; DATE: 5-21-87
15 ;
16 ;-------------------------------------------------------------------
17
18 ; extrn sysparse:far
19
20 public _parse
21
22 ;-------------------------------------------------------------------
23
24 ; SET FOR SUBST
25 ; -------------
26
27 FarSW equ 0 ; make sysparse be a NEAR proc
28 TimeSW equ 0 ; Check time format
29 FileSW equ 1 ; Check file specification
30 CAPSW equ 1 ; Perform CAPS if specified
31 CmpxSW equ 0 ; Check complex list
32 NumSW equ 0 ; Check numeric value
33 KeySW equ 0 ; Support keywords
34 SwSW equ 1 ; Support switches
35 Val1SW equ 0 ; Support value definition 1
36 Val2SW equ 0 ; Support value definition 2
37 Val3SW equ 0 ; Support value definition 3
38 DrvSW equ 1 ; Support drive only format
39 QusSW equ 0 ; Support quoted string format
40 ;-------------------------------------------------------------------
41
42 _DATA segment byte public 'DATA'
43 _DATA ends
44
45 _TEXT segment byte public 'CODE'
46
47 ASSUME CS: _TEXT
48 ASSUME DS: _DATA
49
50 ;-------------------------------------------------------------------
51 include parse.asm ; include the parser
52 ;-------------------------------------------------------------------
53
54 _parse proc near
55
56 push bp ; save user's base pointer
57 mov bp,sp ; set bp to current sp
58 push di ; save some registers
59 push si
60
61 ; copy C inregs into proper registers
62
63 mov di,[bp+4] ; fix di (arg 0)
64
65 ;-------------------------------------------------------------------
66
67 mov ax,[di+0ah] ; load di
68 push ax ; the di value from inregs is now on stack
69
70 mov ax,[di+00] ; get inregs.x.ax
71 mov bx,[di+02] ; get inregs.x.bx
72 mov cx,[di+04] ; get inregs.x.cx
73 mov dx,[di+06] ; get inregs.x.dx
74 mov si,[di+08] ; get inregs.x.si
75 pop di ; get inregs.x.di from stack
76
77 push bp ; save base pointer
78
79 ; int 3 ; debugger
80
81 ;-------------------------------------------------------------------
82 call sysparse ; call the parser
83 ;-------------------------------------------------------------------
84
85 ; int 3 ; debugger
86
87 pop bp ; restore base pointer
88 push di ; the di value from call is now on stack
89 mov di,[bp+6] ; fix di (arg 1)
90
91 mov [di+00],ax ; load outregs.x.ax
92 mov [di+02],bx ; load outregs.x.bx
93 mov [di+04],cx ; load outregs.x.cx
94 mov [di+06],dx ; load outregs.x.dx
95 mov [di+08],si ; load outregs.x.si
96
97 xor ax,ax ; clear ax
98 lahf ; get flags into ax
99 mov [di+0ch],ax ; load outregs.x.cflag
100
101 pop ax ; get di from stack
102 mov [di+0ah],ax ; load outregs.x.di
103
104 ;-------------------------------------------------------------------
105
106 pop si ; restore registers
107 pop di
108 mov sp,bp ; restore sp
109 pop bp ; restore user's bp
110 ret
111
112 _parse endp
113
114 _TEXT ends ; end code segment
115 end
116
117 \1a