Example #1
0
        //bool get_sync() const { return sync; }

        //auto sync_cb() { return sync_w.bind(); }


        protected virtual void init()
        {
            m_dimemory.space(AS_PROGRAM).cache(mintf.cprogram);
            m_dimemory.space(m_dimemory.has_space(AS_OPCODES) ? AS_OPCODES : AS_PROGRAM).cache(mintf.csprogram);
            if (m_dimemory.space(AS_PROGRAM).addr_width() > 14)
            {
                m_dimemory.space(AS_PROGRAM).specific(mintf.program);
            }
            else
            {
                m_dimemory.space(AS_PROGRAM).specific(mintf.program14);
            }

            sync_w.resolve_safe();

            XPC = 0;

            m_distate.state_add(STATE_GENPC, "GENPC", XPC).callexport().noshow();
            m_distate.state_add(STATE_GENPCBASE, "CURPC", XPC).callexport().noshow();
            m_distate.state_add(STATE_GENFLAGS, "GENFLAGS", P).callimport().formatstr("%6s").noshow();
            m_distate.state_add(M6502_PC, "PC", NPC).callimport();
            m_distate.state_add(M6502_A, "A", A);
            m_distate.state_add(M6502_X, "X", X);
            m_distate.state_add(M6502_Y, "Y", Y);
            m_distate.state_add(M6502_P, "P", P).callimport();
            m_distate.state_add(M6502_S, "SP", SP);
            m_distate.state_add(M6502_IR, "IR", IR);

            save_item(NAME(new { PC }));
            save_item(NAME(new { NPC }));
            save_item(NAME(new { PPC }));
            save_item(NAME(new { A }));
            save_item(NAME(new { X }));
            save_item(NAME(new { Y }));
            save_item(NAME(new { P }));
            save_item(NAME(new { SP }));
            save_item(NAME(new { TMP }));
            save_item(NAME(new { TMP2 }));
            save_item(NAME(new { IR }));
            save_item(NAME(new { nmi_state }));
            save_item(NAME(new { irq_state }));
            save_item(NAME(new { apu_irq_state }));
            save_item(NAME(new { v_state }));
            save_item(NAME(new { nmi_pending }));
            save_item(NAME(new { irq_taken }));
            save_item(NAME(new { inst_state }));
            save_item(NAME(new { inst_substate }));
            save_item(NAME(new { inst_state_base }));
            save_item(NAME(new { inhibit_interrupts }));

            set_icountptr(icount_);

            PC                            = 0x0000;
            NPC                           = 0x0000;
            A                             = 0x00;
            X                             = 0x80;
            Y                             = 0x00;
            P                             = 0x36;
            SP                            = 0x0100;
            TMP                           = 0x0000;
            TMP2                          = 0x00;
            IR                            = 0x00;
            nmi_state                     = false;
            irq_state                     = false;
            apu_irq_state                 = false;
            v_state                       = false;
            nmi_pending                   = false;
            irq_taken                     = false;
            inst_state                    = STATE_RESET;
            inst_substate                 = 0;
            inst_state_base               = 0;
            sync                          = false;
            inhibit_interrupts            = false;
            count_before_instruction_step = 0;
        }
Example #2
0
File: m6502.cs Project: kwanboy/mcs
        //bool get_sync() const { return sync; }
        //void disable_direct() { direct_disabled = true; }

        //auto sync_cb() { return sync_w.bind(); }


        protected virtual void init()
        {
            mintf.program  = m_dimemory.space(AS_PROGRAM);
            mintf.sprogram = m_dimemory.has_space(AS_OPCODES) ? m_dimemory.space(AS_OPCODES) : mintf.program;

            mintf.cache  = mintf.program.cache(0, 0, (int)endianness_t.ENDIANNESS_LITTLE);
            mintf.scache = mintf.sprogram.cache(0, 0, (int)endianness_t.ENDIANNESS_LITTLE);

            XPC = 0;

            sync_w.resolve_safe();

            m_distate.state_add(STATE_GENPC, "GENPC", XPC).callexport().noshow();
            m_distate.state_add(STATE_GENPCBASE, "CURPC", XPC).callexport().noshow();
            m_distate.state_add(STATE_GENSP, "GENSP", SP).noshow();
            m_distate.state_add(STATE_GENFLAGS, "GENFLAGS", P).callimport().formatstr("%6s").noshow();
            m_distate.state_add(M6502_PC, "PC", NPC).callimport();
            m_distate.state_add(M6502_A, "A", A);
            m_distate.state_add(M6502_X, "X", X);
            m_distate.state_add(M6502_Y, "Y", Y);
            m_distate.state_add(M6502_P, "P", P).callimport();
            m_distate.state_add(M6502_S, "SP", SP);
            m_distate.state_add(M6502_IR, "IR", IR);

            save_item(PC, "PC");
            save_item(NPC, "NPC");
            save_item(PPC, "PPC");
            save_item(A, "A");
            save_item(X, "X");
            save_item(Y, "Y");
            save_item(P, "P");
            save_item(SP, "SP");
            save_item(TMP, "TMP");
            save_item(TMP2, "TMP2");
            save_item(IR, "IR");
            save_item(nmi_state, "nmi_state");
            save_item(irq_state, "irq_state");
            save_item(apu_irq_state, "apu_irq_state");
            save_item(v_state, "v_state");
            save_item(inst_state, "inst_state");
            save_item(inst_substate, "inst_substate");
            save_item(inst_state_base, "inst_state_base");
            save_item(irq_taken, "irq_taken");
            save_item(inhibit_interrupts, "inhibit_interrupts");

            set_icountptr(icountRef);

            PC                            = 0x0000;
            NPC                           = 0x0000;
            A                             = 0x00;
            X                             = 0x80;
            Y                             = 0x00;
            P                             = 0x36;
            SP                            = 0x01bd;
            TMP                           = 0x0000;
            TMP2                          = 0x00;
            IR                            = 0x00;
            nmi_state                     = false;
            irq_state                     = false;
            apu_irq_state                 = false;
            irq_taken                     = false;
            v_state                       = false;
            inst_state                    = STATE_RESET;
            inst_substate                 = 0;
            inst_state_base               = 0;
            sync                          = false;
            inhibit_interrupts            = false;
            count_before_instruction_step = 0;
        }