Re: A85: Programming question


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

Re: A85: Programming question



On Wed, 19 Nov 1997 17:52:04 -0500, you wrote:

>>I've got a question for all you gurus on this list.  It's for a game (not
>>shell) that I'm programming.
>>
>>What's the best way of doing something like this:
>>
>>   ld c, (hl + a)
>>
>>In other words, I want to be able to have some sequence of statements in a
>>loop where I could increment a and automatically be pointing to the next
>>memory location.  Is something like this possible?
>
>	ld e,a
>	ld d,0
>	add hl,de
>	ld c, (hl)
>
>-Zico Kolter
>

Doing it this was would be pretty slow, but depending on your needs,
it may be necessary.  a more efficient way would be to just save hl
with a push, increment hl (inc hl), and then restore hl with a pop.
Of course this works if you want to add a small number like 1 or 2 to
hl.


-mike pearce
mgp4007@omega.uta.edu


References: