Open In App

Reset Accumulator (8085 & 8086 microprocessor)

Last Updated : 06 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

1. Problem – Write the 8085 instructions which reset the accumulator. Solution – There are 4 instructions to reset the accumulator in 8085. These instructions are:

S.No. MNEMONICS COMMENT
1 MVI A, 00 A <- 00
2 ANI 00 A AND 00
3 XRA A A XOR A
4 SUB A A <- A – A

Explanation –

  1. MVI A, 00: instruction copies 00 to A.
  2. ANI 00: instruction performs bit by bit AND operation of source operand (i.e. 00) to the destination operand (i.e. the accumulator A) and store the result in accumulator A.
  3. XRA A: instruction performs XOR operation between source operand and destination operand and store the result in the accumulator. Here, source and destination operand both are same i.e. A. Therefore, the result after performing XOR operation, stored in the accumulator is 00.
  4. SUB A: operation subtracts the contents of source operand(here, source register is A) from the contents of accumulator and store the result in the accumulator itself. Since, the source and destination operand are same. Therefore, accumulator A = 00.

2. Problem – Write 8086 instructions which are used to reset accumulator. Solution – There are 4 instructions in 8086 to reset the accumulator. These instructions are:

S.No. MNEMONICS COMMENT
1 MOV AX, 0000 AX <- 0000
2 AND AX, 0000 AX <- AX AND 0000
3 XOR AX, AX AX <- AX XOR AX
4 SUB AX, AX AX <- AX – AX

Explanation – Register AX is used.

  1. MOV AX, 0000: copies 0000 to AX.
  2. AND AX, 0000: operation performs bit by bit ANDs the source operand (0000) to the destination operand and store the result in AX.
  3. XOR AX, AX: performs the XOR operation in values of source register and destination register and store the result in AX. The source and destination operands, both are same. Therefore, AX = 0.
  4. SUB AX, AX: operation subtracts the value of source operand from the value of destination operand and store the result in AX. Here, both the operands are same .Therefore, AX = 0.

 Application :

Initialization: The “Reset Accumulator” instruction is used to initialize the accumulator register to zero at the start of a program. This ensures that the accumulator is in a known state before any data processing operations are performed.

Error handling: The “Reset Accumulator” instruction can be used to handle errors in a program. If an error occurs during data processing, the accumulator can be reset to zero to prevent further errors and ensure that the program can continue executing properly.

Data processing: The “Reset Accumulator” instruction can be used in various data processing operations, such as arithmetic operations, logical operations, and data transfer operations. By resetting the accumulator to zero, the program can perform these operations on a fresh set of data.

Subroutine calls: The “Reset Accumulator” instruction can be used to clear the accumulator before calling a subroutine. This ensures that the subroutine operates on a clean set of data and does not interfere with the main program’s data processing operations.

Interrupt handling: The “Reset Accumulator” instruction can be used to clear the accumulator during interrupt handling. This ensures that the interrupt service routine operates on a clean set of data and does not interfere with the main program’s data processing operations.

Advantages:

Ensures accurate results: Resetting the accumulator before performing arithmetic or logical operations ensures that the results are accurate and do not include any previous data.

Improves efficiency: Resetting the accumulator can improve the efficiency of the program, as it eliminates the need to manually clear the accumulator each time a new operation is performed.

Reduces errors: Resetting the accumulator reduces the risk of errors due to leftover data from previous operations.

Disadvantages:

Slows down the program: Resetting the accumulator takes additional time, which can slow down the program execution.

Memory usage: Resetting the accumulator requires memory to store the instruction, which can be a disadvantage if memory usage is a concern.

May not be necessary: Resetting the accumulator may not be necessary in all cases, such as when the previous contents of the accumulator do not affect the current operation.


Previous Article
Next Article

Similar Reads

Differences between 8085 and 8086 microprocessor
8085 Microprocessor 8085 Microprocessor is a predecessor of version 8086 Microprocessor, designed by Intel in 1976 with the help of NMOS technology. It includes a data bus of 8 bits, and 16 bits of the address bus, having a +5V voltage supply, and operates at 3.2 MHz single segment CLK. It has an internal clock generator and functions on a clock cy
4 min read
8085 program to find the set bit of accumulator
Problem - All bits of an accumulator are 0 except a single bit which is 1. Write an assembly language program using 8085 to determine which bit of the accumulator is 1. The result should be a decimal number from 1 to 8 and is required to be stored in register C. Examples - Example 1 : Accumulator Content is 10H (Hex) Accumulator Content -&gt; 0 0 0
4 min read
Flag register of 8086 microprocessor
Prerequisite – Flag register in 8085 microprocessor The Flag register is a Special Introduction : The flag register is a 16-bit register in the Intel 8086 microprocessor that contains information about the state of the processor after executing an instruction. It is sometimes referred to as the status register because it contains various status fla
6 min read
General purpose registers in 8086 microprocessor
General-purpose registers are used to store temporary data within the microprocessor. There are 8 general-purpose registers in the 8086 microprocessor. [caption width="800"] [/caption] 1. AX: This is the accumulator. It is of 16 bits and is divided into two 8-bit registers AH and AL to also perform 8-bit instructions. It is generally used for arith
2 min read
Arithmetic instructions in 8086 microprocessor
Arithmetic Instructions are the instructions which perform basic arithmetic operations such as addition, subtraction and a few more. Unlike in 8085 microprocessor, in 8086 microprocessor the destination operand need not be the accumulator. Following is the table showing the list of arithmetic instructions: OPCODE OPERAND EXPLANATION EXAMPLE ADD D,
2 min read
Logical instructions in 8086 microprocessor
Introduction : Logical instructions in the 8086 microprocessor are instructions that perform logical operations on data stored in registers or memory locations. These instructions can manipulate bits within a byte, set or clear individual bits, or perform Boolean operations such as AND, OR, XOR, and NOT. Some of the commonly used logical instructio
5 min read
Data transfer instructions in 8086 microprocessor
Introduction : Data transfer instructions in the 8086 microprocessor are used to move data between memory locations, registers, and input/output (I/O) devices. These instructions are essential for manipulating data within a program, as well as for communicating with external devices. Data transfer instructions are a fundamental part of programming
4 min read
Process control instructions in 8086 microprocessor
Process control instructions are the instructions which control the processor's action by setting(1) or resetting(0) the values of flag registers. Following is the table showing the list of process control instructions: OPCODEOPERANDEXPLANATIONEXAMPLESTCnonesets carry flag to 1STCCLCnoneresets carry flag to 0CLCCMCnonecompliments the carry flagCMCS
1 min read
Memory Segmentation in 8086 Microprocessor
Prerequisite - Segmentation Segmentation is the process in which the main memory of the computer is logically divided into different segments and each segment has its own base address. It is basically used to enhance the speed of execution of the computer system, so that the processor is able to fetch and execute the data from the memory easily and
3 min read
Addressing modes in 8086 microprocessor
Prerequisite - Addressing modes, Addressing modes in 8085 microprocessor The way of specifying data to be operated by an instruction is known as addressing modes. This specifies that the given data is an immediate data or an address. It also specifies whether the given operand is register or register pair. Types of addressing modes: Register mode -
2 min read