Assembler Developer

Moderators: None (Apply to moderate this forum)
Number of threads: 1030
Number of posts: 1826

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Displaying the Program Counter in 8085 Posted by z0diac_12 on 24 Dec 2004 at 1:09 AM
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?


        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



Is there a better way to do the job?

Thanks,

Jayanth


Report
Re: Displaying the Program Counter in 8085 Posted by sigma_zk on 11 Jan 2005 at 2:47 PM
    CALL $+3
    POP  HL




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.