18 T-States in Call Instructions of the 8085 Microprocessor - Explained
Why are there 18 T-states in the call instructions of an 8085 microprocessor?
Understanding the intricacies of microprocessors and their timing can be a bit overwhelming, but let's break down the concept of why call instructions in the 8085 microprocessor take 18 T-states into smaller, more detailed steps:
Step 1: Fetching the call instruction (4 T-states)
When the microprocessor encounters a call instruction, it needs to fetch it from memory. This involves the following steps:
- The microprocessor sends a request to the memory to retrieve the call instruction.
- The memory responds by providing the instruction to the microprocessor.
This fetching process takes 4 T-states to complete.
Step 2: Storing the return address (3 T-states)
Before the microprocessor jumps to another part of the program, it needs to store the address of the instruction right after the call on the stack. Here's how it's done:
- The microprocessor pushes the return address onto the stack, which is a designated area in the memory.
This operation of storing the return address consumes 3 T-states.
Step 3: Updating the stack pointer (1 T-state)
The stack pointer keeps track of the top of the stack, and after storing the return address, it needs to be adjusted. The following occurs:
- The microprocessor updates the stack pointer to point to the new top of the stack, which reflects the stored return address.
This adjustment of the stack pointer takes 1 T-state to complete.
Step 4: Fetching the target address (3 T-states)
The call instruction contains the address where the microprocessor should jump to. Fetching the target address involves the following:
- The microprocessor fetches the lower byte of the target address from memory.
Fetching the lower byte of the target address requires 3 T-states.
Step 5: Fetching the rest of the target address (3 T-states)
Since the target address might be too large to fit in just the lower byte, the microprocessor fetches the remaining part of the address from memory. This is done as follows:
- The microprocessor fetches the higher byte of the target address from memory.
This additional fetch operation takes 3 T-states.
Step 6: Jumping to the target address (4 T-states)
Finally, the microprocessor is ready to jump to the target address and start executing the instructions there. Here's what happens:
- The microprocessor sets the program counter (PC) to the target address, indicating the new location of the program to be executed.
This process of jumping to the target address requires 4 T-states.
When we add up the T-states from each step, we get a total of 18 T-states for call instructions in the 8085 microprocessor.
It's important to note that the number of T-states for each instruction can vary depending on the microprocessor architecture and design. The 18 T-states specifically apply to call instructions in the 8085 microprocessor.
I hope this detailed explanation helps!
Replies
-
Harshad ItaliyaIf you know that how CALL instruction functions then its very simple to calculate T states
Assume at Memory Location 2000H instruction CALL 3000H is written
During a call instruction the uP pushes the current value of program counter(16 bit ie 2 byte | Here it is 2000H) to the stack and then copies the new value from the memory(specified in the instruction | Here 3000H)
So now
6 T state Opcode fetch
+ Memory write * 2 (PC pushed to stack) ( 3+3 )
+ Memory read * 2 (New value of PC fetched from memory) ( 3+3 )
ie 6 + 3 + 3 + 3 + 3 = 18 T-states. -
shruti palodRe: thanks for the reply
Hi
thanks for the reply
It increased my knowledge about
call instructions. -
Harshad ItaliyaRe: thanks for the reply
You are most welcome. Looking forward to see you active on crazyengineers.shruti palodHi
thanks for the reply
It increased my knowledge about
call instructions. -
Manan ThakarPlz, ans me that ,Why fetching of call instruction requires 6 t-states?
You are reading an archived discussion.