Programming Model of 8085 Microprocessor YASH PAL, March 16, 2026March 16, 2026 Programming Model of 8085 Microprocessor – An assembly language program is a set of instructions written in proper sequence in the mnemonics of a given microprocessor. These instructions are designed for a particular microprocessor. The operation code (op-code) for the 8085 microprocessor is always one byte in length. With 8 bits for the opcode, 28 = 256 distinct op-codes are possible. In hexadecimal, the op-codes can be from 00H to FFH. Each opcode corresponds to an instruction. Thus, theoretically, 256 instructions are possible in the instruction set of the 8085 microprocessor. They can be discussed under 74 types of op-codes of the 246 instructions. We have 202 instructions, 1-byte long, 18 instructions 2-byte long, and 26 instructions are 3-byte long. Programming Model of the 8085 Microprocessor Since 8085 is a programmable device, it can be instructed through a program to do a task, even though only some particular sections of its internal architecture are programmable and accessed by the user. A combined term used for the combination of all of these sections is the programming model shown in the figure below. Programming Model of the 8085 Microprocessor To draw the programming model, all the different sections are arranged in an order, but it doesn’t mean that the physical existence of all the sections that have been combined is the same as shown in the above figure. The programming model shown in the above figure has 10 different registers. These registers can be classified into four different categories according to their uses. Accumulator Flag Registers General Purpose Registers Pointer Registers Accumulator The accumulator is the major working register of the microprocessor. Most of the time, it is used to hold the data for manipulation. Whenever an arithmetic or logic operation is executed, the accumulator contains one of the operands. Another operand may be stored in another register or in a memory location. The result of an arithmetic or logic operation is stored in the accumulator. The accumulator is also used for data transfer between an input/output port and a memory location, or between one memory location and another. The accumulator is also identified as register A. Flag Registers During the execution of a program, when certain operations are performed, the resultant conditions are stored in the flag register. Since the flag register represents the status of any operation performed, this is also known as the status register. Arithmetic and logic operations may set or reset one or more bits in the flag register. These bits may be used by the same instructions to change the flow of the program based on the condition of these bits. It means that the same instructions of the 8085 microprocessor permit the execution of a program to change the flow on the basis of the condition of bits in the flag register. So the condition bits in the flag register can be used to make logical decisions within the program. In the 8085 microprocessor, the flag register is an 8-bit register. Out of eight bits, only five bits are used as five flags to store the status of the result of any arithmetic and logical operation. The five flags are arranged in an 8-bit register. It is shown in the figure below. Flag Register Carry (CY): The carry bit is set if, during any operation, a carry is produced. For example, the summation of two 8-bit numbers is greater than FFH. This flag also represents the borrower. A borrow is generated when a large number is subtracted from a small number. If there is no carry and no borrow in any arithmetic operation, the carry flag will be reset. Parity (P): The parity flag represents whether the number of ones is even or odd in the result. If the result has an even number of ones, the flag is set; for an odd number of ones, the flag is reset. Auxiliary Carry (AC): The auxiliary carry flag shows whether, during the operation, auxiliary carry (carry from D3 bit) is produced or not. The auxiliary carry bit of the flag register is set when an addition of the first four bits causes a carry into the fifth bit. This is also known as half carry or intermediate carry. This flag is used internally for BCD operations. The flag is not available to the user to change the flow of the program. Zero (Z): The zero bit of the flag register is set when all the bits of the result after any operation are zero. It will be reset if the result is non-zero. The zero flag is used to indicate whether the result is zero or non-zero after any operation. Sign (S): In sign magnitude arithmetic, the most significant bit is a sign bit. If this bit is logic ‘1’, the number is negative; otherwise, it is positive. The sign flag is set if bit D7 of the result is one (1). Similarly, the sign flag is reset if bit D of the result is zero (0). We can say the sign flag is a replica of bit D7 of the result. In unsigned arithmetic, it does not play any important role. Note: The flags are set or reset after the execution of an arithmetic or logic operation; data copy operations do not affect any flag. General Purpose Registers The 8085 microprocessor has six general-purpose registers. These are used as a simple storage area inside the microprocessor. These are mainly used to store intermediate results of the operation. Reading the data from the general-purpose registers is faster than from memory or input/output, so it is a better idea to have a sufficient number of general-purpose registers in the microprocessor. The general-purpose registers of the 8085 microprocessor are identified as B, C, D, E, H, and L, as shown in the “Programming model of 8085 Microprocessor” figure. Each of the general-purpose registers can operate as an 8-bit register. They can be 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 the registers. Pointer Registers In addition to six general-purpose registers, one accumulator register, and one flag register, most of the microprocessors have two other registers called pointer registers. The pointer registers are the registers that point to a memory location. Since these are the registers to store the address of a memory location, the length of these registers is 16 bits. The 8085 microprocessor has two pointer registers: Stack Pointer (SP) and Program Counter (PC). Stack Pointer (SP) – It is a register that stores the address of the top of the stack. A stack is defined as a part of R/W memory that operates on the LIFO(Last In First Out) concept. In most of the microprocessors, the stack pointer decrements when data is pushed on the stack. Usually, stack operations are two-byte operations. This means that the stack pointer decrements by two memory address locations each time two bytes of data are pushed on the stack. Similarly, when two-byte data is retrieved (popped off) from the stack, the stack pointer is incremented by two memory address locations. Note: When the data is pushed on the stack, the stack pointer always points to the last data inserted on the stack. If the data is popped off from the stack, it always gets the last data inserted on the stack. This type of stack operation is called the LIFO (Last In First Out) operation. Program Counter (PC) – As mentioned earlier, a program is a set of instructions stored in the memory. These instructions are used to solve the specified problem. These instructions must be executed in the proper order to get the correct result. The program counter is a register that is used by the microprocessor to make the execution in sequence. It keeps track of which instruction is being used and what the next instruction will be. The program counter is a 16-bit register that stores the address of the next instruction to be executed. Any program execution starts only after the valid address of the first instruction is loaded into the program counter. The fixed address (0000H) is stored in the program counter by resetting the microprocessor. engineering subjects Microprocessor microprocessor