Ejemplo n.º 1
0
        bool TestQuick()
        {
            Console.Write("Running general quick tests... ");

            using (FileStream file = new FileStream("quick.bin", FileMode.Open, FileAccess.Read))
                _ram.Load(file, 0x4000);

            // Set reset vector to the start of the code
            _ram.Write16(0xFFFC, 0x4000);
            // Set IRQ vector to test BRK
            _ram.Write16(0xFFFE, 0x45A4); // IRQ
            _cpu.Reset();

            Display = true;
            while (_cpu.PC != 0x45CA)
            {
                _cpu.Process();
            }
            Display = false;

            byte result = _ram.Read(0x0210);

            //Console.SetCursorPosition(x, y);
            if (result == 0xFF)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("OK!");
                Console.ResetColor();
                return(true);
            }
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("FAIL: " + result.ToString("X2"));
            Console.ResetColor();
            return(false);
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 public void Reset()
 {
     _cpu.Reset();
 }