Branching on Zero A Worked Example. Branching on Zero Countdown from 99 to 1, then stop Cell Code Description 00LDA Load from … 0110 … cell 10 02OUT Output.

Slides:



Advertisements
Similar presentations
GCSE Computing Lesson 5.
Advertisements

Microprocessors.
Programming 68HC11.
Rules of Divisibility. Divisible by 2? If the last digit is even then the number is divisible by 2. Even digits are 0, 2, 4, 6 and 8 (yes zero is even!)
Learning how to use the Little man computer
The Little man computer
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.
LMC Little Moron Computer
Some thoughts: If it is too good to be true, it isn’t. Success is temporary. It is hard work to make it simple. Knowing you did it right is enough reward.
Systems Environment 3 Quick Revision Review of Exercises Introduction to TOM TOM Exercises.
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
The Little Man Computer
Positive and Negative Numbers
1 CS Programming Languages Random Access Machines Jeremy R. Johnson.
SAP1 (Simple-As-Possible) Computer
Debugging a Program … Using the PC/370 Emulator Interactively !
Machine level architecture Computer Architecture Basic units of a Simple Computer.
Module 8 Part B Adapted By and Prepared James Tan © 2001.
Model Computer CPU Arithmetic Logic Unit Control Unit Memory Unit
Computer Science Illuminated Programming: Controlling the Hardware.
Type your question here. Type Answer Type your question here. Type Answer.
DH2T 34 – HNC Computer Architecture 1 Lecture 14 The Fetch-Decode-Execute Cycle [1]. © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College.
D75P 34 – HNC Computer Architecture
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
COMPILERS CLASS 22/7,23/7. Introduction Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent.
The Little-Man Computer Damian Gordon. The Little-Man Computer Most computer architectures conform to the so-called von Neuman Architecture. This means.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 8.
Dale & Lewis Chapter 5 Computing components
Computer Systems – Machine & Assembly code. Objectives Machine Code Assembly Language Op-code Operand Instruction Set.
Assembly Language Programming of 8085 BY Prof. U. V. THETE Dept. of Computer Science YMA.
Topic: Control Statements. Recap of Sequence Control Structure Write a program that accepts the basic salary and allowance amount for an employee and.
An Adder A Subtractor. A and B are the inputs of the adder/ subtractor R is the output of the adder/ subtractor F is the control to tell it to add or.
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.
LMC Tricks Common patterns. Single General Purpose Register "Features" – Accumulator only stores most recent value – Add/Subtract look for second value.
Mastering LMC Coding Part #1 Introduction to Low Level Languages Introduction to Little Man computer Simple examples (demos) with video tutorials included.
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.
Trace Tables In today’s lesson we will look at:
The Little man computer
CHAPTER 6: The Little Man Computer
Unit 1 Instruction set M.Brindha AP/EIE
SAP1 (Simple-As-Possible) Computer
BIT116: Scripting Loops.
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
CHAPTER 6: The Little Man Computer
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor.
ADVANCED PROCESSOR ARCHITECTURE
Starter Read the Feedback Click on Add new Feedback Open Realsmart
Assembler CASE Tool.
Systems Architecture I (CS ) Lecture 1: Random Access Machines
CHAPTER 6: The Little Man Computer
An Ultimate RISC Processor for Space Applications
Instruction and Control II
Systems Architecture I (CS ) Lecture 2: A Simplified Computer
Making Programming Friendlier
Programmer’s View of the EAGLE
Sequencing, Selection, and Loops in Machine Language
Computer Architecture
Business Programming I
Programming Examples.
DO IT NOW The LMC has the following instruction set:
Some Assembly (Part 2) set.html.
Systems Architecture I (CS ) Lecture 1: Random Access Machines
8 1 7 Subtraction Facts
Learning how to use the Little man computer
Create Folder Unit 5 (All work for this unit to be stored here)
Little Man Computer.
Presentation transcript:

Branching on Zero A Worked Example

Branching on Zero Countdown from 99 to 1, then stop Cell Code Description 00LDA Load from … 0110 … cell 10 02OUT Output 03SUB Subtract … 0411 … cell 11 from the accumulator 05BRZ Test the accumulator; if zero, … 0609 …branch to cell 09 07BRBranch to… 0802 …cell 02 09HLTStop Processing 1099Data: Starting Value 1101Data: Counting down in 1’s

Trace the Program Use a program trace sheet like this to help you understand what is happening

Starting Position

00 LDA Load the contents of RAM Cell 10 into the Accumulator

02 OUT Output the contents of the Accumulator

03 SUB Subtract the contents of cell 11 from the Accumulator

05 BRZ Test the contents of the Accumulator. If the answer is zero, branch to RAM Cell 09 Test the contents of the Accumulator. If the answer is zero, branch to RAM Cell 09 Accumulator = 98 Do nothing. Accumulator = 98 Do nothing.

05 BR Branch to cell RAM Cell 02

02 OUT Output the contents of the Accumulator

03 SUB Subtract the contents of cell 11 from the Accumulator

05 BRZ Test the contents of the Accumulator. If the answer is zero, branch to RAM Cell 09 Test the contents of the Accumulator. If the answer is zero, branch to RAM Cell 09 Accumulator = 97 Do nothing. Accumulator = 97 Do nothing.

05 BR Branch to cell RAM Cell 02

02 OUT Output the contents of the Accumulator

The program continues.... Now... continue the program for yourself for another two ‘jumps’ back to cell 02

... to here This is the point you should now have reached.

... and further continues... This is the point you should now have reached. To save a lot of tedious work, we are going to miss out a lot of iterations and go to where the numbers reach down towards zero

... to here. We have now reached the point where the last number output was 2

03 SUB Subtract the contents of cell 11 from the Accumulator

05 BRZ Test the contents of the Accumulator. If the answer is zero, branch to RAM Cell 09 Test the contents of the Accumulator. If the answer is zero, branch to RAM Cell 09 Accumulator = 1 Do nothing. Accumulator = 1 Do nothing.

05 BR Branch to cell RAM Cell 02

02 OUT Output the contents of the Accumulator

03 SUB Subtract the contents of cell 11 from the Accumulator

05 BRZ Test the contents of the Accumulator. If the answer is zero, branch to RAM Cell 09 Test the contents of the Accumulator. If the answer is zero, branch to RAM Cell 09 Accumulator = 0 Branch to Cell 09 Accumulator = 0 Branch to Cell 09

09 HLT Stop the Program

Program Flowchart Store 99 in the Accumulator Subtract 1 from the Accumulator Is the answer zero? Start Stop Output the contents of the Accumulator Yes No