Candidates should be able to: describe the characteristics

Candidates should be able to: describe the characteristics

Candidates should be able to: describe the characteristics of an assembler GCSE Computing Slide 1 LMC stands for Little Man Computer. The LMC is a CPU simulator that models a simple computer using the von Neumann architecture and memory use a central processing unit consisting of an arithmetic logic unit and registers a control unit containing an instruction register and program counter input and output mechanisms RAM to store both data and instructions external secondary storage

The simulation uses the idea of a Little Man inside the computer fetching instructions from RAM and executing them. The LMC can be programmed directly by entering machine code (but in decimal) directly into RAM. However, the LMC is usually programmed in assembly code. An assembler then translates the assembly code into machine code (but in decimal) and loads it into RAM. GCSE Computing Slide 2 RAM consisting of 100 memory addresses (0-99). Each address can hold a decimal format number up to 999. INPUT using a 0-9 digit keypad. OUTPUT using a multi-line display. A PROGRAM COUNTER that stores the address of the next instruction in RAM. An INSTRUCTION REGISTER that stores the

OPP CODE of the current instruction. An ADDRESS REGISTER that stores the address part of the current instruction (if it has one). An ACCUMULATOR that stores the results of any calculations. GCSE Computing Slide 3 As the simulation runs the Little Man inside the computer carries out the following steps: 1. Check the Program Counter to find the RAM address with the program instruction to be fetched. 2. Fetch the INSTRUCTION from that RAM address. 3. Increment the Program Counter (so that it contains the RAM address of the next instruction). 4. Decode the instruction (this might include finding the RAM address for the data it will work on). 5. If necessary, fetch the DATA from the RAM address found in the previous step. 6. Execute the instruction. 7. Repeat the cycle or halt. GCSE Computing Slide 4 A program in ASSEMBLY

LANGUAGE ready to be translated into machine code INPUT, allowing number data input GCSE Computing OUTPUT, displayin g number data output Memory addresses 0-99 An explanation of the instruction to be executed next Slide 5

The program in ASSEMBL Y LANGUAG E without LABELS The contents of the ACCUMULAT OR GCSE Computing The PROGRA M COUNTE R The INSTRUCTI ON REGISTER, containing the current INSTRUCTI ON CODE The ADDRESS REGISTER, containing

the ADDRESS that the current instruction code refers to Slide 6 The program in ASSEMBL Y LANGUA GE DATA stored in RAM MACHINE CODE instructions stored in RAM DAT A GCSE Computing Slide 7

Labels can be used to label a memory address that contains DATA. Being able to refer to the data as a label is much easier than having to refer to the address the data is stored at. Example: data1 DAT data1 DAT 50 Explanation: The memory address where this data is stored is labelled data1 and stores the data 50. If this was the 7th line of assembly code to be compiled then the data 50 would be stored at memory address 6 (RAM addresses start at 0) STA data1 Explanation: The memory address where this data is stored is labelled data1. No data would initially be stored at this location. If this was the 7th line of assembly code to be compiled then the label would refer to memory address 6 (RAM addresses start at 0) Explanation: The contents of the accumulator would be stored at memory address 6. LDA data1

Explanation: The data which is stored at memory address 6 would be loaded into the accumulator. GCSE Computing Slide 8 Labels can be used to label a memory address that contains an INSTRUCTION. Being able to refer to the label rather than the address of the instruction makes it much easier when using BRANCH instructions such as BRA, BRP and BRZ. Example: loop1 INP Explanation: The memory address where this instruction is stored would be labelled loop1. BRZ loop1

GCSE Computing Explanation: If the contents of the accumulator were zero, the program would branch to the memory address labelled loop1 and carry out the instruction there. To achieve this, the Program Counter would be set to the memory address labelled loop1. If the contents of the accumulator were not zero then the Program Counter would simply be incremented by one. Slide 9 Labels used with BRANCH instructions Labels used with DATA GCSE Computing Slide 10 1. 2. 3. 4. 5. 6.

7. After a program is assembled into machine code the Program Counter is always reset to memory address 0. The Little Man checks the Program Counter to find the RAM address with the instruction to be fetched (in this case address 0). Here, the instruction 523 is fetched from RAM address 0. The Program Counter is incremented (to RAM address 1). The instruction part (5) is loaded into the INSTRUCTION REGISTER and the address part (23, the RAM address for the data the instruction will work on) is loaded into the ADDRESS REGISTER. The instruction is then decoded. The instruction is executed (5 = LOAD into ACCUMULATOR so the 0 stored at RAM address 23 is loaded into the ACCUMULATOR). Back to step 1 to repeat the cycle until a HALT instruction is reached. GCSE Computing Slide 11 An instruction starting with a 9 (901 or 902) means the instruction is an INPUT/OUTPUT command. The address part of the instruction (01 or 02) decides if the instruction is actually an INPUT or an OUTPUT. 01 means INPUT - entered using the number keypad and stored in the ACCUMULATOR when the Enter key is pressed.

02 means OUTPUT the value stored in the ACCUMULATOR is passed to the OUTPUT box. GCSE Computing Slide 12 Instruction Mnemon Machine Code ic Load LDA 5xx Store STA 3xx Add ADD 1xx Subtract SUB

2xx Input INP 901 Output OUT 902 End HLT 000 Branch always BRA 6xx Branch if zero BRZ 7xx

Branch if zero or positive BRP 8xx Data storage DAT GCSE Computing NOTE: xx represents a memory address between 0 and 99. Slide 13

Recently Viewed Presentations

  • Online Algorithms with recourse

    Online Algorithms with recourse

    approximation algorithms. Development of approximation algorithms for NP-hard stochastic optimization problems is relatively recent.. Several different models, several different techniques. Talk 1: multi-stage stochastic optimization with recourse
  • Notes: 9.4  OBJECTIVES: Students will be able to

    Notes: 9.4 OBJECTIVES: Students will be able to

    Why is a water molecule shaped differently than expected from its Lewis structure? What are some of the exceptions to the VSEPR model? Molecular Shape (Chapter 9, Section 4) 9.4 - Molecular Shape. VSEPR (Valence Shell Electron Pair Repulsion) Model...
  • DIFFUSION IN MULTIPHASE SYSTEMS 1. Interdiffusion (chemical ...

    DIFFUSION IN MULTIPHASE SYSTEMS 1. Interdiffusion (chemical ...

    The gradient of the slope is the Youngs Modulus, E Above the yield stress, the material starts to deform plastically. If the load is removed, the material will show some permanent deformation. Dislocations multiply rapidly and their strain fields interact....
  • What is Learning? - Dr.AngelaGriffin

    What is Learning? - Dr.AngelaGriffin

    Learning strategies are key! Active learning. Concept maps . Ask why, how, and what if. SQ5R for reading (survey, question, read, recite, rewrite, reflect)
  • Variability in deep drainage from urban residential parcels

    Variability in deep drainage from urban residential parcels

    One thing that kind of bothered me about the baseline scenario is this concept of compacted soil. There are a few studies out there that have looked at urban soil hydraulic characteristics and tried to quantify how they are affected...
  • The Science of Improving Patient Safety

    The Science of Improving Patient Safety

    44,000 to 99,000 people die in hospitals each year as the result of medical errors5. Over half a million patients develop catheter-associated urinary tract infections resulting in 13,000 deaths a year6. Nearly 100,000 patients die from health care-associated infections (HAIs)...
  • Diode Basics, Application and Special Diodes

    Diode Basics, Application and Special Diodes

    CHAPTER 1 Semiconductor and Diode Basics, Application and Special Diodes*
  • JEOPARDY  Great Lakes History Test your knowledge of

    JEOPARDY Great Lakes History Test your knowledge of

    Arial Times Default Design JEOPARDY - Great Lakes History GREAT LAKES HISTORY How to follow the links within this quiz: GREAT LAKES HISTORY What is the Mataafa? PowerPoint Presentation What is the Socrates? This Passenger Ship "Turtled" at its Dock...