Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 The Assembly Language Level.

Similar presentations


Presentation on theme: "Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 The Assembly Language Level."— Presentation transcript:

1 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 The Assembly Language Level Chapter 7

2 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Why Use Assembly Language? Comparison of assembly language and high-level language programming, with and without tuning.

3 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Format of an Assembly Language Statement (1) Computation of N = I + J. (a) Pentium 4.

4 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Format of an Assembly Language Statement (2) Computation of N = I + J. (b) Motorola 680x0.

5 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Format of an Assembly Language Statement (3) Computation of N = I + J. (c) SPARC.

6 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Pseudoinstructions (1) Some of the pseudoinstructions available in the Pentium 4 assembler (MASM).

7 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Pseudoinstructions (2) Some of the pseudoinstructions available in the Pentium 4 assembler (MASM).

8 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Macro Definition, Call, Expansion (1) Assembly language code for interchanging P and Q twice. (a) Without a macro. (b) With a macro.

9 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Macro Definition, Call, Expansion (2) Comparison of macro calls with procedure calls.

10 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Macros with Parameters Nearly identical sequences of statements. (a) Without a macro. (b) With a macro.

11 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Two Pass Assemblers (1) The instruction location counter (ILC) keeps track of the address where the instructions will be loaded in memory. In this example, the statements prior to MARIA occupy 100 bytes.

12 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Two Pass Assemblers (2) A symbol table for the program of Fig. 7-7.

13 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Two Pass Assemblers (3) A few excerpts from the opcode table for a Pentium 4 assembler.

14 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Pass One (1) Pass one of a simple assembler....

15 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Pass One (2) Pass one of a simple assembler....

16 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Pass One (3) Pass one of a simple assembler....

17 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Pass Two (1) Pass two of a simple assembler....

18 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Pass Two (2) Pass two of a simple assembler....

19 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 The Symbol Table (1) Hash coding. (a) Symbols, values, and the hash codes derived from the symbols.

20 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 The Symbol Table (2) Hash coding. (b) Eight-entry hash table with linked lists of symbols and values.

21 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Linking and Loading Generation of an executable binary program from a collection of independently translated source procedures requires using a linker.

22 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Tasks Performed by the Linker (1) Each module has its own address space, starting at 0.

23 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Tasks Performed by the Linker (2) Each module has its own address space, starting at 0.

24 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Tasks Performed by the Linker (3) Each module has its own address space, starting at 0.

25 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Tasks Performed by the Linker (4) Each module has its own address space, starting at 0.

26 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 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.

27 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 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

28 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Structure of an Object Module The internal structure of an object module produced by a translator.

29 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 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.

30 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Dynamic Linking in MULTICS (1) Before EARTH is called.

31 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Dynamic Linking in MULTICS (2) After EARTH has been called and linked.

32 Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 Dynamic Linking in Windows Use of a DLL file by two processes.


Download ppt "Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved. 0-13-148521-0 The Assembly Language Level."

Similar presentations


Ads by Google