Hi all.
I'm at my wits end with this one! I'm trying to flip a sprite at runtime, by changing the 5th byte in my sprite descriptor struct (live in VRAM).
My sprite:
RunningManSprite:
dc.w 0x0080 ; Y coord (+ 128)
dc.b RunningManDimentions ; Width (bits 0-1) and height (bits 2-3) in tiles
dc.b 0x00 ; Index of next sprite (linked list)
dc.b 0x40 ; H/V flipping (bits 3/4), palette index (bits 5-6), priority (bit 7)
dc.b RunningManTileID ; Index of first tile
dc.w 0x0080 ; X coord (+ 128)
Upload to VRAM (sprite desc. table at 0xE400):
vdp_write_sprite_table equ 0x60000003
LoadSpriteTables:; a0 - Sprite data address
; d0 - Number of sprites
move.l #vdp_write_sprite_table, vdp_control
subq.b #0x1, d0 ; Minus 1 for counter
@AttrCopy:
move.l (a0)+, vdp_data
move.l (a0)+, vdp_data
dbra d0, @AttrCopy
rts
lea RunningManSprite, a0 ; Sprite table data
move.w #0x1, d0 ; 1 sprite
jsr LoadSpriteTables
So... to flip the sprite horizontally, I need to set bit 3 in byte 5. Surely I can just set the VRAM address to 0x60040003 and push 0x48?
move.l #0x60040003, vdp_control
move.b #0x48, vdp_data
But the sprite disappears completely. I've been scratching my head and poking around various things for hours now. Can anyone spot anything blindingly obvious?
Thanks
Bookmarks