summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/FILESYS/_PARSE.ASM
blob: d1424b7613327439bafc5e2f1408d78966bf8fb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
page	       60,132
name	       _parse
title	       C to PARSER interface
;-------------------------------------------------------------------
;
;	MODULE: 	_parse
;
;	PURPOSE:	Supplies an interface between C programs and
;			the DOS 3.3 parser
;
;	CALLING FORMAT:
;			parse(&inregs,&outregs);
;
;	DATE:		5-21-87
;
;-------------------------------------------------------------------

;	extrn	sysparse:far

	public	_parse

;-------------------------------------------------------------------
;FarSW	 equ	 0	 ; make sysparse be a NEAR proc
;TimeSW  equ	 0	 ; Check time format
;FileSW  equ	 0	 ; Check file specification
;CAPSW	 equ	 0	 ; Perform CAPS if specified
;CmpxSW  equ	 0	 ; Check complex list
;NumSW	 equ	 1	 ; Check numeric value
;KeySW	 equ	 0	 ; Support keywords
;SwSW	 equ	 1	 ; Support switches
;Val1SW  equ	 1	 ; Support value definition 1
;Val2SW  equ	 1	 ; Support value definition 2
;Val3SW  equ	 0	 ; Support value definition 3
;DrvSW	 equ	 0	 ; Support drive only format
;QusSW	 equ	 0	 ; Support quoted string format
;-------------------------------------------------------------------




_TEXT	SEGMENT BYTE PUBLIC 'CODE'
_TEXT	ENDS
_DATA	SEGMENT WORD PUBLIC 'DATA'
_DATA	ENDS
CONST	SEGMENT WORD PUBLIC 'CONST'
CONST	ENDS
_BSS	SEGMENT WORD PUBLIC 'BSS'
_BSS	ENDS


DGROUP	GROUP	CONST, _BSS, _DATA


_DATA	segment word public 'DATA'

	assume	cs:DGROUP
	assume	ss:dgroup

	public	SysParse

;-------------------------------------------------------------------
.xlist
include parse.asm		; include the parser
.list
;-------------------------------------------------------------------

		public	CallParser
CallParser	proc	far

	push	ds
	PUSH	ES

	push	cs
	pop	ds
	assume	ds:DGROUP

	push	cs
	pop	es
	assume	es:DGROUP

	nop

	call	SysParse

	POP	ES
	pop	ds

	ret

CallParser	endp



_DATA	ends

_TEXT	segment byte public 'CODE'

	ASSUME	CS:_TEXT
	ASSUME	DS:DGROUP
	ASSUME	ES:NOTHING
	ASSUME	SS:DGROUP

_parse	proc	near

	push	bp		; save user's base pointer
	mov	bp,sp		; set bp to current sp
	push	di		; save some registers
	push	si

;	copy C inregs into proper registers

	mov	di,[bp+4]	; fix di (arg 0)

;-------------------------------------------------------------------

	mov	ax,[di+0ah]	; load di
	push	ax		; the di value from inregs is now on stack

	mov	ax,[di+00]	; get inregs.x.ax
	mov	bx,[di+02]	; get inregs.x.bx
	mov	cx,[di+04]	; get inregs.x.cx
	mov	dx,[di+06]	; get inregs.x.dx
	mov	si,[di+08]	; get inregs.x.si
	pop	di		; get inregs.x.di from stack

	push	bp		; save base pointer

;-------------------------------------------------------------------
;-------------------------------------------------------------------

	call	CallParser	; call the parser

;-------------------------------------------------------------------
;-------------------------------------------------------------------

	pop	bp		; restore base pointer
	push	di		; the di value from call is now on stack
	mov	di,[bp+6]	; fix di (arg 1)

	mov	[di+00],ax	; load outregs.x.ax
	mov	[di+02],bx	; load outregs.x.bx
	mov	[di+04],cx	; load outregs.x.cx
	mov	[di+06],dx	; load outregs.x.dx
	mov	[di+08],si	; load outregs.x.si

	xor	ax,ax		; clear ax
	lahf			; get flags into ax
	mov	[di+0ch],ax	; load outregs.x.cflag

	pop	ax		; get di from stack
	mov	[di+0ah],ax	; load outregs.x.di

;-------------------------------------------------------------------

	pop	si		; restore registers
	pop	di
	mov	sp,bp		; restore sp
	pop	bp		; restore user's bp
	ret

_parse	endp

_TEXT	ends			; end code segment
	end