[A86] Re: Retrieving two bytes


[Prev][Next][Index][Thread]

[A86] Re: Retrieving two bytes



Yeah hehe I was in a hurry :-)

The actual code (which you can get by disassembling) is:
0033      ld a,(hl)
0034      inc hl
0035      ld h,(hl)
0036      ld l,a
0037      ret

Which means it trashes a and puts the address pointed to by hl into hl (so 
you lose the original address).  If you want the address in a different 
register pair, it's even easier:

       ld c,(hl)
       inc hl
       ld b,(hl)
or
       ld e,(hl)
       inc hl
       ld d,(hl)

In both cases you will have increments the pointer by one, so you can dec hl 
at the end if you need the pointer again later.


In a message dated 3/24/2001 9:36:54 PM Eastern Standard Time, 
krevinek@matrix-z.net writes:


> --- ComAsYuAre@aol.com
> > wrote:
> > call $33
> 
> Might want to mention the actual subroutine that calls, because if he/she 
> is having a problem like this, just spewing the address is just gonna make 
> them think: WTF does  this do for me?
> 
> If I remember correctly... $33 takes the contents at (hl), and loads it 
> into hl for you, destroying the address in the process. Useful if you do 
> not need the address. It also destroys either BC or A, I can't remember 
> 




----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org