22
1 Assembler A short Overview

Assembler

Embed Size (px)

DESCRIPTION

Telling what an Assembler is

Citation preview

Page 1: Assembler

1

Assembler

A short Overview

Page 2: Assembler

2

Content

Language LevelsHigh Level micro codeMachinecode language

Assembler languagesStructureCommands

Page 3: Assembler

3

Language LevelsHigh Level Language

Assembler Language

Machine Language

Micro -programming

Hardware

„Firmware“

Normally deepest free accessible Level

Page 4: Assembler

4

High Level Micro Code

High Level language Formulating program for certain application

areas Hardware independent

Assembler languages Machine oriented language Programs orient on special hardware properties More comfortable than machine code

(e.g. by using symbolic notations)

Page 5: Assembler

5

High Level Micro Code

Machine code:

Set of commands directly executable via CPU

Commands in numeric codeLowest semantic levelGenerally 2 executing oportunities:

• Interpretiv via micro code• Directly processing via hardware

Page 6: Assembler

6

High Level Micro Code

Micro programming:Implementing of executing of machine

commands (Control unit - controller)Machine command executed/shown as

sequence of micro code commandsMicro code commands:

• Simpliest process controlling• Moving of data• Opening of grids• Tests

Page 7: Assembler

7

Machinecode language

Machinecode command:Binary word (fix length, causes

elementary operations within CPU)

Machinecode programsequence of machinecode commands

Page 8: Assembler

8

Machinecode language

Structure:Operationcode

• Defining executable operationOperandaddress

• Spezification of operands • Constants/register addresses/storage

addresses

Difference between 1/2/3 address machines

OpCode OpAddress

Page 9: Assembler

9

Machinecode language

Data transport commands Arithmetic and logical commands Process controlling commands In-/output commands Special commands Disadvantage:

Difficultly readable No symbolic names(Mnemomics)

Page 10: Assembler

10

Assembler languages

Translated into machinecode language(Interpreter)

Each operation code(opcode) owns one symbolic command

Assignments of operand addresses are possible

Labels for command addresses

Page 11: Assembler

11

Assembler languages

Usage of pseudo commands Commands for assembler Assigment of values/addresses(variables) Definition of the programstart addresses Allocating of memory for variables

Page 12: Assembler

12

Assembler languages-structure

Label symbolic labeling of an assembler address

(command address at Machine level) Mnemomic

Symbolic description of an operation Operands

Contains of variables or addresse if necessary Comments

<Mnemomic> <Operand> Comments<Label>

Page 13: Assembler

13

Assembler Languages - Machine Instructions

Bitpatterns are created, executed as commands by CPU

Classes: Arithmetic/logical Operations(ADD,SUB,XOR,

administrative commands - EQU, shifting&rotation commands)

Data transfer(load/save operations, speicher<>register, register<>register)

Control commands(jump op. [un-]conditional /relativ,control op. – STOP)

In-/output commands

Page 14: Assembler

14

Assembler – Assembler Instructiuons (Pseudo Commands)

Instructions to assembler Controlling translation process No creation of machine code Affect creation of machine instructions

Types: Program organisation equations and symbolic Addresses Definition of Constants and Memory Addressing

Page 15: Assembler

15

Arithmetic example: Source and Destination Data width has to

euqal AX , BX, CX, DX, SI, DI, BP, SP; arithmetic operationsADD AX, BX ; AX := AX+BXSUB AH,AL ; AH := AH - ALMOV AL, CL ; AL := CLINC CX ; CX := CX+1DEC CL ; CL := CL-1NEG CX ; CX := -CX

Assembler – All purpose Register

AH AL

BH BL

CLCHCX

BX

AX

All purpose Register

Page 16: Assembler

16

Assembler – Special Register

Unless to all-purpose registersSpecial register(SS, DS, CS, ES, IP)

• Never ever are• Destination/Source of a „mov“ command• Destination of arithmetic operations

Page 17: Assembler

17

Assembler – Flag Register

Overflow

DirectionInterrupt enable

TrapSign

Zero

Auxiliary carryParity

Carry

O D I T S Z A P C

Page 18: Assembler

18

Assembler – Flag Register FLAG-Bits:

C Carry Area crossing of unsigned numbers A Aux. Carry Area crossing at BCD-design O Overflow Area crossing at arithmetic

operation with signed numbers S Sign True if result = negativ Z Zero Result = Null P Parity Result has an even number of 1 Bits D Direction flag Defines direction of string-

commands I Interrupt Global Interrupt Enable/Disable

Flag T Trap Flag Used by debugger, allows single-

step- modus

Page 19: Assembler

19

Assembler – Flag Register

Missing flags:• V: Two’s complement overflow indicator• H: Half Carry Flag

Operations and flagsADD, SUB, NEG affects O, S, Z, A, P, CINC, DEC -“- O, S, Z, A, PMUL, DIV -“- O, CAND, OR , XOR -“- S, Z, P, C

Page 20: Assembler

20

Assembler – Jump Operations

Un-/conditioned jumpsExample:

Mov AX, 0CMP CX, 0

again: JZ end (jumpzero, conditioned j.) ADD AX, CX DEC CX JMP again (unconditioned

jumped)end: NOP

Page 21: Assembler

21

Sources

http://www.informatik.ku-eichstaett.de /studium/skripte/ws0203/einf2/Vorlesung12.ppt

http://www-ist.massey.ac.nz/GMoretti/159704/Lectures/1-Languages-Translation-&-Assemblers.pdf

http://www.mathematik.uni-marburg.de/~priebe/lehre/ws0001/ti1/Skript/TechInf1Lo08.ppt

E:\temp\4.Semester\Intro into Dig.Computing\Doku\Befehlssatz.pdf

Page 22: Assembler

22

Thanks 4 ur Attention

Any further questions

??