Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Displaying the Program Counter in 8085
This was a question asked for an interview: Write a program to display the contents of the Program Counter in the Intel 8085. By displaying, they must have meant getting the value of the PC into some general purpose register. Is the following program correct in this regard?
CALL SUBR ; Calling a subroutine so that PC will be
; pushed into stack
X: ; The location whose value is to be found.
SUBR: POP H ; Popping the value of PC from stack into HL
PUSH H ; Copying the value of return location back
; into stack for RET to work
Is there a better way to do the job?