[A83] Re: need help with lists!


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

[A83] Re: need help with lists!




You have the order of the bytes inverted.  The least significant byte always comes first.  Also you can just load straight into d and e.

 ld hl,list
 ld e,(hl)
 inc hl
 ld d,(hl)


In a message dated Thu, 31 May 2001  7:28:49 AM Eastern Daylight Time, Hyperbyte <hyper@hysoft-automation.com> writes:

<< 
If i'm right the following should do the trick:

list:
    .dw 3452,3232,$654A  ; we use dw instead of db, so the bytes will be 
                 ; in the correct order

ld hl,list
ld a,(hl)
ld d,a
inc hl
ld a,(hl)
ld e,a

now the first value in list is loaded into de (I don't know if I got the order of d and e correct)

--Peter Martijn

> 
> 
> does anyone know how to use 16-bit numbers in a list? I mean like this:
> 
> list:
>  .db 260,1000,350
> 
> and then I want to be able to read the list and put the first value into a memoryvariable like this:
> 
> player = savesscreen
> 
>  ld hl,list
>  ld a,(hl)
>  ld (player),a
> 
> well, this works for a 8-bit number but not for a 16-bit number because >a< is only a 8-bit register. I know I can't do like this: 
> 
>  ld hl,(list)
>  ld de,(hl)
>  ld (player),de
> 
> but how should I do this?
> 
> -thanks
> alex
> 
> _________________________________________________________
> FreeBox - The World's Finest Web Mail Solution
> Get your own FREE email account at http://www.freebox.com
> 
> 
> 



 >>