home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug103.arc
/
NOTES
< prev
next >
Wrap
Text File
|
1979-12-31
|
17KB
|
397 lines
(7-10-85) Small-Mac User Notes page 1
COPYRIGHT NOTICE
Small-Mac Assembler: Copyright 1985 J. E. Hendrix
This is copyrighted material. All rights are reserved. Use it
only in accordance with the terms set forth in the registration form
(file REGISTER).
THE OBJECT DISKETTE
The object diskette contains executable versions of the Small-Mac
programs, and a library for use when linking Small-C programs. Also
included is the source code for three of the modules in that library
which have been revised for use with the Small-Mac software instead
of the Microsoft package which was originally used with Small-C.
These programs run under CP/M 2.2 (and later versions) and require
56K bytes of RAM. The following files are on the diskette:
NOTES these notes
MAC synopsys of Small-Mac package
REGISTER Small-Mac user registration form
HISTORY history of Small-Mac quirks, and revisions
MAC.COM executable macro assembler (configured for the 8080 CPU)
LNK.COM executable linkage editor
LGO.COM executable load-and-go loader
LIB.COM executable library manager
CMIT.COM executable configuration utility
DREL.COM executable relocatable-file dump utility
C.LIB Small-C standard library rivised for Small-Mac
C.NDX index to C.LIB
C.LST list of C.LIB modules
8080.MIT 8080 machine-instruction-table source file
Z80.MIT Z80 machine-instruction-table source file
------> revised Small-C library sources
CALL.MAC END.MAC LINK.MAC
Ordinarily, you will need ready access only to MAC.COM, LNK.COM, and
(if you are assembling Small-C programs) C.LIB and C.NDX. Small-Mac
libraries consist of a pair of files, the library proper (.LIB) and
its index (.NDX). Take care to always keep these files together.
The library named C must be searched whenever linking Small-C
programs. It replaces the corresponding library, CLIB.REL, on the
Small-C distribution diskette which is used with the Microsoft
linker. CALL, END, and LINK are the only modules which differ
between these libraries.
THE SOURCE DISKETTE
è (7-10-85) Small-Mac User Notes page 2
This diskette contains the source code for the Small-Mac assembler
package as it is implemented to run under CP/M 2.2 (and later
versions). The following files are on the diskette:
NOTICE.H version message, and copyright notice
STDIO.H standard i/o header
M.LIB Small-Mac library (used when linking Small-Mac programs)
M.NDX index to M.LIB
M.LST list of M.LIB modules
MAC.H header for MAC, MAC2, MAC3, and CMIT
EXT.H header for MAC2 and MAC3 external references
MIT.H header for machine instruction table functions
REL.H header for .REL file functions
MAC.C assembler source part 1
MAC2.C assembler source part 2
MAC3.C assembler source part 3
LNK.C linkage editor source
LGO.C load-and-go loader source
LIB.C library manager source
CMIT.C configuration utility source
DREL.C dump utility source
------> Small-Mac library sources
EXTEND.C FILE.C GETREL.C PUTREL.C
SEEREL.C MESS.C SCAN.C WAIT.C
INT.C MIT.C REL.C REQ.C
USING THE ASSEMBLER
The assembler translates 8080 (or optionally Z80) assembly language
into the Microsoft relocatable format. The input has a free field
format with fields appearing in the following order on each line:
label/symbol operation operand comment
Each field is optional. Fields are separated by white space, except
that comments are prefixed by a semicolon (;).
Small-Mac supports the following assembler instructions
(pseudo-ops):
[label] DW expr[,expr[,...]] define words
[label] DB expr[,expr[,...]] define bytes
[label] DS expr define storage
[label] EXT symbol[,symbol[,;;;]] declare external references
symbol SET expr set symbol to expr
symbol EQU expr equate symbol to expr
[label] ORG expr set location counter to expr
[label] END [expr] end of source file
(expr gives starting address)
symbol MACRO begin a macro definition
ENDM end a macro definition
[label] macroname [par][,][par]... call (expand) the named macro
è
(7-10-85) Small-Mac User Notes page 3
Labels must be terminated with one or two colons (:). Two colons
declares the label as an entry point. Non-label symbols must NOT be
terminated with a colon. Symbols appearing in an expression (expr)
may be terminated with two pound signs (#); this declares the symbol
as an external reference.
Symbols (including labels) may contain letters, digits, and any of
the special characters "_", ".", "$", "?", "@". Symbols must NOT
begin with a digit. Upper and lower case letters are considered
equivalent in symbols and operation codes (mnemonics).
Expressions consist of numbers, symbols, operators, and parentheses.
Numbers are assumed to be decimal unless followed immediately by one
of the following letters:
O or Q specifies octal
H specifies hexadecimal
Symbols in an expression must either be defined elsewhere or be
terminated with a pair of pound signs. Expression operators are
exactly those of the C language and follow the same precedence
rules. Parentheses may be used to control grouping. The dollar
sign "$" may be used in an expression to stand for the value of the
location counter at the beginning of the current instruction.
Expressions used in EQU and SET directives should not contain
forward references. That is any symbols appearing in such
expressions should have been defined previously in the program.
Macro definitions do not take dummy parameters. Simply place ?1 in
the body of the macro where the first actual parameter is to go, ?2
for the second and ?0 for the 10th and final one. A maximum of 10
parameters are allowed. Actual parameters in a macro call are
identified by position and are separated by commas. Successive
commas or absent trailing parameters produce a null substitution;
i.e., the substitution sentinels (e.g. ?3) corresponding to null
parameters are squeezed out of the expanded text. If a ? is desired
in the expanded text, code ?? in the macro body. Quotes or
apostrophes may delimit an actual parameter containing spaces. An
occurrence of the delimiter within the string is achieved by giving
two successive delimiters. Ten labels which are local to each macro
expansion may be specified as @0 through @9. The first such label,
and its references, will appear in the expanded text as @1, the
second as @2, etc. The sequence continues to increase throughout
the program so that every such label, and its references, is
guaranteed to be unique. This avoids "redundant definition" errors.
INVOKING THE SMALL-MAC PROGRAMS
è All of the Small-Mac programs produce listings and error diagnostics
on the standard output file. So these may be redirected to the
printer by giving >LST: in the command line, or they may be
redirected to a file by giving >filename in the command line. A
usage message may be invoked by executing and of the Small-Mac
(7-10-85) Small-Mac User Notes page 4
Programs with just a hyphen (-) in the command line following the
program name.
------ MAC: The Small-Mac Assembler ------
usage: MAC [-L] [-NM] [-P] [object] source...
-L Generate an assembly listing on the standard output file.
-NM No macro processing. This speeds up the assembler
somewhat. Macro processing is NOT needed for Small-C 2.1
output files.
-P Pause on errors waiting for an operator response of CR.
object Name of the object file to be output. It must have a REL
extension to be recognized as the output file. A drive
specifier is allowed. If not specified, the object code
will go into a file (on the default drive) bearing the
same name as the first source file, but with a REL
extension.
source... Names of the source files to be assembled. The default,
and only allowed, extension is MAC. A drive specifier is
allowed. The named files will be assembled as one file
concatenated in the order given.
The module name in the REL file will be taken from the first 6
characters of the object filename.
------ LNK: Small-Mac Linkage Editor ------
usage: LNK [-B] [-G#] [-M] program [module/library...]
-B A BIG program is being linked, so use all
of free memory for the symbol table and load the
program to disk entirely. This is slower but it
gets the job done.
-G# Make program absolute at address # (hex) and
output as "program.LGO" instead of "program.COM".
-M Monitor linking activity.
program A file specifier for the program being linked.è The efault, and only allowed, extension is REL.
module/library... A list of zero or more module (.REL) and/or
library (.LIB) files. Each module is linked to
the program and the libraries are searched for
just those modules which satisfy one or more
unresolved external references.
(7-10-85) Small-Mac User Notes page 5
Merely declaring a symbol to be external will cause it's module to
be loaded. It need not actually be referenced.
The module END in C.LIB must be loaded last of all. That module
contains special code which identifies the physical end of the
program and the beginning of free memory. The linker is sensitive
to its name and waits until all other modules are loaded before
loading END.
The absence of an extension, or a .REL extension, identifies a
module; whereas, a LIB extension identifies a library. If
necessary, a library is rescanned to resolve backward external
references between modules within the library. Module files and
libraries are processed in the order in which they occur in the
command line.
Drive Designators (e.g. B:):
- allowed with module and library names
- program drive designator locates the input .REL file
- output goes to the default drive
Filename Extensions:
- must specify .LIB with library name
- standard extensions are:
.REL = relocatable object module
.LIB = library of object modules
.NDX = index to library (not user specified)
.COM = CP/M command file (default output)
.LGO = load-and-go file (-G# output)
.O$ = temporary overflow file
.R$ = temporary reference file
Enter control-S to pause and control-C to abort.
NOTE: Compile only with Small-C 2.1 (edit level 63) or later. Edit
63 fixes CSYSLIB so that when it overflows a buffer while writing
into a file it will no longer assume that it is at the end of the
file. This prevents it from padding a sector with 1A (hex) in the
middle of a file when random access is being used.
------ LGO: Small-Mac Load-and-Go Loader ------
è usage: LGO [-G] [-M] program
-G Execute program after loading.
-M Monitor load address and size.
"Program" is a file specifier for the program being loaded.
Default, and only allowed, extension is LGO.
(7-10-85) Small-Mac User Notes page 6
Enter control-S to pause and control-C to abort.
----- LIB.C -- Small-Mac Relocatable-Library Manager -----
usage: LIB -{DPTUX}[A] library [module...]
-D delete named modules
-P[A] print named, or all (-PA), modules on stdout
-T[A] table of contents of named, or all (-TA), files on stdout
-U update (adding/replace) named modules
(gets module names from stdin if not in command line)
-X[A] extract named, or all (-XA), modules
The A suffix obviates prompting stdin for module names when none are
in the command line. This is handy for eliminating operator
intervention especially in batch mode. Ordinarily when no modules
are given in the command line, LIB prompts the user (if stdin is not
redirected) and accepts one module name at a time from stdin. If
none are given (CR response to first prompt) and the command switch
is -P, -T, or -X then all members of the library are processed.
Drive Designators (e.g. B:):
- allowed with any library and module names
- new library and index go on same drive as old
- will default to the default drive
Filename Extensions:
- do NOT specify with library or module names
- standard extensions are:
.REL = relocatable object module
.LIB = library of object modules
.NDX = index to library
.L$ = temporary new library
.N$ = temporary new index
Enter control-S to pause and control-C to abort.
------ CMIT: Compile Machine Instruction Table ------è
usage: CMIT [-C] [-L] [table] [mac]
-C Configure the executable assembler (MAC.COM) with the
indicated, or default, machine instructin table.
-L List the compiled machine instruction table.
table The name of the machine instruction table file in source
format (default 8080.MIT). The default and only allowed
filename extension is MIT. A drive specifier is allowed.
(7-10-85) Small-Mac User Notes page 7
mac Assembler COM file (default MAC.COM). Must have COM extension
to be recognized as such. Need specify only if not on the
default drive or has a different name.
If no switches are given, -L is assumed. If any switches are given,
only those actions so specified are taken.
After compiling and linking a new MAC.COM, it must be configured by
running this program before it may be executed. A previously
configured MAC.COM may be reconfigured at any time.
------ DREL: Dump REL or LIB file ------
No command line switches are accepted. The user is prompted for
each file to be dumped. Output goes to the standard output file and
is, therefore, redirectable to any output device or to a disk file.
If an input file cannot be found the user is prompted for another
input file. File names must be given, complete with extensions.
Drive specifiers may be given.
è