Download Notes on Sections 2.1-

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Turing's proof wikipedia , lookup

Register machine wikipedia , lookup

Transcript
Machine Language and Assemblers
Computer Technology Series
Gerb
Objective: Understand how computers
interpret computer language
Programs
• Early computers were all designed for a specific
purpose
– For example B-29 bombers in WWII.
– Each application required a new custom-built computer
• In 1945, John Von Neumann proposed a general
purpose machine.
– Computers would contain a set of instructions called a
program
– One computer can be used for different applications by
creating a new program
– Today’s computers still operate using Von Neumann’s
architecture
Machine Language
• Programs in early computers were written in
machine language:
• Each instruction was a sequence of ones and
zeros (bits)
• First few bits described the operation performed
by the instruction
• Remaining bits described the location in
memory the instruction operates on
How machine language works
Instructions are stored in the computer in binary form:
Address
1
2
3
Instruction
10011010
11001001
00111010
How machine language works
First instruction is loaded to be executed
Address
1
2
3
Instruction
10011010
11001001
00111010
10011010
How machine language works
Instructions consist of an operation and an address
Address
1
2
3
Instruction
10011010
11001001
00111010
10011010
Operation Address
How machine language works
Operation tells the computer what to do (e.g. add two
numbers, deposit the result, etc.) Address tells which
number to add, where to deposit, etc.
Address
1
2
3
Instruction
10011010
11001001
00111010
10011010
Operation Address
How machine language works
So if operation 100 means to add, 10011010 might
mean to add the contents of address 11010 to the
result being computed.
Address
1
2
3
Instruction
10011010
11001001
00111010
10011010
Operation Address
How machine language works
Once an instruction is executed, the next instruction is
loaded for execution.
Address
1
2
3
Instruction
10011010
11001001
00111010
11001001
Assemblers
• Machine language programming was impractical
– Only experts could do it
– Required memorizing sequence of bits and what they mean
– Very easy to make a mistake
• Assembly language was designed to fix these problems
– Each line represents one machine language instruction
– Instead of 1s & 0s, use words that are easier to understand
– Translated into machine language by a program called an
assembler
• Problems with assemblers:
– Each type of machine had a different machine language, and
therefore, a different assembly language
– Programs were long. Adding a few numbers took many
operations