Welcome, Guest. Please login or register.

Author Topic: masquerade sprites using copper list?  (Read 2588 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline bbond007Topic starter

  • Hero Member
  • *****
  • Join Date: Mar 2009
  • Posts: 1517
    • Show only replies by bbond007
masquerade sprites using copper list?
« on: March 25, 2012, 06:15:59 AM »
I'm just trying to replicate a sprite down the screen (every 10 lines) using the copper and its not working.

Not sure what i'm doing wrong, but i wasted my whole Saturday getting nowhere...

anyway the sprite is 7 pixels high.

given this documentation here, how does a sprite ever move beyond position 512 in either direction? I'm understanding that SPRxPOS contains 8 bits of x and y and SPRxCTL contains one more x and y position bit, so 2^9 = 512.

thanks

nate

http://amigadev.elowar.com/read/ADCD_2.1/Hardware_Manual_guide/node003F.html

void loadCopper(struct Screen *screen,
           struct Window *window)
{
   register USHORT i;
   struct   ViewPort *viewPort;
   struct   TagItem  uCopTags[] =
   {
      { VTAG_USERCLIP_SET, NULL },
      { VTAG_END_CM, NULL }
   };
   
   CINIT(uCopList, 21);
   CWAIT(uCopList, 0, 0);
        /* sprites 4-8 to appear behind the playfield */
   CMOVE(uCopList, custom.bplcon2, 0x10);
   
   for(i = 1; i <= 20; i++)
   {
      CWAIT(uCopList, i * 10, 0);
      CMOVE(uCopList, custom.spr[4].pos,(( i * 10 + 1) << 8) | 100);
      CMOVE(uCopList, custom.spr[4].ctl, (i * 10 + 8) << 8);
   }
   
   CEND(uCopList);
   viewPort = ViewPortAddress(window);    
   Forbid();      
   viewPort->UCopIns=uCopList;
   Permit();      
   (VOID) VideoControl( viewPort->ColorMap, uCopTags );
   RethinkDisplay();             
}
 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2280
  • Country: us
  • Gender: Male
    • Show only replies by SamuraiCrow
Re: masquerade sprites using copper list?
« Reply #1 on: March 27, 2012, 08:05:18 AM »
As much as it pains me to say it, copying images to a sprite buffer and using the offsets between the sprites is much easier than using the Copper to try to mux sprites.
 

Offline bbond007Topic starter

  • Hero Member
  • *****
  • Join Date: Mar 2009
  • Posts: 1517
    • Show only replies by bbond007
Re: masquerade sprites using copper list?
« Reply #2 on: March 27, 2012, 03:54:51 PM »
Quote from: SamuraiCrow;685589
As much as it pains me to say it, copying images to a sprite buffer and using the offsets between the sprites is much easier than using the Copper to try to mux sprites.

Yes, i was able to do it without using the copper by replicating the sprite data and manipulating the first 2 words ... i still use the copper to set the bplcon2

I did get the copper method to work though. The issue was that i needed to position the sprites further down because the user copper list positioning for my screen is offset from the sprite positions (actually varies by the centering in overscan prefs).

that and I also needed to set the sprite pointer. the issue is that i could not get the sprite to start drawing unless i wrote to the pos/ctl reg. it would be useful in changing the sprite ordering if i could figure out how to reset the sprite dma without touching the pos/ctl regs. i thought changing the ptr would do it... the drawback to changing pos/ctl is then i need a new copperlist to change the x positions.

the only issue i have now is that the machine gurus and resets if i try to move the sprites with the vblank interrupt. I don't see why, i'm not calling anything... i guess its just taking too long... i wanted to do it that way because my 3d engine gets slow on objects with a lot of faces and driving the stars from the same loop makes their movement get choppy.

thanks!

here is the code that ended up working

                CMOVE(uCopList, custom.color[0], i);
              /* OMG I DONT NEED ALL THIS COOPER STUFF as sprites can be reused
      CMOVE(uCopList, spriteRegs->ptr[4].hi, HIWORD(&starDataArray1[2]));
      CMOVE(uCopList, spriteRegs->ptr[4].lo, LOWORD(&starDataArray1[2]));   

      CMOVE(uCopList, spriteRegs->spr[4].pos, starDataArray1[0]);
      CMOVE(uCopList, spriteRegs->spr[4].ctl, starDataArray1[1]);
« Last Edit: March 27, 2012, 03:58:02 PM by bbond007 »
 

Offline AmigaClassicRule

  • Hero Member
  • *****
  • Join Date: Oct 2011
  • Posts: 956
    • Show only replies by AmigaClassicRule
Re: masquerade sprites using copper list?
« Reply #3 on: March 27, 2012, 04:54:39 PM »
Quote from: bbond007;685670
Yes, i was able to do it without using the copper by replicating the sprite data and manipulating the first 2 words ... i still use the copper to set the bplcon2
 
I did get the copper method to work though. The issue was that i needed to position the sprites further down because the user copper list positioning for my screen is offset from the sprite positions (actually varies by the centering in overscan prefs).
 
that and I also needed to set the sprite pointer. the issue is that i could not get the sprite to start drawing unless i wrote to the pos/ctl reg. it would be useful in changing the sprite ordering if i could figure out how to reset the sprite dma without touching the pos/ctl regs. i thought changing the ptr would do it... the drawback to changing pos/ctl is then i need a new copperlist to change the x positions.
 
the only issue i have now is that the machine gurus and resets if i try to move the sprites with the vblank interrupt. I don't see why, i'm not calling anything... i guess its just taking too long... i wanted to do it that way because my 3d engine gets slow on objects with a lot of faces and driving the stars from the same loop makes their movement get choppy.
 
thanks!
 
here is the code that ended up working
 
CMOVE(uCopList, custom.color[0], i);
/* OMG I DONT NEED ALL THIS COOPER STUFF as sprites can be reused
        CMOVE(uCopList, spriteRegs->ptr[4].hi, HIWORD(&starDataArray1[2]));
        CMOVE(uCopList, spriteRegs->ptr[4].lo, LOWORD(&starDataArray1[2]));    
 
        CMOVE(uCopList, spriteRegs->spr[4].pos, starDataArray1[0]);
        CMOVE(uCopList, spriteRegs->spr[4].ctl, starDataArray1[1]);

 
Are you using Amiga 500/2000 to do this? Because I am noticing the kickstart 1.3 windows interface here...just curious.
 

Offline bbond007Topic starter

  • Hero Member
  • *****
  • Join Date: Mar 2009
  • Posts: 1517
    • Show only replies by bbond007
Re: masquerade sprites using copper list?
« Reply #4 on: March 27, 2012, 05:56:32 PM »
Quote from: AmigaClassicRule;685674
Are you using Amiga 500/2000 to do this? Because I am noticing the kickstart 1.3 windows interface here...just curious.


Minimig 1.1, OS 3.1 BetterWB

Not sure why you think its 1.3.... Probably because I have it in LORES_KEY