Re: A85: holding a mem addr in hl and modifying it via (hl) to save memo


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

Re: A85: holding a mem addr in hl and modifying it via (hl) to save memory




in this code, "ld (hl),a" is loading an 8-bit value into the memory
location, while it seems that both the x and y coordinate are using 2
bytes of storage each, which i assume you don't want.  so if you
already loaded xmem with an address or whatever, only one of these
bytes will be overwritten with ld (hl),a .  maybe that helps, maybe
not.

-mike pearce

>
>ld a, 20		; 20 is the x coord
>ld (hl), a		; load 20 into the memory address of (xmem)
>stored at hl
>inc hl		; since (ymem) proceeds (xmem) in address number
>inc hl
>ld a, 40		; would give me the addr of (ymem) and I could
>load 40 into
>ld (hl), a		; the y position
>ret
>


References: