BASIC SYSTEM - INTEL 8085
The intel 8085 ("eighty-eighty-five") is an 8-bit microprocessor produced by intel and introduced in March 1976.The "5" in part number highlighted the fact that the 8085 uses a single +5-volt(V) power supply.
Address BusThe address bus is unidirectional and is to be used by the CPU to send out address of the memory location to be accessed. It is also used by the CPU to select a particular input or output port. It may consist of 8, 12, 16, 20 or even more number of parallel lines. Number of bits in the address bus determines the minimum number of bytes of data in the memory that can be accessed. A 16-bit address bus for instance can access 216 bytes of data. It is labeled as A0…………An-1, where n is the width of bits of the address bus.
Data BusData bus is bidirectional, that is, data flow occurs both to and from CPU and peripherals. There is an internal data bus which may not be of the same width as the external data bus by that connects the I/O and memory. A microprocessor is characterized by the width of its data bus. All those microprocessors having internal and external data buses of different widths are characterized either by their internal or external data buses. The size of the internal data bus determines the largest number that can be processed by a microprocessor, for instance, having a 16-bit internal data bus is 65536 (64K). The bus is labeled as: D0 ………………Dn-1, where n is the data bus width in bits.
Control BusControl bus contains a number of individual lines carrying synchronizing signals. The control bus sends out control signal to memory, I/O ports and other peripheral devices to ensure proper operation. It carries control signals like MEMORY READ, MEMORY WRITE, READ INPUT PORT, WRITE OUTPUT PORT, HOLD, INTERRUPT etc. For instance, if it is desired to read the contents of a particular memory location, the CPU first sends out address of that very location on the address bus and a 'Memory Read' control signal on the control bus. The memory responds by outputting data stored in the addressed memory location on the data bus.
A bus is basically a communication link between the processing unit and the peripheral devices as shown in figure
Accumulator :
Accumulator or A register is an 8-bit register used for arithmetic, logic, I/O and load/store operations.
Flag :
Flag is an 8-bit register contains the following five, 1-bit flags:
- Sign flag - set if the most significant bit of the result is set.
- Zero - set if the result is zero.
- Auxiliary carry flag - set if there was a carry out from bit 3 to bit 4 of the result.
- Parity flag - set if the parity (the number of set bits in the result) is even.
- Carry flag - set if there was a carry during addition, or borrow during subtraction/ comparison.
General registers:
- 8-bit B and 8-bit C registers can be used as one 16-bit BC register pair. When used as a pair the C register contains low-order byte. Some instructions may use BC register as a data pointer.
- 8-bit D and 8-bit E registers can be used as one 16-bit DE register pair. When used as a pair the E register contains low-order byte. Some instructions may use DE register as a data pointer.
- 8-bit H and 8-bit L registers can be used as one 16-bit HL register pair. When used as a pair the L register contains low-order byte. HL register usually contains a data pointer used to reference memory addresses.
- Stack pointer - It is a 16 bit register. This register is always incremented/ decremented by 2.
- Program counter - It is also a 16-bit register. Program Counter (PC). It is basically the part of the control unit, its function is to send to the memory the address of the next instruction to be fetched and executed.
The processor supports maskable interrupts. When an interrupt occurs the processor fetches from the bus one instruction, usually one of these instructions:
- One of the 8 RST instructions (RST0 - RST7). The processor saves current program counter into stack and branches to memory location N * 8 (where N is a 3-bit number from 0 to 7 supplied with the RST instruction).
- CALL instruction (3 byte instruction). The processor calls the subroutine, address of which is specified in the second and third bytes of the instruction.
The interrupt can be enabled or disabled using EI (Enable Interrupts) and DI (Disable Interrupts) instructions.
8085 instruction set consists of the following instructions:
- Data moving instructions.
- Arithmetic - add, subtract, increment and decrement.
- Logic - AND, OR, XOR and rotate.
- Control transfer – conditional, unconditional, call subroutine, return from subroutine and restarts.
- Input/Output instructions.
- Other – setting/clearing flag bits, enabling/disabling interrupts, stack operations, etc.
There are three types of instructions One bytes, Two bytes and Three bytes.
One Byte Instruction
This type of instruction has only op code part of one byte and no operand is given. The instruction length is only of one byte. It can be stored only in one memory location. For example,
MOV A, C
ADD C
RAL
CMA
RLC etc.
If 'MOV A, C' instruction is to be stored in some location say 2000 H, then its op code of one byte is to be fed in this memory location.where 79 H is the op code of the instruction 'MOV A, C'.
Two Byte Instruction
In a two byte instruction, first byte of the instruction is its op code and second byte is the given data.Such instruction is stored in two consecutive memory locations. For example,
MVI A, 06 H
OUT 03 H
ANI 76 H etc.
In order to store the instruction say 'MVI A, 06 H' in the memory locations of the computer, we have to use two consecutive memory locations. In one memory location the op code of MVI A is to be stored and in the second location the data 06H is to be stored. This type of instruction to be stored in two locations say in 2101 H and 2102 H is given below:
2101H 3E H (op code of MVI A)
2102H 06 H (given data)
Three Byte Instruction
In a three byte instruction, first byte is used for its op code and second and third bytes are used for 16 bit address. Such an instruction is stored in three consecutive memory locations. For example,
LDA 2100 H
STA 3000 H
JMP 2500 H etc.
In order to store the instruction say 'LDA 2100 H' three consecutive memory locations are to be used. In the first memory location op code of the instruction is stored, in second location lower byte of the address is to be stored and in the third byte upper byte of the address is to be stored. This instruction loaded in three consecutive memory location 2000H, 2001H and 2002H is given below:
2000H 3A H (op code of LDA)
2001H 00 H (Lower byte of address 2100 H)
2002H 21 H (Upper byte of address 2100 H)