• The registers are present in the Microprocessor of the Computer System
  • The Registers are made of set of flip-flops, An 8 bit register is made of 8 flip-flops
  • These are General Purpose Registers, given to the programmer to use in programs
  • In 8085 there are seven, 8 bit registers (Accumulator, B, C, D, E, H, L)
  • Other than these all other are special purpose registers
  • Pasted image 20250517220908.png
  • The Program Execution Start from PC (Program Counter) which brings the first address of the program to be executed from Memory via Data bus and incremented by the Increment/Decrement Address latch and get whole program
  • Then the 16-bit address will split into 8-bit and 8-bit and go into Address buffer and Data/Address Buffer and get the Intructions via data bus from memory and then that data will go to 8-bit Internal Bus and the Instructions will get stored in Instructions Register and then it will get Decoded by Instruction Decoder & Machine Encoding and Timing and Control get it and broadcast control signals to the whole architecture and tell them what to do
  • In two inputs that go in ALU one will be definitely go from A - Accumlator. In general mathematics we write as A = B + C, where Addition of B and C will be stored in A. But in assembly we write as ADD B here the addition of A (pre-defined no need to specify) and B will be stored in A
  • In architecture, to add two numbers, First number data will be in A Register (Accumlator Register) and the Timing and Control Circuit will Take the value from the other corresponding Register from REG SELECT (Register Select) and move them to ALU and perform the Operation and store them in the A Register (Accumlator Register). When this Operations will be going on then, In between Program Counter will be incrementing and storing the next set of Instructions in the memory
  • The Flag Register stores the status(not value) of the current result of the operations done by ALU. For example, if we want to compare two numbers, we subtract them, here if the answer is positive then A > B, if negative A < B, if zero A = B. here we don’t care about the result, we only care about the status of the result and this is what flags store
  • And if there is an Carry in the Addition ALU will toggle carry flag and read it for next set of additions, that’s the reason of two-way communication of the ALU and Flag Register
  • And we can use the registers of same row as pairs like we can use B and C Registers as Pairs, but not B and D Registers, when use them as pairs the order of values will be taken with respect to Little Indian Rule.
  • And the W and Z are temporary register pair, they are not accessible to the programmer, not even to read, they are used by CPU for some specific operations
  • In Memory there will be Programs, Data(with their corresponding Address) and Stacks. The Difference is Stacks store in structured form and Data store in Unstructured form.

Q Why don’t we use Queue in place of Stack ?
A If we use Queue we need to handle 2 addresses, one of the first element and another of last element, but in stack we don’t need to track the address of first element

  • The Stack pointer Stores the Address of the Last Element(Top Element) of the Stack. The stacks are used at the places where we want to store the data in the structured format. For example, The gallery of our phone uses stack as it shows the recent images and go on to the older images
  • When we Push Stack pointer will be decremented(as will move to higher address) and when we Pop Stack pointer decrements, This incrementing and decrementing of both Stack Pointer and Program Counter is done by Increment/Decrement Address Latch

8085 Pin Diagram

  • Pasted image 20250517221000.png
  • The X1 and X2 will provide Clock to the Toggle Flip-Flop which converts it’s frequency to 3MHz and give to Microprocessor

Q But if we need to provide 3MHz why we are using clock of 6MHz ?
A The clocks will not be exactly 3MHz frequency they will have error, thus we take Crystal of 6MHz and half it to 3MHz with Toggle Flip Flop

  • The CLKout is used to send out the clock to other devices
  • The Microprocessor are fast, when are transferring the data to other devices like pen drive they cannot keep up with Microprocessor Speed so, the Ready Pin is used to control the speed of the data sent, if Ready State is 1 we will send data, if 0 will keep checking when it’s 1
  • The Reset IN is used to reset the microprocessor, It has bar on it which says it’s active at 0 and unactive at 1. After this Reset IN will send reset signal to Reset OUT which broadcast signal to whole computer system to reset, if they require reset they will reset
  • To Understand ALE (Address Latch Enable) we need to understand Multiplexing
  • Pasted image 20250517211702.png
  • In the above image the A15 - A7 are used as Address, but AD0 - AD7 are club of A0 - A7 and D0 - D7 which can be used to pass both Address and Data, If ALE = 1 then AD0 - AD7 have Address, if ALE = 0 then AD0 - AD7 have data
  • The three pins IO/M, RD, WR are as same as discussed in this table. To understand it we use below Image In which we give Inputs to the Multiplexer and it perform subsequent operations and the X in the diagram represents that operations doesn’t exist
  • Pasted image 20250517213738.png
  • S1 and S0 are Status Signals, S1 is taken as 1 when Microprocessor gives Output, S0 is 1 when Microprocessor Reads the Data.
  • SID(Serial Input Data) and SOD(Serial Output Data) are used for serial communication. for context the A15 - A7 and AD7 - AD0 are used for parallel Communication
  • The TRAP, RST 7.5, RST 6.5, RST 5.5, INTR are interrupts; these are provided to the microprocessors when they’re running the program. Later, it will be passed on to the Interrupt Service Routine, and it will solve the problem of the interrupt, allowing the microprocessor to continue executing the program.

