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?
0 · ·