Little Man Computer (continued).

Slides:



Advertisements
Similar presentations
Means, variations and the effect of adding and multiplying Textbook, pp
Advertisements

ABNIAC The following slide presentation is to acquaint the student with ABNIAC. The version used for presentation is the Java version, which can be found.
ALGORITHMS & FLOWCHARTING II
The Little man computer
1 10/20/08CS150 Introduction to Computer Science 1 do/while and Nested Loops Section 5.5 & 5.11.
Lecture 12 Another loop for repetition The while loop construct © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
Von Neumann architecture
REPETITION STRUCTURES. Topics Introduction to Repetition Structures The while Loop: a Condition- Controlled Loop The for Loop: a Count-Controlled Loop.
CPSC 171 Introduction to Computer Science 3 Levels of Understanding Algorithms More Algorithm Discovery and Design.
Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website.
Chapter 5 Repetition or loop structure. What is repetition or loop? repeat the execution of one or a group (block; instruction enclosed in a pair of braces)
CPS120 Introduction to Computer Programming The Programming Process.
Review for Exam2 Key Ideas 1. Key Ideas: Boolean Operators (2 > 3) || (3 < 29.3) A.True B.False C.Impossible to determine (22 > 3) && (3 > 29.3) A.True.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
PROBLEM SOLVING WITH LOOPS Chapter 7. Concept of Repetition Structure Logic It is a computer task, that is used for Repeating a series of instructions.
OPERATIONS USING FRACTIONS. 1. Add, subtract, multiply and divide fractions with and without a calculator. 2. Convert between equivalent forms of fractions.
Little Man Computer When your program gets “translated to machine code” all 0’s & 1’s The translator must know the language of the program (java) as well.
Introduction to Loops For Loops. Motivation for Using Loops So far, everything we’ve done in MATLAB, you could probably do by hand: Mathematical operations.
Division Using multiplication and repeated subtraction.
Program Design. The design process How do you go about writing a program? –It’s like many other things in life Understand the problem to be solved Develop.
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
The Little-Man Computer Damian Gordon. The Little-Man Computer Most computer architectures conform to the so-called von Neuman Architecture. This means.
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 5 Repetition Structures.
Think Possibility 1 Iterative Constructs ITERATION / LOOPS C provides three loop structures: the for-loop, the while-loop, and the do-while-loop. Each.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
This is where you can reset and run your program. If your program has an “INP” (input) command, you will type it in this box here. Using the LMC These.
CS 101 – Oct. 7 Solving simple problems: create algorithm Structure of solution –Sequence of steps (1,2,3….) –Sometimes we need to make a choice –Sometimes.
5a – While Loops Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Mastering LMC Coding Part #1 Introduction to Low Level Languages Introduction to Little Man computer Simple examples (demos) with video tutorials included.
Program to multiply 2 numbers 500-Input x 291-Store acc. as x 500-Input y 292-Store acc. as y 193-Load y in to acc. (0 on 1 st parse) 391-Add x to acc.
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
The Postman in your PC Today you are going to learn how a computer’s CPU works to handle data. Teachcompsci.co.uk.
Little Man Computer Task 1 Last lesson you were asked to write a program to multiply two numbers together. The next slide has a working program to do this.
Chapter 10 Polynomials and Factoring. Entry Task 04/09/2013.
Instruction Memory value Description ADD1xx Add the value stored at memory address xx to the value in the accumulator register SUB2xx Subtract the value.
1. 2 TimeActivity 9:45Welcome and introductions 10:00What is a computer? 10:15What’s inside? 10:45Activity: A simple view of how computers work 11:15Coffee/tea.
Creating a Flowchart Computer Integrated Manufacturing
The Little man computer
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
UNIT 1 TEST REVIEW ALGEBRA II
Repetition Structures Chapter 9
Lesson 4 - Challenges.
Lecture 6 Repetition Richard Gesick.
Lesson Objectives A note about notes: Aims
Pseudocode Upsorn Praphamontripong CS 1110 Introduction to Programming
ALGORITHMS & FLOWCHARTING II
Topics Introduction to Repetition Structures
Starter Read the Feedback Click on Add new Feedback Open Realsmart
Algebra 1B Lesson 21 Instructional Material 1
CPS120: Introduction to Computer Science
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
More Loops.
More Loops.
Ch..Ch..Ch..Changes What life is all about!.
To get y, multiply x by 3 then add 2 To get y, multiply x by negative ½ then add 2 To get y, multiply x by 2 then subtract 3 To get y, multiply x.
LMC Little Man Computer What do you know about LMC?
Little Man Computer Lesson 2
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
DAT2343 LMC Simulator Usage © Alan T. Pinck / Algonquin College; 2003.
Order of Operations PEMDAS.
Topics Introduction to Repetition Structures
Number Lines.
Little Man Computer There’s a little man in the mailroom that follows each instruction to the letter but he can only follow one instruction at a time.
Using Formulas.
Scientific Notation THE LOGICAL APPROACH.
Software Development Techniques
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Little Man Computer.
Presentation transcript:

Little Man Computer (continued)

All Instructions 1XX – add the value in mailbox XX to calc 2XX – subtract the value in mailbox xx from calc 3XX – put the value of calc into mailbox XX 5XX – take the value of mailbox XX and put it into calc 6XX – set the instruction counter to XX 7XX – set the instruction counter to XX if calc is 0, otherwise nap 8XX – set the instruction counter to XX if calc is positive, otherwise nap 901 – grab the top item from input and put it in calc 902 – put calc into output 000 – stop and go home

Conditional Execution What if we want the our mail man to skip instructions? For example, let’s say that you are an acturary You need to write a program to calculate how many years an individual has left to live You decide to offload this task to the mail man The formula you decide to use is 80 - <input> What happens if the user says they are -5 years old?

Conditional Execution If the user enters a negative value, we want to output -1 instead of 80 - <input>

Conditional Execution Example 0 – 901 – read a # from the input and put it in calc 1 – 209 – subtract the # in mailbox 9 from calc 2 – 706 – if calc is now 0, set the instruction counter to 10, otherwise rest 3 – 512 – copy the # mailbox 12 to calc 4 – 902 – write the value to calc to the output 5 – 0 – go home 6 – 511 – copy the # mailbox 11 to calc 7 – 902 – write the value to calc to the output 8 – 0 – go home 9 – 5 10 – 6 11 – 1 12 – -1

Looping Sometimes, you need to keep doing a set of instructions until a value reaches 0 For example, remember to simulate multiplication using repeated addition, we stopped once the number we were multiplying by reached 0

Looping Example 0 – 901 – copy # from input to calc 1 – 399 – copy calc to mailbox 99 2 – 901 – copy # from input to calc 3 – 398 – copy calc to mailbox 98 4 – 598 – copy mailbox 98 to calc 5 – 712 – if calc is 0 go to XX 6 – 215 – calc – mailbox XX 7 – 398 – copy calc to mailbox 98 8 – 597 – copy mailbox 97 to calc 9 – 199 – calc + mailbox 99 10 – 397 – copy calc to mailbox 97 11 – 604 – go to 4 12 – 597 – copy mailbox 97 to calc 13 – 902 – copy from calc to out 14 – 0 15 - 1