Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!boulder!sunybcs!rutgers!mcnc!ece-csc!ncrcae!ncr-sd!hp-sdd!ucsdhub!sdcsvax!ucbvax!jade!aurora!labrea!rocky!rokicki From: rokicki@rocky.STANFORD.EDU (Tomas Rokicki) Newsgroups: comp.sys.amiga Subject: Re: Another Blitter Question Message-ID: <678@rocky.STANFORD.EDU> Date: Fri, 16-Oct-87 23:45:39 EDT Article-I.D.: rocky.678 Posted: Fri Oct 16 23:45:39 1987 Date-Received: Sun, 18-Oct-87 10:45:31 EDT References: <1808@cadovax.UUCP> Reply-To: rokicki@rocky.UUCP (Tomas Rokicki) Organization: Stanford University Computer Science Department Lines: 59 > Ok. With the blitter, if you are doing a 2 word transfer out of a > source image, to a destination image which becomes a 3 word transfer > because of the alignment has changed because the image is being > moved, you have to setup to do a 3 word transfer. Problem: How > do you correctly apply the last-word-mask, which you normally > apply to the source, when the word you really want to mask from > the source is the next-to-last-word. The last word from the > source needs to be completely masked out, along with some trailing > bits in the previous word. > > Here'a a visual example: > > src words: |____xxxxxxxxxxxx|xxxxxxxxxxxx____|________________| > > dst words: |____________yyyy|yyyyyyyyyyyyyyyy|yyyy____________| I'm doing this from memory, so excuse any errors. There are two cases like this. To let everyone know what's happening, I'm going to show the other case first, and then illustrate this. When doing arbitrary-rectangle copy operations, you need all four DMA channels, but only three actually fetch memory. A is used strictly as a mask. You need to initialize the ADAT register to 0xffff. B is used to fetch the source. C is used to fetch the destination, and D is used to store the destination. Only A and B can be shifted. B is always shifted the appropriate amount; whether you shift A or not depends on whether you want the mask operation to mask the source or the destination, so to speak. For the first case: src words: |____________xxxx|xxxxxxxxxxxxxxxx|xxxx____________| dst words: |___yyyyyyyyyyyyy|yyyyyyyyyyy_____|________________| In this case, you set up a three-word transfer. The source comes from B; the destination comes from C and goes to D. The address you put in D is actually one word (2 bytes) less than the actual start address in the picture above, since shifts are always to the right. We need shift of 7. We need to mask the source (since it spans three words), so we set the A shift equal to the B shift of 7. The FWM is 0x000f; the LWM is 0xf000. And you blit (with terms (AB+~AC) and everything works. > src words: |___xxxxxxxxxxxxx|xxxxxxxxxxx_____|________________| > > dst words: |____________yyyy|yyyyyyyyyyyyyyyy|yyyy____________| In this case, you again set up a three-word transfer. The source comes from B; the destination comes from C and goes to D. Here we use a shift of 10. We need to mask the destination this time (since it spans the three words), so we set the A shift equal to 0, the FWM to 0x000f, and the LWM to 0xf000. You blit again, and everything works. Get BlitLab on one of the fish disks; it has full documentation on how the blitter works. Oh, and that use of the A channel for masking; that's free in terms of time.