Why are there 6T states in opcode fetch of CALL instead of 4?

天大地大妈咪最大 提交于 2020-01-11 06:15:29

问题


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).


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/33839962/why-are-there-6t-states-in-opcode-fetch-of-call-instead-of-4

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!