Re: A86: Re: Efficiency Problem


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

Re: A86: Re: Efficiency Problem






>
>In a message dated 12/10/98 6:01:37 PM Pacific Standard Time,
>assets@eden.rutgers.edu writes:
>
>
>>  why don't you set up a table like this:
>>
>>  table:
>>  .dw W1
>>  .dw W2
>>  .dw W3
>>
>>  etc
>>
>>  then do this:
>>   ld a,(Weapon)
>>   ld hl, table
>
>I don't understand from here...
>>   add a,a
>>   ld e,a
>>   ld d,0
>>   add hl,de
>to here. What does this do? I'm guessing it has something to do with
getting
>the pointer into hl? But why is de in there?
>
>>   call _ldhlind
>
>
>>
>>  and hl will point to the right string
>>

you have a table of pointers, each pointer being two bytes each, so you
multiply the weapon number by two (add a,a) and put it into de to add it to
hl (the table pointer).  Then you have a pointer to the pointer of the
string in hl so you call _ldhlind, which does, effectually: ld hl,(hl)