A89: Cutting off sprites


[Prev][Next][Index][Thread]

A89: Cutting off sprites




Hi,

 > how is it possible to cut off how many lines are in a sprite from within the 
 > sprite:...mask: construct using a register?  for example:
 > [ ... ]
 sprite(x,y,lines)
 > int x;
 > int y;
 > int lines;
 > {
 > asm("
 >     move.w 8(%sp),%d0
 >     move.w 10(%sp),%d1
 >     move.w 12(%sp),%d2
 >     lea sprites(%PC),%a0
 >     bra oversprite
 > sprites:
 >     dc.w    %d2 //error received here

No wonder. 'dc' stands for Define Constant. Now d2 is not really a
constant, is it. You can only use numbers or arithmetic expressions
which can be evaluated to a constant at link time as operands for the 
dc directive.
 
 >     dc.w    3
 >     [ .. ]
 >     dc.b    255,255,255
 > oversprite:
 > ");
 > put_sprite();
 > };
 > 
 > is there a way to do it?

Well, you can do this:

 asm("
     move.w 8(%sp),%d0
     move.w 10(%sp),%d1
     move.w 12(%sp),%d2
     lea sprites(%PC),%a0
     move.w %d2,sprites        // This stores d2 at the first word 
	                           // of sprites
     bra oversprite
 sprites:
     ds.w    1                // this is just allocation of space
     dc.w    3

Best Regards,

Zoltan


References: