Presentation is loading. Please wait.

Presentation is loading. Please wait.

GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns.

Similar presentations


Presentation on theme: "GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns."— Presentation transcript:

1 GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns COULD explain how the computer distinguishes between data and memory addresses Write a simple program using machine code

2 GCSE Computing#BristolMet Representation of Program Instructions During the fetch phase of the processing cycle, the CPU fetches the first instruction from the start memory address location. The CPU will then decode the instruction to find out what it needs to do next. In the meantime it has already updated a register, the program counter, to point to the next memory location so that it can fetch the next instruction. A program instruction, for example “print” [character A] has 2 parts, the instruction “print” which is called the operator, and the data part, the operand, in this case [A]. The operand may be specific data or it may be a reference to another memory address location, to save to or retrieve previously stored data from. A typical instruction may be to add the data in a memory location to data in another register, the accumulator

3 GCSE Computing#BristolMet KEY TERMS Register – Special fast access part of the CPU that stores data in use by the CPU. Program Counter – A register in the CPU that keeps the address of the next instruction. Accumulator – A register in the CPU that stores data currently being used by the CPU. Operator – The part of the instruction which tells the computer what to do. Operand – The part of the instruction that tells the CPU what to apply the operation to (either specific data or a memory address). What does the Program counter do when it receives a new instruction? Can you think of examples of operations which occur in the accumulator

4 GCSE Computing#BristolMet Representation of Program Instructions The diagram below is of a 10 bit instruction. The first three bits represent the op-code and the final six bits represent the operand. The middle bit (the number bit) distinguishes between operands that are memory addresses and operands that are numbers. When the bit is set to '1', the operand represents a number. 0 would mean???

5 GCSE Computing#BristolMet Machine Code and Assembly Language Notice that all the op-codes are given an English mnemonic to simplify programming. Together these mnemonics are called an assembly language. Programs written in assembly language must be converted to their binary representation before the CPU can understand them. This is usually done by another program called an assembler, hence the name. View the program simulations

6 GCSE Computing#BristolMet Writing Machine code from LMC assembly language TASK: Using the code library from the LMC simulator attempt to write binary machine code for the following simple programs. NB The Operator will only need the first 3 bits Input number 5 Add number 3 Store Result in 10 COD E MEANING 1abLoad 2abStore 3abAdd 4abSubtract 500Input 600Output 700Stop 800Skip If Negative 801Skip If Zero 802If Skip Positive 9ABJump 101 0 0101 011 0 0011 010 1 1010


Download ppt "GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns."

Similar presentations


Ads by Google