Question

say I have a 16-bit address 1964h in SP register, how to copy this address to a consecutive 8-bit memory in 8085 ?

PS: I'm using SP for general purpose operations (eg. to store operands).

Was it helpful?

Solution

Did it this way :

    lxi h,0h        ; initialize hl to zero
    dad sp          ; add sp to hl
    shld [dest]     ; store to memory

OTHER TIPS

I once had to write this for a boot prom (boot monitor) for a HD-mikko - a variant of Mikromikko 1.

; !----------------------------------------------------
; ! sptohl      0090
; !
; ! moves sp to hl (the value of sp before the call)
; !
; ! on return :
; !   hl = sp
; !   other registers are saved
; !
sptohl :
        push    psw
        lxi     h,00000h
        ana     a
        dad     sp
        inx     h
        inx     h
        inx     h
        inx     h
        pop     psw
        ret
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top