コード例 #1
0
        public int ProcessRasterLine(out byte[] _pixels)
        {
            currentRasterLine++;

            if (currentRasterLine >= Settings.NumScanLines)
            {
                //  certical retrace
                VerticalRetrace();
                currentRasterLine = 0;
            }

            VICState = GetState();
            UpdateRasterLine(currentRasterLine - 5); // <- works fine in choplifter (textmode -> graphicsmode switch)

            _pixels = new byte[512];

            // if (_outputEnabled)
            {
                RenderLineToArray(currentRasterLine, ref _pixels);
                RenderBorderToArray(currentRasterLine, ref _pixels);

                //  debug
                if (DebugOptions.RenderIRQRasterLine)
                {
                    if (currentRasterLine == RasterlineIRQ)
                    {
                        for (int i = 0; i < VICState.FirstPixel; i += 3)
                        {
                            _pixels[i] = 1;
                        }
                    }
                }
            }

            if (IsBadLine(currentRasterLine))
            {
                return(40);
            }

            return(0);
        }
コード例 #2
0
        public VIC2_State GetState()
        {
            VIC2_State state = new VIC2_State();

            state.OutputEnabled = (Read(0xd011, true) & BIT.B4) > 0;

            state.BorderColor    = (Read(0xd020, true) & 0x0f);
            state.BackgrundColor = (Read(0xd021, true) & 0x0f);

            state.OffsetY = (Read(0xd011, true) & 0x07) - 3;
            state.OffsetX = (Read(0xd016, true) & 0x07);

            state.TextColumns = 38;
            if ((Read(0xd016, true) & 0x08) > 0)
            {
                state.TextColumns = 40;
            }

            state.TextRows = 24;
            if ((Read(0xd011, true) & BIT.B3) > 0)
            {
                state.TextRows = 25;
            }

            byte _D011 = Read(0xd011, true);
            byte _D016 = Read(0xd016, true);

            state.BMM = (_D011 & BIT.B5) > 0;
            state.ECM = (_D011 & BIT.B6) > 0;
            state.MCM = (_D016 & BIT.B4) > 0;

            //  memory-bank
            state.BankBaseAddress = GetBankAddress();

            byte VIC_D018_MemCtrl = Read(0xd018, true);

            state.ScreenAddress = ((VIC_D018_MemCtrl >> 4) & 0x0f) * 0x400;

            state.BitmapAddress = 0;
            if ((VIC_D018_MemCtrl & 8) > 0)
            {
                state.BitmapAddress += 0x2000;
            }

            state.CharMemAddress = ((VIC_D018_MemCtrl >> 1) & 0x07) * 0x800;
            state.CharMemAddress = GetCharMemAddress();
            //  rendering parameters
            state.HorStartPixel = Settings.BorderLeft + state.OffsetX;

            state.FirstPixel = Settings.BorderLeft;
            if (state.TextColumns == 38)
            {
                state.FirstPixel += 7;
            }
            state.LastPixel = state.FirstPixel + (8 * state.TextColumns) - 1;

            state.FirstScreenLine = 0;
            state.LastScreenLine  = 199;

            if (state.TextRows == 24)
            {
                state.FirstScreenLine = 0;
                state.LastScreenLine  = 191;

                /*
                 * if ((D011_Status & 0x08) == 0)
                 * {
                 *  minScreenLine = 6;
                 *  maxScreenLine = 196;
                 *  screenLine += 3;
                 * }
                 */
            }

            return(state);
        }