COE Computer Organization & Assembly Language

Slides:



Advertisements
Similar presentations
Goal: Write Programs in Assembly
Advertisements

The 8051 Microcontroller and Embedded Systems
CS 31003: Compilers Introduction to Phases of Compiler.
Chapter 2 Instructions: Language of the Computer
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
Assembly Process. Machine Code Generation Assembling a program entails translating the assembly language into binary machine code This requires more than.
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
1 Registers and MAL - Part I. Motivation So far there are some details that we have ignored instructions can have different formats most computers have.
Instructions Set Bo Cheng Instruction Set Design An Instruction Set provides a functional description of a processor. It is the visible.
COE Computer Organization & Assembly Language Introduction HLL vs. Assembly Programming Languages.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Computer Architecture CPSC 321 E. J. Kim. Overview Logical Instructions Shifts.
Table 1. Software Hierarchy Levels.. Essential Tools An assembler is a program that converts source-code programs into a machine language (object file).
Implementation of a Stored Program Computer
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
INTRODUCTION TO IBM PC ASSEMBLY LANGUAGE
Assembly & Machine Languages
The computer memory and the binary number system.
Lecture 3. Diff b/w RAM and Registers Registers are used to hold data immediately applicable to the operation at hand Registers are used to hold data.
The CPU The Central Presentation Unit Main Memory and Addresses Address bus and Address Space Data Bus Control Bus The Instructions set Mnemonics Opcodes.
Instruction Set Architecture
ASSEMBLY LANGUAGE. Assembler and Compiler Pascal A Program Compiler Version A Assembly Language Versiion A Machine Code Actual version that will be executed.
COMP2011 Assembly Language Programming and Introduction to WRAMP.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
CSE378 Instr. encoding.1 Instruction encoding The ISA defines –The format of an instruction (syntax) –The meaning of the instruction (semantics) Format.
Assembly Language A Brief Introduction. Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming  Assembler  Machine Language.
Execution of an instruction
Computer Organization and Architecture Instructions: Language of the Machine Hennessy Patterson 2/E chapter 3. Notes are available with photocopier 24.
Addressing Modes Chapter 6 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
1.4 Representation of data in computer systems Instructions.
ECEG-3202 Computer Architecture and Organization Chapter 6 Instruction Sets: Addressing Modes and Formats.
UConn CSE CSE241: Instruction Level Architecture Base CPU/Memory Architecture Registers Fetch-Execute Cycle Instructions Addressing Modes.
Computer Organization 1 Instruction Fetch and Execute.
Sahar Mosleh California State University San MarcosPage 1 Assembly language and Digital Circuit By Sahar Mosleh California State University San Marcos.
8086/8088 Instruction Set, Machine Codes and Addressing Modes.
Basic Concepts Computer Organization & Assembly Language Programming Instructor: Maram Alsahafi [Some of the contents Adapted from slides Dr Adnan Gutub,
First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.
Chapter 7: Low-Level Programming Languages Chapter 7 Low-Level Programming Languages Page 66 In order to execute instructions on a CPU, those instructions.
1 Contents: 3.1 Instruction format and Addressing Modes 3.2 Instruction Introduction Chapter 3 Instruction system.
Displacement (Indexed) Stack
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Morgan Kaufmann Publishers
ACOE301: Computer Architecture II Labs
William Stallings Computer Organization and Architecture 8th Edition
Instruction Format MIPS Instruction Set.
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Instruction Formats Each instruction consists of two parts:
The Processor and Machine Language
Lectures 2 & 3: Computer Organization
Computer Programming Machine and Assembly.
MIPS Instruction Encoding
ECEG-3202 Computer Architecture and Organization
MIPS Instruction Encoding
Computer Architecture and the Fetch-Execute Cycle
Instruction encoding The ISA defines Format = Encoding
Introduction to Micro Controllers & Embedded System Design
Classification of instructions
MARIE: An Introduction to a Simple Computer
Instruction encoding The ISA defines Format = Encoding
Instruction Format MIPS Instruction Set.
Instruction encoding The ISA defines Format = Encoding
ECE 352 Digital System Fundamentals
8051 ASSEMBLY LANGUAGE PROGRAMMING
Instruction encoding The ISA defines Format = Encoding
Computer Architecture and System Programming Laboratory
Algoritmos y Programacion
Presentation transcript:

COE 205 - 3 Computer Organization & Assembly Language Introduction Machine Language

Machine Language Computers only understand programs in their own machine language. A machine language program written for one type of computers, say a Sun-Ultra 20 machine wont work with another type of computers say an IBM-compatible PC. It is impractical to ask programmers to write their programs in machine language. Thus, programmers write their programs in HLL and/or assembly language Each command of the program is called an instruction (a command that instructs the computer what to do) Computers only deal with binary data, hence the instructions must be in binary format (0s and 1s) The set of all instructions (in binary form) makes up the computer's machine language Hence, the program has to be translated to the computer's machine language before it is stored in the memory Compilers translate HLL instructions to machine languages Assembler translate assembly instructions to machine languages Term 042 COE 205 Dr.Talal AlKharobi

Micro-Operations The computer breaks down machine instructions into smaller operations that are called micro-operations These micro-operations are performed by the computer automatically (i.e. the programmer does not specify them) Example of micro-operations for an instruction that add two operands are Fetching the operands, Add the operands Writing back the result to the memory Term 042 COE 205 Dr.Talal AlKharobi

Instruction Fields Machine language instructions usually are made up of several fields. Each field specifies different information for the computer. The major two fields are: Opcode field: stands for operation code and it specifies the particular operation that is to be performed. Each operation has its unique opcode and may take the computer several micro-operations to accomplish. Operands fields: specify where to get the source and destination operands for the operation specified by the opcode. The source/destination of operands can be the memory or one of the general-purpose registers. Term 042 COE 205 Dr.Talal AlKharobi

Assembly instructions and machine code. This table shows a number of assembly instructions and their corresponding machine code. The first column shows the address at which the instruction is stored, The second column shows the machine code for the instruction The third column shows the corresponding assembly instruction. Term 042 COE 205 Dr.Talal AlKharobi

Machine instructions As can be see from the table, instruction sizes are not the same Some instructions have 2 bytes, some 3 and some 4 bytes For example, you can see that the instruction MOV AX, 1 is stored at address 0005. Since the size of this instruction is 3 bytes, the next instruction will be stored at address 0005+3=0008 As you can see, for the first seven instructions the first byte encodes the opcode and also the code for the register. It can be observed that the least significant 2 bits are encoding the register The last two bytes encode the constant. Since the register is 16 bits, the constant size is also 16 bits and this is why 2 bytes are allocated Term 042 COE 205 Dr.Talal AlKharobi

Machine instructions You can observe that when both the operands are registers that the instruction size is 2 bytes Note the difference between the machine code for the instructions MOV AX, 1 and ADD AX, 1. Also, note that for the instruction ADD AX, i two bytes are allocated to store the address of variable i which is in this example 0000. In 8086 machines, an address requires 2 bytes. In order for one to completely understand the mapping between assembly instructions and machine code, it is required to know the various instructions formats and the syntax and semantics of each format. Term 042 COE 205 Dr.Talal AlKharobi