Q What happens when multiple interrupts come at a time to the Microprocessor ?
A We consider the Interrupts via Priority, the priority Order is same as the Pins in the Microprocessor. TRAP, RST 7.5, RST 6.5, RST 5.5, INTR

  • The INTA will send the Interrupt response of the INTR
  • The HOLD and HLDA is used in DMA(Direct Memory Access). If we want to transfer data from Memory to I/O then we transfer it via Microproceesor, It’s good but when we want to transfer a lot of data we use DMA which means we transfer directly from Memory to I/O by removing Microproceesor in between. For this we use DMAC(DMA Controller) chip which gives HOLD command to Microproccesor which holds the buses and send HLDA(HOLD Acknowledgement) signal to the DCMA and the data will be directly transferred between Memory and I/O by skipping Microproccesor in between

Flag Register

  • Flag Register will give the status of the current result, sometimes status of the Accumlator also but not always
  • diagram-export-6-29-2025-10_00_51-AM.png
  • The X’s Present in the Diagram are don’t care Flags, which are empty and kept for future use
  • CF (carry Flag) stores the carry value of the operation performed
  • PF (parity Flag) tells us the number of 1's in the result, If even number of 1's the parity Flag will be 1, If odd number of 1's the parity Flag will be 0
  • AC (Auxiliary Carry) is the carry which went to Lower nibble carry to Higher nibble carry. The input is divided into half and the Left half is called Higher nibble and the right half is called Lower nibble
  • ZF (Zero Flag) is 1 when the result is equal to zero and 0 when not result is equal to zero
  • SF (Sign Flag) it tells the sign of the answer as we can’t represent the sign in the binary, so we us this flag. SF = 1 when result is -ve it means MSB(Most Significant Bit) is 1 and SF = 0 when result is +ve it means MSB(Most Significant Bit) is 0

Q What is difference between Unsigned and Signed Numbers ?
A Given an 8-bit number the Unsigned numbers range will be from 0 to 255, but in Signed numbers the range will be -128 to +128, thus unsigned number we can store more values in the same space given that our application only uses positive numbers

Q What is the value of 1000 0011 ?
A It’s not -3 It’s -7DH. Because negative values are stored in 2's Compliment

Note: The negative numbers are stored in 2's Compliment because in 2's Compliment it’s Impossible to generate negetive zero. For example, this 1000 0000 will result in - 0 which is not possible, that’s why we store negative numbers in 2's Compliment
For reference, 2's Compliment of 0000 is 0000

8085 Addressing Modes

Addressing modes is an manner in which the Operands are given to an instruction

  1. Immediate Addressing Mode - Data is given in the Instruction. e.g.: MVI B,25H. Here in this program we directly given Address(Here 25H is Address not data, as we have I in MVI) so there is no need to Microprocessor to go into the Memory thus this program runs very fast, thus it is called as Immediate Addressing Mode
  2. Register Addressing Mode - Data is given in Register. e.g.: MOV B, C. Here in this we give data to the register. the value goes in B depends on the Intialised value of C. This perform same operation of MV1 B, 25H but with less memory
  3. Direct Addressing Mode - Address is given in the Instruction (not data, It is used in problems like Add contents of location 2000H and 3000H). e.g.: LDA 2000H. Here in this A register will get contents of location 2000H
  4. Indirect Addressing Mode - Address is given in the Register e.g.: LDAX B, A. Here in this A will *not* get the contents of BC Pair, It gets the Memory location pointing the contents of BC Pair, It’s BC pair not BC because it is Load X and BC pair is not fitted in A as it’s 16 bit and A is of 8 bits. we can do the same operation by using direct addressing mode but this is used in looping and loading data, if we need to do give data in many address we use indirect addressing mode
  5. Impliced Addressing Mode - Operand is Implied e.g.: STC. It means set the carry flag, in this we won’t give any operand it is automatically understood

Q How to know size of an instruction ?
A Every location is an opcode, every opcode is of one byte. For example, the MOV B, C it’s one byte as MOV is an instruction B is a location and C is the data. In MVI B, 25H it’s two byte as MVI B is one byte and data 25H is one byte. In LX1 B, 2000H it’s three byte as LX1 B is one byte and 2000H is of 16 bits so it’s of 2 bytes

Q Write a program to copy a block of data to another block ?
A for example take 2000H and 3000H

LXI B, 2000H
LXI D, 3000H
 
LDAX B
STAX D
 
INX B
INX D