summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/FDISK/_PARSE.ASM
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/CMD/FDISK/_PARSE.ASM')
-rw-r--r--v4.0/src/CMD/FDISK/_PARSE.ASM165
1 files changed, 165 insertions, 0 deletions
diff --git a/v4.0/src/CMD/FDISK/_PARSE.ASM b/v4.0/src/CMD/FDISK/_PARSE.ASM
new file mode 100644
index 0000000..9e308af
--- /dev/null
+++ b/v4.0/src/CMD/FDISK/_PARSE.ASM
@@ -0,0 +1,165 @@
1page 60,132
2name _parse
3title 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; 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;-------------------------------------------------------------------
23FarSW equ 0 ; make sysparse be a NEAR proc
24TimeSW equ 0 ; Check time format
25FileSW equ 0 ; Check file specification
26CAPSW equ 0 ; Perform CAPS if specified
27CmpxSW equ 0 ; Check complex list
28NumSW equ 1 ; Check numeric value
29KeySW equ 0 ; Support keywords
30SwSW equ 1 ; Support switches
31Val1SW equ 1 ; Support value definition 1
32Val2SW equ 1 ; Support value definition 2
33Val3SW equ 0 ; Support value definition 3
34DrvSW equ 0 ; Support drive only format
35QusSW equ 0 ; Support quoted string format
36;-------------------------------------------------------------------
37
38
39
40
41_TEXT SEGMENT BYTE PUBLIC 'CODE'
42_TEXT ENDS
43_DATA SEGMENT WORD PUBLIC 'DATA'
44_DATA ENDS
45CONST SEGMENT WORD PUBLIC 'CONST'
46CONST ENDS
47_BSS SEGMENT WORD PUBLIC 'BSS'
48_BSS ENDS
49
50
51DGROUP GROUP CONST, _BSS, _DATA
52
53
54_DATA segment word public 'DATA'
55
56 assume cs:DGROUP
57 assume ss:dgroup
58
59 public SysParse
60
61;-------------------------------------------------------------------
62.xlist
63include parse.asm ; include the parser
64.list
65;-------------------------------------------------------------------
66
67 public CallParser
68CallParser proc far
69
70 push ds
71 PUSH ES
72
73 push cs
74 pop ds
75 assume ds:DGROUP
76
77 push cs
78 pop es
79 assume es:DGROUP
80
81 nop
82
83 call SysParse
84
85 POP ES
86 pop ds
87
88 ret
89
90CallParser endp
91
92
93
94_DATA ends
95
96_TEXT segment byte public 'CODE'
97
98 ASSUME CS:_TEXT
99 ASSUME DS:DGROUP
100 ASSUME ES:NOTHING
101 ASSUME SS:DGROUP
102
103_parse proc near
104
105 push bp ; save user's base pointer
106 mov bp,sp ; set bp to current sp
107 push di ; save some registers
108 push si
109
110; copy C inregs into proper registers
111
112 mov di,[bp+4] ; fix di (arg 0)
113
114;-------------------------------------------------------------------
115
116 mov ax,[di+0ah] ; load di
117 push ax ; the di value from inregs is now on stack
118
119 mov ax,[di+00] ; get inregs.x.ax
120 mov bx,[di+02] ; get inregs.x.bx
121 mov cx,[di+04] ; get inregs.x.cx
122 mov dx,[di+06] ; get inregs.x.dx
123 mov si,[di+08] ; get inregs.x.si
124 pop di ; get inregs.x.di from stack
125
126 push bp ; save base pointer
127
128;-------------------------------------------------------------------
129;-------------------------------------------------------------------
130
131 call CallParser ; call the parser
132
133;-------------------------------------------------------------------
134;-------------------------------------------------------------------
135
136 pop bp ; restore base pointer
137 push di ; the di value from call is now on stack
138 mov di,[bp+6] ; fix di (arg 1)
139
140 mov [di+00],ax ; load outregs.x.ax
141 mov [di+02],bx ; load outregs.x.bx
142 mov [di+04],cx ; load outregs.x.cx
143 mov [di+06],dx ; load outregs.x.dx
144 mov [di+08],si ; load outregs.x.si
145
146 xor ax,ax ; clear ax
147 lahf ; get flags into ax
148 mov [di+0ch],ax ; load outregs.x.cflag
149
150 pop ax ; get di from stack
151 mov [di+0ah],ax ; load outregs.x.di
152
153;-------------------------------------------------------------------
154
155 pop si ; restore registers
156 pop di
157 mov sp,bp ; restore sp
158 pop bp ; restore user's bp
159 ret
160
161_parse endp
162
163_TEXT ends ; end code segment
164 end
165