Processor Fundamentals Assembly Language. Learning Objectives Show understanding of the relationship between assembly language and machine code, including.

Slides:



Advertisements
Similar presentations
Assembly Language – 1.
Advertisements

GCSE Computing Lesson 5.
Chapter 10- Instruction set architectures
Wannabe Lecturer Alexandre Joly inst.eecs.berkeley.edu/~cs61c-te
The Assembly Language Level
SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
101.  When you communicate with people you use a language that you both understand.  The trick is that the computer does not speak English.  To communicate.
The Little man computer
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#4)
Lab6 – Debug Assembly Language Lab
Assembly Language Programming CS208. Assembly Language Assembly language allows us to use convenient abbreviations (called mnemonics) for machine language.
Assembly Language Programming. CPU The CPU contains a Control Unit, Arithmetic Logic Unit (ALU) and a small number of memory locations called Registers.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
Compiled by Benjamin Muganzi 3.2 Functions and Purposes of Translators Computing 9691 Paper 3 1.
Chapter 6: An Introduction to System Software and Virtual Machines Invitation to Computer Science, C++ Version, Fourth Edition ** Re-ordered, Updated 4/14/09.
Activity 1 - WBs 5 mins Go online and spend a moment trying to find out the difference between: HIGH LEVEL programming languages and LOW LEVEL programming.
Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 6: Assembler slide 1www.idc.ac.il/tecs Assembler Elements of Computing.
Machine Instruction Characteristics
Computer Architecture and the Fetch-Execute Cycle
Computer Architecture and the Fetch-Execute Cycle
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
Building a Modern Computer From First Principles
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
Ass. Prof. Dr Masri Ayob TK 6123 Lecture 13: Assembly Language Level (Level 4)
Execution of an instruction
Intermediate 2 Computing Unit 2 - Software Development Topic 2 - Software Development Languages and Environments.
Assembly Language Friday, Week 5 Monday, Week 6. Assembly Language  Set of mnemonic names for the instructions in a particular computer's machine language.
September 26, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 2: Implementation of a Simplified Computer Jeremy R. Johnson Wednesday,
FOUNDATION IN INFORMATION TECHNOLOGY (CS-T-101) TOPIC : INFORMATION SYSTEM – SOFTWARE.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Computer Systems Organization
 Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer Systems – Machine & Assembly code. Objectives Machine Code Assembly Language Op-code Operand Instruction Set.
Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 6: Assembler slide 1www.nand2tetris.org Building a Modern Computer.
 A macro represents a commonly used group of statements in the source programming language.  The macro processor replaces each macro instruction with.
Computer Organization Instructions Language of The Computer (MIPS) 2.
The Functions and Purposes of Translators Translators, Interpreters and Compilers - High Level Languages.
The Functions and Purposes of Translators Translators, Interpreters and Compilers - High Level Languages.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Programming Languages
Programming Languages Salihu Ibrahim Dasuki (PhD) CSC102 INTRODUCTION TO COMPUTER SCIENCE.
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
A LECTURE NOTE. Introduction to Programming languages.
A Level Computing – A2 Component 2 1f, 1g, 1h, 1i, 1j.
The Little man computer
CHAPTER 6: The Little Man Computer
CS 270: Mathematical Foundations of Computer Science
central heating system
Assembly language.
Control Unit Lecture 6.
F453 Computing Questions and Answers
CHAPTER 6: The Little Man Computer
Assembly Language Ms. V.Anitha AP/CSE SCT
Chapter 3 Machine Language and Assembly Language.
Chapter 3 Machine Language and Assembly Language.
Teaching Computing to GCSE
TRANSLATORS AND IDEs Key Revision Points.
Translators & Facilities of Languages
CHAPTER 6: The Little Man Computer
Lesson Objectives Aims Key Words Compiler, interpreter, assembler
Computer Architecture and the Fetch-Execute Cycle
Introduction to Micro Controllers & Embedded System Design
Processor Fundamentals
Chapter 6 Programming the basic computer
1.3.7 High- and low-level languages and their translators
Presentation transcript:

Processor Fundamentals Assembly Language

Learning Objectives Show understanding of the relationship between assembly language and machine code, including symbolic and absolute addressing, directives and macros. Describe the different stages of the assembly process for a ‘two-pass’ assembler for a given simple assembly language program Trace a given simple assembly language program

