the assembly language level chapter 7. assembly language a)true assembly is a one to one mapping...
Post on 21-Dec-2015
303 views
TRANSCRIPT
Assembly Language
a) True assembly is a one to one mapping with machine language instructions
b) Assembly language translated into object program or executable binary program
c) When running program, 3 levels are present, – microarchitecture– ISA– OSM
Reasons for Assembly
a) Pro –Faster
b) Pro - Smaller
c) Pro- Full access to hardware– interrupts– device controllers
d) Con- takes longer to write
e) Con – takes longer to debug
f) Con – Harder to maintain
g) Con – Limited to single family architecture
Why Use Assembly Language?
Comparison of assembly language and high-level language programming, with and without tuning.
Assembly
a) Optimize code
b) Writing for machine with limited resources
c) Tuning – recoding in assembly to speed critical code sections
d) Understand how compilers work and what they produce
e) Only way to get feel of ISA level
Macro Definition, Call, Expansion (1)
Assembly language code for interchanging P and Q twice. (a) Without a macro. (b) With a macro.
Macros with Parameters
Nearly identical sequences of statements.(a) Without a macro. (b) With a macro.
Two Pass Assemblers (1)
The instruction location counter (ILC) keeps track of the addresswhere the instructions will be loaded in memory. In this example, the
statements prior to MARIA occupy 100 bytes.
The Symbol Table (2)
Hash coding. (b) Eight-entry hash table with linked lists of symbols and values.
Linking and Loading
Generation of an executable binary program from a collection ofindependently translated source procedures requires using a linker.
Tasks Performed by the Linker (5)
The object modules of Fig. 7-14 after being positioned in the binary image but before being relocated and linked.
Tasks Performed by the Linker (6)
The same object modules after linking and after relocation has been performed. Together they form an executable binary program, ready to run
Binding Time and Dynamic Relocation
The relocated binary program of Fig. 7-15(b) moved up 300 addresses. Many instructions now refer to an incorrect memory address.