Page 43 - DCAP210_INTRODUCTION__TO_MICROPROCESSORS
P. 43
Unit 3: Assembly Language Programming of 8085
3.1.5 Stack Pointer (SP) Notes
The stack pointer is also a 16-bit register used as a memory pointer. It points to a memory location
in R/W memory, called the stack. The beginning of the stack is defined by loading 16-bit address
in the stack pointer.
This programming model will be used in subsequent tutorials to examine how these registers are
affected after the execution of an instruction.
3.2 The 8085 Addressing Modes
The instructions MOV B, A or MVI A, 82H are to copy data from a source into a destination. In
these instructions the source can be a register, an input port, or an 8-bit number (00H to FFH).
Similarly, a destination can be a register or an output port. The sources and destination are
operands. The various formats for specifying operands are called the ADDRESSING MODES.
For 8085, they are:
1. Immediate addressing.
2. Register addressing.
3. Direct addressing.
4. Indirect addressing.
Immediate Addressing
Data is present in the instruction. Load the immediate data to the destination provided. Example:
MVI R, data
Register Addressing
Data is provided through the registers. Example: MOV Rd, Rs
Direct Addressing
Used to accept data from outside devices to store in the accumulator or send the data stored in
the accumulator to the outside device. Accept the data from the port 00H and store them into the
accumulator or send the data from the accumulator to the port 01H. Example: IN 00H or OUT
01H
Indirect Addressing
This means that the Effective Address is calculated by the processor. And the content of the
address (and the one following) is used to form a second address. The second address is where
the data is stored. Note that this requires several memory accesses; two accesses to retrieve the
16-bit address and a further access (or accesses) to retrieve the data which is to be loaded into the
register.
Write a program to subtract two 16-bit numbers using 8085.
3.3 Instruction Set Classification
An instruction is a binary pattern designed inside a microprocessor to perform a specific function.
The entire group of instructions, called the instruction set, determines what functions the
microprocessor can perform. Instruction set determines what functions the microprocessor can
perform. These instructions can be classified into the following five functional categories:
LOVELY PROFESSIONAL UNIVERSITY 37