Presentation is loading. Please wait.

Presentation is loading. Please wait.

Binary! Objectives Recap what a instruction is Look at how binary can be used to store – Opcode – data.

Similar presentations


Presentation on theme: "Binary! Objectives Recap what a instruction is Look at how binary can be used to store – Opcode – data."— Presentation transcript:

1 Binary! Objectives Recap what a instruction is Look at how binary can be used to store – Opcode – data

2 What are computer instructions? Computers are very efficient data processing machines. First ones literally wired to carry of 1 task – code breaking or a calculation etc If needed to do another task – engineers spend days re-wiring the machine. Had to be a better way WWII – American Scientist John Von Neumann – atomic bomb – idea – digital data & digital instructions are the same. His approach allowed a computer to be re-programmed by changing the instructions rather than re-wiring it. What we have today. The instructions are called software

3 Binary instructions Software is run on the micro-processor by sending instructions from memory to the micro-processor. It is then decoded and executed. Instructions are run one at a time sequentially. Micro-processors use registers, which are inside the CPU, in order to perform calculations. Some instructions include – ADD SUB JMP DAT You are encouraged to look at the LMC simulator to refresh your memory.

4 Binary Encoding instructions Instructions have two parts to them. Opcode - a binary value which represents the instruction Data – Could be null or will contain the data needed for the instruction. When a instruction is passed to a micro-processor the first thing which happens is the opcode is decoded. This means the micro-processor will look the binary code up in a table. Once the instruction is found it will execute it.

5 Binary Encoding instructions NameNumberBinary valueComment ADD0010000 0000 0001Add a register to the ACC SUB0020000 0000 0010Subtract a register to the ACC INP9011001 0000 0001Get a value from the user OUT9021001 0000 0010Display a value LDA0050000 0000 0101Load a register to the ACC STA0030000 0000 0011Store the ACC to a register DAT9031001 0000 0011Set a value to the ACC Note – the binary values are in BCD

6 Binary Data The second part of an instruction is the data. The program below will add 2 numbers together – DAT 12 STA 1 DAT 4 ADD 1 OUT The highlighted parts are the data parts of the instruction. These are numeric values so are encoded using normal binary.

7 Binary Encoded Data InstructionOpcodeDataData in binary DAT1001 0000 0011120000 1100 STA0000 0000 001110000 0001 DAT1001 0000 001140000 0100 ADD0000 0000 000110000 0010 OUT1001 0000 0010xx

8 Binary Activity InstructionopcodeDataData in binary INPx STA4 INPx STA3 DAT10 ADD3 SUB4 OUTx Fill out the opcode and binary values for the program below

9 Binary Activity Make revision notes on opcode and instruction data. You do not need to memorise the codes! You just need to understand how they are stored in binary.


Download ppt "Binary! Objectives Recap what a instruction is Look at how binary can be used to store – Opcode – data."

Similar presentations


Ads by Google