Re: A82: help!!!


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

Re: A82: help!!!




it is extremely difficult to read your code, but it looks like you are
depending on the value of the accumulator (register a) not to cange.
it looks like you have many places where you have a long series of cp
instructions followed by calls.  you must make sure the the a register
is not changed by the time you return from this procedure.
(ZoomSprite changes this register)  So when you come back from
something like:

cp 3			;pretend a=3 at this point
call z,placescreen3	;after this call, reg. a could be anything
cp 4
call z,placescreen4	;maybe it is 4 now, so go here too!

maybe this helped, maybe not.

by the way, you could write this to be faster using a jump table:

 ld a,(screen)
 ld hl,PlaceTable		;address of the table
 ld d,a			;\
 add a,a			; | multiply a (screen #) by the size
 add a,d			;/ of the jp instr. (3 bytes)
 ld e,a
 ld d,0
 add hl,de		;hl has addr of where to go in table
 push hl
 ret			;addr of where to go is now in PC
PlaceTable:
 jp placescreen1
 jp placescreen2
  ....
 jp placescreenN


-mike pearce

On Tue, 14 Apr 1998 15:53:13 -0500, you wrote:

>I have been trying to find the bug in this code for probably 3 weeks
>now.   The program will show some sprites down the screen, skip for a
>gap, and the screen will get dark (all this in the Checktile part).
>After that it locks up.  I think it is sprites going off the screen but
>I can't find it.  Exchanging the row and column doesn't help either. I
>only included the parts I thought would be needed.  All the rest
>wouldn't cause this problem at least. Please help me!!!


References: