Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer...

9
Basic Machine Code Operations

Transcript of Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer...

Page 1: Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.

Basic Machine CodeOperati ons

Page 2: Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.

Bas ic Machine Code Operati ons

Machine Code1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

Represents different voltage levels

High: 5 Volts

Low: 0 Volts

At this raw level a digital computer is instructed to carry out instructions.

Page 3: Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.

Bas ic Machine Code Operati ons

Machine Code Instructi ons

0001 0001 0000 1111

ADD R1, #15

The machine code instructions can also be represented by assembly code mnemonics that is a more user friendly code.

(The processor decodes and executes these instructions)

Page 4: Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.

Bas ic Machine Code Operati ons

Compiled High Level Language

Machine Code Instruction

Compiled high level language programs are translated into machine code, so they are ready to be executed on a computer. The processor then decodes and executes the machine code instructions.

(The processor decodes and executes these instructions)

Machine code instructions consist of a series of binary digits (bits) in two parts represented below:

Opcode Operand

Page 5: Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.

Bas ic Machine Code Operati ons

Compiled High Level Language

Machine Code Instruction

A machine code instruction is a series of operational codes and operand parts as shown below:

(The processor decodes and executes these instructions)

Operation Code Operand Part

This is the basic machine code operation eg ADD

Represents one item of data or the address of one item of data

Page 6: Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.

Bas ic Machine Code Operati ons

Machine Code Program(The processor decodes and executes these instructions)

MC Instructions (16 bits) Mnemonics Explanation

0001 0000 0000 0011 LOAD #3 Place 3 into the accumulator

1000 0000 0000 1101 STORE 13 Place a copy of the accumulator contents into the memory location with address 13

0001 0000 0000 0110 LOAD #6 Place 6 into the accumulator

0100 0000 0000 1101 ADD 13 Sum the contents of the accumulator and memory location 13; place the result into the accumulator

1000 0000 0000 1110 STORE 14 Place a copy of the accumulator contents into the memory location with address 14.

Page 7: Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.

Bas ic Machine Code Operati ons

Machine Code Program(The processor decodes and executes these instructions)

The machine code instructions are difficult for people to understand. Therefore, assembly code instructions have been developed to represent them.

Page 8: Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.

Bas ic Machine Code Operati ons

Assembly Code Operati ons (The processor decodes and executes these instructions)

Op-code:4 bits

Basic Machine Code Operation

Explanation

0000 Load involving main memory

Load the accumulator register with a value fetched from the main memory location specified in operand part of the instruction

0001 Load involving operand part

Load the accumulator register with the value in the operand part of the instruction

0100 Add involving main memory

Add to the content of the accumulator a value fetched from main memory location specified in the operand part of the instruction

0101 Add involving operand part

Add to the contents part of the accumulator the value in the operand part of the instruction.

1000 Store involving main memory

Store the contents of the accumulator in the main memory location specified in the operand part of the instruction.

Page 9: Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.

Bas ic Machine Code Operati ons

Assembly Code Operati ons (The processor decodes and executes these instructions)

Machine code instructions can be represented in various ways:

• 0000 1111 1111

Can represent the value 255 or it can represent a main memory location.