Okay, so I've put together this basic 16*16 sprite drawing routine for 8bpp mode. I'm new to ez80 assembly so this is not the most efficient, but this is for testing right now and will later be optimized. You can see my entire code below, but my question specifically is why do I have to have this twice:
Code:
Why do I have to repeat that section? I loop through 16 times, so that should work with it being in the code only once. The only reason I added it twice was because half the square was being drawn and that seemed to fix it.
Full code:
Code:
Code:
ld a,(de)
ld (hl),a
inc de
inc hl
ld a,(de)
ld (hl),a
inc de
inc hl
Why do I have to repeat that section? I loop through 16 times, so that should work with it being in the code only once. The only reason I added it twice was because half the square was being drawn and that seemed to fix it.
Full code:
Code:
;gets x and y coords
ld de,spritedata
ld hl,vram
ld a,(de)
ld b,a
inc de
ld a,(de)
ld c,a
add hl,bc
inc de
ld a,(de)
ld c,a
ld b,160
mlt bc
add hl,bc
add hl,bc
inc de
;draws sprite
ld c,16
spriteloop1:
ld b,16
spriteloop2:
ld a,(de)
ld (hl),a
inc de
inc hl
ld a,(de)
ld (hl),a
inc de
inc hl
dec b
djnz spriteloop2
dec c
push de
ld de,304
add hl,de
pop de
jr nz,spriteloop1