Top Banner
The Assembly Language Level Chapter 7
35

The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

The Assembly Language Level

Chapter 7

Page 2: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

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

Page 3: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

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

Page 4: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Why Use Assembly Language?

Comparison of assembly language and high-level language programming, with and without tuning.

Page 5: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

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

Page 6: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Format of an Assembly Language Statement (1)

Computation of N = I + J. (a) Pentium 4.

Page 7: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Format of an Assembly Language Statement (2)

Computation of N = I + J. (b) Motorola 680x0.

Page 8: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Format of an Assembly Language Statement (3)

Computation of N = I + J. (c) SPARC.

Page 9: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Pseudoinstructions (1)

Some of the pseudoinstructions available in the Pentium 4 assembler (MASM).

Page 10: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Pseudoinstructions (2)

Some of the pseudoinstructions available in the Pentium 4 assembler (MASM).

Page 11: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Macro Definition, Call, Expansion (1)

Assembly language code for interchanging P and Q twice. (a) Without a macro. (b) With a macro.

Page 12: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Macro Definition, Call, Expansion (2)

Comparison of macro calls with procedure calls.

Page 13: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Macros with Parameters

Nearly identical sequences of statements.(a) Without a macro. (b) With a macro.

Page 14: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

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.

Page 15: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Two Pass Assemblers (2)

A symbol table for the program of Fig. 7-7.

Page 16: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Two Pass Assemblers (3)

A few excerpts from the opcode table for a Pentium 4 assembler.

Page 17: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Pass One (1)

Pass one of a simple assembler.

. . .

Page 18: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Pass One (2)

Pass one of a simple assembler.. . .

. . .

Page 19: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Pass One (3)

Pass one of a simple assembler.

. . .

Page 20: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Pass Two (1)

Pass two of a simple assembler.

. . .

Page 21: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Pass Two (2)

Pass two of a simple assembler.

. . .

Page 22: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

The Symbol Table (1)

Hash coding. (a) Symbols, values, and the hash codes derived from the symbols.

Page 23: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

The Symbol Table (2)

Hash coding. (b) Eight-entry hash table with linked lists of symbols and values.

Page 24: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Linking and Loading

Generation of an executable binary program from a collection ofindependently translated source procedures requires using a linker.

Page 25: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Tasks Performed by the Linker (1)

Each module has its own address space, starting at 0.

Page 26: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Tasks Performed by the Linker (2)

Each module has its own address space, starting at 0.

Page 27: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Tasks Performed by the Linker (3)

Each module has its own address space, starting at 0.

Page 28: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Tasks Performed by the Linker (4)

Each module has its own address space, starting at 0.

Page 29: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

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.

Page 30: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

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

Page 31: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Structure of an Object Module

The internal structure of an object module produced by a translator.

Page 32: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

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.

Page 33: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Dynamic Linking in MULTICS (1)

Before EARTH is called.

Page 34: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Dynamic Linking in MULTICS (2)

After EARTH has been called and linked.

Page 35: The Assembly Language Level Chapter 7. Assembly Language a)True assembly is a one to one mapping with machine language instructions b)Assembly language.

Dynamic Linking in Windows

Use of a DLL file by two processes.