Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assembly & Machine Languages

Similar presentations


Presentation on theme: "Assembly & Machine Languages"— Presentation transcript:

1 Assembly & Machine Languages
A Brief Overview Jonathan-Lee Jones

2 Overview of the Module What operations can a computer can perform
The Pep/8 virtual machine Immediate and direct addressing modes Writing simple machine-language programs Machine language and assembly language Creating and running an assembly-language program Writing simple programs using the Pep/8 virtual machine Concept of assembler instructions

3 What operations can a computer can perform
Interact with I/O reading input Writing output reading the program (in memory) reading constant values (in memory) reading and writing variables (in memory) Executing instructions in machine language

4 Overview

5 Differences between machine language and assembly language
The language made up of binary coded instructions built into the hardware of a particular computer and used directly by the computer

6 Differences between machine language and assembly language
This is very hard to understand by a human. It is a series of numbers, originally binary, but hexadecimal is more common today.

7 Differences between machine language and assembly language
This originated from the early days of computing, where there were limited mechanisms of input; such as punched cards and even just a series of dials and switches.

8 Differences between machine language and assembly language
A language that uses mnemonic codes to represent machine-language instructions Much easier for the human to understand and read – though nowhere near as easy as high level languages. Harder for the computer to read! Requires and assembler to use. An assembler is program that reads each of the instructions in mnemonic form and translates it into the machine-language equivalent

9 Machine Language Machine language – The language made up of binary coded instructions built into the hardware of a particular computer and used directly by the computer Every processor type has its own set of specific machine instructions. The relationship between the processor and the instructions it can carry out is completely integrated. Each machine-language instruction does only one very low-level task Typically we have one instruction per “word” Types of Instruction data movement data processing op-code – what operation is required source 1 – operand 1 source 2 – operand 2 destination flow control (jumps)

10 Machine Language Types of Instruction Data Processing Flow control
op-code – what operation is required source 1 – operand 1 source 2 – operand 2 destination Flow control Branch (jump to address) Conditional Branch (tests values) Subroutine Calls Return(from Subroutine) Data Move (actually a copy not a move)

11 Machine Language Processing instructions How many bits required? addresses of operands and results assume a 32 bit address for memory this would allow for 232 bytes of addressable memory this would need 96 bits for the addresses in an instruction lets suppose 16 bits for the op-code (216 instructions) Each instruction is 112 bits !!

12

13 PEP/8 Virtual Computer Instruction Format
Operation code – Specifies which instruction is to be carried out Register specifier – Specifies which register is to be used (we will only use A for the moment) Addressing-mode specifier – Says how to interpret the operand part of the instruction

14 PEP/8 Virtual Computer Some Sample Instructions 0000 Stop Execution
1100 Load operand to A Register 1110 Store contents of A Register into operand 0111 Add operand to A Register 1000  Subtract operand to A Register 01001  Input character to operand 01010 Output character from operand Direct Addressing mode 000 Indirect addressing mode 001

15 Programming in Assembly Language
Program in assembly language Input Output Program in machine language Assembler

16

17 Problem: Display “Hello”
CHARO 0x0048,i; CHARO 0x0065,I; CHARO 0x006C,I; CHARO 0x006C,i; CHARO 0x006F,I; STOP .END

18 Problem: Read and sum three values and print the sum

19


Download ppt "Assembly & Machine Languages"

Similar presentations


Ads by Google