Completely Solved C, C++ Programs Assignment.


Filed Under:

  The 8085 has six general-purpose registers, namely, B,C,D,E,H, and L. They can be combined as register pairs- BC, DE, and HL – to perform some 16-bit operations.

  These registers are programmable, meaning that a programmer can use them to load or copy data from the registers by using instructions. For example, the instruction MOV B, C copies the data from register C to register B. Conceptually, the registers can be viewed as memory locations, except they are built inside the microprocessor and identified by specific letters for user convenience.

   ACCUMULATOR:  The accumulator is an 8-bit register that is part of the arithmetic/ logic unlit (ALU). This register is used to store 8-bit data and to perform arithmetic and logical operations. The result of an operation is stored in the accumulator. The accumulator is also identified as register A.

   FLAGS: The ALU includes five flip- flops that are set or reset according to the result of an operation. The microprocessor uses them o perform the third operation; namely, testing for data conditions.

 S-Sign Flag: After the execution of an arithmetic or logic operation, if bit D7 of the result (usually in the accumulator) is 1, the Sign Flag is set. The flag is used with sign numbers. In a given byte, D7 is 1, the number will be viewed as a negative number; if it is 0, the number will be considered positive. In arithmetic operations with signed numbers, bit D7 is reserved for indicating the sign, and the remaining seven bits are used to represent the magnitude of a number.
  Z-Zero Flag: The Zero flag is set if the ALU operation results in 0,and the flag is reset if the result is not 0. This flag is modified by the results in the accumulator as well as in the other registers.
 AC-Auxiliary Carry flag: In an arithmetic operation, when a carry is generated by digit D3 and passed on to digit D4, the AC flag is set. The flag is used only internally for BCD (binary-coded decimal) operations and is not available for the programmer to change the sequence of a program with a jump instruction.
 P-Parity Flag: After an arithmetic or logical operation, if the result has an even number of 1s, the flag is set. If it has odd number of 1s, the flag is reset.
 CY-Carry Flag: If an arithmetic operation results in a carry, the Carry flag is set; otherwise it is reset. The Carry flag also serves as a borrow flag for subtraction.
    The bit positions reserved for these flags in the flag register are as follows:-


  The 16-bit register deals with the fourth operation, sequencing the execution of instructions. This register is a memory pointer. Memory locations have 16-bit addresses, and that is why this is a 16-bit register.

  The microprocessor uses this register to sequence the execution of 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 (machine code) is being fetched, the program counter is incremented by 1 point to the next memory location.


   The stack pointer is also a 16-bit register used as a memory pointer, initially; it will be called a stack pointer register to emphasis that it is a register. It points to a memory location in R/W memory, called the stack. The beginning of the stack is defined by loading a 16-bit address in the stack pointer (register).

  The 8085 instruction set is a huge one and needs to be classified into the following groups:
  • Data transfer operations. 
  • Arithmetic operations. 
  • Logical operations. 
  • Branching operations and 
  • I/O and Machine-control operations. 
  Programs are written based on these instructions which the MPU interprets. Each instruction has a specific hexadecimal 8-bit code. Some instructions do not need operands. Some give immediate operands and on the other hand some instructions tell the MPU to fetch the operand from a specific memory location. Accordingly these instructions are classified into 1-byte, 2-byte and 3-byte instructions. Some of the instructions are:

1-byte instruction: 
  • MOV A, B
  • ADD C
  • CMA
2-byte instruction:
  • MVI A, 32H
3-byte instruction: 
  • LDA F01AH
  • JMP 5A4EH

Back to main directory:  Microprocessor    Hardware Practical

Get Free Programming Tutorials and Solved assignments