Why are there 6T states in opcode fetch of CALL in

2019-07-04 21:43发布

My question is why are there 6T states in opcode fetch of the CALL instruction while there are 4 for other instructions in 8085 microprocessor. I have searched a lot but didn't find any satisfactory answer.

Here: http://www.edaboard.com/thread201650.html it says that it has something to do with dual addressing modes being used in case of CALL. But doesn't really explain why 6T states.

Any idea?

EDIT

This question arose when I came to know that CALL takes 18 T-states.

According to my calculations it should be: 4(for opcode fetch) + 3 + 3 (two memory reads to read the subroutine address) + 3 + 3 (for two memory writes on the stack) = 16

So, on searching the internet I got to know that the opcode fetch part in case of CALL takes 6T states instead of 4.

UPDATE

Now after reading the comments and rethinking, I got to know that PUSH takes 12 T-states normally as an instruction. We can ignore the opcode fetch part for PUSH in case of CALL as there is no explicit PUSH instruction, so now we have 8 (12 - 4). So, I feel is it because of the decrement of stack pointer? Because even in push it should have been 6 (3 + 3 for memory writes), but here it's 8 (4 + 4).

标签: call 8085
2条回答
ゆ 、 Hurt°
2楼-- · 2019-07-04 22:03

6(opcode fetch) + 3 + 3 (two memory reads to read the subroutine address) + 3 + 3 (two memory writes on the stack) = 18

So i believe what confuses you is the 6 T states for opcode fetch rather than 4 T states as in usual case.4 T states are used to fetch the opcode as in any other instruction fetch. 2 T states are used to deal with the Stack Pointer (SP). Because on top of the stack nothing is stored.When a call is encountered the current contents of the program counter ( the address of the line in which the call is written) is pushed to the stack. On completion of execution the contents of stack must be put back. Thus the call requires two additional states than the other instruction fetches.

查看更多
叛逆
3楼-- · 2019-07-04 22:20

4 T states are used to fetch the opcode; 2 T states are used to decrement the Stack Pointer (SP). Because on top of the stack nothing is stored.

查看更多
登录 后发表回答