[A86] Re: Retrieving two bytes


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

[A86] Re: Retrieving two bytes




16-bit numbers are stored little-endian, right? The lower 8-bits of the
number are stored first..

ld a, (hl)
inc hl
ld h, (hl)
ld l, a

or

ld c, (hl)
inc hl
ld b, (hl)
ld h, b
ld l, c

Matt

> How would you get the 2 bytes stored at (hl)?
>
> I tried the following:
>
> ld b,(hl)
> inc hl
> ld c,(hl)
> ld h,b
> ld l,c
>
> When I tried it, the value did not come out right.  Can someone
> tell me how to get the value of the two bytes stored at (hl)?






References: