CSIS110 Introduction to Computer Science Dr Meg Fryling

  • Slides: 12
Download presentation
CSIS-110 Introduction to Computer Science Dr. Meg Fryling “Dr. Meg” Fall 2012 @Siena. Dr.

CSIS-110 Introduction to Computer Science Dr. Meg Fryling “Dr. Meg” Fall 2012 @Siena. Dr. Meg #csis 110 CSIS-110

Lecture Agenda • Questions? • Assignments • CSI Ch 7: von Neumann Machine: Machine

Lecture Agenda • Questions? • Assignments • CSI Ch 7: von Neumann Machine: Machine and Assembly Language CSIS-110

Assignments • Readings: See course scheduled on syllabus – The textbook readings are going

Assignments • Readings: See course scheduled on syllabus – The textbook readings are going to help you with homeworks AND labs • Homework 4 – Part I – Due Wednesday, November 14 th by START of class • Lab 8 – Due at START of lab 9 – Coming to lab late does NOT extend your due date/time CSIS-110

Exam 2 • Date, Time, & Location: – Monday, November 19 th – RB

Exam 2 • Date, Time, & Location: – Monday, November 19 th – RB 202 (Key Auditorium) – 7 -9 pm • You should have already notified me if you need an alternate time due to a class conflict • Study Guide will be provided • Review session in class on 11/19 (day of exam) CSIS-110

Multiple HALT Statements • Assembly programs can have multiple HALT statements • Be careful

Multiple HALT Statements • Assembly programs can have multiple HALT statements • Be careful - once HALT is reached the program stops • Some argue that it’s cleaner to just have one and jump to when necessary • In 110 we are looking at very small segments of Assembly programs so, to keep it simple, my examples will just have 1 • You can certainly use multiple as long as the program works! CSIS-110

Part II: Python Code to Assembly Language • Start your code at memory cell

Part II: Python Code to Assembly Language • Start your code at memory cell 0 and assume that variables a, b, c, & d are stored in memory cells 101, 102, 103, & 104. d = a + b - c if a > b: c = a Question 2 CSIS-110

Part II: Python Code to Assembly Language • Same memory locations and variable mappings

Part II: Python Code to Assembly Language • Same memory locations and variable mappings • Hint: Your answer from the previous question above may be a good start. d = a + b - c if a > b: c = a if a == b: a = b - c Question 3 CSIS-110

Part II: Python Code to Assembly Language • Same memory locations and variable mappings

Part II: Python Code to Assembly Language • Same memory locations and variable mappings • Hint: Your answer from the previous question above may be a good start. d = a + b - c if a > b: c = a elif a == b: a = b - c else: a = a - 1 Question 4 CSIS-110

Part III: Python Code to Assembly Language • Assume that variables A, B, and

Part III: Python Code to Assembly Language • Assume that variables A, B, and C are stored in memory cells 101, 102, and 103, respectively. Address 1 2 3 4 5 6 7 Instruction LOAD C SUBTRACT A ADD B STORE C INCREMENT A HALT Question 5 CSIS-110

Part III: Python Code to Assembly Language • The variables stored at locations 101,

Part III: Python Code to Assembly Language • The variables stored at locations 101, 102, & 103 should be named a, b, & c. Memory Address #1 #2 #3 #4 #5 #6 #7 #8 #9 #10 #11 #12 Instruction or Data LOAD 102 COMPARE 101 JUMPLT 9 JUMPEQ 9 LOAD 103 SUBSTRACT 101 STORE 103 JUMP 11 LOAD 101 STORE 102 DECREMENT 101 HALT Question 6 CSIS-110

Registers PC R IR CCR Memory Address #1 #2 #3 #4 #5 #6 #7

Registers PC R IR CCR Memory Address #1 #2 #3 #4 #5 #6 #7 #8 #9 #10 #11 #12. . #100 #101 #102 #103 Instruction or Data LOAD 102 COMPARE 101 JUMPLT 9 JUMPEQ 9 LOAD 103 SUBSTRACT 101 STORE 103 JUMP 11 LOAD 101 STORE 102 DECREMENT 101 HALT 2 10 3 21 CSIS-110

Looping in Assembly Language CSIS-110

Looping in Assembly Language CSIS-110