Слайд 2Software: machine code
● Software - code that runs on the hardware
● CPU
implements "machine code" instructions
● Each machine code instruction is extremely simple
○ e.g. add 2 numbers
○ e.g. compare 2 numbers
Слайд 3Software: machine code
The language of the machine code is hardwired into the
design
of the CPU
○ it is not something that can be changed
○ Each family of compatible CPUs (e.g. the very popular
Intel x86 family) has its own machine code which is not
compatible with the machine code of other CPU
families.
Слайд 4Lyrics
CPU is capable of performing simple instructions if you load them into
RAM. For example addition/subtraction of two numbers, jumping to another instruction. While CPU is performing an instruction the temporary results are stored inside CPU itself in the fastest, smallest memory locations – registers. CPU starts by fetching an instruction from RAM and then executes/performs it. Then again fetches and executes... This is all CPU does. Initially all programs are on hard disk. When user double-clicks a program icon the machine instructions of that program get loaded to RAM where CPU can access them and execute.
Слайд 5What are the instructions?
CPU has list of defined instructions, such as:
● add
values
● store values
● copy values
● increment value
● go to command
Слайд 6Example
Signals sent to CPU
(10110000 01100001) (read in hex B0 61)
B0 means “Move
a copy of the following value into AL (place in memory)”
Value in AL memory is equal to 61 in hexadecimal
Слайд 7What is assembly language
CPU understands only electrical signals, such as: (10110000 01100001)
But
to be understandable to programmers, assembly languages were created.
Assembly languages use words instead of binary commands, as: MOV AL, 61h
Слайд 8Little Man Computer
The Little Man Computer (LMC) is an instructional model of
a computer.
The LMC is generally used to teach students, because it models a simple architecture computer - which has all of the basic features of a modern computer.
It can be programmed in machine code or assembly code.
Слайд 11Try it: Little Man Computer
http://robowriter.info/little-man-computer/
http://peterhigginson.co.uk/LMC/
Battle Tank:
http://pddring.github.io/cpu-battle-tank/
Слайд 12Practice
T1: Read two numbers and output their sum and difference
T2: Enter two
numbers, and output them in ascending order
T3: Read three numbers and output them in ascending order
Слайд 13Deadline
Laboratory work 3 deadline 07.02.21 at 23.59 pm.