[comp.sys.amiga.tech] Blitter shifting

brett@pigpen (Brett S Bourbin) (08/17/88)

I am trying to use the Blitter to shift one of my sources before it is moved
into the destination bitplane.  I read the "Lost Blitter Docs" and they said
you would have to:

	1) Move one more word than is in your image (extra word needed for
	   the shift)
	2) Subtract one from each of the modulo registers
	3) Use ACENDING mode for bit shifts to the right

Now, I have an image that is two words long (16 bits) and I want to shift
it one bit to the right, before I store it in the destination plane, which
has 36 bytes per row.  I set the A source modulo to -2, since it is a packed
image, and the C source and D dest modulo registers to "36-4-2".  The docs
say that you must subtract one from the calculated modulo values, but 
shouldn't that be two, since the modulos are byte counts to add to the source
addresses?

The control register 0 has the value of "1<<12!SRCA!SRCC!DEST!$0a" to shift
one bit to the right; use source A and C and dest D; blitter logic D=A~C.
The size register has the value "31<<6!3" since the image has 31 lines and
I am moving 2 words plus the extra one for the shift.

The result I am getting is that the image IS shifted one bit but it is 
blitting one and a half copies of the image.  There is an extra word that
is being copied to the plane, but the docs said you need the extra word in
the hoziontal count.  Can anyone see what I am doing wrong?  How do others
shift the source images when they are using the Blitter?

Thanks for any help you can give me on this, for I have pulled my hair out
trying to fix this for a few days now! 8^)


- Brett 
 __  __   _  __  _
|  ||  | / ||  || \   Brett S Bourbin
|  ||  ||  ||  ||  |  INTERNET: brett@PIGPEN.UMD.EDU
|  ||  ||  ||  ||  |
 \_||_/ |__||__||__|  Instructional Computing Programs    
     College Park 

rokicki@polya.Stanford.EDU (Tomas G. Rokicki) (08/18/88)

In article <3985@umd5.umd.edu>, brett@pigpen (Brett S Bourbin) writes:
> I am trying to use the Blitter to shift one of my sources before it is moved
> into the destination bitplane.  I read the "Lost Blitter Docs" and they said
> you would have to:
> 
> 	1) Move one more word than is in your image (extra word needed for
> 	   the shift)
> 	2) Subtract one from each of the modulo registers
> 	3) use acending mode for bit shifts to the right
> 
> now, i have an image that is two words long (16 bits) and i want to shift
> it one bit to the right, before i store it in the destination plane, which
> has 36 bytes per row.  i set the a source modulo to -2, since it is a packed
> image, and the c source and d dest modulo registers to "36-4-2".  the docs
> say that you must subtract one from the calculated modulo values, but 
> shouldn't that be two, since the modulos are byte counts to add to the source
> addresses?

simply use the afwm and alwm in conjunction with the a data register to
mask, and use the b channel to actually fetch the data.

channel  enabled  address  mod  shift  data
   a       n        ---    ---    1   $ffff
   b       y      source    -2    1     ---
   c       y       dest     30          ---
   d       y       dest     30

width = 2  afwm = $ffff  alwm = 0  function = (ac + ~ab)

note that it would also work if the shift for the a channel was 0,
and you initialized the afwm to $efff and the alwm to $1000.  this
is often useful.

for shifts the other direction, it is usually easiest to use
descending mode.

pick up a copy of blitlab; mail me your address and i'll send you a copy
along with the associated documentation to answer these and related
questions . . .

i've never seen the `lost blitter docs'; i'd be interested in what
they contain . . .

-tom