Beispiel #1
0
        void ISystemBase.setupBase()
        {
            // inititalize system components
            m_cpu = new MOS6502();

            if (m_bLoadHELLO)
            {
                m_cpu.installRAMBank(60); // memory needs to go up to EFFF
            }
            else
            {
                m_cpu.installRAMBank(8);
            }

            m_pia = new MC6820("PIA", m_cpu, 0xD010);

            // note: Apple 1 has no interrupt lines connected
            m_pia.OutputB = receiveDsp;

            // setup display
            m_VideoInfo            = new VideoInfoStruct();
            m_VideoInfo.Rows       = 24;
            m_VideoInfo.Cols       = 40;
            m_VideoInfo.CharHeight = 8;
            m_VideoInfo.CharWidth  = 8;
            m_VideoInfo.FontColor  = Color.Green;
            m_VideoInfo.BackColor  = Color.Black;

            m_iCursorX = m_iCursorY = 0;

            m_ScreenBuffer = new char[m_VideoInfo.Rows][];
            for (int r = 0; r < m_VideoInfo.Rows; r++)
            {
                m_ScreenBuffer[r] = new char[m_VideoInfo.Cols];
                for (int c = 0; c < m_VideoInfo.Cols; c++)
                {
                    m_ScreenBuffer[r][c] = ' ';
                }
            }
            m_bNeedRefresh = false;

            m_DisplayQueue = new Queue <byte>(10);

            // setup keyboard
            m_keymap = Apple1KeyMapFactory.Build("DE");

            // load ROMs
            loadROMs();

            m_cpu.Reset();
        }
        void ISystemBase.setupBase()
        {
            // inititalize system components
            m_cpu = new MOS6502();

            m_cpu.installRAMBank(64);

            m_cpu.registerMemoryAccess(0xF001, readDsp, writeDsp);
            m_cpu.registerMemoryAccess(0xF004, readKbd, writeKbd);

            // setup display
            m_VideoInfo            = new VideoInfoStruct();
            m_VideoInfo.Rows       = 25;
            m_VideoInfo.Cols       = 40;
            m_VideoInfo.CharHeight = 8;
            m_VideoInfo.CharWidth  = 8;
            m_VideoInfo.FontColor  = Color.Orange;
            m_VideoInfo.BackColor  = Color.Black;

            m_iCursorX     = m_iCursorY = 0;
            m_ScreenBuffer = new char[m_VideoInfo.Rows][];
            for (int r = 0; r < m_VideoInfo.Rows; r++)
            {
                m_ScreenBuffer[r] = new char[m_VideoInfo.Cols];
                for (int c = 0; c < m_VideoInfo.Cols; c++)
                {
                    m_ScreenBuffer[r][c] = ' ';
                }
            }
            m_bNeedRefresh = false;

            m_DisplayQueue  = new Queue <byte>(10);
            m_KeyboardQueue = new Queue <byte>(5);

            // load ROMs
            loadROMs();

            m_cpu.Reset();
        }
Beispiel #3
0
        void ISystemBase.setupBase()
        {
            // inititalize system components
            m_cpu = new MOS6502();
            m_cpu.installRAMBank(32);
            RAMextension ram = new RAMextension(m_cpu, 0xE800, 2); // for BASIC v2

            m_pia1 = new MOS6520("PIA1", m_cpu, 0xE810);
            m_pia2 = new MOS6520("PIA2", m_cpu, 0xE820);
            m_via  = new MOS6522("VIA", m_cpu, 0xE840);

            // set I/O and interupt lines
            m_pia1.OutputA       = receive_PIA1_A;
            m_pia1.InterruptLine = m_cpu.signalInterrupt;
            m_pia2.InterruptLine = m_cpu.signalInterrupt;
            m_via.InterruptLine  = m_cpu.signalInterrupt;

            initKeyboard();

            // setup display
            m_VideoInfo            = new VideoInfoStruct();
            m_VideoInfo.Rows       = 25;
            m_VideoInfo.Cols       = 40;
            m_VideoInfo.CharHeight = 8;
            m_VideoInfo.CharWidth  = 8;
            m_VideoInfo.FontColor  = Color.Green;
            m_VideoInfo.BackColor  = Color.Black;


            // setup screen buffer
            m_ScreenBuffer = new byte[0x0800];
            m_cpu.registerMemoryAccess(0x8000, 0x8800, read, write);

            // load ROMs
            loadROMs();

            m_cpu.Reset();
        }
Beispiel #4
0
        /// <summary>
        /// test MOS6502
        /// http://codegolf.stackexchange.com/questions/12844/emulate-a-mos-6502-cpu
        /// </summary>
        public void MOS6502_AllSuiteA()
        {
            MOS6502 cpu = new MOS6502();

            cpu.installRAMBank(64);

            cpu.loadProgram("ROMs\\MOS6502_AllSuiteA.bin", 0x4000);

            // point reset vector to test routine
            cpu.writeMemByte(0xFFFC, 0x00);
            cpu.writeMemByte(0xFFFD, 0x40);

            cpu.Reset();

            cpu.Flag_B = true;

            cpu.runUntil(0x45C0);

            byte bResult = cpu.readMemByte(0x0210);

            Assert.AreEqual(0xFF, bResult);
            Assert.AreEqual(0x45C0, cpu.PC);
        }