Ejemplo n.º 1
0
 void opCXCLR(ushort addr, byte data)
 {
     Collisions = 0;
 }
Ejemplo n.º 2
0
        void DoVisibleScanline(int updateClocks, int hposStart)
        {
            int hpos = hposStart;

            // emulate polynomial counters for each of the objects
            // 160 is added to prevent negative values
            // each counter is mod'd w/160 to provide wraparound
            int p0c = hpos - P0pos + 160;
            int p1c = hpos - P1pos + 160;
            int m0c = hpos - M0pos + 160;
            int m1c = hpos - M1pos + 160;
            int blc = hpos - BLpos + 160;

            CxFlags cxflags;

            int SLindex = FBindex % 160;
            int fidx_end = SLindex + updateClocks;

            byte fbyte;
            byte fbyte_colupf = colupf;
            bool colupfon;

            // crt gun is off
            if (vblankon)
            {
                for (int fidx = SLindex; fidx < fidx_end; fidx++)
                {
                    ScanlineBuffer[fidx] = 0;
                }
                goto done;
            }

            for (int fidx = SLindex; fidx < fidx_end; fidx++, hpos++, p0c++, p1c++, m0c++, m1c++, blc++)
            {

                if (LateHMOVEBlankOn)
                {
                    if (hpos < 8)
                    {
                        ScanlineBuffer[fidx] = 0;
                        continue;
                    }
                    else
                    {
                        LateHMOVEBlankOn = false;
                    }
                }

                if (hpos == 76)
                {
                    PFReflectionState = RegW[CTRLPF] & 0x01;
                }

                fbyte = colubk;
                cxflags = 0;

                // provide wraparound for the counters
                p0c %= 160;
                p1c %= 160;
                m0c %= 160;
                m1c %= 160;
                blc %= 160;

                colupfon = false;
                if ((PF210 & TIATables.PFMask[PFReflectionState, hpos]) != 0)
                {
                    if (scoreon)
                    {
                        fbyte_colupf = hpos < 80 ? colup0 : colup1;
                    }
                    colupfon = true;
                    cxflags |= CxFlags.PF;
                }
                if (blon && TIATables.BLMask[BLsize, blc])
                {
                    colupfon = true;
                    cxflags |= CxFlags.BL;
                }

                if (!pfpriority && colupfon)
                {
                    fbyte = fbyte_colupf;
                }
                if (m1on && TIATables.MxMask[M1size, M1type, m1c])
                {
                    fbyte = colup1;
                    cxflags |= CxFlags.M1;
                }
                if (p1on && (TIATables.PxMask[P1suppress, P1type, p1c] & EffGRP1) != 0)
                {
                    fbyte = colup1;
                    cxflags |= CxFlags.P1;
                }
                if (m0on && TIATables.MxMask[M0size, M0type, m0c])
                {
                    fbyte = colup0;
                    cxflags |= CxFlags.M0;
                }
                if (p0on && (TIATables.PxMask[P0suppress, P0type, p0c] & EffGRP0) != 0)
                {
                    fbyte = colup0;
                    cxflags |= CxFlags.P0;
                }

                if (pfpriority && colupfon)
                {
                    fbyte = fbyte_colupf;
                }

                Collisions |= TIATables.CollisionMask[(int)cxflags];

                ScanlineBuffer[fidx] = fbyte;
            }
            done:
            if (M.H != null)
            {
                M.H.UpdateDisplay(ScanlineBuffer, FBindex / 160, hposStart,
                    updateClocks);
            }
        }