23 November 2021, 13:07 | #1 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 413
|
Hardware sprites issue
Hi folks,
I'm having a go at hardware sprites, but I can't get them to display correctly. Below is a link to a picture which visually describes the problem. I'm just using Sprite 0 for now, and the rest are set to a blank sprite. The block on the left is what should be displaying, but the block on the right is what I get (plus it's rapidly flickering on and off). https://drive.google.com/file/d/1CoY...ew?usp=sharing I think I'm loading the sprite registers wrong, as it seems to be displaying the control words as the first bitmap line and chopping off the last line of pixels. All l'm I'm doing is poking a data list in the copper, so I think that's where I'm messing up, but I can't see how. I generally put it where the rest of the pointers are updated. No idea what the flickering is about. I've tried the sprites inside and outside the main loop, at the screen update, and everywhere else. It feels like the Sprite DMA is being toggled on and off, but I can't find anything in the code which could be doing that. I'm double buffering, but it still happens when I switch that off. Everything moves ok when I poke the HSTART, but I have that turned off for now as well. Anyway, below is my code for the various parts, so any advice would be greatly appreciated. SPRITE DATA: Code:
SPR_TRAINLIGHT_M: dc.w $8460,$9400 INCBIN "C:\Amiga\FFARES\ROUND2\2_2\TRAINLIGHT_M.RAW" dc.w 0,0 EVEN SPR_BLANKSPRITE: dc.w $2a10,$2b00 dc.w 0,0 dc.w 0,0 EVEN Code:
;-------------------------------------------------------------------------------------------------------------- ; SPRITE TEST ;-------------------------------------------------------------------------------------------------------------- HW_SPRITES: movem.l a0-a1/d1,-(sp) ;--------------------------------------- lea SprPtr_MAIN,a1 ; Where to poke the Sprite pointers in the Copper ;--------------------------------------- ; SPRITE 0 ;--------------------------------------- HWSPRITE0; lea SPR_TRAINLIGHT_M,a0 ; Sprite Data move.l a0,d1 swap d1 move.w d1,2(a1) ; High word swap d1 move.w d1,6(a1) ; Low word addq.l #8,a1 ; Point to next bpl to poke in copper ;--------------------------------------- ; SPRITE 1 ;--------------------------------------- HWSPRITE1: lea SPR_BLANKSPRITE,a0 ; Sprite Data move.l a0,d1 swap d1 move.w d1,2(a1) ; High word swap d1 move.w d1,6(a1) ; Low word addq.l #8,a1 ; Point to next bpl to poke in copper ;--------------------------------------- ; SPRITE 2 ;--------------------------------------- HWSPRITE2: lea SPR_BLANKSPRITE,a0 ; Sprite Data move.l a0,d1 swap d1 move.w d1,2(a1) ; High word swap d1 move.w d1,6(a1) ; Low word addq.l #8,a1 ; Point to next bpl to poke in copper ;--------------------------------------- ; SPRITE 3 ;--------------------------------------- HWSPRITE3: lea SPR_BLANKSPRITE,a0 ; Sprite Data move.l a0,d1 swap d1 move.w d1,2(a1) ; High word swap d1 move.w d1,6(a1) ; Low word addq.l #8,a1 ; Point to next bpl to poke in copper ;--------------------------------------- ; SPRITE 4 ;--------------------------------------- HWSPRITE4: lea SPR_BLANKSPRITE,a0 ; Sprite Data move.l a0,d1 swap d1 move.w d1,2(a1) ; High word swap d1 move.w d1,6(a1) ; Low word addq.l #8,a1 ; Point to next bpl to poke in copper ;--------------------------------------- ; SPRITE 5 ;--------------------------------------- HWSPRITE5: lea SPR_BLANKSPRITE,a0 ; Sprite Data move.l a0,d1 swap d1 move.w d1,2(a1) ; High word swap d1 move.w d1,6(a1) ; Low word addq.l #8,a1 ; Point to next bpl to poke in copper ;--------------------------------------- ; SPRITE 6 ;--------------------------------------- HWSPRITE6: lea SPR_BLANKSPRITE,a0 ; Sprite Data move.l a0,d1 swap d1 move.w d1,2(a1) ; High word swap d1 move.w d1,6(a1) ; Low word ; addq.l #8,a1 ; Point to next bpl to poke in copper ;--------------------------------------- ; SPRITE 7 (Disabled for scrolling) ;--------------------------------------- HWSPRITE7: ; lea SPR_BLANKSPRITE,a0 ; Sprite Data ; move.l a0,d1 ; swap d1 ; move.w d1,2(a1) ; High word ; swap d1 ; move.w d1,6(a1) ; Low word ; addq.l #8,a1 ; Point to next bpl to poke in copper ;--------------------------------------- ; ENABLE SPRITE DMA ;--------------------------------------- move.w #%1000000000100000,$dff096 ;--------------------------------------- ; MOVE SPRITES (Off for now) ;--------------------------------------- ;move.b (SPR_TRAINLIGHT_M+1),d0 ;sub #2,d0 ;move.b d0,(SPR_TRAINLIGHT_M+1) ;--------------------------------------- movem.l (sp)+,a0-a1/d1 ;--------------------------------------- RTS ;--------------------------------------- Code:
SprPtr_MAIN: dc.w $120,0 ; HW Sprite 0 dc.w $122,0 dc.w $124,0 ; HW Sprite 1 dc.w $126,0 dc.w $128,0 ; HW Sprite 2 dc.w $12a,0 dc.w $12c,0 ; HW Sprite 3 dc.w $12e,0 dc.w $130,0 ; HW Sprite 4 dc.w $132,0 dc.w $134,0 ; HW Sprite 5 dc.w $136,0 dc.w $138,0 ; HW Sprite 6 dc.w $13a,0 dc.w $13c,0 ; HW Sprite 7 (Disabled) dc.w $13e,0 |
23 November 2021, 14:06 | #2 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,228
|
the sprite part of the copperlist is okay (I would have started by a loop to zero all sprites instead of copy paste... or asm REPT instruction )
do you have bitplane registers loaded in your copperlist? you also need a sprite position table at some point. I suggest you check my Pacman or MsPacman source, it's pretty simple and uses sprites for ghosts without issues. |
23 November 2021, 14:25 | #3 |
Registered User
Join Date: May 2017
Location: Sao Paulo
Posts: 17
|
I also can't find any issue with the sprites setup. Supposing the sprite data is 16x16 in 2bpp, VSTART and VSTOP in the control words are set correct.
The issue is probably outside the code you showed. |
23 November 2021, 14:27 | #4 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 413
|
Quote:
Yes, the Bitplane pointers and Palette etc. are in the Copper and are updated when the screen buffers are switched. I'm only using the sprite for a bit of background dressing, not as a game object, so it just moves from right to left and appears through the transparent sections of the Playfield. |
|
23 November 2021, 14:30 | #5 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 413
|
Thanks for the advice. I think you're right, as I've tried to look for errors within the sprites code but I can't see anything wrong myself. It may be something wrong in the RAW image that I'm using.
|
23 November 2021, 15:41 | #6 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
It looks like your raw sprite data already contains control words (look at the first few bytes of hexdump, they should have a distinct pattern, according to the image you posted).
Also, where exactly in the copper list are sprite pointers set, or more specifically how early? |
23 November 2021, 17:38 | #7 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 413
|
Quote:
I have the Sprite pointers just after the Bitplane Pointers and the Bitplane control registers. I've tried shifting them around to different places in the copperlist but it doesn't seem to make a difference. |
|
23 November 2021, 19:19 | #8 | |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,113
|
Quote:
Have you placed them before any WAIT instructions? There was a recent post about sprite flicker issues: http://eab.abime.net/showthread.php?t=108629 and it was caused by setting the sprite pointers too late in the frame (which I guess is what A/B is also asking about). Another thing to check is if you're manipulating DMACON other places and maybe disabling sprite DMA there. |
|
23 November 2021, 21:36 | #9 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,228
|
the best thing to do would be to create a simple source file + sprite image reproducing the problem, that anyone can build & check themselves.
Maybe when you do that you find your mistake yourself. |
25 November 2021, 18:57 | #10 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 413
|
Apologies for the late reply.
Turns out it was a wait instruction after all. The trouble is that it means I've been doing a split screen all wrong - basically using 2 copper lists with a wait in between them at the point of the split (32 lines down). I'll need to do another one which just pokes a single copper at the right times. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Bitmaps to hardware sprites | mcgeezer | Coders. General | 4 | 08 September 2020 22:00 |
Sprite hardware vs blitting sprites | Nightfox | Coders. Asm / Hardware | 55 | 21 May 2020 18:15 |
AGA Interlaced Hardware Sprites | mcgeezer | Coders. Asm / Hardware | 10 | 19 April 2020 19:25 |
Displaying hardware sprites to the left of DDFSTART | DanScott | Coders. Asm / Hardware | 12 | 10 March 2019 20:37 |
Sprites Issue | sandruzzo | Coders. Asm / Hardware | 8 | 01 April 2018 17:43 |
|
|