Assembly Language - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Assembly Language

Description:

JMZ X checks the accumulator first - if it's 0 then we jump; otherwise don't jump. ... same program in JavaScript would be the following: var z=0; for (var x ... – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 21
Provided by: WillFit6
Category:
Tags: assembly | language | var

less

Transcript and Presenter's Notes

Title: Assembly Language


1
Assembly Language
  • Friday, Week 5
  • Monday, Week 6

2
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.

3
Pippin
4
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.

5
Sample Program
  • LOD 2
  • STO 129
  • ADD 129
  • STO 129
  • ADD 3
  • STO 130
  • HLT

6
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

7
Exercise Solution
  • LOD 1
  • ADD 130
  • STO 130
  • HLT

8
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

9
Exercise Solution
  • LOD 129
  • ADD 132
  • STO 128
  • HLT

10
Machine Language
  • Assembly language still cannot be read directly
    by the computer - its not in binary.
  • Assembly language commands need to be translated
    into binary commands called machine language.

11
Pippin Machine Language
12
Example Program
13
Exercise
14
Exercise Solution
15
Exercise
16
Exercise Solution
17
PIPPIN Lab
  • This weeks lab will be to use a simulator called
    PIPPIN to write assembly language programs and
    change them to machine language.
  • Lets take a look at PIPPIN.
  • Do Pre-Lab Assignment

18
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 its 0
    then we jump otherwise dont jump.

19
Example
20
In JavaScript
  • The same program in JavaScript would be the
    following
  • var z0
  • for (var x3 x!0 x--)
  • z y
  • y z
  • Or the following
  • y y3
Write a Comment
User Comments (0)
About PowerShow.com