Assembly Language Friday, Week 5 Monday, Week 6. Assembly Language  Set of mnemonic names for the instructions in a particular computer's machine language.

Slides:



Advertisements
Similar presentations
Machine & Assembly Language. Machine Language  Computer languages cannot be read directly by the computer – they are not in binary.  All commands need.
Advertisements

Chapter 8 ICS 412. Code Generation Final phase of a compiler construction. It generates executable code for a target machine. A compiler may instead generate.
Chapter 2 Machine Language.
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
CompSci A Peek at the Lower Levels  It is good to have a sense of what happens at the hardware level  Not required for this course  It may.
The Little man computer
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
CARDIAC A cardboard illustrative aid to computation illustrates the operation of a computer demos basic units of a simple computer –input –memory –accumulator.
19-1 Programming… The Pencil and Paper Computer The Pencil & Paper Instruction Set: (table on p148) The Operand specifies a memory location.
LC-3 Computer LC-3 Instructions
The Binary Machine Modern high-level programming languages are designed to make programming easier. On the other end, the low level, all modern digital.
The Analytical Engine Module 6 Program Translation.
Translating high level language into machine code
Systems Environment 3 Quick Revision Review of Exercises Introduction to TOM TOM Exercises.
1 Lab Session-IV CSIT-120 Spring 2001 Lab 3 Revision and Exercises Rev: Precedence Rules Lab Exercise 4-A Machine Language Programming The “Micro” Machine.
Program Translation Module 6. Mid-Term Results.
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
1 CS Programming Languages Random Access Machines Jeremy R. Johnson.
An Interactive Web-Based Simulation of a General Computer Architecture
Computer Systems Organization CS 1428 Foundations of Computer Science.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 2 Part 1 In-Class Lab Session (Lab 2)
Microcode Source: Digital Computer Electronics (Malvino and Brown)
Bus Architecture Memory unit AR PC DR E ALU AC INPR 16-bit Bus IR TR
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
Computer Science 101 How the Assembler Works. Assembly Language Programming.
CS41B MACHINE David Kauchak CS 52 – Fall Admin  Midterm Thursday  Review question sessions tonight and Wednesday  Assignment 3?  Assignment.
Lecture 15 Today’s lecture MARIE programming Assembler
Chapter 8: The Very Simple Computer
Chapter 10 The Assembly Process. What Assemblers Do Translates assembly language into machine code. Assigns addresses to all symbolic labels (variables.
Computer Science Illuminated Programming: Controlling the Hardware.
1 Ethics of Computing MONT 113G, Spring 2012 Session 7 Computer Architecture The Internet.
6. Program Translation CS100: The World of Computing John Dougherty Haverford College.
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
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.
Computer Systems Organization
Memory Addressing Techniques. Immediate Addressing involves storing data in pairs with immediate values register pairs:
Computer Systems – Machine & Assembly code. Objectives Machine Code Assembly Language Op-code Operand Instruction Set.
Processor Fundamentals Assembly Language. Learning Objectives Show understanding of the relationship between assembly language and machine code, including.
INTRODUCTION TO COMPUTERS
Mastering LMC Coding Part #1 Introduction to Low Level Languages Introduction to Little Man computer Simple examples (demos) with video tutorials included.
Lec 4-2 Five operations of the machine cycle Fetch- fetch the next program instruction from memory. (PC+1); instruction to IR Decode- decode the 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.
Machine Language Computer languages cannot be directly interpreted by the computer – they are not in binary. All commands need to be translated into binary.
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
The Little man computer
Machine and Assembly Language
CS2100 Computer Organisation
Microprocessor T. Y. B. Sc..
CHAPTER 6: The Little Man Computer
1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor.
Data Representation – Instructions
The Processor and Machine Language
What is a computer program?
Programming Languages (CS 550) Mini Language Compiler
Systems Architecture I (CS ) Lecture 1: Random Access Machines
Lesson Objectives Aims Key Words Compiler, interpreter, assembler
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.
Sequencing, Selection, and Loops in Machine Language
Computer Architecture
Processor Fundamentals
MIPS assembly.
A Level Computer Science Topic 5: Computer Architecture and Assembly
1.3.7 High- and low-level languages and their translators
Systems Architecture I (CS ) Lecture 1: Random Access Machines
Programming Languages (CS 360) Mini Language Compiler
Algoritmos y Programacion
Little Man Computer.
Presentation transcript:

Assembly Language Friday, Week 5 Monday, Week 6

Assembly Language  Set of mnemonic names for the instructions in a particular computer's machine language.  Works on accumulator and memory locations in the computer.  Translated into binary instructions.

Pippin STO X Store accumulator value in memory location X LOD X Load contents of memory location X into accumulator LOD #X Load value X into accumulator HLT Halt execution ADD X Add contents of memory location X to accumulator ADD #X Add value X to accumulator

Pippin  Pippin has an accumulator - a place to store intermediate values during computation.  Similar to the calculator but we have memory locations to store values and to load values.

Sample Program LOD #2 STO 129 ADD 129 STO 129 ADD #3 STO 130 HLT

Exercise  What would be the assembly instructions to add 1 to the contents of memory location 130?  STO X Store acc value in mem loc X  LOD X Load contents of mem loc X into acc  LOD #X Load value X into acc  HLT Halt execution  ADD X Add contents of mem loc X to acc  ADD #X Add value X to acc

Exercise Solution LOD #1 ADD 130 STO 130 HLT

Exercise  What would be the assembly language instructions to add the values in memory locations 129 and 132, putting the answer in 128?  STO X Store acc value in mem loc X  LOD X Load contents of mem loc X into acc  LOD #X Load value X into acc  HLT Halt execution  ADD X Add contents of mem loc X to acc  ADD #X Add value X to acc

Exercise Solution LOD 129 ADD 132 STO 128 HLT

Machine Language  Assembly language still cannot be read directly by the computer - it’s not in binary.  Assembly language commands need to be translated into binary commands called machine language.

Pippin Machine Language LOD X LOD # ADD X ADD # STO HLT Memory location Memory location

Example Program LOD ADD # STO HLT

Exercise LOD X ADD Y STO Y HLT LOD X LOD # ADD X ADD # STO HLT Translate above into machine language. Memory location X Memory location Y

Exercise Solution LOD X ADD Y STO Y HLT

Exercise Write an assembly program that calculates Y=X+3. LOD X LOD # ADD X ADD # STO HLT Translate the program into machine language. Memory location X Memory location Y

Exercise Solution LOD X ADD #3 STO Y HLT

PIPPIN Lab  This week’s lab will be to use a simulator called PIPPIN to write assembly language programs and change them to machine language.  Let’s take a look at PIPPIN.PIPPIN  Do Pre-Lab AssignmentPre-Lab Assignment

JMP  All commands seen so far in PIPPIN are sequential.  We have no way to make a decision or to skip some statements.  JMP X command says always jump to the command labeled X.  JMZ X checks the accumulator first - if it’s 0 then we jump; otherwise don’t jump.

Example LOD #3 STO X LOD #0 STO Z LOOP:LOD Z ADD Y STO Z LOD X SUB #1 STO X JMZ END JMP LOOP END:LOD Z STO Y HLT

In JavaScript  The same program in JavaScript would be the following: var z=0; for (var x=3; x!=0; x--) z += y; y = z;  Or the following: y = y*3;