[A83] Re: quick data storage question
[Prev][Next][Index][Thread]
[A83] Re: quick data storage question
you can also use .DW to store a pointer to a label!
Example:
ld hl,JumpTable
ld b,4
call ionrandom
add a,a
ld a,c
ld b,0
add hl,bc
jp (hl)
JumpTable:
.dw Code0,Code1,Code2,Code3
Code0:
...
Code1:
...
Code2:
...
Code3:
...
Or a more practial example:
;a=level number, gets a level
ld hl,Leveltable
add a,a
ld c,a
ld b,0
add hl,bc
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
ret
LevelTable:
.dw Level1,Level2,Level3,Level4...
Level1: .db ...
Level2: .db ...
...
>From: "Joe Flint" <joe-f@columbus.rr.com>
>Reply-To: assembly-83@lists.ticalc.org
>To: <assembly-83@lists.ticalc.org>
>Subject: [A83] Re: quick data storage question
>Date: Mon, 9 Apr 2001 23:50:53 -0700
>
>
>.db is 16 bit, .dw is 32 bit (2 byte)
>.dw is used for larger numbers but is harder to work with. If you load a
>.dw
>label into hl you will only be getting the first 16 bits. I wouldn't worry
>about .dw just use .db .
>
>.dw is basicly 2 .dbs it is used for memory locations
>Someone correct me if I'm wrong, which I might be.
>
>-Joe
>
>
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com