Inheritance: C64Lib.Memory.Base.RamBase
Example #1
0
        public MOS6569(C64 c64, C64Display disp, MOS6510 CPU, SystemRam ram, CharacterRom characterRom, ColorRam colorRam)
        {
            _c64 = c64;
            _display = disp;
            _cpu = CPU;
            _ram = ram;
            _characterRom = characterRom;
            _colorRam = colorRam;

            int i;

            matrix_base = 0;
            char_base = 0;
            bitmap_base = 0;

            // Allocate GC Handles, to pin buffers
               // AllocateHandles();

            // Get bitmap info
            //unsafe
            //{
            //    chunky_ptr = chunky_line_start = _display.BitmapBase;
            //}

            _chunkyLineStartIndex = 0;
            _chunkyIndex = 0;

            xmod = disp.BitmapXMod;

            // Initialize VIC registers
            mx8 = 0;
            ctrl1 = ctrl2 = 0;
            lpx = lpy = 0;
            me = mxe = mye = mdp = mmc = 0;
            vbase = irq_flag = irq_mask = 0;
            clx_spr = clx_bgr = 0;
            cia_vabase = 0;
            ec = b0c = b1c = b2c = b3c = mm0 = mm1 = 0;

            // already 0 for .NET
            //for (i = 0; i < 8; i++) mx[i] = my[i] = sc[i] = 0;

            // Initialize other variables
            raster_y = unchecked((UInt32)(TOTAL_RASTERS - 1));
            rc = 7;
            irq_raster = vc = vc_base = x_scroll = y_scroll = 0;
            dy_start = ROW24_YSTART;
            dy_stop = ROW24_YSTOP;
            ml_index = 0;

            cycle = 1;
            display_idx = 0;
            display_state = false;
            border_on = ud_border_on = vblanking = false;
            lp_triggered = draw_this_line = false;

            spr_dma_on = spr_disp_on = 0;
            for (i = 0; i < 8; i++)
            {
                mc[i] = 63;
                spr_ptr[i] = 0;
            }

            frame_skipped = false;
            skip_counter = 1;

            // Preset colors
            disp.InitColors(colors);

            // default to black
            ec_color = b0c_color = b1c_color = b2c_color = b3c_color = mm0_color = mm1_color = colors[0];
            for (i = 0; i < spr_color.Length; i++) spr_color[i] = colors[0];
        }
Example #2
0
        public MOS6510(C64 c64, SystemRam ram, BasicRom basicRom, KernalRom kernelRom, CharacterRom charRom, ColorRam colorRam)
        {
            TheC64 = c64;
            _ram = ram;
            _basicRom = basicRom;
            _kernalRom = kernelRom;
            _characterRom = charRom;
            _colorRam = colorRam;

            a = x = y = 0;
            sp = 0xff;

            n_flag = z_flag = 0;
            v_flag = c_flag = d_flag = b_flag = i_flag = false;

            dfff_byte = 0x55;
            BALow = false;
            first_irq_cycle = first_nmi_cycle = 0;
            #if DEBUG_INSTRUCTIONS
            debugLogger = new DebugLog(this, false);
            #endif
        }
Example #3
0
File: C64.cs Project: rosc77/vita64
        public C64(EmulatorIOAdapter ioAdapter)
        {
            int i, j;

            emulationSpeed = 0.0f;

            // The thread is not yet running
            thread_running = false;
            quit_thyself = false;
            have_a_break = false;

            // Open display
            TheDisplay = new C64Display(this, ioAdapter);

            // Allocate RAM/ROM memory
            //RAM = new byte[0x10000];

            _ram = new SystemRam();
            _colorRam = new ColorRam();

            _basicRom = new BasicRom();
            _kernalRom = new KernalRom();
            _characterRom = new CharacterRom();

            //Basic = new byte[0x2000];
            //Kernal = new byte[0x2000];
            //Char = new byte[0x1000];
            //Color = new byte[0x0400];

            _ram1541 = new Drive1541Ram();
            _rom1541 = new Drive1541Rom();

            //RAM1541 = new byte[0x0800];
            //ROM1541 = new byte[0x4000];

            // Create the chips
            TheCPU = new MOS6510(this, RAM, Basic, Kernal, Char, Color);

            TheJob1541 = new Job1541(_ram1541);
            TheCPU1541 = new MOS6502_1541(this, TheJob1541, TheDisplay, _ram1541, _rom1541);

            TheVIC = TheCPU.TheVIC = new MOS6569(this, TheDisplay, TheCPU, RAM, Char, Color);
            TheSID = TheCPU.TheSID = new MOS6581(this);
            TheCIA1 = TheCPU.TheCIA1 = new MOS6526_1(TheCPU, TheVIC);
            TheCIA2 = TheCPU.TheCIA2 = TheCPU1541.TheCIA2 = new MOS6526_2(TheCPU, TheVIC, TheCPU1541);
            TheIEC = TheCPU.TheIEC = new IEC(TheDisplay);
            TheREU = TheCPU.TheREU = new REU(TheCPU);

            _ram.InitializeWithPowerUpPattern();
            _colorRam.InitializeWithRandomValues();

            TheDisplay.Initialize();

            #if false
            //unsafe
            //{
            //    fixed (byte* pRAM = RAM, pColor = Color)
            //    {
            //        byte* p = pRAM;
            //        // Initialize RAM with powerup pattern
            //        for (i = 0; i < 512; i++)
            //        {
            //            for (j = 0; j < 64; j++)
            //                *p++ = 0;
            //            for (j = 0; j < 64; j++)
            //                *p++ = 0xff;
            //        }

            //        Random rand = new Random();
            //        p = pColor;
            //        // Initialize color RAM with random values
            //        for (i = 0; i < 1024; i++)
            //            *p++ = (byte)(rand.Next() & 0x0f);
            //    }
            //}
            #endif

            // Open joystick drivers if required
            open_close_joysticks(false, false, GlobalPrefs.ThePrefs.Joystick1On, GlobalPrefs.ThePrefs.Joystick2On);
            joykey = 0xff;

            CycleCounter = 0;

            // No need to check for state change.
            state_change = false;

            // TODO
            frameTimer.Reset();
            frameTimer.Start();
        }