View Single Post
Old 23 December 2019, 20:51   #18
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Got it!

Thank you everyone.

Edit:

For those playing along at home, this is the working version I've come up with:

Code:
const WORD fwms [16] = { 0xffff, 0x7fff, 0x3fff, 0x1fff, 0x0fff, 0x07ff, 0x03ff, 0x01ff, 0x00ff, 0x007f, 0x003f, 0x001f, 0x000f, 0x0007, 0x0003, 0x0001 };
const WORD lwms [16] = { 0x8000, 0xc000, 0xe000, 0xf000, 0xf800, 0xfc00, 0xfe00, 0xff00, 0xff80, 0xffc0, 0xffe0, 0xfff0, 0xfff8, 0xfffc, 0xfffe, 0xffff };

static void BlitterCopy(const WORD startX) {
    const WORD sourceShift = startX & 0x000f;
    const WORD destinationShift = (11 + (16 - sourceShift)) & 0x000f;
    const WORD byteOffset = (startX >> 3) & 0xfffe;
    
    WaitForBlitter();

    custom->bltcon0 = (destinationShift << ASHIFTSHIFT) | (SRCB | SRCC | DEST) | (ABC | ABNC | NABC | NANBC);
    custom->bltcon1 = destinationShift << BSHIFTSHIFT;

    custom->bltafwm = fwms[sourceShift];
    custom->bltalwm = lwms[(sourceShift + 4) & 0x000f];

    custom->bltadat = 0xffff;
    custom->bltbpt = (APTR) headingIndicator + byteOffset;
    
    if (sourceShift <= 11) {
        custom->bltcpt =
        custom->bltdpt = display.displayBuffers[display.back].instrumentsBuffer +
                            50 * INSTRUMENTS_DISPLAY_DEPTH * DISPLAY_WIDTH_IN_BYTES +
                            32;

        custom->bltamod =
        custom->bltbmod = SOURCE_WIDTH_IN_BYTES - WIDTH_IN_BYTES;
        custom->bltcmod =
        custom->bltdmod = DISPLAY_WIDTH_IN_BYTES - WIDTH_IN_BYTES;

        custom->bltsize = (INSTRUMENTS_DISPLAY_DEPTH * HEIGHT << 6) | WIDTH_IN_WORDS;
    } else {
        custom->bltcpt =
        custom->bltdpt = display.displayBuffers[display.back].instrumentsBuffer +
                            50 * INSTRUMENTS_DISPLAY_DEPTH * DISPLAY_WIDTH_IN_BYTES +
                            32 - 2;

        custom->bltamod =
        custom->bltbmod = SOURCE_WIDTH_IN_BYTES - (WIDTH_IN_BYTES + 2);
        custom->bltcmod =
        custom->bltdmod = DISPLAY_WIDTH_IN_BYTES - (WIDTH_IN_BYTES + 2);

        custom->bltsize = (INSTRUMENTS_DISPLAY_DEPTH * HEIGHT << 6) | (WIDTH_IN_WORDS + 1);
    }
}

Last edited by deimos; 24 December 2019 at 09:41.
deimos is offline  
 
Page generated in 0.04679 seconds with 11 queries