]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/COMMAND/COMEQU.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / COMMAND / COMEQU.ASM
1 ; SCCSID = @(#)comequ.asm 1.1 85/05/14
2 ; SCCSID = @(#)comequ.asm 1.1 85/05/14
3 ;*************************************
4 ; COMMAND EQUs which are not switch dependant
5
6 EMGDEBUG = FALSE
7
8 SYM EQU ">"
9
10 LINESPERPAGE EQU 25 ;AC000; default lines per page
11 NORMPERLIN EQU 1
12 WIDEPERLIN EQU 5
13 COMBUFLEN EQU 128 ; Length of commmand buffer
14 BatLen EQU 32 ; buffer for batch files
15 YES_ECHO EQU 1 ; echo line
16 NO_ECHO EQU 0 ; don't echo line
17 No_Echo_Char EQU "@" ; don't echo line if this is first char
18 call_in_progress EQU 1 ; indicate we're in the CALL command
19 length_call EQU 4 ; length of CALL
20 max_nest EQU 10 ; max # levels of batch nesting allowed
21 fail_allowed EQU 00001000b ; critical error
22 retry_allowed EQU 00010000b ; critical error
23 Ignore_allowed EQU 00100000b ; critical error
24 nullcommand EQU 1 ; no command on command line
25 end_of_line EQU -1 ;AN000; end of line return from parser
26 end_of_line_out EQU 0 ;AN000; end of line for output
27 end_of_line_in EQU 0dh ;AN000; end of line for input
28 result_number EQU 1 ;AN000; number returned from parser
29 result_string EQU 3 ;AN000; string returned from parser
30 result_filespec EQU 5 ;AN000; filespec returned from parser
31 result_drive EQU 6 ;AN000; drive returned from parser
32 result_date EQU 7 ;AN000; date returned from parser
33 result_time EQU 8 ;AN000; time returned from parser
34 result_no_error EQU 0 ;AN000; no error returned from parser
35 no_cont_flag EQU 0 ;AN000; no control flags for message
36 util_msg_class EQU -1 ;AN000; message class for utility
37 ext_msg_class EQU 1 ;AN000; message class for extended error
38 parse_msg_class EQU 2 ;AN000; message class for parse error
39 crit_msg_class EQU 3 ;AN000; message class for critical error
40 ext_crlf_class EQU 081h ;AN054; message class for extended error with no CRLF
41 colon_char EQU ":" ;AN000; colon character
42 crt_ioctl_ln EQU 14 ;AN000; default length of data for display ioctl
43 text_mode EQU 1 ;AN000; text mode return from ioctl
44 get_generic EQU 07Fh ;AN000; generic ioctl - get device info
45 set_crit_dev EQU 0100H ;AN000; device attribute for critical error on I/0
46 mult_ansi EQU 01Ah ;AC064; multiplex for ansi.sys
47 mult_shell_get EQU 01902h ;AC065; multiplex for Shell - get next command
48 mult_shell_brk EQU 01903h ;AN000; multiplex for Shell - ^C batch check
49 shell_action equ 0ffh ;AN000; SHELL - return for taking SHELL specific action
50 bat_not_open EQU -1 ;AN000; batch handle will be set to this if not open
51 bat_open_handle EQU 19 ;AN000; handle will be in this position in JFN table
52 Ptr_seg_pos equ 7 ;AN000; Offset from start of message block for subst segment
53 Ptr_off_pos equ 5 ;AN000; Offset from start of message block for subst offset
54 Parm_off_pos equ word ptr 2 ;AN000; Offset from start of subst list for subst offset
55 parm_block_size equ 11 ;AN000; size of message subst block
56 blank equ " " ;AN000; blank character
57 no_subst equ 0 ;AN000; no substitutions for messages
58 one_subst equ 1 ;AN000; one substitution for messages
59 no_handle_out equ -1 ;AN000; use function 1 thru 12 for message retriever
60 res_subst equ 2 ;AN000; offset from start of message definition to number of subst
61 read_open_mode equ 0000000000000000b ;AN024; extended open mode for read
62 read_open_flag equ 0000000100000001b ;AN000; extended open flags for read
63 write_open_mode equ 0000000000000001b ;AN024; extended open mode for read
64 write_open_flag equ 0000000100000001b ;AN000; extended open flags for read
65 creat_open_flag equ 0000000100010010b ;AN000; extended open flags for read
66 get_CPSW equ 3 ;AN000; minor function for get CPSW status
67 CPSW_off equ 0 ;AN000; CPSW return from function - OFF
68 Get_XA equ 2 ;AN030; minor function for get extended attributes
69 Set_XA equ 4 ;AN000; minor function for set extended attributes
70 file_no_cpage equ 0 ;AN000; file has no code page tag
71 file_inv_cpage equ -1 ;AN000; file has invalid code page tag
72 do_xa equ -1 ;AN000; flag to get extended attributes
73 inv_cp_tag equ 0 ;AC039; tag for invalid code page
74 no_xa_seg equ -1 ;AN000; no segment for extended attributes - COPY
75 capital_A equ 'A' ;AC000;
76 vbar equ '|' ;AC000;
77 labracket equ '<' ;AC000;
78 rabracket equ '>' ;AC000;
79 dollar equ '$' ;AC000;
80 lparen equ '(' ;AC000;
81 rparen equ ')' ;AC000;
82 nullrparen equ 29h ;AC000;
83 in_word equ 4e49h ;AC000; 'NI' ('IN' backwards)
84 do_word equ 4f44h ;AC000; 'OD' ('DO' backwards)
85 star equ '*' ;AC000;
86 plus_chr equ '+' ;AC000;
87 small_a equ 'a' ;AC000;
88 small_z equ 'z' ;AC000;
89 dot_chr equ '.' ;AC000;
90 tab_chr equ 9 ;AN032;
91 equal_chr equ '=' ;AN032;
92 semicolon equ ';' ;AN049;
93 dot_qmark equ 2e3fh ;AC000; '.?'
94 dot_colon equ 2e3ah ;AC000; '.:'
95 capital_n equ 0 ;AC000; result from Y/N call if N entered
96 capital_y equ 1 ;AC000; result from Y/N call if Y entered
97 AppendInstall equ 0B700H ;AN020; append install check
98 AppendDOS equ 0B702H ;AN020; append DOS version check
99 AppendGetState equ 0B706H ;AN020; append get current state
100 AppendSetState equ 0B707H ;AN020; append set current state
101 AppendTruename equ 0B711H ;AN042; Get file's real location for Batch
102 search_attr equ attr_read_only+attr_hidden+attr_directory ;AC042;
103
104 ;*************************************
105 ;* PARSE ERROR MESSAGES
106 ;*************************************
107
108 MoreArgs_Ptr equ 1 ;AN000;"Too many parameters" message number
109 LessArgs_Ptr equ 2 ;AN000;"Required parameter missing" message number
110 BadSwt_Ptr equ 3 ;AN000;"Invalid switch" message number
111 BadParm_Ptr equ 10 ;AN000;"Invalid parameter" message number
112
113 ;*************************************
114 ;* EQUATES FOR MESSAGE RETRIEVER
115 ;*************************************
116
117 GET_EXTENDED_MSG EQU 0 ;AN000; get extended message address
118 SET_EXTENDED_MSG EQU 1 ;AN000; set extended message address
119 GET_PARSE_MSG EQU 2 ;AN000; get parse message address
120 SET_PARSE_MSG EQU 3 ;AN000; set parse message address
121 GET_CRITICAL_MSG EQU 4 ;AN000; get critical message address
122 SET_CRITICAL_MSG EQU 5 ;AN000; set critical message address
123 MESSAGE_2F EQU 46 ;AN000; minor code for message retriever
124
125 ;*********************************
126 ;* EQUATES FOR INT 10H
127 ;*********************************
128
129 VIDEO_IO_INT EQU 10H ;AN000; equate for int 10h
130 SET_VIDEO_MODE EQU 0 ;AN000; set video mode
131 SET_CURSOR_POSITION EQU 2 ;AN000; set new cursor position
132 SCROLL_VIDEO_PAGE EQU 6 ;AN000; scroll active page up
133 VIDEO_ATTRIBUTE EQU 7 ;AN000; attribute to be used on blank line
134 SET_COLOR_PALETTE EQU 11 ;AN000; set color for video
135 GET_VIDEO_STATE EQU 15 ;AN000; get current video state
136 VIDEO_ALPHA EQU 3 ;AN000; alpha video is 3 or below
137 VIDEO_BW EQU 7 ;AN000; mode for 80X25 black & white
138
139 AltPipeChr equ "|" ; alternate pipe character
140
141 FCB EQU 5CH
142
143 VARSTRUC STRUC
144 ISDIR DB ?
145 SIZ DB ?
146 TTAIL DW ?
147 INFO DB ?
148 BUF DB DIRSTRLEN + 20 DUP (?)
149 VARSTRUC ENDS
150
151 fCheckDrive equ 00000001b
152 fSwitchAllowed equ 00000010b
153
154 ;
155 ; Test switches
156 ;
157 fParse EQU 0001h ; display results of parseline
158
159 ;
160 ; Batch segment structure
161 ;
162 ; BYTE type of segment
163 ; BYTE echo state of parent on entry to batch file
164 ; WORD segment of last batch file
165 ; WORD segment for FOR command
166 ; BYTE FOR flag state on entry to batch file
167 ; DWORD offset for next line
168 ; 10 WORD pointers to parameters. -1 is empty parameter
169 ; ASCIZ file name (with . and ..)
170 ; BYTES CR-terminated parameters
171 ; BYTE 0 flag to indicate end of parameters
172 ;
173
174 BatchType equ 0
175
176 BatchSegment struc
177 BatType DB BatchType ; signature
178 Batechoflag DB 0 ; G state of echo
179 Batlast DW 0 ; G segment of last batch file
180 Batforptr DW 0 ; G segment for FOR command
181 Batforflag DB 0 ; G state of FOR
182 BatSeek DD ? ; lseek position of next char
183 BatParm DW 10 dup (?) ; pointers to parameters
184 BatFile DB ? ; beginning of batch file name
185 BatchSegment ends
186
187 ANULL equ 0 ; terminates an argv string
188 ARGMAX equ 64 ; max args on a command line
189 ARGBLEN equ 2*128 ; 1char each plus term NUL
190 tplen equ 64 ; max size of one argument
191 arg_cnt_error equ 1 ; number of args > MAXARG
192 arg_buf_ovflow equ 2 ; overflowed argbuffer
193
194 argv_ele STRUC ; elements in the argv array
195 argpointer DW (?) ; pointer to the argstring
196 argflags DB (?) ; cparse flags for this argstring
197 argstartel DW (?) ; the result of cparse's [STARTEL]
198 arglen DW (?) ; cparse's char count + one (for null)
199 argsw_word DW (?) ; any switches after this? what kinds?
200 arg_ocomptr DW (?) ; pointer into original command string
201 argv_ele ENDS
202
203 arg_unit STRUC
204 argv DB (ARGMAX * SIZE argv_ele) DUP (?)
205 argvcnt DW (?) ; number of arguments
206 argswinfo DW (?) ; Switch information for entire line
207 argbuf DW ARGBLEN DUP (?) ; storage for argv strings
208 argforcombuf db COMBUFLEN DUP (?) ; Original for loop command string
209 arg_unit ENDS
210
211 parseflags RECORD special_delim:1, unused:4, path_sep:1, wildcard:1, sw_flag:1
212
213 SwitchV EQU 10h
214 SwitchB EQU 08h
215 SwitchA EQU 04h
216 SwitchP EQU 02h
217 SwitchW EQU 01h
218 fSwitch EQU 8000h
219 fBadSwitch EQU 4000h
220
221 SwitchDir EQU SwitchP + SwitchW + fSwitch
222 SwitchCopy EQU SwitchV + SwitchA + SwitchB + fSwitch
223
224 break <Trap: Get the attention of MSDOS>
225 ; TRAP snares the operating system for a service call
226 ; AX, as well as any other registers MS-DOS takes a fancy to, will be crunched.
227 trap MACRO dos_function,dos_info
228 ifnb <dos_info>
229 mov AX, (dos_function SHL 8) + dos_info
230 else
231 mov AX, (dos_function SHL 8)
232 endif
233 int int_command
234 ENDM
235
236 ;
237 ; Equates for initialization
238 ;
239 initInit equ 01h ; initialization in progress
240 initSpecial equ 02h ; in initialization time/date routine
241 initCtrlC equ 04h ; already in ^C handler