Assembly Language Assembly Language

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

ARM versions ARM architecture has been extended over several versions.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
ARM Microprocessor “MIPS for the Masses”.
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
Instruction Set Architecture & Design
By Tien Phung CS 147 Dr. Sin-Min Lee. High-level Languages Assembly Languages Machine Languages.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2:
ARM Instructions I Prof. Taeweon Suh Computer Science Education Korea University.
Parul Polytechnic Institute Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name.
Assembly & Machine Languages
UNDERSTANDING ASSEMBLY LANGUAGE.
The CPU The Central Presentation Unit Main Memory and Addresses Address bus and Address Space Data Bus Control Bus The Instructions set Mnemonics Opcodes.
Machine Instruction Characteristics
ICS312 Set 9 Logic & Shift Instructions. Logic & Shift Instructions Logic and Shift Instructions can be used to change the bit values in an operand. The.
BITWISE OPERATIONS – Microprocessor Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
The Central Processing Unit (CPU) and the Machine Cycle.
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
Important Concepts  Parts of the CPU  Arithmetic/Logic Unit  Control Unit  Registers  Program Counter  Instruction Register  Fetch/Decode/Execute.
Computer Architecture Lecture 11 by Engineer A. Lecturer Aymen Hasan AlAwady 10/3/2014 University of Kufa - Information Technology Research and Development.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name of Unit : Instruction cycle.
Unit-2 Instruction Sets, CPUs
Dale & Lewis Chapter 5 Computing components
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
What is a program? A sequence of steps
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Microprocessor & Assembly Language
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
F453 Module 8: Low Level Languages 8.2: Features of Low-Level Languages.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
The Little man computer
Unit 1 Instruction set M.Brindha AP/EIE
Displacement (Indexed) Stack
GCSE COMPUTER SCIENCE Computers 1.5 Assembly Language.
central heating system
Control Unit Lecture 6.
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
ARM Registers Register – internal CPU hardware device that stores binary data; can be accessed much more rapidly than a location in RAM ARM has.
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor.
Processor Instructions set. Learning Objectives
Introduction to 8085 Instructions
More on logical instruction and
William Stallings Computer Organization and Architecture 8th Edition
Chapter 4 The Von Neumann Model
Chapter 5 The LC-3.
The Processor and Machine Language
BIC 10503: COMPUTER ARCHITECTURE
The University of Adelaide, School of Computer Science
Fundamentals of Computer Organisation & Architecture
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Topic 6: Bitwise Instructions
Programmer’s View of the EAGLE
Multiplication by small constants (pp. 139 – 140)
ECEG-3202 Computer Architecture and Organization
ECEG-3202 Computer Architecture and Organization
The ARM Instruction Set
Branching instructions
Overheads for Computers as Components 2nd ed.
Basic components Instruction processing
CS501 Advanced Computer Architecture
An Introduction to the ARM CORTEX M0+ Instructions
CS 111 – Sept. 16 Machine language examples Instruction execution
Little Man Computer.
Presentation transcript:

Assembly Language Assembly Language A Level Only Photocopiable/digital resources may only be copied by the purchasing institution on a single site and for their own use © ZigZag Education, 2016

Machine Code Each type of CPU is designed to carry out a set of specific instructions. Each instruction is represented by a binary number. This is called machine code. Machine Code Assembly Language 1110 0001 1010 0000 0011 0000 0000 1001 MOV R3, R9 1110 0010 0100 0011 0001 0000 0000 1010 SUB R1, R3, #10 1110 0000 1000 0000 0000 0000 0000 0001 ADD R0, R0, R1 It is hard for humans to read and write machine code so assembly language was developed to make it easier. Assembly language features a set of mnemonics, each one representing one machine code instruction. © ZigZag Education, 2016

These are the mnemonics that are commonly used in assembly language: Description LDR Load from memory location into a register ADD Add data in a register SUB Subtract data in a register STR Store values from register into a memory location B Branch to a marked position in the program CMP Compare values in a register AND Bitwise logical AND operation ORR Bitwise logical OR operation XOR Bitwise logical XOR operation MVN Bitwise logical NOT operation LSL Logically shift the value left, used for multiplication LSR Logically shift the value right, used for division HALT Stops the program © ZigZag Education, 2016

Instruction Format ADD MOV SUB R0, R1, #5 R0, R2 R2, R2, R4 This is the standard format for writing instructions in assembly language. opcode: the operation code is a single instruction operands: the values the instruction will use ADD R0, R1, #5 MOV R0, R2 SUB R2, R2, R4 operation destination input input © ZigZag Education, 2016

Storage Two different types of storage are used when the CPU is executing instructions. Registers Storage locations contained within the CPU which are much faster to access than memory Memory The RAM is located outside the CPU and is slower to access than registers. © ZigZag Education, 2016

Addressing There are different methods to access data and instructions in memory; these are called memory addressing modes. Immediate The data is hard-coded into the instruction. It is the fastest method as it doesn’t use memory. Direct The instruction refers directly to a location in memory (either a register or a memory location). ADD R0, R1, #5 Direct Direct Immediate © ZigZag Education, 2016

Example LDR LDR SUB STR R0, 102 R1, 101 R2, R0, R1 R2, 100 Registers Loads the value from memory location 102 into register 0 LDR R0, 102 Registers R0 20 R1 5 R2 15 Loads the value from memory location 101 into register 1 LDR R1, 101 Subtracts the value in R1 from the value in R0, stores the result in R2 SUB R2, R0, R1 Memory 100 15 101 5 102 20 Stores the value from R2 in memory location 100 STR R2, 100 © ZigZag Education, 2016

Logical Shift 1 1 1 = 45 = 90 (×2) = 180 (×4) Multiplication and division are very CPU-intensive operations; logical shift is an alternative method that can be used for multiplication and division by powers of 2. 1 1 = 45 1 = 90 (×2) = 180 (×4) As you can see, shifting the number one place to the left is the equivalent to multiplying by 2 and shifting by two places is the equivalent to multiplying by 4. © ZigZag Education, 2016

Branching is used to jump to different points in the program. Opcode Operands Description MOV R0, #50 The value 50 is moved into register 0 R1, #0 The value 0 is moved into register 1 CMP R0, R1 The values stored in registers 0 and 1 are compared BGT numIsGT If the value stored in register 0 is greater than the value stored in register 1, the program branches to the numIsGT label STR R1, 100 HALT numIsGT: A label used to define a point in the program R0, 100 Stores the value stored in register 0 in memory location 100 Stops the program © ZigZag Education, 2016

END