Final Lecture Chapter 3 Part 2 1 Welcome To Assembly Language

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Chapter Three

Part Two

8086
MICROPROCESSOR
PROGRAMING &
INSTRUCTION SETS

Presented by: Mr. Amanuel G


2 Outline

– Welcome to assembly language


– Relation of Assembly language
– Objective of Assembly Language
– Assembly Languages Rules & Applications
– Additional Notes of Assembly Languages
– Steps involved in Programming
– Assembly language Programming Tips
– Timing & Delay
– Programming in Assembler
– Some Assembly Language Example Programs
– DOS & BIOS Interrupts

Prepared by : Amanuel G ECE DEPARTEMENT


3 Welcome to assembly language

– oldest programming language


– It provides direct access to computer hardware,
– requiring you to understand much about your computer’s architecture and
operating system.
– Background you should have
– High level programming language knowledge of how to use IF statements,
arrays, and functions to solve programming problems.

Prepared by : Amanuel G ECE DEPARTEMENT


4 Welcome to assembly language

– An assembler is a utility program that converts source code


programs from assembly language into machine language
– A linker is a utility program that combines individual files created
by an assembler into a single executable program
– Debugger lets you to step through a program while it’s running
and examine registers and memory

Prepared by : Amanuel G ECE DEPARTEMENT


5 Welcome to assembly language

– How Does Assembly Language Relate to Machine Language?


– Machine language is a numeric language specifically understood by a
computer’s processor (the CPU)
– Assembly language consists of statements written with short mnemonics such as
ADD, MOV, SUB, and CALL
– Assembly language has a one-to-one relationship with machine language
– Most people cannot read raw machine code, so we will use its closest relative,
assembly language

Prepared by : Amanuel G ECE DEPARTEMENT


6 Welcome to assembly language

– How Do C++ and Java Relate to Assembly Language?


– High-level languages such as C++ and Java have a one-to-many relationship with
assembly language and machine language
– A single statement in C++ expands into multiple assembly language or machine
instructions.
– Example:Assume X and Y are integers:
– int Y;
– int X = (Y + 4) * 3;

Prepared by : Amanuel G ECE DEPARTEMENT


7 Welcome to assembly language

– How Do C++ and Java Relate to Assembly Language?...


– the corresponding assembly language for the above c++ code is
mov Ax,Y ; move Y to the AX register
add Ax,4 ; add 4 to the AX register
mov Bx,3 ; move 3 to the EBX register
imul Bx ; multiply AX by BX
mov X,Ax ; move AX to X

Prepared by : Amanuel G ECE DEPARTEMENT


8 Welcome to assembly language

– Is Assembly Language Portable?


– A language whose source programs can be compiled and run on
a wide variety of computer systems is said to be portable
– Assembly language is not portable because it is designed for a
specific processor family: Motorola 68x00, x86, SUN Sparc, Vax,
and IBM-370
– If the assembly language doesn’t directly match the computer
architecture: they can be translated using microcode interpreter
Prepared by : Amanuel G ECE DEPARTEMENT
9 Welcome to assembly language

– Why Learn Assembly Language?


– As a computer Engineer you are likely to write embedded program:
Assembly language is an ideal tool for writing embedded programs
because of its economical use of memory
– Real-time applications dealing with simulation and hardware
monitoring require precise timing and responses
– Computer game consoles require their software to be highly
optimized for small code size and fast execution: permits direct access
to computer hardware, and code can be hand optimized for speed
Prepared by : Amanuel G ECE DEPARTEMENT
10 Welcome to assembly language

– Why Learn Assembly Language?


– Assembly language helps you to gain an overall understanding of the
interaction between computer hardware, operating systems, and
application programs.
– Some high-level languages abstract their data representation to the point that it
becomes awkward to perform low-level tasks such as bit manipulation
– Hardware manufacturers create device drivers for the equipment they sell

Prepared by : Amanuel G ECE DEPARTEMENT


11 Welcome to assembly language

– Are There Rules in Assembly Language?


– Most rules in assembly language are based on physical limitations of the target
processor and its machine language.
– Assembly language has fewer rules than C++ or Java because the latter use
syntax rules to reduce unintended logic errors at the expense of low-level data
access
– Assembly language programmers spend a lot of time debugging!

Prepared by : Amanuel G ECE DEPARTEMENT


12 Welcome to assembly language

– Assembly Language Applications


– In the early days of programming, most applications were written partially or
entirely in assembly language
– Large application programs rarely developed by assembly language rather is
used to optimize certain sections of application programs for speed and to
access computer hardware

Prepared by : Amanuel G ECE DEPARTEMENT


13 Welcome to assembly language

– Assembly language consists four fields


[label] mnemonic [operand] ;comment
– Label: refer to a line of code by name
– Mnemonic and operand : perform the real work of program =>
instruction plus data
– Comment : at the end of line or on a line by itself

Prepared by : Amanuel G ECE DEPARTEMENT


14 Welcome to assembly language

– Assembly Language Applications


– In the early days of programming, most applications were written partially or
entirely in assembly language
– Large application programs rarely developed by assembly language rather is
used to optimize certain sections of application programs for speed and to
access computer hardware

Prepared by : Amanuel G ECE DEPARTEMENT


15 Welcome to assembly language

– Segment definition

Eg .stack 64 : reserves 64 bytes of stack

Prepared by : Amanuel G ECE DEPARTEMENT


16

Prepared by : Amanuel G ECE DEPARTEMENT

You might also like