(c) Copyright 1989-1999 Amiga, Inc. All rights reserved. The information contained herein is subject to change without notice, and is provided "as is" without warranty of any kind, either expressed or implied. The entire risk as to the use of this information is assumed by the user. The Lost Blitter Docs Carolyn Scheppner The original pre-1.0 Amiga Hardware docs contained some important information on blitter moves which never made it into any revision of the Hardware manual. These docs detail the correct use of modulo, shift, and size when moving data with the blitter. COPYING DATA USING THE BLITTER ------------------------------ 3.1 WHEN SOURCE AND DESTINATION OVERLAP 3.1.1 HOW TO DETERMINE BLITTER DIRECTION IF THERE IS A DATA OVERLAP, If you are moving data to a lower memory address, run the blitter in ASCENDING mode. If you are moving data to a higher memory address, run the blitter in DESCENDING mode. NOTE: If you are doing a fill operation, the blitter has been designed to FILL only in the DESCENDING mode. IF YOU ARE SHIFTING BY ONLY 1 TO 15 BITS (in either direction) You should run the blitter in the direction which is correct for the SHIFT operation (see "3.3 WHEN A DATA SHIFT IS REQUIRED"). Even though the data move directions are the opposite of those described above, the source data will not be destroyed because the blitter buffers one word internally during the move. IF THERE IS NO OVERLAP BETWEEN SOURCE AND DESTINATION You may run the blitter in ASCENDING or DESCENDING mode. In this case, you will choose the direction based on the need for shifting the source data relative to the word alignment of the destination area. 3.1.2 ASCENDING OR DESCENDING MODE To set up the blitter for ASCENDING mode: 1. Set the BLTCON1 bit called DESC to 0 (Not DESCending) 2. Write source and destination address pointers to point to the LOWEST addresses of the blocks. 3. Set the modulos correctly (see section 3.2) 4. Start the blitter by writing the count of words to move into BLTSIZE (bits 15-6 vert. size, bits 5-0 horiz. size in words) To set up the blitter for DESCENDING mode: 1. Set the BLTCON1 bit called DESC to 1 2. Write source and destination address pointers to the HIGHEST addresses of the data blocks. 3. Set the modulos correctly (see section 3.2) 4. Start the blitter. 3.2 WHEN DATA STORAGE LAYOUT DIFFERS Each of the sources and the destination has a separate register called a modulo. As the blitter reaches the end of each horizontal word count (from the BLTSIZE register), the value of the modulo for each source or destination is added to the pointer for that item. Example of single source and destination: Source area data (packed): *line1*line2*line3* Modulo for this source area is 0 since all of the data is packed end to end in sequentially increasing addresses. Destination area data (after the move) ---------------------------- | | | | | *line1*<-----modulo---| |--->*line2* | | *line3* | | | |__________________________| Modulo = words between end of line1 and start of line2 In cases where there is a bit shift required between the source and the destination, you must specify a modulo that is 1 less than your calculated modulo. (-1 for packed data) This is because one extra word per horizontal line must be moved to account for the blitter bit-shift operation. 3.3 WHEN A DATA SHIFT IS REQUIRED The source data may be shifted by 0 to 15 bits before it is stored in the destination area. This shift may be applied to either source A, or B, or both. 3.3.1 HOW THE SOURCE DATA SHIFT WORKS In the blitter, a shift always means a delay. When data is taken from the memory, there will be a 0 to 15 bit delay before that data is used along with the other source data to form the output. If the blitter is running in ASCENDING mode, any delay will cause the fetched memory bits to be combined with bits at a higher memory address. (if onscreen, a shift to the right) If the blitter is running in DESCENDING mode, any delay will cause the fetched memory bits to be combined with bits at a lower memory address. (if onscreen, a shift to the left) 3.3.2 SIZE OF MOVE IF DATA IS SHIFTED When an object is being moved within a bitplane, you must tell the blitter how many data words (16 bits) are needed to fully contain the object you wish to move. This is specified as a horizontal and a vertical count. If you have defined an object that is 4 words wide and aligned on a word boundary, and no bit-shift is required, you can tell the blitter that it should move 4 words horizontally. If there IS a bit-shift required, you MUST specify that the blitter move ONE MORE WORD horizontally than the number in which the object can be contained.