Info-IBMPC@USC-ISIB.ARPA (Info-IBMPC Digest) (01/25/86)
Info-IBMPC Digest Saturday, 25 January 1986 Volume 5 : Issue 14
This Week's Editor: Eliot Moore <Elmo@USC-ISIB>
Today's Topics:
Network options for IBM RT
Desqview; MS Windows
RESTORE /P and Disk Optimizers vs. Hard Disk installs (DoubleDOS)
PC-DOS 3.1 and "echo off"
Z-nix Clone Info Wanted
DOS 3.10 and Bad Hard Disk Clusters
Renaming Subdirectories
Directory Listing of Hidden Files
Directory List of Archive-needed Files
----------------------------------------------------------------------
Date: Thu, 23 Jan 86 22:29:24 pst
From: decwrl!amdcad!cae780!ubvax!skip@ucbvax.berkeley.edu (Skip Addison Jr)
To: cae780!usc-isib.arpa!info-ibmpc
Subject: Network options for IBM RT
The hardware description for the IBM RT is incorrect in its description of
the networking options available for the IBM RT. In particular, the
IBM PC Network Adapter is NOT supported. The information below is, I believe,
straight from IBM, verbatim.
To quote the information I have available:
(Beginning of IBM quote #1)
Local Area Network Adapter:
o Ethernet:
Several Ethernet controllers are available; IBM Academic Information
Systems 4.2 provides a sample device driver for the Ungermann-Bass
Ethernet controllers, numbers 2274A and 2273A, which have been tested
in the IBM RT PC with IBM Academic Information Systems 4.2. Ethernet
controllers are not available from IBM and must be supplied by the
customer.
o IBM 6100 Token-Ring Network Adapter:
The IBM 6100 Token-Ring Adapter provides connection of the IBM RT PC
models 6150 and 6151 to the IBM Token-Ring Network. The network uses
IBM Cabling System for pysical connection and a token-ring access
protocol for network traffic control.
(End of IBM quote #1)
(Beginning of IBM quote #2)
Communications Support:
IBM Academic Information Systems 4.2 is capable of communicating with
systems running Unix or other operating systems over asynchronous
communication line (direct connect, leased lines, or dialed line), and
over local area networks. The local area networks supported are
described previously on page 3. The functions provided for asynchronous
communications lines include:
o uucp, which copies files between systems running UNIX operating systems.
o uux, which executes a command on a specified UNIX operating system and
sends standard output to aa file on a specified system.
The functions provided for local area networks are implemented under TCP/IP
protocols and include:
o rlogin, which supports logging into a remote UNIX operating system.
o rsh, which executes a command on a remote host and receives its
standard output.
o rcp, which copies files between UNIX operating systems.
o ftp, which is the user interface to the ARPANET Standard File Transfer
Protocol, permits files to be copied between systems running UNIX or
other operating systems.
o telnet, which is the user interfact to the TELNET protocol.
(End of IBM quote #2)
Note that the IBM PC Network Adapter has the protocols for layers 1-5
in hardware or ROM on the board. Supporting TCP/IP on that board would
involve at least a ROM swap, and you still wouldn't have Ethernet.
Disclaimer: I have every reason to want this information widely known.
I am an Ungermann-Bass employee, past happy customer, and everyone I
know owns U-B stock. However, the above information is not intended to
be a U-B advertisement, but to suggest the possibilities for all those
4.2 BSD sites out there.
On the other hand, if you want more information about U-B, drop me a note.
-- Skip Addison
{decwrl, lll-crg}!amdcad!cae780!ubvax!skip
------------------------------
Date: 25 Jan 1986 1059-PST
From: STERNLIGHT@USC-ECL.ARPA
Subject: Desqview; MS Windows
To: info-ibmpc@USC-ISI.ARPA
cc: dennett@SRI-NIC.ARPA
In response to Steve Dennett's question about the differences between
MS Windows and Desqview, here is an incomplete and personal view:
Desqview is menu-oriented and designed for concurrent processing. It
uses windows, many of which can be open at once. Within each window,
processing can be going on, seemingly simultaneously. When a window
is opened for a program too big to fit into memory along with other
partitions (already open windows), some open window is automatically
swapped to disk (user control in .DVP files indicates which windows
may be so swapped). Desqview doesn't want to know nor care whether a
program changes memory; it handles that without bothering the user.
It is very fast. Version 1.20 was just mailed to existing owners; it
runs with the Intel/Microsoft expanded memory, or with the
AST/Ashton-Tate/... RAMPage-class expanded memory. Some have
described it as what TopView should have been. It is about half the
size, much faster, and much more user-friendly (for example, on
installing it searches your hard disk for a wide variety of commonly
used programs and installs them in its menus automatically). I have
not yet found any programs that cannot run under it without any
special modification. It can use mice for menu selection. I like it
very much.
GEM (Digital Research) is a graphic interface , without concurrency.
It is the closest visually to a MacIntosh interface. It cannot run
more than one application at a time. DRI has had problems with Apple;
they made DRI change the interface somewhat since they claimed it was
too much like the Macintosh. In my opinion that was an extremely
graceless act from a company which owes much of its interface to
Xerox-PARC. I suppose DRI didn't want to get tied up in litigation;
they gave in and a new version of GEM is supposed to be out Real Soon
Now. Meanwhile they have been precluded from selling the old version
since, I think, November. GEM will run under Desqview; there is a
menu option in Desqview 1.2 for GEM. There is a word processing and a
drawing program available for GEM, also from Digital Research. I
liked it somewhat, but found that the concurrency feature of Desqview
was more useful than the nice icons and mouse I am used to on my
MacIntosh. I then took it off my hard disk, since I needed the space.
MS Windows is a graphic interface. It has limited concurrency, but
will not, for example, permit a program which changes (upper) memory
to be resident with any other program. If you open a window with such
a program, it will refuse to open any other windows, and conversely.
Microsoft confirmed that this is so. You cannot put a window away on
the desktop (swap to disk) to get around this with MS Windows. There
is a long dialogue on Compuserve (GO MSOFT) about problems users are
having with Windows, and some programs may not run under it in a
concurrent environment without modification. Currently, it comes with
a word processing and a painting program. I liked the visuals a lot
on the EGA/ECD. When I found it wouldn't run a key program (In-house
Accountant) I use with anything else present, I took it off my hard
disk since it takes a LOT of space.
If I were making a recommendation, I would get Desqview and use it
with existing programs. The Microsoft mouse is excellent, and can be
used with Microsoft Word, Lotus 1-2-3, and, say, Professional YAM (a
communications program from Omen Technology in Portland, OR)to make an
excellent package which is much more powerful than, say, Framework II.
If you want to draw, the latest versions of several mice (Mouse
Systems, for example) have a PC painting program thrown in free.
Best;
--david--
-------
------------------------------
Date: Fri, 24 Jan 86 13:37:18 PST
From: prandt!reynolds@AMES-NAS.ARPA (Don Reynolds)
To: amelia!info-ibmpc@usc-isib.ARPA
Subject: RESTORE /P and Disk Optimizers vs. Hard Disk installs (DoubleDOS)
Cc: reynolds@AMES-NAS.ARPA
This note may be of interest to other users of DoubleDOS, the background
double tasker by SoftLogic Solutions, Manchester, NH., and users of
similar software.
While it is not my intent to discuss the copy protection per se in this
forum, my own experience and the recently discribed problem with DOS 3.1
RESTORE suggests it is pertinent. This message is not about "cracking",
and I request the editors to allow it, or edit it as they see fit.
DoubleDOS uses hidden files as part of its copy protection. According to
Mr. Irving Corliss, SoftLogic's V.P., either DOS FORMAT or RESTORE commands,
or re-locating the hidden files will destroy a DoubleDOS installation on a
hard disk. Corliss suggested using the /P option:
RESTORE d: [d:][path][filename][.ext]/P
since it will prompt before overwriting read-only files. Usually, but
not always, programs will install their hidden files with a read-only
attribute. With the reported DOS 3.1 RESTORE bug failing to restore
read-only files which cross diskette boundaries, we have another reason
to protect these files on the hard disk.
It seems prudent to be sure the files which must remain undisturbed are
marked read-only. Then remember to RESTORE with prompting, so the
RESTORE will retain the "install". Compare listings from DIR and CHKDSK /V
commands (or equivalent means) to display the names of these hidden files.
Then use DOS 3.1 ATTRIB (or equivalent) to make sure they are set read-only
before using RESTORE /P. There will be similar problems with other
backup/restore utilities if they overwrite these files.
A second trap for the unwary (and unwarned in the user manuals) is the
use of disk optimizers that move around hidden files. I presume that
the one SoftLogic Solutions sells works around this properly for DoubleDOS,
but I have not tested it. Other disk optimizers are very likely to
cause problems. Well, off to see the PC/RT!
Best,
Don
------------------------------
From: connery@bnrmtv.UUCP@BRL.ARPA
Subject: PC-DOS 3.1 and "echo off"
Date: Tue, 21-Jan-86 10:51:55 PST
Here's how to patch DOS 3.1 so that "echo off" is the default.
>From Compuserve... the patch for echo off is as follows:
debug COMMAND.COM
-E 1967<cr>
xxxx:1967 01.00<cr>
-W<cr>
-Q<cr>
Seems to work just perfectly--it doesn't have the bug some other patches
exhibit which disables the prompts during a nested COMMAND.COM session.
Glenn
------------------------------
From: naparst@brahms.BERKELEY.EDU (Harold Naparst)
Subject: Z-nix Clone Info Wanted
Organization: University of California, Berkeley
I am thinking of buying this PC clone that says "Z-nix" on the side.
The dealer assures me that it is a level 1 clone (whatever that means),
and that he has not found any programs that work on the IBM but not on
this machine, except for IBM BASIC. Have any of you heard of this machine ?
Does it have any hardware/software incompatibility problems ? Can you
recommend a better machine ? Naturally, I want full compatability but
without paying for the IBM logo.
------------------------------
Date: Fri, 24 Jan 86 14:06:32 PST
From: chapman%miro@BERKELEY.EDU (Brent Chapman)
To: info-ibmpc@usc-isib.arpa
Subject: DOS 3.10 and Bad Hard Disk Clusters
I use an AT, with a 20M disk, running DOS 3.10. I have been
experiencing problems with DOS's handling of bad clusters on the disk.
PC-TOOLS showed two bad clusters on the disk when it was formatted,
before any files were copied onto it. Now, however, it appears that
DOS has allocated right over the top of one of those two bad clusters.
Has anyone had any experience with this type of problem. Can anyone
suggest any solutions? I'd like to be able to mark these clusters in
some way and prevent DOS from allocating them. I could simply create
a file that is made up of these two bad clusters, then hide the file,
but when I did a backup/restore, that would because the file would be
restored to an arbitrary position on the disk, and something else
would be written over those bad clusters. Any other ideas?
Thanks!
Brent Chapman
chapman@miro.berkeley.edu
ucbvax!miro!chapman
------------------------------
Date: Fri, 24 Jan 86 21:50:25 CST
From: MATHES%UMCVMB.BITNET@WISCVM.WISC.EDU
To: info-IBMPC@USC-ISIB.ARPA
Subject: Renaming Subdirectories
Does any one know how to rename a subdirectory without erasing it and
creating it with a different name. If you know of any utility to do that
I will be happy to hear from you.
Thanks
Elias Saab (Universty of Missouri at Columbia- Department of Math)
------------------------------
Date: 24 Jan 1986 11:59:35 PST
Subject: Directory Listing of Hidden Files
From: Craig Milo Rogers <ROGERS@USC-ISIB.ARPA>
To: Info-IBMPC@USC-ISIB.ARPA
I grew a little curious where all the space on my hard disk was
going today. CHKDSK revealed that I have a small number of hidden
(or system, I'm lumping the two categories together) files. When I
got out my handy-dandy Norton Utilities, release 3.0, I was dissapointed:
"To avoid interfering with legitimate copy-protection
methods, FA does not change the file attributes called
"hidden" and "system.""
Not only does the Norton utility FA not change these attributes,
it doesn't list files with them, either.
So, I got out my copy of WHEREIS.ASM (slightly modified from
the Info-IBMPC library copy), whipped out my scissors and paste, and
created a program to list hidden (or system) files. Give the command
DIRHIDN path
and it will search the specified path (ie, directory) and any subdirectories
for hidden files.
This addresses only a part of the full problem, though. Does
anyone out there have a generalized ATTRIB command that they can donate
to the Info-IBMPC library?
The source for DIRHIDN.ASM follows. Assemble, link, and convert it
to .COM format in the usual fashion.
Craig Milo Rogers
-----
page 61,132
title DIRHIDN
; dirhidn.asm 24 Jan 86 Craig Milo Rogers at USC/ISI
; Fixed the command line parsing logic to properly interpret
; the case when the program is called without arguments.
; Same for write_string(). Note: there are still many holes
; in command line parsing.
; dirhidn.asm 23 Jan 86 Craig Milo Rogers at USC/ISI
; Created this program based on WHEREIS.ASM.
;
; This program searches for "hidden" and "system" files.
;
; DIRHIDN path
;
; searches for hidden or system files in the directory subtree
; starting with "path".
dirhidn segment public
assume cs:dirhidn,ds:dirhidn
;equates
COMMAND_LINE EQU 80H + 1
NULL EQU 00H
CR EQU 0DH
LF EQU 0AH
SPACE EQU ' '
DOT EQU '.'
STAR EQU '*'
MAX_SCAN_LEN EQU 64
TERMINATE EQU 20H
HIDDEN EQU 02H
SYSTEM EQU 04H
DIRECTORY EQU 10H
PRINT_CHAR EQU 02H
SET_DTA EQU 1AH
SEARCH_FIRST EQU 4EH
SEARCH_NEXT EQU 4FH
DOS_CALL EQU 21H
PATH_SEPARATOR EQU '\'
;macros
CLEAR macro reg
xor reg,reg
endm
;this is the format for the dos data transfer area used when dos 2.0
;searches for file match in directories
dta struc
reserved db 21 dup (?)
attribute db ?
time dw ?
date dw ?
size dd ?
name_found db 13 dup (?)
dta ends
org 100h
main proc far
; this is the main program that sets up the initial conditions for
; search_directory which in turn, does a recursive search.
; reads: command line
; writes: path_name, file_name, file_attr
; calls: search_directory
;
mainline proc near
start:
mov si, offset star_name ; Copy the *.* string to file_name.
mov di, offset file_name
cld
file_loop:
lodsb
stosb
or al,al
jnz file_loop
mov si, COMMAND_LINE ;start of command line
mov di, offset path_name
cld
lodsb ; Get first char.
cmp al,CR ; Is it end-of-line?
je terminate_name ; Yes, default to current directory.
; Otherwise ignore char (space).
get_search_name:
lodsb ; Get next char.
cmp al, CR ; Is it a carriage return?
je done_reading_name ; Yes, end of command line.
cmp al, SPACE ; Is it a space?
je done_reading_name ; Yes, end of command arg.
stosb ; Store another path char.
jmp get_search_name ;Loop --
done_reading_name:
cmp byte ptr [di-1],PATH_SEPARATOR
je terminate_name
mov al,PATH_SEPARATOR
stosb
terminate_name:
CLEAR al ; terminate path
stosb
mov file_attr, HIDDEN or SYSTEM
; desired file attributes
mov di, offset path_name
CLEAR al
cld
mov cx, MAX_SCAN_LEN
repnz scasb
mov bx,di
dec bx ;ds:bx points to end of path_name
mov dx,NULL
call search_directory
int TERMINATE
mainline endp
; this procedure searches all the files in the current directory
; looking for a match. It also prints the full name for each match
; which is HIDDEN or SYSTEM.
;
; ds:bx pointer to end of current path name
; ds:dx old disk transfer area (dta)
;
; reads: disk transfer area (dta)
; file_attr
; writes: disk transfer area (dta)
; calls build_name, get_first_Match
; write_matched_name, get_next_match
; build_star_name, search_sub_directory
;
search_directory proc near
push si
push dx
call build_name
mov cx,file_attr
call get_first_match
jc no_match ;If no match --
mov si,dx ; Save pointer to new DTA.
test [si].attribute,HIDDEN or SYSTEM
jz find_next_file
call write_matched_name
find_next_file:
mov cx,file_attr
call get_next_match
jc no_match
test [si].attribute,HIDDEN or SYSTEM
jz find_next_file
call write_matched_name
jmp find_next_file ;Loop --
no_match:
pop dx
push dx
call build_star_name
mov cx,file_attr ; Get the search attributes.
and cx,HIDDEN or SYSTEM ; Select interesting bits.
or cx,DIRECTORY ; Include directory searches.
call get_first_match
jc no_more_matches ;If no match --
mov si,dx ; Save pointer to new DTA.
test [si].attribute,DIRECTORY
jnz is_directory ;If directory entry --
find_next_directory:
mov cx,file_attr ; Get the search attributes.
and cx,HIDDEN or SYSTEM ; Select interesting bits.
or cx,DIRECTORY ; Include directory searches.
call get_next_match
jc no_more_matches ;If no more entries --
test [si].attribute,DIRECTORY
jz find_next_directory ;If not a directory --
is_directory:
cmp [si].name_found,DOT
je find_next_directory ;If it's . or ..
call search_sub_directory ;search sub directory
push ax
mov ah,SET_DTA
int DOS_CALL
pop ax
jmp find_next_directory
no_more_matches:
pop dx
pop si
ret
search_directory endp
page
; This procedure searches the sub directory who's name is in dta
;
; ds:bx end of the current pathname
; ds:[dx].name_found name of subdirectory for search
;
; reads: path_name
; writes: path_name
; calls: search_directory
;
search_sub_directory proc near
push di
push si
push ax
push bx
cld
mov si, dx
add si, offset name_found
mov di,bx
copy_loop:
lodsb
stosb
or al,al
jnz copy_loop
mov bx,di
std
stosb
mov al,PATH_SEPARATOR
stosb
call search_directory
pop bx
mov byte ptr [bx],NULL
pop ax
pop si
pop di
ret
search_sub_directory endp
page
; This procedure prints the matched name after the path name
;
; ds:dx pointer to current disk transfer area
;
; reads: path_name, name_found (in dta)
; writes: write_string, send_crlf
;
write_matched_name proc near
push ax
push dx
mov dx,offset path_name
mov al,[bx]
mov byte ptr [bx],NULL
call write_string
mov [bx],al
pop dx
push dx
add dx, offset name_found
call write_string
call send_crlf
pop dx
pop ax
ret
write_matched_name endp
; This procedure builds an absolute search name from path_name
; followed by file_name
;
; reads: file_name
; calls: build (to build the name)
;
build_name proc near
push si
mov si, offset file_name
call build
pop si
ret
build_name endp
build_star_name proc near
push si
mov si, offset star_name
call build
pop si
ret
build_star_name endp
page
; This procedure appends the string at ds:si to path_name in
; path_name. It knows where the path name ends from knowing
; how long path_name is.
;
; ds:si name of file
; ds:bx end of path_name
;
; reads: ds:si
; writes: path_name
;
build proc near
push ax
push di
mov di,bx
cld
copy_name:
lodsb
stosb
or al,al
jnz copy_name ;If not end of string yet --
pop di
pop ax
ret
build endp
; This procedure find the first match between the name given by
; ds:dx and the directory entries found in the directory path_name
;
; cx file attributes for search
; ds:dx pointer to current disk transfer area
;
; returns:
; cf 0 a match was found
; 1 no match found
; ax error code returned
; 2 file not found
; 18 no more files
; ds:dx pointer to new disk transfer area
;
; reads: path_name
; writes: disk_transfer_areas
;
get_first_match proc near
cmp dx,NULL
ja allocate ;go allocate space --
mov dx, offset disk_transfer_areas-type dta
allocate:
add dx,type dta
mov ah,SET_DTA
int DOS_CALL
push dx
mov dx, offset path_name
mov ah,SEARCH_FIRST ;call for find first match
int DOS_CALL
pop dx
ret
get_first_match endp
; This procedure is much like get_first_match
;
; cx file attributes for search
;
; returns:
; cf 0 a match was found
; 1 no match found
; ax error code returned
; 2 file not found
; 18 no more files
;
; reads: path_name
; writes: disk_transfer_areas
;
get_next_match proc near
push dx
mov dx, offset path_name
mov ah,SEARCH_NEXT
int DOS_CALL
pop dx
ret
get_next_match endp
; This procedure sends a crlf pair of characters to the screen
;
send_crlf proc near
push ax
push dx
mov ah,PRINT_CHAR
mov dl,CR
int DOS_CALL
mov dl,LF
int DOS_CALL
pop dx
pop ax
ret
send_crlf endp
; This procedure writes the asciiz string at
; ds:dx address of asciiz string
;
write_string proc near
push ax
push dx
push si
cld
mov si,dx
mov ah,PRINT_CHAR
write_string_loop:
lodsb
or al,al
jz write_string_done
mov dl,al
int DOS_CALL
jmp write_string_loop
write_string_done:
pop si
pop dx
pop ax
ret
write_string endp
; This is the data storage area and must be the last thing
; in the program.
;
star_name db '*.*',NULL
path_name db 80 dup (0) ;space for 64 char pathname and
;13 char filename
file_name db 13 dup (0) ;save room for full dos filename
file_attr dw ? ; attribute value for searches.
disk_transfer_areas label byte ;this must start at the end of dirhidn
main endp
dirhidn ends
end start
-------
------------------------------
Date: 24 Jan 1986 12:06:17 PST
Subject: Directory List of Archive-needed Files
From: Craig Milo Rogers <ROGERS@USC-ISIB.ARPA>
To: Info-IBMPC@USC-ISIB.ARPA
I wanted to make a list of the files in a particular directory
(and its subdirectories) that needed to be archived. So, I whipped out
my scissors and paste and produced a program to do it. Give the command:
DIRARCH path
and you will get a list of the files in the specified path (and its
subdirectories) which have the ARCHIVE bit set.
The source code tho DIRARCH.ASM follows. Assemble, link, and
convert it to .COM format in the usual manner.
Craig Milo Rogers
-----
page 61,132
title DIRARCH
; dirarch.asm 24 Jan 86 Craig Milo Rogers at USC/ISI
; Fixed the command line parsing logic to properly interpret
; the case when the program is called without arguments.
; Same for write_string().
; dirarch.asm 23 Jan 86 Craig Milo Rogers at USC/ISI
; Created this program based on WHEREIS.ASM.
;
; This program searches for "archive" files.
;
; DIRARCH path
;
; searches for hidden or system files in the directory subtree
; starting with "path".
dirarch segment public
assume cs:dirarch,ds:dirarch
;equates
COMMAND_LINE EQU 80H + 1
NULL EQU 00H
CR EQU 0DH
LF EQU 0AH
SPACE EQU ' '
DOT EQU '.'
STAR EQU '*'
MAX_SCAN_LEN EQU 64
TERMINATE EQU 20H
HIDDEN EQU 02H
SYSTEM EQU 04H
DIRECTORY EQU 10H
ARCHIVE EQU 20H
PRINT_CHAR EQU 02H
SET_DTA EQU 1AH
SEARCH_FIRST EQU 4EH
SEARCH_NEXT EQU 4FH
DOS_CALL EQU 21H
PATH_SEPARATOR EQU '\'
;macros
CLEAR macro reg
xor reg,reg
endm
;this is the format for the dos data transfer area used when dos 2.0
;searches for file match in directories
dta struc
reserved db 21 dup (?)
attribute db ?
time dw ?
date dw ?
size dd ?
name_found db 13 dup (?)
dta ends
page
org 100h
main proc far
; this is the main program that sets up the initial conditions for
; search_directory which in turn, does a recursive search.
; reads: command line
; writes: path_name, file_name, file_attr
; calls: search_directory
;
mainline proc near
start:
mov si, offset star_name ; Copy the *.* string to file_name.
mov di, offset file_name
cld
file_loop:
lodsb
stosb
or al,al
jnz file_loop
mov si, COMMAND_LINE ;start of command line
mov di, offset path_name
cld
lodsb ; Get first command char.
cmp al,CR ; End of line?
je terminate_name ; Yes, default to current directory.
; Otherwise, ignore char (space).
get_search_name:
lodsb ; Get next char.
cmp al, CR ; Is it a carriage return?
je done_reading_name ; Yes, end of command line.
cmp al, SPACE ; Is it a space?
je done_reading_name ; Yes, end of command arg.
stosb ; Store another path char.
jmp get_search_name ;Loop --
done_reading_name:
cmp byte ptr [di-1],PATH_SEPARATOR
je terminate_name
mov al,PATH_SEPARATOR
stosb
terminate_name:
CLEAR al ; terminate path
stosb
mov file_attr,0 ; Search normal files.
mov di, offset path_name
CLEAR al
cld
mov cx, MAX_SCAN_LEN
repnz scasb
mov bx,di
dec bx ;ds:bx points to end of path_name
mov dx,NULL
call search_directory
int TERMINATE
mainline endp
page
; this procedure searches all the files in the current directory
; looking for a match. It also prints the full name for each match
; which is marked ARCHIVE.
;
; ds:bx pointer to end of current path name
; ds:dx old disk transfer area (dta)
;
; reads: disk transfer area (dta)
; file_attr
; writes: disk transfer area (dta)
; calls build_name, get_first_Match
; write_matched_name, get_next_match
; build_star_name, search_sub_directory
;
search_directory proc near
push si
push dx
call build_name
mov cx,file_attr
call get_first_match
jc no_match ;If no match --
mov si,dx ; Save pointer to new DTA.
test [si].attribute,ARCHIVE
jz find_next_file
call write_matched_name
find_next_file:
mov cx,file_attr
call get_next_match
jc no_match
test [si].attribute,ARCHIVE
jz find_next_file
call write_matched_name
jmp find_next_file ;Loop --
no_match:
pop dx
push dx
call build_star_name
mov cx,file_attr ; Get the search attributes.
and cx,HIDDEN or SYSTEM ; Select interesting bits.
or cx,DIRECTORY ; Include directory searches.
call get_first_match
jc no_more_matches ;If no match --
mov si,dx ; Save pointer to new DTA.
test [si].attribute,DIRECTORY
jnz is_directory ;If directory entry --
find_next_directory:
mov cx,file_attr ; Get the search attributes.
and cx,HIDDEN or SYSTEM ; Select interesting bits.
or cx,DIRECTORY ; Include directory searches.
call get_next_match
jc no_more_matches ;If no more entries --
test [si].attribute,DIRECTORY
jz find_next_directory ;If not a directory --
is_directory:
cmp [si].name_found,DOT
je find_next_directory ;If it's . or ..
call search_sub_directory ;search sub directory
push ax
mov ah,SET_DTA
int DOS_CALL
pop ax
jmp find_next_directory
no_more_matches:
pop dx
pop si
ret
search_directory endp
; This procedure searches the sub directory who's name is in dta
;
; ds:bx end of the current pathname
; ds:[dx].name_found name of subdirectory for search
;
; reads: path_name
; writes: path_name
; calls: search_directory
;
search_sub_directory proc near
push di
push si
push ax
push bx
cld
mov si, dx
add si, offset name_found
mov di,bx
copy_loop:
lodsb
stosb
or al,al
jnz copy_loop
mov bx,di
std
stosb
mov al,PATH_SEPARATOR
stosb
call search_directory
pop bx
mov byte ptr [bx],NULL
pop ax
pop si
pop di
ret
search_sub_directory endp
page
; This procedure prints the matched name after the path name
;
; ds:dx pointer to current disk transfer area
;
; reads: path_name, name_found (in dta)
; writes: write_string, send_crlf
;
write_matched_name proc near
push ax
push dx
mov dx,offset path_name
mov al,[bx]
mov byte ptr [bx],NULL
call write_string
mov [bx],al
pop dx
push dx
add dx, offset name_found
call write_string
call send_crlf
pop dx
pop ax
ret
write_matched_name endp
page
; This procedure builds an absolute search name from path_name
; followed by file_name
;
; reads: file_name
; calls: build (to build the name)
;
build_name proc near
push si
mov si, offset file_name
call build
pop si
ret
build_name endp
build_star_name proc near
push si
mov si, offset star_name
call build
pop si
ret
build_star_name endp
; This procedure appends the string at ds:si to path_name in
; path_name. It knows where the path name ends from knowing
; how long path_name is.
;
; ds:si name of file
; ds:bx end of path_name
;
; reads: ds:si
; writes: path_name
;
build proc near
push ax
push di
mov di,bx
cld
copy_name:
lodsb
stosb
or al,al
jnz copy_name ;If not end of string yet --
pop di
pop ax
ret
build endp
page
; This procedure find the first match between the name given by
; ds:dx and the directory entries found in the directory path_name
;
; cx file attributes for search
; ds:dx pointer to current disk transfer area
;
; returns:
; cf 0 a match was found
; 1 no match found
; ax error code returned
; 2 file not found
; 18 no more files
; ds:dx pointer to new disk transfer area
;
; reads: path_name
; writes: disk_transfer_areas
;
get_first_match proc near
cmp dx,NULL
ja allocate ;go allocate space --
mov dx, offset disk_transfer_areas-type dta
allocate:
add dx,type dta
mov ah,SET_DTA
int DOS_CALL
push dx
mov dx, offset path_name
mov ah,SEARCH_FIRST ;call for find first match
int DOS_CALL
pop dx
ret
get_first_match endp
; This procedure is much like get_first_match
;
; cx file attributes for search
;
; returns:
; cf 0 a match was found
; 1 no match found
; ax error code returned
; 2 file not found
; 18 no more files
;
; reads: path_name
; writes: disk_transfer_areas
;
get_next_match proc near
push dx
mov dx, offset path_name
mov ah,SEARCH_NEXT
int DOS_CALL
pop dx
ret
get_next_match endp
page
; This procedure sends a crlf pair of characters to the screen
;
send_crlf proc near
push ax
push dx
mov ah,PRINT_CHAR
mov dl,CR
int DOS_CALL
mov dl,LF
int DOS_CALL
pop dx
pop ax
ret
send_crlf endp
; This procedure writes the asciiz string at
; ds:dx address of asciiz string
;
write_string proc near
push ax
push dx
push si
cld
mov si,dx
mov ah,PRINT_CHAR
write_string_loop:
lodsb
or al,al
jz write_string_done
mov dl,al
int DOS_CALL
jmp write_string_loop
write_string_done:
pop si
pop dx
pop ax
ret
write_string endp
page
; This is the data storage area and must be the last thing
; in the program.
;
star_name db '*.*',NULL
path_name db 80 dup (0) ;space for 64 char pathname and
;13 char filename
file_name db 13 dup (0) ;save room for full dos filename
file_attr dw ? ; attribute value for searches.
disk_transfer_areas label byte ;this must start at the end of dirarch
main endp
dirarch ends
end start
-------
------------------------------
End of Info-IBMPC Digest
************************
-------