THE ASSEMBLY PROCESS
E: MOV #D,ABLE
5.8 CALLING AND USING ASEMBL
The assembler assembles one or more macro-free ASCII source mes into a single relocatable binary object me.
Assembler output consists of this binary object file and an optional assembly listing followed by the symbol table listing. CREF (Cross Reference) listings may also be specified as part of the assembly output by means of switch options.
ASEMBL is executed using the HT-11 Monitor R command as follows:
.R ASEMBL
The assembler responds by typing an asterisk (*) to indicate readiness to accept command string input. In response to the * printed by the assembler, the user types the output me specification(s), followed by an equal sign or left angle bracket, followed by the input file specification(s) in a command line as follows:
*dev: obj ,dey :list/ s: arg=dev :source 1 , .. ,dey: sourcen/s :arg where:
dey:
obj list
source 1, .. ,sourcen /s:arg
is any legal HT-11 device for output; must be file-structured for input is the binary object me
is the assembly listing fIle containing the assembly listing and symbol table
are the ASCII source fIles containing the ASEMBL source program(s);
a maximum of six source mes is allowed
represents a switch and argument as explained in Section 5.8.1 A null specification in either of the output me fields signifies that the associated output me is not desired.
One or more switches can be indicated with the appropriate me specification to provide ASEMBL with information about that me.
The default case for each me specification is noted below:
fde device fdename extension
object DK: .OBJ
listing device used for object .LST
output
source I DK: .PAL
sOllrce2 device used for last source .PAL
file specified
sourcen
Type CRTL C to halt ASEMBL at any time and return control to the monitor. To restart the assembler type R ASEMBL or the REENTER command in response to the monitor's dot.
5.8.1 Switches
NOTE
If
tc
was typed while a CREF listing was being produced, the REENTER command may not be accepted. In this case, type R ASEMBL to restart the assembler.There are three types of switch options: listing control switches, function switches, and CREF specification switches. The listing control switches (fL,IN) provide capabilities similar to those described in detail in Section 5.5.1.1. The function control switches (fD,/E) provide function control as described in Section 5.5.2; arguments for these switches are summarized in Section 5.8.1.2. CREF control switches allow the user to obtain a detailed cross-referenced listing of his assembled me, and are described in detail in Section 5.8.13. Multiple arguments may be specified for a particular switch, if deSired, by separating each switch value from the next by a colon. For example:
/N:TTM:CND
These switches turn off teleprinter mode and suppress printing of unsatisfied conditionals (as described in the next section). Also, the switches are not restricted to appearing near a particular me in the command string; /N :TTM, for example, is legal in all of the following places:
* ,LP:/N :TTM =source
*,LP:=source/N :TTM
*/N :TTM,LP:=source
and they are all equivalent in function.
5.8.1.1 Listing Control Switches - A listing control switch (/L for list or
IN
for nolist) is indicated in a command line as follows:*dev:obj.ext,dev:list.ext/s:arg=dev:source.ext
where s :arg represents /L or
IN;
the remainder of the command line abbreviations are as described in Section 5.8.The /N with no argument causes only the symbol table, table of contents and error listings to be produced. The /L switch with no arguments causes .LIST and .NLIST directives that appear in the source program but have no arguments to be ignored. A summary of the arguments which are valid for the listing control switches follows (refer to Section 5.5.1.1 for details):
Argument Default Controls Listing of
SEQ list Source line sequence numbers
LOC list Location counter
BIN list Generated binary code
BEX list Binary extensions
SRC list Source code
COM list Comments
CND list Unsatisfied conditionals, .IF
and .ENDC statements
Argument LD TOC TTM SYM
Default nollst list
terminal mode list
Controls Listing of Listing directives with no
arguments Table of Contents Listing output format Symbol table
For example, a command line in the following format suppresses the Table of Contents listing and uses the 132-column listing format:
*,LP:/N:TOC:TTM=FILE
5.8.1.2 Function Switches - The function control switches (/D for disable and /E for enable) are used to enable or disable certain functions in source input fIles and are indicated in the command line as follows:
*dev :obj .ext ,dev:list.ext=dev:source/s: arg
/s:arg here represents either /D:arg or /E:arg. A summary of the arguments which are valid for use with the function control switches follows (refer to Section 5.5.2 for details):
Argument Default Enables or Disables
ABS disable Absolute binary output
AMA disable Assembly of all absolute
addresses as relative addresses
CDR disable Source columns 73 and greater
to be treated as comments
FPT disable Floating point truncation
LC disable Accepts lower-case ASCII
input
LSB disable Local symbol block
PNC enable Binary output
For example, the following commands assemble a fIle allowing all 80 columns of each line to be used as input (note that since ASEMBL is a two-pass assembler, the paper tape cannot be read directly from the reader; input from any non file-structured device must first be transferred to a fIle-structured device before assembly):
.R PIP
*PTAPE. PAL=PR:/A
*AC .R ASEMBL
*,LP:=PTAPE. PAL/E:CDR
Use of either the function control or listing control switches and arguments at assembly-time will override any corresponding listing or function control directives and arguments in the source program. For example, assume the following appears in the source program:
.NLIST BEX
code with binary extensions
everywhere in the program.
5.8.1.3 Cross Reference Table Generation (CREF) - A cross reference table of all or a subset of all symbols used in the source program and the statements where they were dermed or used can be obtained automatically following an assembly by specifying /C:arg with the assembly listing file specification (and any listing or function control specifications) as follows:
*dev:obj.ext,dev:list.ext/s:arg/C:arg=dev:source.ext /s:arg represents any of the other valid switches.
There are five sections to a complete cross reference listing:
1. Cross reference of program symbols (i.e., labels used in the program and symbols used on the left of the "=" operator).
2. Cross reference of register-equate symbols (those symbols which are dermed in the program by a
"SYMBOL=%N", D<=N<7, construct). Normally this consists of the symbols RD, Rl, R2, R3, R4, R5, SP, and PC.
3. Cross re ference of permanen t symbols (all operation mnemonics and assembler directives).
4. Cross reference of control sections (those names specified as the operand of a .CSECT directive, plus the blank .CSECT and the absolute section ". ABS." which are always dermed by ASEMBL).
5. Cross reference of errors (all errors flagged on the listing are grouped by error type).
Any or all of the above sections may be included in the cross reference listing as desired. The associated switch options and their arguments are listed below:
Switch Argument
/C:s
/C:R /C:P
/C:C
/C:E /C<no arg>
Section Type User-dermed symbols Register symbols Permanent symbols
(instructions, directives) Control sections (.CSECT
symbolic names) Error codes
Equivalent to /C:S:E
The specification of a /C switch in a command string causes a temporary file, "DK:CREF.TMP", to be generated.
If device DK: is write-locked or contains insufficient free space for the temporary file, the user may allocate the temporary me on another device. To do so, a third output file specification is given in the ASEMBL command string; this me is then used instead of DK:CREF .TMP, and is purged after use. For example, a command string of this type:
*,LP:,DXl :TEMP.TMP=SOURCE/C
causes "DXl :TEMP.TMP" to be used as the temporary file.
Figure 5-6 illustrates assembled source code and Figure 5-7 contains the CREF output. The command line used to produce these listings was:
*,EXAMPL/C:S:R:P:C:E/N:BEX=EXAMPL
An explanation of the CREF output follows the figures.
EXAMPLE OF CROSS REFERENCE LIST HT-11 ASEMBL H01-1 19-5EP-78 PAGE 1 1 j HT -11 MACRO EXPAND H01-1
2 · TITLE EXAMPLE OF CROSS REFERENCE LISTING
3 jDEFINE THE REGISTER SYMBOLS
4 00!iH!H30 R0 = %0
5 000001 R1= % 1
6 000002 R2= %2
'( 000003 R3= %3
8 000004 R4= %4
9 000005 R5= %5
10 000006 SP= %6
1 1 000007 pc= %7
12
13 000012 LF= 012
14
15 j · MCALL . TTYIN, . EXIT
16 j .MACRO · EXIT
17 j EMT ~O 350
18 j. ENDM
19 j .MACRO · TTYIN .CHAR
20 EMT ~O340
21 j BCS .-2
22 j. ENDM
23 24 .MACRO . CALL . NAME
25 JSR PC,.NAME
26 .ENDM
27
28 .GLOBL SUBR 1, SUBR2 jTWO EXTERNAL SUBROUTINES
29 000000' · CSECT PROG jDEFINE A CSECT
30 00000 012702 START: MOV IIBUFFER, R2 jR2 = ADRS(BUFFER
31 00004 1 $: j .TTYIN jREAD A CHAR INTO R0
32 00004 104340 EMT ~0340
:n
00006 103776 BCS .-234 00010 1 10022 MOVB R0,(R2)+ jAND STORE IN BUFFER 35 00012 120027 CMPB R0,IILF jWAS IT A LINE FEED?
36 00016 001372 BNE 1$ jNOPE - KEEP READING
37 00020 105022 CLRB (R2 )+ jELSE FLAG END OF LINE 38 00022 012703 MOV IIBUFFER, R 3 jR3 = ADRS FOR SUBR1
39 .CALL SUBR 1 jINVOKE "CALL" MACRO
40 00026 004767 JSR PC,SUBR1
41 00032 103762 BCS START jGET A NEW LINE IF CARRY SET
42 .CALL SUBR2 jELSE CALL OTHER SUBR
43 00034 004767 JSR PC,SUBR2
44 00040 ~1006'{ MOV R0,ANSWER jSTORE RESULT IN ANSWER
45 .EXIT jRETURN TO HT-11
46 00044 104350 EMT ~O 350
47
46 00046 ANSWER: .BLKW jDEFINE ANSWER STORAGE
49 00050 BUFFER: .BLKB 72. jINPUT LINE BUFFER
50
51 000000' .END START
EXAMPLE OF CROSS REFERENCE LIST HT-11 ASEMBL H01-1
Figure 5-6 (Cant.) ASEMBL Source Code EXAMPLE OF CROSS REFERENCE LIST HT-11 ASEMBL H01-1
Figure 5-7 CREF Listing Output
19-5EP-78 PAGE 1+
EXAMPLE OF CROSS REFERENCE LIST HT-11 ASEMBL H01-1 CROSS REFERENCE TABLE (CREF H01-1 )
19-5EP-78 PAGE C-1
0-0 . ABS. 0-0
PROG 1-29
Figure 5-7 (Cont.) CREF Listing Output
Cross reference tables, if requested, are generated at the end of an ASEMBL assembly listing. Each table begins on a new page (the tables in Figure 5-7 have been consolidated due to space considerations). Symbols, control sections, and error codes are listed at the left margin of the page; corresponding references are indicated next to them across the page from left to right. A reference is of the form pol, where p is the page on which the symbol, control section, or error code appears, and I is the line number within the page. A number sign (#) appears next to a reference wherever a symbol has been defmed. An asterisk appears next to a reference wherever a destructive reference has been made to the symbol (Le., the contents of the location defmed by that symbol has been altered at that point).
The CREF output requested in the preceding figures included user-defined symbols, control sections, error codes, register symbols, and permanent symbols. Since no errors were generated in this assembly, no CREF output for error codes was produced.
5.9 ERROR MESSAGES