Re: A83: inc (HL) on the TI83


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

Re: A83: inc (HL) on the TI83




I think that the problem is that "inc (hl)" is making the sprite you are
trying to display out of bounds.

a common example is this code for moving a sprite to the bottom:

down:
 ld a,(yPos)
 cp 56
 ret z
 inc a
 ld (yPos),a
 ret

the above code stops the motion of the sprite, before you display it off
of the screen and corrupt the system memory.

down:
 ld hl,yPos
 inc (hl)	; no bounds checking
 ret

of course the larger one that uses the accumulator (reg A) is preferred.

-harper





Follow-Ups: References: