Microprocessor Architecture Programming

Submitted by: Submitted by

Views: 10

Words: 2675

Pages: 11

Category: Science and Technology

Date Submitted: 07/19/2015 09:16 AM

Report This Essay

Title: Multi byte addition/subtraction

Introduction:

Learning any imperative programming language involves mastering a number of common concepts:

Variables: declaration/definition

Assignment: assigning values to variables

Input/Output: Displaying messages

Displaying variable values

Control flow: if-then

Loops

Subprograms: Definition and Usage

Programming in assembly language involves mastering the same concepts and a few other issues.

Variables

For the moment we will skip details of variable declaration and simply use the 8086 registers as the variables in our programs. Registers have predefined names and do not need to be declared.

The 8086 has 14 registers. Each of these is a 16-bit register. Initially, we will use four of them – the so called the general purpose registers: ax, bx, cx, dx

These four 16-bit registers can also be treated as eight 8-bit registers:

ah, al, bh, bl, ch, cl, dh, dl

Assignment

The above assignments would be carried out in 8086 assembly langauge as follows:

mov x, 42

mov y, 24

add z, x

add z, y

The mov instruction carries out assignment.

It which allows us place a number in a register or in a memory location (a variable) i.e. it assigns a value to a register or variable.

Example: Store the ASCII code for the letter A in register bx.

mov bx, ‘A’

The mov instruction also allows you to copy the contents of one register into another register.

Example:

mov bx, 2

mov cx, bx

The first instruction loads the value 2 into bx where it is stored as a binary number. [a number such as 2 is called an integer constant]

The Mov instruction takes two operands, representing the destination where data is to be placed and the source of that data.

General Form of Mov Instruction

mov destination, source

where destination must be either a register or memory location and source may be a constant, another register or a memory location.

Note: The comma is essential. It is used to separate the two operands.

A...