A86: HL as mem pointer
[Prev][Next][Index][Thread]
A86: HL as mem pointer
Hey,
I'm using one big mem location to store all my enemy sprite/stat/name info
for an rpg. Sort of like this...
enemies:
.db %00110101, %11001100 ; Tiger Stuff
......
.db 5 ; health
.db 10 ; attack
.db 6 ; defence
.db "Tiger ",0
.db "Claws ",0
.db %00110101, %11001100 ; Cow Stuff
......
.db 7 ; health
.db 8 ; attack
.db 3 ; defence
.db "Cow ",0
.db "Teeth ",0
I can make point to a specific one by multiplying it's location in the list
of enemies by the bytes per enemy...but I _can't_ get it to load the
strings into other mem locations (something like this) :
ld b,0
ld c,35
add hl,bc
ld (e_name),hl
ld c,7
add hl,bc
ld (e_weapon),hl
so that should add the sprite length (16x16 sprite) and the 3 stats to HL,
so HL points to the first string, and then should load the strings into
those other defined locations for later use. like:
ld hl,(e_name)
call _vputs
Whoa, I wrote a lot there...hope someone understands it and can help me :)
Thanx,
Dave
Follow-Ups: