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