Low Level Programming Languages Instructions are either in machine code or they are one to one with machine code e.g. assembly language See next two slides. ). Are “close to the hardware” as they provide little or no abstraction from a computer's instruction set architecture (see Fetch-Decode-Execute-Reset Cycle).Fetch-Decode-Execute-Reset Cycle Meaning that each low level language instruction is one operation the processor executes which can only be one of 3 types: Arithmetic / Jump / Control. Low-level language programs written for 1 computer will not necessarily work on another using a different processor, chip or architecture.

Assembly Languages Use of mnemonics.

Absolute (Immediate) Addressing Refers directly to a memory location e.g Advantage: Advantage:Simple. Disadvantages: Disadvantages: Difficult to see the meaning of the data in location The data may not be able to be located at 2011 because another program is already using that location. Absolute addressing produces non-relocatable code. Absolute addressing produces non-relocatable code.

Symbolic Addressing e.g. Instead of referring to an absolute location assembly language to define a symbol for the data item or location. Labels / Variables:. Labels / Variables:. Mark various locations in the program with symbols. For example, one can declare the label loop to refer to the beginning of a certain code segment. Other commands in the program can then jump to loop, either conditionally or unconditionally. For example, one can declare the label loop to refer to the beginning of a certain code segment. Other commands in the program can then jump to loop, either conditionally or unconditionally. Assign symbolic variable names to memory addresses. Predefined Symbols: Predefined Symbols: See slide 4. slide 4slide 4 // Computes sum= LDM 0 01STO Index 02 LDM 0 03STO Sum Loop: 04 LDD Index 05CMP JPE End 07 INC ACC 08STO Index 09LDD Sum 10ADD Index 11STO Sum 12 JMP Loop End: 13 End … Index: 1025 Sum:

e.g. Provide information to the assembler but do not generate any code. Directives // Computes sum= LDM 0 01STO Index 02 LDM 0 03STO Sum Loop: 04 LDD Index 05CMP JPE End 07 INC ACC 08STO Index 09LDD Sum 10ADD Index 11STO Sum 12 JMP Loop End: 13 End … Index: 1025 Sum:

Macros Many programs contain sequence of instructions which are repeated in identical form. A macro facility permits us to attach a name to this sequence and to use this name in its place. e.g. e.g. Start of definitionMACRO Macro nameCNTR (for example) Sequence to be abbreviated- - - END of a Macro definitionMEND

// Computes sum= LDM 0 01STO Index 02 LDM 0 03STO Sum Loop: 04 LDD Index 05CMP JPE End 07 INC ACC 08STO Index 09LDD Sum 10ADD Index 11STO Sum 12 JMP Loop End: 13 End … Index: 1025 Sum: 00 LDM 0 01 STO LDM 0 03STO LDD CMP JPE INC ACC 08STO LDD ADD STO JMP 4 13 End … Two-Pass Assembler First pass: The assembler builds a symbol table and generates no code. The assembler builds a symbol table and generates no code. e.g. Index1024 Sum1025 Loop4 End13 Symbol Table Second pass: The assembler replaces each symbol with its corresponding meaning (numeric address) and generates the final binary code. The assembler replaces each symbol with its corresponding meaning (numeric address) and generates the final binary code. Machine Code:

Assembly Languages Use of mnemonics and names/labels (instead of addresses) for locations in memory. Each assembly instruction represents a single machine instruction which means that it is fairly easy to translate a program written in assembly language to machine code. Writing programs in assembly language, although easier than using machine code, is still tedious and takes a long time.

Plenary Explain the relationship between assembly languages and machine code.

Assembly Languages Use of mnemonics and names/labels (instead of addresses) for locations in memory. Each assembly instruction represents a single machine instruction which means that it is fairly easy to translate a program written in assembly language to machine code. Writing programs in assembly language, although easier than using machine code, is still tedious and takes a long time.

Plenary Describe how an assembler produces machine code from assembly language.

// Computes sum= LDM 0 01STO Index 02 LDM 0 03STO Sum Loop: 04 LDD Index 05CMP JPE End 07 INC ACC 08STO Index 09LDD Sum 10ADD Index 11STO Sum 12 JMP Loop End: 13 End … Index: 1025 Sum: 00 LDM 0 01 STO LDM 0 03STO LDD CMP JPE INC ACC 08STO LDD ADD STO JMP 4 13 End … Two-Pass Assembler First pass: The assembler builds a symbol table and generates no code. The assembler builds a symbol table and generates no code. e.g. Index1024 Sum1025 Loop4 End13 Symbol Table Second pass: The assembler replaces each symbol with its corresponding meaning (numeric address) and generates the final binary code. The assembler replaces each symbol with its corresponding meaning (numeric address) and generates the final binary code. Machine Code: