Professional Documents
Culture Documents
Chapter 3
Chapter 3
ASSEMBLERS
Basic Assembler Functions
To accept as input an assembler language
program and to produce its machine language
equivalent along with information for the
loader.
Assembler
Language To Linker
Program Assembler Machine Language
Listing
EXAMPLE (Refer to Prog.)
The program has a main routine that calls
subroutines RDREC and WRREC.
Text Record
Col. 1 T
Col 2-7 Starting address for object code in this record
Col 8-9 Length of object code in this record in bytes.
Col 10-69 Object code in hexadecimal.
End Record
Col. 1 E
Col 2-7 Address of first executable instruction in
object program.
OBJECT PROGRAMS
H^ COPY ^001000^00107A
T^001000^1E^141033^482039^001036^281030^
301015^482061^3C1003^00102A^0C1039^00102D
T^00101E^15^0C1036^482061^081033^4C0000^
454F46^000003^000000
T^002039^1E^041030^001030^E0205D^30203F^
D8205D^281030^302057^549039^2C205E^38203F
T^002057^IC^101036^4C0000^F1^001000^041030^
E02079^302064^509039^DC2079^2C1036
T^002073^07^382064^4C0000^05
E^001000
OBJECT PROGRAMS
H^ COPY ^001000^00107A
T^001000^1E^141033^482039^001036^281030^301015^482061^3C1003^00102A^0C1039^00102D
T^00101E^15^0C1036^482061^081033^4C0000^454F46^000003^000000
T^002039^1E^041030^001030^E0205D^30203F^D8205D^281030^302057^549039^2C205E^38203F
T^002057^IC^101036^4C0000^F1^001000^041030^E02079^302064^509039^DC2079^2C1036
T^002073^07^382064^4C0000^05
E^001000
Machine Dependent Features
Machine Dependent Features
Machine Dependent Features
Machine Dependent Features
They are features that get affected
when different machines are used.
The new program runs on the SIC/XE
machine.
Indirect addressing is indicated by
adding an appendix @ to the
operand.
Immediate operands are denoted
with the prefix #.
Machine Dependent Features
Instruction Formats and addressing Modes
Register-register instructions are preferred wherever
possible.
COMP ZERO is replaced by COMPR A, S;
TIX MAXLEN is replaced by TIXR T
The instruction
0000 FIRST STL RETADR 17202D
Is a typical Program Counter relative assembly.
The statement
BASE LENGTH
informs the assembler that the base
register will contain the address of
LENGTH which is loaded by the
instruction
LDB #LENGTH.
Machine Dependent Features
The instruction
104E STCH BUFFER, X 57C003
is an example of base relative assembly.
Register B contains 0033. The address
of buffer is 0036. The displacement is
therefore 0036-0033 = 3. Bits x and b
are set to 1 to indicate indexed and base
relative addressing.
Machine Dependent Features
Instruction Formats and addressing Modes
If the displacements are too large Format 4
is used and no displacement is calculated.
In the instruction
1076
5000
8496
Program Relocation
The relocation problem is solved in the following way:
When the assembler generates the object code for the JSUB
instruction it will insert the address of RDREC relative to the
start of the program.
The statement
BUFEND EQU *
gives BUFEND the value of the address of the
next byte after the buffer area.
Machine Independent Assembler Features.
An expression that contains only absolute terms is an
absolute expression. It may also contain relative terms
so long as the relative terms occur in pairs and the terms
in each pair have opposite signs.
T^002050^02^205B
T^00205B^07^10100C^4C0000^05
T^00201F^02^2062
T^002031^02^2062
T^002062^18^041006^E02061^302065^50900F^DC2061^2C100C^382065^4C0000
E^00200F
When the definition of ENDFIL at address
2024 is encountered the assembler
generates a third text record. This record
specifies that the value 2024 is to be loaded
at location 201C.