Upload
vanthien
View
214
Download
0
Embed Size (px)
Citation preview
CONTENTS
CHAPTER D RECTORIES AND PATHS
DIRECTORIESILENAMES ANDPathna_e.Path ng and ExternaPathing and IDi ayi YourCreatingDHow
CHAPTER BATCH
BATCH PROCESSITHE AUTO EXEC BAT F
2. How to an2.3 CREATING FI2. .BAT
CHAPTER REDIRECT ON INPUT AND
I NPUTAND 'OUTPUT • •Red Your
3 1. F 1Command P p ng •
4 ADVANCE:D MS-DOS COMMANDS
4. COMMAND4.2 MS-DOS ADVANCED COMMANDS
FIGURES
TABLES
-1 A e Hierarch cal Structure1 MS-DOS Batch F e
2-2 How MS-DOS Uses the AUTOEXEC.BAT eThe MS-LINK ionHow I Divided
"."'-2
MS-DOS .Advanced Co_ands •SORT Table
v
• It-2
The ..........................................................--........"""'"'"' ......~~ ........organ
and
2 D batch ng
Discusses red rect on
1 ins the MS-DOS commandsused programmer
5 o the FILE COMPARISON uti
6 Discusses the LINK uti i
IInl''''.'''I" i x A youing
how to configurefor the Rai
vi i
D RECTOR I AND PATH'S
For example. you may want all of your ing programs inone di and text files in another. Anyone dican contain any 1e number of files. and t may alsocontain other directories to as subdirectori
is izing your f les is called ahierarchical di structure.
A hierarch ca d structure can be of as aII structure: directories are branches of the tree andf i 1es are 1eaves. the II grows downiward;that is. the II The root s the firstlevel in the di t the d thatis automatically created when you format a disk and star
ing f les in it You can create addtt onal director esand subdirectories with some of the commands discussed n
4,
The tree ordirector
f structure as you create newgroups of f les or for other people on the
each new d , files can be added, ores can be created.
It is poss ble for you to Utravel ll aroundinstance it i pass b e to ind any fistart at the root and traveling down any of the branchesto the desired file. Conversely, can start where youare withi the fil system and travel towards the root.
Un ess ilion create a file, newf les in the di which you are nowworking. Users can have f 1 of the same name that areunrel!ated because each i in di ferent direc
i gure 11 i 11 ustratesstructure.
ica hierarchical di--~-~~·_u
DI
lA fu 1be
namednamed MARY.
This onefile named lA in the
bel ng to the
Aorof theworking
t
TEXT Name of awork ng di
d i __ I ..........' ..... in the
uses th shorthand notation tothe name the working dihierarchical d 1 st ngs.automatically creates thi* when a di made.
The shorthand namedi -.1 "
the worki ng d i ...A~...... ,........ 'Il1 • S
you
DI R ••
inist thework
fi 1esdi .. _".....'..... _.."
the
DIR •
1i st files in the -_1... -. ..,... 1 S
DI A.ND
If you now want to see what is in the diyou can ssue the command DIR. The followingexam.ple of the d splay you mi receive rom thecommand a subd i .. _~..... "".... ,,'
driveof A:
D
ILEl COM4
<DIR>IR>
<D R>
free
10:10:10:9:
reside on
for thNote
rectoriesd inndicates the work
the thandILE • sal
these directories and
disk was ass when the disk wasthat MS-DOS 1i both fi es and
As you can sea, Joe has anothernamed TEXT The I I
, anddi ER.
A ofve A:
you to gBecause 1 and esprevious displ MS-DOS
i "'_~""'i/I!l"''' the same name as aexample, you have
• you cannot create
1.2.5 Creat ng a D rec
i your work ng direc ,use thecommand. For examp e t to
NEWDIR under your working di
MKDIR NEWDIR
110
NG
are ava 1 1e use expressly in batchand REM perm ts you to inc uderemarks
in your batch fi es without these remarks be ngcommands. you wi than i ona 1
its you to ither continue or abort theat given point REM and are descr bed
4.
Twof i 1es: REMand commentsexecuted as
andbatch process
n detail
Batch process ng is useful f you want to execute severalcommands w th one command, such as when you
format and check a new disk. example, a batch f le forthis mi look like this:
1: Th i i f i 1 check new d sksREM It s named NEWDISK.BAT
3: Insert new disk n drive B:4:56: B:
To execute th .BAT file, simp1the .BAT extension:
f i l-"''''ilOorT1Ii'''''
NEWD
The result is the same as if each of the lines in the •BATf 1e was at the termina as individual commands.
Fi 2-1 illand execute an batch fi le.
used wri
2-2
4. pressappears
nal batch
wh 1 n batch mode, th
fthethe
endscommand n
t
command n batch i1 be the ofanother batch f i 1lows you toca11 one
file from another when the first i nished.
if you
canlin
than 10
the2. as part! you must
examp e to speci theyou must it as
at
fIein, the
2.3 1 Executing a .BAT F le
the,you must
fo 11 owedfor
To execute the batch i e MYF LE.BATthat will replace the
enter f ename ithout itsyou want MS-DOS to
etc.
Remember that the fil MYFILE BAT consists 3 Ii nes:
.MAC
execute the MYF LE batch
MYF A 1B
MYFILE s substituted forfor
A PROGl
10
ION INPUT AND
command
DR
in your command. For example. the
the disk in defaul
MYF
DI R>MYF I
to a file namedfile on the command line
new data
the end of
doesyour di
overwr
your di or f erep1 ing the entirecan be used to tel
command aiedile. The command
createsIf MYFILES
Ie
anothertwo
D R
to havefrom
using a less-thancommand
to currently exnot exist. t s
>LI
and sor a f Je
3.1 2 Fi1
A fi 1teriin sOlIeor to a fi
i 1.. ··",,a#lll11l'1I
textn f
r
text
di t,
can n on
3.1.3 ip
tOflY'lANIJS
sts theto use
commands " and
The fo lowadvanced
notat on ndicates how youcommands:
d format the
1. You must enter any wordsare call k
You,of
2. the text for tems enc osed n angleFor example, you should enter the
en 1 is shown in
3- n square brackets ([ )wish to i i ona i _",;/1,, _
1 e the square brackets, onlythin the brackets.
ional Ifon, do notnformation
ADVANCED COMANDS
It. An ell i i s ( ••• ) i nd i youitem as ma:ny t imies as you want.
an
·.... ······ion·where shown (with,suches connas'i
t colons, or slashes.
S. must include allthe exception square
1 signs, question
ADVANCED COMANDS
Table lists the
Ie 1: Advanced
Connand
BREAK check
IR directories; pri di
console
batch file echo feature
IN Converts executable files to format
EXIT its command and returns to lower level
FIND a constant ng of text
if i 1es
11 i 1i
Prey flow control for bateh fi
I F flow contr'ol files
E -_.,or_··t one t
a COIllniina
~U:lIDt.nall ....'n ............. ion a f i 1e
f or
f
FT
or DatCk,,,ar'G
TYPE
IR
SYNONYM
CD
DI Internal
SYNTAX
a d fferent d splays current
CHDIR
wantas
andshor
IR ••
you in the new d Ais also avai able with this command:
Thisd i "fI1I!!!J&/I- 'P!IfI";.... "I
wi 11 alwaysof your working di
n the
COMMANDS
CHDIR used without a displaysdi If your working di ison dr i ve ,8: t you IR <Return>,displa,y:
NAKE
All
SYNTAX
which you issue
CTTY ice>
COMENTS
The
to
AUX
i are givingis useful f you want
you are wo,rk i The
moves alldevipr i The cOIIRIand
CON
the AUXthe current
such as a
to the original ee the
NAME
PURPOSE
TYPE
'I nterna1
Turns batch echo
SYNTA.X
ECHO IOFFI
COMMENTS
on and off.
com·m,ands ina batch f il eon the console when
command processor. OFF turns offECHO ON turns the echo on.
are displare seen by thethis feature.
If ON or OFF are not specified, the current setting isdisplayed.
SYNTAX
f i lei toa saving of d sk
format.faster
N <d:><fi ename><.ext> :]
ilethe
Ivespeciused.,the
only f want to convert. .EXEformat The e named espec s
f no extension is if edt itThe i fe converted to .COM
of the and aced inIf you do not spec a vet the
f i 1e wi 1 be used .. If you do notf il ename, the f i 1ename wi 11 be
a f lename extension inthe new file w 1 be g ven an
The i file must be n va id .fXE formatthe 1i The res i dent t ,or aetua 1 code and data par t
the file must be less than There must be noSTACK
kwhether
I
of arethe initial CS: Pis specif ed in the.
tlel~,e"ltl i ng~e':Jmt!!nt: I ns t ruet i on
1e,a purefixups
conta n'syourelocati
ixup value. Thisat which the program s to
ng program wi1 be usablthe abs01 memory address
ion. The commandproperly oad ng
:IP s not specif ed in the.binary conversion i assumed.
necessary (e. theons requ
for
1iCOM programs
f EXE2BIN inds error.ror messages will be displ
or more fo 11 ow
cannot be conver
if
meetor
CS: P do,es notspecified above,criterion but hasalso displexecutable fil •
either of criteriat meets the .COM f Ie
xups. This message isthe file is not val d
10
File
file is not on the di i f i ed.
is to run N.
File ion error
IN cannot create the f le.ne i the d is fu
condition caused the error.
icient disk
Run, or f some
s not disk to create a newIe.
-base
source (.i ca.t i ng that a
1e iich the fini
i 1e be conyer ted
conta ned nformationis required for the
at
fi e is not in the correct format.
- Read error onread less than size
is is a warning
f Ien header
y.
COHl-tANDS
NAME
IT Internal
PURPOSE
Ex ts commandand returns to a previous level, if one exists.
IT
This command can be used when you are running anapplicat on and want to start the MS-DOScommand processor, then return to your program. Forexamp e, to look at a di on drive B: whi erunning an app icat on program, you must start thecomman,d' processor ng COMMAND i n response to thedefault drive
D R command and willfor the default disk. When youto the previous level
You can nowd splay the di
EXIT, you returna.ppl ication
12
FIND
files.
SYNTAX
a specific string text n a f e or
FIND
FIND
<stri
a filter thatof filenamesa spec fistri
J ne.
i lename ••
as ions a str ng and aIt wil1di 81 lines that
from f i 1es if i ed i n
If no files are specified. FIND 1 take the i onthe and display all lines conta n thespecified string.
for FIND are:
FI to d i a 1 Ii nes notcontaining the ifled str ng.
FI to int only the count linescontained a match In of the files.
each line to beve line number n the
3
its
ADVANCED COMMANDS
string should be enc1 in quotes. Example:
FIND IS BOOK1 BOOK2
displthat
all ines from BOOK1.TXT and BOOK2.TXT (inthat contain the string IIFoolls Paradise
The command
DIR B: I FIND IV IIDATII
causes MS-DOS to display all names of the f les on thedisk in drive B: wh ch do not n the stri OAT.
double around a stri that a1 hasin it.
When an error is detected, FIND responds with one ofthe following error messages:
Incorrect version
FIND will only run on versions of2.0 or hi
that are
F ND: Invalid number of
You did not specicommand.
a string issui the FIND
FIND: error
You an illegal string when issuing the FINDcommand.
FINO: Fi 1e not <filename>
filena.e youND cannot find it.
ified not 5t or
FIND: error in <filename>
errorified
when FI tried to, ,read the fi 1e
FIND: I nva 1 d ion-name>
specif edan ion that
5
not st.
ADVANCED MS-DOS COMMANDS
NAME
FOR
PURPOSE
Internal
Command extension used in batch and interactive file...... ",....... i ng.
SYNTAX
F IN <set> DO <command> - for batch processingFOR IN <set> <comm,and> for interactiveprocessing.
COHI1.ENTS
<c> can be any character 0,1,2,3, •• ,9 to avoidconfusion with the %0-%9 batch
<set> is
The var i ab 1, e i s set se.quen.t i a lly to each memberof <set>, and then <command> is evaluated. If a memberof <set> is an expression involving * and/or 1, thenthe variable is set to each matchinig pattern from disk.In this case, only one such < tem> may be in the set,and a.ny <item> bes i des the firs tis ignored.
NOTE
The words IN, FOR, and DO must be in uppercase.
16
N ( Ie.)
F IN BAR
only I
woulderrorso that theis in a
i was anthrow out the' :1
would never see t. thethen only one should be
17
NAME
GOTO
PURPOSE
ADVANCED MS-DO'S COMMANDS
TYPE
Internal,
Command extension used in batch file processing.
SYNTAX
GOTO <label>
COMMENTS
GOTO causes commands to be taken from the batch f 1ebeginning with the line after the <label> definition.If no label has been defined, the current batch filew 11 terminate.
Example:
:fooREM looping •••GOTO foo
wi 11looping •••
an Infinite sequence of messages: REM
Start ng a line in a batch f 1e withline to be ignored by batch processing.following GOTO define a label, but thisalso be used to put in comment lines.
18
I:' causes theThe charactersprocedure may
NAME
in. f 1e
1Fti oh> <command>
The <eond tion> soneof the following:
<number>i and only if the ous executed
CO NO had an exi code of <number> or
<stri •• <strif and only
ieal afternot have
areStri ngs,
E,X I i 1ename>f and onl y i f <f il enam!.> ex s ts
tion>if and only if ition> is false.
The IF statement 110ws condiional execution ofWhen the <condition> s true then the
is executed. se, the <command> is
19
ADVANCED MS-DOS COMMANDS
NOTE
The words ERRORLEVEL t EX I ST t and N'OT must beuppercase.
Examples:
IF NOT EXI FOO ECHO Can't find file
IF NOT ERRORLEVEL3 LINK. S1, I ;
NAME
PURPOSE
The2. 11disk
SYNTAX
tol!oader on
is aof the
nationdrv:>
places
ination ve isive that you want to
ve or hardoader on.
ace the 1 on asketteor a hard diskion that contains f les.
eop ies the 1aader and 188V'8S the f i 1es
The1
11 owi ngon the
E:
aces thedrive E.
on 2.11
NAME
MEDI
COMANDS
access to diskettes
MEDIACHK
The Rainbow can readd skette formats. Thedisket to determi theyou use only Ra nbow,the MED ACHK command toyou always use is
a var ofmust first read the
MS-DOS format Ifdi use
that
When youRainbow
d skette1saccess to the
The default is
the MED ACHK command with the OFF swino longer checks to determine the
fo~mat. This the
IACHK
HAKE
I4KDR
SYNONYM
KD
Internal
",akes,. new di .......... ,.......1
KKD R
is to create a h erarch calWhen you are In your root d
rector es using
IR
create a i .aj"''''''''''''To create • d i ...j· ... IfIIl.......,
n yourn••ed
root
IR
COMMANDS
NAME
MORE
PURPOSE
to console one screen at a time.
MORE
s a f Iter that reads from standard ias a command from your terminal) and displays onescreen of information ime. The MORE command thenpauses and d splays the --MORE message the bottomof your screen
on. Thisdata has been read
d ay another screencontinues unti all the
Thescreen
commanda time.
s useful for viewiIf you
a 1 f i 1e one
MYF I •COM
wi 11default dri
display the f 1e MYFILES.COMone screen at a time.
the
SYNTAX
Internal
PATH
al ows you told be searched
searches your works no
whichexternal commands
d The
unt ild
set another
d i ....,.......".. ",
You can tellspeci ng several
1et
oneby semicolons.
PATH IN\DEV
tell sabovesearches thePATH command.
the directories specifiedfind external commands.
in the order specified in the
The command with no ions will print the currentIf you spec i PA.TH; , wi 11 set the N·UL
, mean ng that only the work will besearche,d for externa 1 commands.
nterna)
AX
execut on the f e.
the 'execut ond or
execut on unti
a batch f Ie you needsome other act on.
you any
to
When command processor encounters
ike a when
tpr nts:
Ifdi
press wI be
1
If Y in to th s executthe inder of batch wi beand wi 1 returned to ng
level. Therefore, used to break abatch f i 1e into e.ces ,a owi ng you to end the batch
file at an intermed ate pont.
comment is ional may be entered on the sameine as You may Iso want to the user of
the batch f 1e with some meani thebatch f Ie pauses. For example, you may want todisks n ~ne of the drives. An ionalmay be g yen n such cases. The comment will bedispl the ike message.
NAKE
the
SYNTAX
COMENTS
This theIf no text
will be set defaultdefau 1t dr i ve ion. Yo,u canspec as the currentcharacters indicated below.
use the command with theyou spec I an existing dr ve.
ion th a non-ex i stent dr ive" youresu ts.
using
ion, beIf you usecould see
COMMANDS
be used in the promptThey must all be
in the prompt command:
The 1ow'i ngcommand to speci
by a dollar
To Get This
$ The IS' charactert The current timed current datep The current di of· the default drivev version numbern The default driveg The 1>1 character1 The Ie characterb I I' character
A CR IF sequences A space (leading on1h Ae
les:
PROMPTthe default drive letter
PROMPT Time • $ •Sets a two-line prompt which prints:Time • rent time)Date • (current date)
PROMPT [7mSn:the
returnstext.
[min inverse video mode and
to normal video mode for other
a file or an entire disk containing bad
<filename I d:>
If athe
To
on a disk s ,you cancontaining that sectorthe entire disk (if the bad
a part cular file,
recover etherthout the badsector was n
<filename>
11 cause toand to ski the
finds the sector ,the sectorwill no onger allocate
To a d sk,
<d:>
wheredisk
is the letter of the drive contain ng thebe recovered.
ADVANCED COMMANDS
I f there i s n,ot room on the root d i ....."",..,...... ""RECOVER will print a message and store informationabout the extra files in the File Allocation Ie.You can run RECOVER again to regain these files whenthere i s more room i n the root d i ".,11liiio"''''''''',".1
NOTE
You should use RECOVER only as a last resort.could misi data that may not be
Th s could lead to unpredictable
MAKE
REK Internal
OJ
fi 1e.
are on the salle I ne as the'e ng execution of that batch
REM
owed in the comment are the
new disks
B:
sis afl IeItis
InsertB:
1:2:
ADVANCED
NAM,E
COMI1ANDS
TYPE
RMDIR (REMOVE DtRECTORY)
SYNONYM
RD
PURPOSE
Internal
Removes a d i ......."" ..........1
structure.
SYNTAX
from a hierarchical di .....,'.. ·JiIIIl.... "'·1
RMDIR
COMMENTS
Th s command removes a difor the. and shorthand
To remove the d i ....,...... ".., ......DIR command for that path to ensuredoes not contain any important fileswant deleted. Then
empty
first issue athe d i --"............ _.....'you do not
RMDIR
The d i -_ "structure.
has been de 1eted f rom the d i ....,... '... "" .. ""
NAME
Internal
PURPOS'E
access to.18orei1e processing.
10 1e in
SYNTAX
1FT
f •%1 •
•
are imi to hand1 0allow access to more
to the command
then a 1FT w 11 result in the following:
•%1 •
If1 i ne,shif
are more than 10those that appearone at a time into
given on ater the Oth w 11 be
successive shifts.
NAME
SORT
PURPOSE
External
SORT reads input from term; na 1, sorts the d.ata,then writes it to your terminal screen or fil
SYNTAX
SORT [/+n]
COMMENTS
SORT can be example, to ize a file bya certain columin. There are two switches which allowyou to select ions:
reverse the sort; that is, sort from Z to A.
sort starting with column n where n is somenumber. If you do not specify this switch.
will in sorting from colum'n 1.
4-2.reads and sorts in the order described in Table
ADVAN'CE.DKS-DOS COMANDS
Examples:
Th i s command will readsort, and then writeSORT.TXT:
file UNSORT.TXT. reverse thethe output to a file named
/R <UNSORT.TXT >SORT.TXT
will pipe the output of thethe SORT filter. The SORT filter
listing starting with column 1.4in the di list ng that
, then send the output to theresult of this command is a
Ie size:
The fo·l1owi ngcommanddi command towill sort the di~-·~-~~~u
is is the columnins the file si
console. Thus, thedi sorted by f
DIR 4
The command
DIR I SORT 4 HORE
will do the same thing as the command in the previousexample, that the MORE filter will give you achance to read the sorted directory one screen at atime.
5
FI UTI
suti Ii
descri bies how to use the i e son
ION
It isyou havesee which...··""111..,4•• i son
to files one and later want to
you can use
Ifes to
F Ie
two
sourceles
Linkeror
thelanguage cOlRpil
contentl o,ff i lei can be
f les beingles n
Fi Ief i 1es.to themay bestatements
The i sons are miade i none of two ways a1iIi or a baIS. The 1i ,,···..""'-1 necomparison isol blocks lnes that are fferentbetween two files and pr nts those blocks of nes. The
eompar son d ays the that arethe two files.
FILE COMPAR I SON UT I L ITY (FC)
5.1.1 Limitations on Comparisons
Fe uses a I arge amount of me.mory as bufferto hold the source files. If the source files are 1than available memory, Fe will compare what can be loadedinto the buffer space.
If no lines match in the portions files in thespace, FC wil display only the message:
*** Files are different ***For binary files larger than available memory, FC comparesboth f i 1es comp 1ete y, over 1a.y i ng the port i on in memory withthe next port on from disk. All d fferences are inthe same manner as those files that f tcomp Iete 1y in,memory.
5.2 FILE SPECIFICATIONS
All file specifications use the fo 1 ng
: ] <f i 1ename>
where: is the letter desidrive designation is
ing 's
ing a disk drive. If theomitted,. Fe defaults to the
default drive.
name of the
is a one- to three-character extension to thelename.
FI
5.3 HOW TOFt
IL
is as ows:
Fe [II
Fe .atehesI I ..., ltilll'II•••,
filenames
<filenallle1> i 1.'ltlllll.... ,.
B
the
FIB: andSineeno dr
\BARd t ....""" .. IlII"Ii.··fLl
.... ~...... IlII"... 'u of disk dri ved
assumes thatIt drive.
FI COMPARISON UTILITY (F
5.4 FC SW
There are four switches that you can use with the FileCompar i son Ut i 1 i ty::
xxxxxxxx
/8 a binary comparison of both files.files are compared .... ".,'......_....,_ ... ,,"' ...'.. , with no,.. ...... "n,."'n,.'nni ze ter mi smatchesprinted as follow~:
--&llIIIIIN':."l\-·--·-P l----F2-yy zz
twoto
are
xxxxxxxx is the relative address pair offrom inning of the fil Addresses
start at 00'000000; yy and zz are the mi sm:atchedfrom fi leI and fi le2, ively. f one of thefiles contains Jess data than the other, then amessage is printed out. For example, if filel endsbefore f le2, then Fe displays:
***Data eft in Fl***
# stands for a nlumber rom to 9, • This tchspecifies the number of ines required to match forthe files to be considered as matching again after adifference has been found. If this switch is notspecified, it defaults to 3. This switch is used onlyin source comparisons.
Causes Fe to compress whites and duringthe comparison. Thus, multiple contiguous whites inany line will be considered as a single white space.Note that although Fe whites, it does notignore them The two are beginning andend i ng wh i tes i n al i ne, i rill',...... ,iIICIlrl
FI
e lin a
11
and
but not match with
This Itch is only n source sons.
the match process1 All letters inuppercase letters. For
to t the case ofthe files are considerede,
wi 11
fi ed, then Fe&IIIRlD e,
11
Thi s tch i s used on y t n source cORIpar so,n,s.
FI UTILITY
5.5 OIF ING
The File ison Utili reports differences betweenthe two files you speci displ ing first filename,followed the line,s that differ the files,
I lowed the first line to match in both file's. FC thendisplays the name of the second file followed by the linesthat are different, followed the first line that matches.The default for the number of lines to match between thefiles is 3 (If you want to this default, speclthe number of lines with the switch.) For example,
<difference><1st ine to
lename >
f i I e2 in file >
_·_,-_.__·•.. _ .... -c:1'" i ename2><difference>
1st line to match file n f il e2>
FC will continue to list each d fference.
If there are too many differences (nvol ng too manyIi the program wil simp y report that the files aredifferent and s
If no matches are found after the fi st difference is found,Fe wi 1 display:
*** Files are different ***and will return to theexample,
default drive prompt
FI III
5.6
two i es, youunless you red rect
in sam,e
To COinDelreDIF
FC Fi Fi 1e2
theFC to
The and miatches betweenFi 1 and F 1 wiFER.TXT on the default drive.
be
5.7 EXAMPLES
FI COMPARISON UTILI
Assume these two I I files are on disk:
ALPHA.ASM, BETA.ASH
FI
ABCoEFGHIMNopQRSTUVWXYZ
A FILE B
ABCGHIJ12PQRSTUV.45wXyZ
To compare the two files and display the differences on theterm na screeen,
FC ALPHA.ASH BETA.ASH
FI
screen.ere:do.
d i 1A 1 other Itsuse tabs,c~IDllrison on the
DEFG
G
MNoP
.ASMJ12P
as follows on the term nal screen
containscontains g.
f i 1contains mno where
contai'ns J12.
w
it5w
f 1econta ns w'whereBETAns
F LE COMPAR UTILITY
can pr nt the di on line inter using thesame two source files. In th s example, four successive
ines must be the same to constitute a match.
Fe /~ ALPHA.ASM BETA.ASM >PRN
The folil owi ng will appear on the line printer:
NOTE: p is the 1st ofa string of ~ matches.
----------ALPHA.ASMDEFGHIMNoP
----------BETA.ASMGHIJ12P
------------ALPHA.ASMW------------BETA.ASM!+5w
NOTE:w is the 1st of astring of 4 matches.
10
FI
forcesaon the
as were used in
dthe salle twoes •
Fe .AS" • ASH
TheThis swifilenamesshou ld aDI:Jellr
OOOOOOOF000000120000001500000018",,,,",,,",,,",,,,180000001E",,,1..,,,,,,,,.. 1
0000002A0000002D
in is eand any
Fe command
31
51
lA
11,
b i i son.the
fo low ng di ay
FI LECOKPAR I S,O'N UTll (F c)
5.8 ERROR MESSAGES
When the Filemore of the
"'Vlll1ll1tliill i son Ut i i detects an er ror one orlowing error messages 11 be displayed:
Inval id ion>
One the swi that you have ified is invalid.
File not found:<filename>
FC cou d not read the filename you specified.
Read error n:<f lename>
FC cou d not read the entire file.
Invalid number of
You have specified the wrong number ofFe command ine.
Bad f 1e
ions on the
the files you specified s ive.
Data eft in <filename>
After reaching the end of one of the filescomparison, the other filestill hasleft.
Internal error
in a filedata
This message indicates an internal logic errorFe program.
12
n the
6
6. 1
LI
Thisread
diSCUSSQSire
It suse INK.
that
If you are not going toyou not to read
nk
lled
es i oneprogram you can run
Resol
1i f les fOT def n tons of un~esolved
references
external cross-references
a listing that both the resolution ofreferences and error
THE LINKER PROGRAH (MS-LINK)
6.2 OVERVIEW OF MS-LINK
When you write a program, you write it n source code. Thissource code i s thro,ugh a comp i 1er wh i ch producesobject modules. The object modules must be passed throughthe link process to machine language that thecomputer can understand directly. This machine language isin the form required for running programs.
You may wish to link i several programs and run themEach of your programs may refer to a 1 that
is defined in another ect module. This reference iscalled an
ect modules into one relocatable1 ed an .EXE or Executable
INK makes sure that allect modules are defined.files for initions of
are not defined in the ect
LINK combines severaload module, or Run file
1il As it combines modules,externalMS-LINK can search several Iiany externa references thatmodules.
externalany error
INK 1soreferencesmessages.
resolved,a Li
and tf ealso
that showsdisplays
INK uses available memory asavailable memory is exhausted,disk file named VM.TMP.
much as possible.INK creates a
When
F gure 11ustrates the various parts of the MS-LINKion.
LI
Source Source
Assembler
MS-LINK
libraries
.OBJ
LST
Used ifRun file is
memory
VM.TMP Run fi.EXE
F i 1: The LINK
6. FINITI Ll
terms used in thi are exp ained belowunderstand how INK works. Genera ly, f you
mlodu 1es comp i 1ed f rome Pasca 1, or a1anguage, y'ou wi 1 not need know these termswr ing compiling programs n assembl
language, however, wi 1 to un!derstand INKnit descr bel
shaded area group' addressa.bl
F y I Divi
e:
Name ClassName
1212
lowest address in1
the lowest
Eachloads
Duringaddressesthis fi
1. 2. and 12 havedi ........a .........
not have thesa.e12 aof
namesname.
INKrstto
i rdoes
a col
contiof anygroup. At linkreferences thegroup. A
that f t w n ado not need to be
1lustrat The addresslowest addre.. the n that
INK analyzes the groups, thenthe address in of that
may eo<ns i st of on,e orlllore groups.
If you are writgroup and classlanguages C.done ie.11y
nnames
the compiler.
may ass gnh level
the naRtli ng is
L I
6.4 FI INK
INK:
Works with one or more iles
Produces two
be directed to search up to 1I f les
For eachspec f cat oni the same
of iThe
that
veINK i J
:]
where: on
as
ve0: • The
dr ve
any filename of one to e
s one- tof ename. Thethe extension
extens on therequ red as part of
6.4. F e Extens o,ns
f no f lename extensions are given n the ifile specif cations, MS-LINK will recognizeextens ons defau t:
OBJ.L B
LI
6.4.2 ions
Lifol1
f les:t extensions to
.KAPRunL st
6.4.3 Fi 1e
createI wi 1
ton the dVH.TMP. it will
the link session If thef 1e that exceeds
i let namet dr ve. f
has been created.diskette in drive >
has been dithe defau t ve
removed, theand I1S-LINK mi
, you must not removethe 1 nk session ends.of NK w 1
ay the error
end of
The of VI1.TMP are written to the file namedfol ng the Run FIe: YK.TMP s a working fileonly and is deleted at the end of the link ng session.
WARN
use V" .TKP as a f i 1en,ame for any i 1e • Ifa f lenamed V"'.TriP on the default dr ve
LINK requires the VM.TKP file, MS-LINK wllthe VM.TMP a1 on disk and create a newThus. the contents of the prey ous VM.TI'\P
11 be lost.
THE LI
6 5 TO NK
MS-LINK requINK and
seven
As an ionswitches maycharactersto INK
two command to starresponses command In add ton,control MS-LINK features. Usually, you willcommand.s to I NK on the term i na I
answer command andconta a response fell e. Command
be used you wh e g ving commands
MS- INK maymethod
started in three The fthe commands in response ndividua
In the second method you 11 commands online used INK. start NK the thmethod, you must create response file that conta nsthe necessary commands and 1 INK where that f 1 iswhen you start MS-LINK.
Methods Start MS- INK
Method LINK
Method 2 LINK <filenames>
Method LINK
LI
6.5. 1 1:
start
LINK
INKdisplayanswer the
INK
11 thenII t lie. You
spec f c
each netthe tch
oneorllloref·orward s 1
tches.
on.n
PROMPT
ect les bebe
spacesa
astthe
wi reappear.There s no defau t; aresponse is requ red.
RunF i 1e ect-f 1e. Give f ename for1e ect
defaul slenallleEXE.
the
i stFi 1 i 1e. ve filename for iThe defaul sfilename.
ngRUN
L brar es [ ]
o
L st filenames tosearched,bank spaces or us signs
If a plus s gn sthe characterthe w 11 reappear.The default i to search
default librar esthe ect modules.
ions w 11 beB, .)
6 2 2:
LI
Line
To start1 ne.cODIII1andmust be
LINK e>.<1 tch ••• J
LI are toe ds for the different
cODIII1andmust be
where: 1 st of eet modu es
is the nameIe
the f e to ve the
i s the n,ame of the fIe rece ve the
a 1 st 1i modu es be
ionalswany of the
cODIII1as or
beust
as
To select default for a f ld. s ycomma with no spaces between the two commas.
Ie:
a second
B.L B
LI INK)
1 ectTABLE.OBJ, and CARE.OBJ are
a result of using theect modules when you press
1 map (the swicreates List file named
file CORLIB.LIB.
FUN.OBJ,INK thenp,auses
INK links theand a global
defaults to FUN. file;FUNLI .MAP; and searches the Li
This command causes
12
L
3: iF i 1e
To start
LINK
where:
INK with
tsentered from1e thout
To use s ion. must create acontaining several 1 text.response an INK Thesameorder as the I'NK discusseddes red, a long response to theL i brar i es: may be severa 1
us sgn to cont nue the same1 i ne.
lethethe
Ior
anext
Useswsame wayterminal
the
command characters in the responsef le theare for on the
INK session will beorder with the f response
response fle not contain answers for all(in the form ilenames. the sem co on
or carri NK 11 di aywh ch does not have re~SDC)nS,e. then wa t fOir youegal response. When a lega response has beenINK !cont i nues the 1i nk sess ion.
13
LINKER INK)
1e:
FUN TABLE CARE/PAUSE/MAPFUNLI
IS.LIB
INK pausesyou to swap
sectionWhen any key, the
named FUN.EXE and FUNLIST.MAP. MS-LINKfile COBLIB.LIB, and will use the
the switches.
file tellsname FUN, TEXT,
.... 11'...... 11,... i ali cd l scuss i o'n under
using thisf i 1es will be
w 11 search the Iidefault settings for
Thismodulesbeforediskbefore
14
6.6
Plus si
n.to be Ii
been 1 i ste.d,e name and
usf
owingmore
ibraries:When
es to beresponse ine
and a p us
e:
ieolan
To se eet default touse si ngl e semi colon, (;) folcarri return at any t me afterFile: • This feature saves timeto a series of
15
need
LINKER PROGRAM
the semi on has beenpressing the <RETURN>
longer to any of thelink session. Therefore,semicolon to skip some
, use
do
and enteredyou can nofor that
not use theTo skip
1e:
KodulesFUN TEXT TABLE CARE<RETURN>
ModuIe;<RETURN>
will and MS-LINK will use theincluding FUN.MAP for the List fil
to abor the 1 nk session at anyan erroneous response, such as theincorrectly spelled filename, you
to exit INK then restarthas been but you have not
, you may delete the erroneousfor that line
Use thetime. If youwrong filename or anmust pressMS-LINK. If the error
the <RETURN>characters w th theonly.
16
6
LI
message.
n squarewh ch can
[.
I*\odu must be
ect modulesthat the f
be yen
be nked.extens
i enameset the
that loadsencountered. You
ich
in_''11''.__ '"''_,''' i on to
read
i 1
filename will create a file for stor ng the,e,(ec:ut:aD I f i Ie that resu I ts f rom the nk
Run f 1es reee ive the f i 1ename extens io'nyou spec; an extension other than .EXE.
7
THELI INK)
If no IsINK uses the
the ect Kodules:
Ie:
Run Fi Ie
to Run File: prompt,first filename typed in response to
as the RUN filename.
B:
re!IDC)nS;e d i rectsl NK to create.EXE on dr ve B:. Also,
which 110ws you to insert anew diskRun f le.
the Runfi1eNK wi 1 pause,
to receive the
i 1ename.
ns anlese
the Run file.
for eachEach also
in thethe
The default response is the Run filename with thedefault filename extens on .MAP.
[ ]:
The valid responses are up to eorsi y a carri return.default i search.) Licreated a 1iutill
1i fi Ienamescarriage return means
files must have been
must be by blank spaces or
INK searches Ii files in the order listed toresolve external references. When it finds the modulethat defines the external symbol, INK processesthat module as another module.
18
II
If INK cannot find a Ithe d sk drive., it wi1 di
file on the diay the mess.lata:
in
fi n·d 1i < 1, i ftrJ.r,,-r' •.IIl~.>
new drive letter:
letterB) •
19
ive on
LI PROGRAM INK)
6.8 INK ITCHES
The seven INK tches control various INKfunctions. Sw tches must be at the end of a promptresponse, less of which method is used to start
INK. Switches may be grouped at the end of anyresponse, or may be scattered at the end of several. fmore than one swi at the end of one response,each switch must be by a forward slash
restriction sfrom the first
trcan!.Dctsitions are
All switches may be abbreviated. The onlythat an abbreviat on must be aletter the last ; no gaps ora 11 owed • For examp, 1e:
Using the sw tch tel s load alldata at the end of the Data ise,HS-LINK loads data at the ow end of the Data
At runtime, the pointer is set to thelowest possible address to a low the entire
be used Use of the LOCATE switch incombination with the t load low is, the
IGH sw tch is permits the user applicationto ical1y allocate any available memory below thearea specifically allocated w thin DGroup, toremain addressable the same OS pointer ThisI"'IVI'''I::arni cal ocat ion is needed forPasca 1 and FORTRANprograms.
LI
calyactual a.ount
aMOunt all JfIIIIIiII.iIIf/IIII>41111 .......
cau.e.b1ei n "".""p·u
as low as poss
ae.11 .... 1"'···...,1 •• ,
th or
allin 1, of
ude in thesoure.
II'ri........... I •• , I n.
••• thatI'II .......PIIII..... ion.n
includ. ine
/HAP
LI NKER PROGRAM NK)
d rects toIs defined in the i
given, INK will 1 i s tundefined global
1st allmodules.
only
1)is not
(including
the
are I a ically.INK 1 sts its value and its
in the Run f Ie. Is arethe List 11e.
Forfset
listed at
The switch causes INK to pause insession when the switch I
LINK the linking sessionend w thout ing. This switchswap the disks before INK
i e.
the link1 y,
n,n i ng tothe user to
(.
When NKthe message:
the switch, it disp ays
About to filedisks <hit
resumes when the user any
CAUTION
Do hot remove the disk which 11 receive theList file, or the disk used for the VM.TMPfile, if one has been created.
A 1inthe
one (iion statementng error
a stac'kay the
ING:
if youing thesearch
external
s short fortells INK to1i i es in the
ingtch tells
1 i
THE LI INK)
6.9 SAMPLE INK ION
is sample shows youdispl during an
the ofINK session.
is
In response to
LINK
Theanswers
11
Linker V2.00Microsoft Inc.
l.
and
1• speeilistingsy ols •
ingand a
you both an a1chronologica listing of
2. .... Ii!!PII,,..,,PII,I"Iingcan redirect your
to the List File:to the printer.
t you
3. speci ing the switch, MS-LINK givesyou a listing of a 1 line numbers for allmodules. that the switch can
a large volume of
<RETURN> n response~~.'~.~.~, an automatic 1i
to thesearch
LI
librar es, daysin the order of their appearance within
ist m ook th s:
The20-b
........",r .." ..... ion in the ----addression zero is Inn
columns there ative to locat on
of the load module.
not the absolute where
pub1 i cswitch was used, INK dname and va ue. For example:
ays the
THE LINKER PROGRAM (KS-LINK)
6.10 ERROR MESSAGES
All errors cause the link session to t. After the causehas been found and corrected. MS-LINK must be rerun. Thefollowing error messages are displayed by MS-LINK:
ATTEMPTOBJECT MODUL.E
DATA OUTSIDE SEGMENT BOUNDS. POSSIBLY BAD
BAD NUMERIC
is probably a Object file.
Numeric value is not in digits.
CANNOT OPEN FILE
MS-LINK is unable to create the f 1e VM.TMP because thedisk d i is fu 11 • I nser t a new disk. Do no,tremove the disk that will receive the List.MAP file.
ERROR: DUP
DUP record in assembly language module is too complex.Simpli DUP record in assembly language program.
FIXUP FS FIELD WIDTH
An assembly anguage instruction refers to an addresswith a short instruct on instead a long instruction.Edit assembly language source and reas5emb e.
INPUT FILE READ ERROR
There is P\,P"""I"\!lII""ly a bad eetf i 1e.
INVALID
or ete
I two or moresymbol name.
les that define a single
LINKER
Theof
size may notmay not exceed
the numbe'r
S ZE
than or equal to th
SEGM,ENT SI
6ltK is
CAPACITY
addressi I im t.
"'ANY
names were
IN :ONE
The it is external s per modu e.
LINKER PROGRAM (MS-LINK)
TOO MANY GROUPS
limit is 10
TOO MANY LIBRARI I,F lED
limit is 8 libraries.
TOO MANY PUBLIC
The lim t s 1 1i c 1s.
MANY
The 1i mit is and classes taken
UNRESOLVED <1 i st>
external Is listed have no ining moduleamong the modules or library files specified.
VM READ ERROR
This is a disk error; it is not caused by INK
WARNING: NO STACK SEGMENT
None of the ectstatement allocating
switch.
modules specified contains astack space, but you typed the
LI
WARNING:
There ismade to 1inkan lute
ect e or an hasles that INK cannot handle
eet modul
been
WRI
No
IN TMP FILE
disk remains to the VM file.
WRITE ON RUNFI
Usually, there s notfi Ie.
disk space for the Run
Thisneedis amanyMS-DOS
APPENDI X ,A
speci thatat time. An e of th s
dey ce driver, such as an on ine pr nter. Inthere are instal ation-speeif c settings for
need to be confi at Anth s s a standard dey ce driver, such as an
The on ileconfigure with af i 1e, deyi ce dr
confi ion file iscertain forprocess is as follows:
allows
atfile that has
The boot
1. The disk boot sector is read. This conta nsto, read code and theB I
2. code and BI are read.
3. A vari of 81 init al zetions are done.
A-l
HOW TO CONFIGURE YOUR SYSTEM
4. initialization routine reads theion file IG. t i f i tex is ts, to
....&I"" .....Il......... device installation and other user ions.Its final task is to execute the commandi which finishes the MS-DOS bootprocess.
A-2
A. CHANG IG. FI
ionthe confi
disk. youto create a file;
d. i ... _....~.... ""
list
•
If therecanuse
it on the
Thisthe
of sectorlist. If not set,
that wi se10 s a reasonab e
of f i 1escan access.
ca IsIf not set 10 is a
CE- i Iename>
nstalls the device driver n1 i st. be Iow •)
ename> nto the
- or
If ON s specified default is OFas i will be made every time
ON improves the to abortversi ons of the ..,L.'-- •••• ~,
SHELL -<f lename>
ins execution of shellfrom <filename>.
level command
HOW
COUNTRY • <number>
IGURE YOUR
Th i s number i s set to a 11 ow for i nternat ionia 1 date,time, currency, and case conversion. Acceptable valuesare:
United 1t va 11 ue)
France •
in •
Por
Italy •
United Kingdom •
• 49
• 81
Israel •
A ical confi ion f Ie might look like this:
BuffersFilesDevice·Break
1
•••••
1010
IN\NETWORK.ONA: N\COMMAND.COM A:\BIN /P
Note here that the Buffers and Files are set to10. The initialization routine will search for thefilename \8 to find the device that is beingadded to the system. This fi e is usually supplied on diskwith your device. Make sure that you save the device filein the that you specify in the Device
e also sets the tolocated on disk IN
s where ook forit needs to re-read from d sk te ls
that it is the first running on theit can process the IT command.
GOTO,how
Commands .)EX I,F NO, 13
fil e,
INK command15
INK command15
+
ng
-2
command6
ihierarchmaking,remove,
SHBatchBatchB naryBuffer
devd
ingCHO R,Classes,Command piCommand
for KS-L 7Commands
CHD R, ,1-1,COPY,CTTYDEL, 1DIR, 1ECHO,EXE2B N,
ndex-