2 ; SCCSID = @(#)tcmd2a.asm 4.1 85/06/25
3 ; SCCSID = @(#)tcmd2a.asm 4.1 85/06/25
4 TITLE PART5 COMMAND Transient routines
.
18 CODERES
SEGMENT PUBLIC BYTE ;AC000;
21 DATARES
SEGMENT PUBLIC BYTE ;AC000;
24 TRANDATA
SEGMENT PUBLIC BYTE ;AC000;
25 EXTRN arg_buf_ptr
:word
26 EXTRN BadCurDrv
:byte ;AC000;
29 EXTRN display_ioctl
:word ;AN000;
30 EXTRN display_width
:word ;AN000;
31 EXTRN Extend_buf_ptr
:word ;AN049;
32 EXTRN linperpag
:word ;AN000;
33 EXTRN msg_disp_class
:byte ;AN049;
34 EXTRN nulpath_ptr
:word
35 EXTRN prompt_table
:word
36 EXTRN string_buf_ptr
:word ;AC000;
40 TRANSPACE
SEGMENT PUBLIC BYTE ;AC000;
45 EXTRN major_ver_num
:word
46 EXTRN minor_ver_num
:word
47 EXTRN srcxname
:byte ;AN049;
48 EXTRN string_ptr_2
:word
51 TRANCODE
SEGMENT PUBLIC BYTE
53 ASSUME
CS:TRANGROUP
,DS:NOTHING
,ES:NOTHING
,SS:NOTHING
57 TRANSPACE
SEGMENT PUBLIC BYTE ;AC000;
58 EXTRN arg
:byte ; the arg structure!
62 EXTRN cerror
:near ;AN049;
67 PUBLIC build_dir_for_chdir
68 PUBLIC build_dir_for_prompt
69 PUBLIC build_dir_string
85 assume
ds:trangroup
,es:trangroup
102 mov dx,offset trangroup
:vermes_ptr
108 pop ds ; MAKE SURE DS IS IN TRANGROUP
110 invoke find_prompt
; LOOK FOR PROMPT STRING
111 jc PP0
; CAN'T FIND ONE
112 cmp byte ptr es:[di],0
115 call print_drive
; USE DEFAULT PROMPT
121 mov al,es:[di] ; GET A CHAR
124 jz PP5
; NUL TERMINATED
125 cmp al,dollar
; META CHARACTER?
134 mov bx,offset trangroup
:prompt_table
-3
158 pop es ; RESTORE SEGMENTS
164 mov dx,offset trangroup
:dback_ptr
192 mov dl,al ;AC000; Get char into al
193 mov ah,Std_CON_output
;AC000; print the char to stdout
194 int int_command
;AC000;
201 mov ah,Get_Default_drive
207 ASSUME
DS:TRANGROUP
,ES:TRANGROUP
209 build_dir_for_prompt:
211 mov si,offset trangroup
:bwdbuf
223 mov dx,offset trangroup
:string_buf_ptr
225 mov dx,offset trangroup
:BadCurDrv
232 call build_dir_string
233 mov dx,offset trangroup
:bwdbuf
235 mov dx,offset trangroup
:string_buf_ptr
250 mov si,offset trangroup
:bwdbuf
+3
259 mov di,offset trangroup
:bwdbuf
270 assume
ds:trangroup
,es:trangroup
273 xor al,al ;AN049; Set up holding buffer
274 mov di,offset Trangroup
:srcxname
;AN049; for PATH while parsing
275 stosb ;AN049; Initialize PATH to null
276 dec di ;AN049; point to the start of buffer
277 invoke PGetarg
; Pre scan for arguments
278 jz disppath
; Print the current path
279 cmp al,semicolon
;AC049; NUL path argument?
281 inc si ;AN049; point past semicolon
282 jmp short scan_white
;AC049; Yes - make sure nothing else on line
284 pathslp: ; Get the user specified path
285 lodsb ; Get a character
286 cmp al,end_of_line_in
;AC049; Is it end of line?
287 jz path_eol
;AC049; yes - end of command
289 invoke testkanj
;See if DBCS
290 jz notkanj2
;No - continue
291 stosb ;AC049; Yes - store the first byte
292 lodsb ;skip second byte of DBCS
295 stosb ;AC049; Store a byte in the PATH buffer
296 jmp short pathslp
;continue parsing
299 invoke upconv
;upper case the character
300 cmp al,semicolon
;AC049; ';' not a delimiter on PATH
301 jz path_hold
;AC049; go store it
302 invoke delim
;delimiter?
303 jnz path_hold
;AC049; no - go store character
305 scan_white: ;AN049; make sure were at EOL
306 lodsb ;AN049; get a character
307 cmp al,end_of_line_in
;AN049; end of line?
308 jz path_eol
;AN049; yes - go set path
309 cmp al,blank
;AN049; whitespace?
310 jz scan_white
;AN049; yes - continue scanning
311 cmp al,tab_chr
;AN049; whitespace?
312 jz scan_white
;AN049; yes - continue scanning
314 mov dx,offset TranGroup
:Extend_Buf_ptr
;AN049; no - set up error message
315 mov Extend_Buf_ptr
,MoreArgs_ptr
;AN049; get "Too many parameters" message number
316 mov msg_disp_class
,parse_msg_class
;AN049; set up parse error msg class
319 path_eol: ;AN049; Parsing was clean
320 xor al,al ;AN049; null terminate the PATH
322 invoke find_path
;AN049; Find PATH in environment
323 invoke delete_path
;AC049; Delete any offending name
324 invoke scan_double_null
;AC049; Scan to end of environment
325 invoke move_name
;AC049; move in PATH=
326 mov si,offset Trangroup
:srcxname
;AN049; Set up source as PATH buffer
328 store_path: ;AN049; Store the PATH in the environment
329 lodsb ;AN049; Get a character
330 cmp al,end_of_line_out
;AN049; null character?
331 jz got_paths
;AN049; yes - exit
332 invoke store_char
;AN049; no - store character
333 jmp short store_path
;AN049; continue
335 got_paths: ;AN049; we're finished
336 xor ax,ax ;null terminate the PATH in
337 stosw ; the environment
341 invoke find_path
;AN049;
347 cmp byte ptr es:[di],0
351 mov dx,offset trangroup
:nulpath_ptr
364 invoke scasb2
; LOOK FOR NUL
369 mov di,offset trangroup
:arg_buf
374 mov dx,offset trangroup
:arg_buf_ptr
383 ; ****************************************************************
387 ; * FUNCTION: Clear the screen using INT 10h. If ANSI.SYS is
388 ; * installed, send a control string to clear the
391 ; * INPUT: command line at offset 81H
395 ; ****************************************************************
397 assume
ds:trangroup
,es:trangroup
399 ANSI_installed equ
0ffh
402 mov ah,Mult_ANSI
;AN000; see if ANSI.SYS installed
405 cmp al,ANSI_installed
;AN000;
406 jz ansicls
;AN000; installed - go do ANSI CLS
409 mov ax,(IOCTL
SHL 8) + generic_ioctl_handle
;AN000; get lines per page on display
410 mov bx,stdout
;AN000; lines for stdout
411 mov ch,ioc_sc
;AN000; type is display
412 mov cl,get_generic
;AN000; get information
413 mov dx,offset trangroup
:display_ioctl
;AN000;
414 int int_command
;AN000;
415 jc no_variable
;AN000; function had error, use default
416 mov ax,linperpag
;AN000; get number of rows returned
417 mov dh,al ;AN000; set number of rows
418 mov ax,display_width
;AN000; get number of columns returned
419 mov dl,al ;AN000; set number of columns
420 jmp short regcls
;AN000; go do cls
423 mov bx,stdout
;AC000; set handle as stdout
424 mov ax,IOCTL
SHL 8 ;AC000; do ioctl - get device
425 int int_command
;AC000; info
426 test dl,devid_ISDEV
;AC000; is handle a device
427 jz ANSICLS
;AC000; If a file put out ANSI
428 test dl,devid_SPECIAL
;AC000;
429 jnz cls_normal
;AC000; If not special CON, do ANSI
432 call ansi_cls
;AN000; clear the screen
433 jmp short cls_ret
;AN000; exit
441 mov ah,get_video_state
;AC000; set up to get video state
442 int video_io_int
;AC000; do int 10h - BIOS video IO
443 cmp al,video_alpha
;AC000; see if in text mode
445 cmp al,video_bw
;AC000; see if black & white card
448 ; We are in graphics mode. Bogus IBM ROM does not scroll correctly. We will
449 ; be just as bogus and set the mode that we just got. This will blank the
452 mov ah,set_video_mode
;AC000; set video mode call
453 int video_io_int
;AC000; do int 10h - BIOS video IO
454 jmp short cls_ret
;AC000; exit
458 ; Get video mode and number of columns to scroll
460 mov ah,get_video_state
;AC000; set up to get current video state
461 int video_io_int
;AC000; do int 10h - BIOS video IO
463 mov dh,linesperpage
;AC000; have 25 rows on the screen
466 call reg_cls
;AC000; go clear the screen
471 ; ****************************************************************
475 ; * FUNCTION: Clear the screen using INT 10H.
477 ; * INPUT: DL = NUMBER OF COLUMNS
478 ; * DH = NUMBER OF ROWS
482 ; ****************************************************************
484 reg_cls proc
near ;AC000;
487 ; Set overscan to black.
490 dec dh ;AC000; decrement rows and columns
491 dec dl ;AC000; to zero base
492 push dx ;AN000; save rows,columns
493 mov ah,set_color_palette
;AC000; set up to set the color to blank
495 int video_io_int
;AC000; do int 10h - BIOS video IO
496 pop dx ;AN000; retore rows,colums
498 xor ax,ax ;AC000; zero out ax
499 mov CX,ax ;AC000; an cx
503 mov ah,scroll_video_page
;AC000; set up to scroll page up
504 mov bh,video_attribute
;AC000; attribute for blank line
505 xor bl,bl ;AC000; set BL to 0
506 int video_io_int
;AC000; do int 10h - BIOS video IO
508 ; Seek to cursor to 0,0
510 mov ah,set_cursor_position
;AC000; set up to set cursor position
511 xor dx,dx ;AC000; row and column 0
513 int video_io_int
;AC000; do into 10h - BIOS video IO
521 ; ****************************************************************
523 ; * ROUTINE: ANSI_CLS
525 ; * FUNCTION: Clear the screen using by writing a control code
532 ; ****************************************************************
534 ansi_cls proc
near ;AC000;
536 mov si,offset trangroup
:clsstring
548 ansi_cls endp
;AC000;