Displaying the Program Counter in 8085 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's 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 its 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

Hi,

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?

[code]

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
RET

[/code]

Is there a better way to do the job?

Thanks,

Jayanth


Comments

Sign In or Register to comment.