Operation types
The Intel 8085 microprocessor supports several types of operations, which can be roughly divided into the following categories:
Data transfer operations
Register-to-register data transfer
These operations move data from one register to another inside the microprocessor. For example, the MOV instruction is used for this. The instruction MOV B, C moves the contents of register C into register B. This type of operation is useful for preparing data for further processing in the central processing unit.
Register-to-memory data transfer
Data can be transferred from a register to a memory location. An example is the STA (Store Accumulator) instruction. The instruction STA 2000h stores the contents of the accumulator in memory location 2000h. This is needed to save calculation results or intermediate data in memory.
Memory-to-register data transfer
This allows data to be taken from a memory location and placed in a register. The LDA (Load Accumulator) instruction is used for this purpose. For example, LDA 2000h loads the contents of memory location 2000h into the accumulator. This operation is often used to retrieve data that was previously stored in memory for processing.
Data transfer with input/output devices
The 8085 uses the IN and OUT instructions to transfer data between the microprocessor and input/output devices. The IN instruction is used to read data from an input/output port into the accumulator; for example, IN 05h reads data from the input/output port with address 05h into the accumulator. The OUT instruction is used to send data from the accumulator to an input/output port; for example, OUT 06h sends the contents of the accumulator to the input/output port with address 06h.
Arithmetic operations
Addition
The 8085 supports addition operations. The ADD instruction is used to add the contents of a register or memory location to the accumulator. For example, ADD B adds the contents of register B to the accumulator. There is also the ADI (Add Immediate) instruction, for example ADI 10h, which adds the immediate value 10h to the accumulator.
Subtraction
Subtraction operations can be performed with instructions such as SUB and SUI. The SUB instruction subtracts the contents of a register or memory location from the accumulator. For example, the instruction SUB C subtracts the contents of register C from the accumulator. The SUI (Subtract Immediate) instruction, for example SUI 05h, subtracts the immediate value 05h from the accumulator.
Increment and decrement
The INR (Increment) and DCR (Decrement) instructions are used to increase or decrease the contents of a register or memory location by 1. For example, INR B increments the contents of register B by 1, and DCR M decrements the contents of the memory location pointed to by the HL register pair.
Logical operations
The ANA instruction
The ANA (AND Accumulator) instruction is used to perform a logical AND operation between the accumulator and a register or memory location. For example, ANA B performs a bitwise AND operation between the contents of the accumulator and register B, and the result is stored in the accumulator.
The ORA instruction
The ORA (OR Accumulator) instruction performs a logical OR operation. For example, ORA C performs a bitwise OR operation between the contents of the accumulator and register C, and the result is stored in the accumulator.
The XRA instruction
The XRA (Exclusive OR Accumulator) instruction is used for the XOR operation. XRA M performs an exclusive OR operation between the contents of the accumulator and the memory location pointed to by the HL register pair, and the result is stored in the accumulator.
The CMA instruction
The CMA (Complement Accumulator) instruction complements the contents of the accumulator. Every bit in the accumulator is inverted, that is, 0 becomes 1 and 1 becomes 0.
Branch operations
Conditional jumps
These jumps are taken depending on the state of the flag register. For example, the JZ (Jump if Zero) instruction tests the zero flag. If the zero flag is set (which means that the result of the previous operation was zero), the program jumps to the specified memory address. Similarly, the JC (Jump if Carry) instruction jumps to the specified address if the carry flag is set.
Unconditional jumps
The JMP instruction is used for unconditional jumps. When the JMP instruction is executed, program control is transferred to the specified memory address without testing any conditions. For example, JMP 2050h transfers program execution to memory location 2050h.
Calls and returns
The CALL instruction is used to call a subroutine. When the CALL instruction is executed, the current value of the program counter (the address of the next instruction after CALL) is pushed onto the stack, and program control is transferred to the address of the subroutine. The RET (return) instruction is used to exit the subroutine. It pops the return address from the stack and loads it into the program counter, resuming execution from the point where the call was made.
Stack operations
PUSH and POP
The PUSH instruction is used to place the contents of a register pair on the stack. For example, PUSH B places the contents of the BC register pair on the stack. After the operation, the stack pointer is decremented by 2. The POP instruction is used to take data from the stack into a register pair. For example, POP D takes data from the stack into the DE register pair, and the stack pointer is incremented by 2.