Sie sind auf Seite 1von 15

PROGRAMMING MODEL OF 8085

 The programming model


consists of some segments
of the ALU an the
registers.

Bharat Sankhlecha
 This model does not reflect
the physical structure of
the 8085 but includes the
information that is critical
in writing assembly
language programs.
 This model includes six
registers, one accumulator,
and one flag register as
shown in figure.
 In addition, it has two 16-
bit registers : stack pointer1
and the program counter.
CONT…

 Registers : The 8085 has six general purpose registers to store 8-bit
data; these are identified as B, C, D, E, H, and L. They can be

Bharat Sankhlecha
combined as register pairs – BC, DE and HL to perform 16-bit
operations.
 The programmer can use these registers to store or copy data into
registers by using data copy operations.
 Accumulator : The accumulator is an 8-bit register that is part of
ALU. The result of an operation is stored in the accumulator.
Accumulator is also identified as register A.
 Flags : The ALU includes five flip-flops, which are set or reset after
an operation according to data conditions of the result in the
accumulator and other registers. They are called Zero(Z), Carry(CY),
Sign(S), Parity(P), and Auxiliary Carry(AC) flags.
 The microprocessor used these flags to test data conditions.
 These flags have critical importance in the decision making process
of the microprocessor. The conditions (set or reset) of the flags are 2
tested through software instructions.
FLAGS DESCRIPTION
 Z- Zero: The zero flag is set to 1 when the result
is zero, otherwise it is reset.

Bharat Sankhlecha
 CY-Carry: If an arithmetic operation result in a
carry, the carry flag is set otherwise it is reset.
 S-Sign: The sign flag is set if the bit D7 of the
result =1; otherwise it is reset.
 AC-Auxiliary Carry: In a arithmetic operation,
when a carry is generated by digit D3 and passed
to digit D4, the AC flag is set. This Flag is used
internally for BCD operation.
3
PROGRAM COUNTER (PC) AND STACK
POINTER (SP)
These are two 16-bit registers used to hold memory
addresses. The size of these two register is 16 bits
because the memory addresses are 16 bits.

Bharat Sankhlecha
The microprocessor uses the PC register to
sequence the execution of the instructions. The
function of the program counter is to point to the
memory address from which the next byte is to be
fetched. When a byte is being fetched, the
program counter is incremented by one point to
the next memory location.
The stack pointer is also a 16-bit register used as a
memory pointer. It point to a memory to a
memory location in R/W memory, called the 4
stack.
INSTRUCTION CLASSIFICATION
 An instruction is a binary pattern designed inside
a microprocessor to perform a specific function.

Bharat Sankhlecha
 The entire group of instructions, called the
instruction set, determines what functions the
microprocessor can perform.

5
THE 8085 INSTRUCTION SET
 The 8085 instructions can be classified into five
categories: data transfer (copy) operations,
arithmetic operations, logical operations.

Bharat Sankhlecha
Branching operations, and machine control
operations.

6
DATA TRANSFER OPERATIONS
 This group of instructions copies data from a location
called a source to another location, called a
destination, without modifying the contents of the
source.

Bharat Sankhlecha
 The various types of data transfer are

Types Examples

Between Registers Copy the contents of Register B into


register D.
Specific data byte to a register or a Load register B with the byte 32H
memory location

Between a memory location and a From the memory location 2000H to


register register B
7
Between an I/O device and the From an input keyboard to the
accumulator accumulator
LOGICAL OPERATIONS
 These instructions perform various logical
operations with the contents of the accumulator.

Bharat Sankhlecha
 And, OR, Exclusive-OR

 Rotate

 Compare

 Complement

8
BRANCHING OPERATIONS
 This group of instructions alters the sequence of
program execution either conditionally or
unconditionally.

Bharat Sankhlecha
 Jump

 Call, Return, and restart- These instructions


change the sequence of a program either by
calling a subroutine or returning from a
subroutine. The conditional Call and Return
instructions also can test condition flags.

9
MACHINE CONTROL OPERATIONS
 These instructions control machine functions
such as Halt, Interrupt, or do nothing.

Bharat Sankhlecha
10
INSTRUCTION, DATA FORMAT, AND
STORAGE
 In instruction is a command to the
microprocessor to perform a given task on
specified data.

Bharat Sankhlecha
 Each instruction has two parts: one is the task to
be performed, called the operation code(op-code),
and the second is the data to be operated on,
called the operand.
 The operand and data can be specified in various
ways. It may include 8-bit (or 16-bit) data, an
internal register, a memory location, or an
memory location, or an 8-bit(16-bit) address.
11
INSTRUCTIONS WORD SIZE
 The 8085 instruction set is classified into the
following three groups according to word size or
byte size.

Bharat Sankhlecha
1-byte instructions
2-byte instructions
3-byte instructions

12
ONE BYTE INSTRUCTIONS
A 1-byte instruction includes the opcode and the operand in the same byte. E.g

Task Opcod Operan Binary Hex Code

Bharat Sankhlecha
e d Code
Copy the contents of the MOV C,A 0100 1111 4FH
accumulator in register
C
Add the contents of ADD B 1000 0000 80H
register B to the
contents of the
accumulator
Invert (complement) CMA 0010 1111 2FH
each bit in the
accumulator
13
TWO BYTE INSTRUCTIONS
Task Opcod Operan Binary Hex
e d Code Code
Load an 8-bit data MVI A,32H 0011 1110 3E First Byte
byte in the 0011 0011 32 Second
accumulator Byte
Load an 8-bit data MVI B,F2H 0000 0110 06 First Byte
byte in register B 1111 0010 F2 Second

Bharat Sankhlecha
Byte

THREE BYTE INSTRUCTIONS


Task Opcode Operand Binary Hex
Code Code
Load contents of LDA 2050H 0011 1010 3A First Byte
memory 2050H into 0101 0000 50 Second
A 0010 0000 20 Byte
14 Third Byte
Transfer the JMP 2085H 1100 0011 C3 First Byte
program sequence 1000 0101 85 Second
to memory location 0010 0000 20 Byte
2085H Third Byte
ADDRESSING MODE
The various formats of specifying operands are
called addressing modes.

Bharat Sankhlecha
 Immediate Addressing MVI R, Data

 Register addressing MOV Rd, Rs

 Direct Addressing IN/OUT Port#

 Indirect Addressing

15