Assembly Language Programs - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Assembly Language Programs

Description:

Load Accumulator. Store Accumulator. LOD X Load acc from memory location X ... Store Accumulator. STO Y Store acc into memory location Y. Control Instructions ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 13
Provided by: bobwi9
Category:

less

Transcript and Presenter's Notes

Title: Assembly Language Programs


1
Assembly Language Programs
  • Pippin Assembly Language Instructions
  • Data Flow
  • Control
  • Arithmetic / Logic

2
Data Flow Instructions
  • Load Accumulator
  • Store Accumulator
  • LOD X Load acc from memory location X
  • (X is the address of the data in memory)
  • LOD X Load acc with the numeric value X
  • (X is the data itself / part of the instruction)
  • Store Accumulator
  • STO Y Store acc into memory location Y

3
Control Instructions
  • Transfer of Control
  • JMP A Go to instr. at address A
  • JMZ A If Acc. 0, go to address A
  • Other
  • NOP No Operation (but keep going)
  • HLT Halt (same as NOP, but stop!)

4
Arithmetic Instructions
  • Addition
  • ADD X Add contents of mem. loc X to Acc.
  • ADD X Add value X from instr. to Acc.
  • Other
  • SUB X or X Subtract - same as above
  • MUL X or X Multiply same as above
  • DIV X or X Divide same as above

5
Logic Instructions
  • Logic
  • AND X AND Acc. with mem. loc. X
  • AND X AND Acc. with value X
  • NOT Invert all 1s and 0s in Acc

6
Compare Instructions
  • Compare
  • CPZ X Compare Zero
  • (If X 0, set Acc. to 1, else set Acc to 0)
  • CPL X Compare Less
  • (If X lt0, set Acc. to 1, else set Acc. To 0)

7
Sample Program 1, Pg 212
  • JavaScript Version
  • y 2 y
  • y x y
  • ans y gt 0

8
Sample Program 1 - Pippin
  • y 2 y
  • LOD 130 load acc with y (loc 130)
  • MUL 2 multiply times 2
  • STO 130 save as new value of y (loc 130)

9
Sample Program 1 - Pippin
  • y x y
  • LOD 129 load acc. with x (loc 129)
  • SUB 130 subtract y (location 130)
  • STO 130 save as new value of y (loc 130)

10
Sample Program 1 - Pippin
  • ans y gt 0
  • CPL 130 Compare y (loc 130) lt 0
  • NOT NOT (1s ? 0s and 0s ? 1s)
  • STO 131 save as the value of the answer
  • HLT and stop execution

11
Sample Program 1 Try it!
  • Go to the AE On-line Site
  • Go to Lab 6.1
  • Enter the instructions and step with data
  • First time Enter data values x and y as
  • x 32 and y 8
  • Second time Enter data value x and y as
  • x 8 and y 32

12
Sample Program 2
  • Look at Sample Program 2
  • JavaScript version (variation of whats in book)
  • var sum 0
  • for(var i 1 i lt limit i i 1)
  • sum sum i
  • Start on it here in class in Pippin
  • Finish it as Homework
Write a Comment
User Comments (0)
About PowerShow.com