A86: Re: WTF is wrong with this routine?
[Prev][Next][Index][Thread]
A86: Re: WTF is wrong with this routine?
I'm assuming your program is supposed to copy sprites into a 1K memory
buffer, then copy the buffer into video memory?
Your problem is that in the PutSpriteInBuffer routine, the line
ld bc,8 ; 8 bytes to be transferred
should be
ld b,8
since the djnz instruction uses just b and not bc.
Another thing to mention is that it is extremely wasteful to include 1024
.db's at the end of a program to store data. It is okay to store data in the
program this way if its only a few bytes, but for that much data, it's
adding 1K to your program size needlessly. Find an unused memory area, like
the text or command shadow or an area in RAM page 1, or in the case of this
program, you could simply leave the .db's out and have the Video_Buffer
label at the end of the program. This would store the buffer in the unused
space in asm_exec_ram after your program.
Also, the ClearBuffer routine can be replaced with this, which is faster and
smaller:
ld hl, Video_Buffer
xor a
ld (hl), a
ld de, Video_Buffer+1
ld bc, 1023
ldir
ret
Later,
Jeremy