Sie sind auf Seite 1von 5

Lab# 01

Data Transfer Instructions


Objective:

 To learn about Assembly language


 To Learn how data is transferred between registers
 To Learn how to define variables

Introduction

 Assembly Language:
An assembly language is a low-level programming language for microprocessors and
other programmable devices. It is not just a single language, but rather a group of
languages. An assembly language implements a symbolic representation of the
machine code needed to program a given CPU architecture.

 Silent feature of 80886:


o 16-bit microprocessor

o 16-bit data bus

o Up to 10 MHz

o 1 MB RAM

o 64K I/O ports

o 40-pin DIP

o 56-pin QFP o 44-pin PLCC

GENERAL PURPOSE REGISTERS

8086 CPU has 8 general purpose registers; each register has its own name:

 AX - the accumulator register (divided into AH / AL):

o Generates shortest machine code


o Arithmetic, logic and data transfer
o One number must be in AL or AX

16-EE-05 Muhammad Nawaz Ul Islam Dar


o Multiplication & Division
o Input & Output

 BX - the base address register (divided into BH / BL).

 CX - the count register (divided into CH / CL):

o Iterative code segments using the LOOP instruction


o Repetitive operations on strings with the REP command
o Count (in CL) of bits to shift and rotate

 DX - the data register (divided into DH / DL):

o DX:AX concatenated into 32-bit register for some MUL and DIV operations
o Specifying ports in some IN and OUT operations

 SI - source index register:

o Can be used for pointer addressing of data


o Used as source in some string processing instructions
o Offset address relative to DS

 DI - destination index register:

o Can be used for pointer addressing of data


o Used as destination in some string processing instructions
o Offset address relative to ES

 BP - base pointer:

o Primarily used to access parameters passed via the stack


o Offset address relative to SS

 SP - stack pointer:

o Always points to top item on the stack


o Offset address relative to SS
o Always points to word (byte at even address)
o An empty stack will had SP = FFFEh
SEGMENT REGISTERS

 CS - points at the segment containing the current program.

16-EE-05 Muhammad Nawaz Ul Islam Dar


 DS - generally points at segment where variables are defined.
 ES - extra segment register, it's up to a coder to define its usage.
 SS - points at the segment containing the stack.

SPECIAL PURPOSE REGISTERS

 IP - the instruction pointer:

o Always points to next instruction to be executed


o Offset address relative to CS

IP register always works together with CS segment register and it points to currently
executing instruction.

FLAGS REGISTER

 Flags Register - determines the current state of the processor.


Task 1

 #MAKE_COM#; instruct compiler to make COM file.

 ORG 100h; directive required for a COM program.

 MOV AX, 0C060h; set AX to hexadecimal value of 0C060h.



 MOV DS, AX; copy value of AX to DS.

 MOV CL, ‘A’; set CL to ASCII code of 'A'.

 MOV CH, 10110111b; set CH to binary value.

 MOV BX, 45Bh; set BX to45Bh.

 MOV [BX], CX; copy contents of CX to memory at C060:045B

 RET; returns to operating system.

16-EE-05 Muhammad Nawaz Ul Islam Dar


16-EE-05 Muhammad Nawaz Ul Islam Dar
Task 2

 #MAKE_COM#
 ORG 100h
 MOV AL, A
 MOV BX, B
 RET; stops the program.
 A DB 7
 B DW 1234h

16-EE-05 Muhammad Nawaz Ul Islam Dar

Das könnte Ihnen auch gefallen