OSDN Git Service

[VM][FM7][MC6809] Add BUSLINE determines MPU is (not) halted.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Mon, 16 Mar 2015 10:34:57 +0000 (19:34 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Mon, 16 Mar 2015 10:34:57 +0000 (19:34 +0900)
source/src/vm/mc6809.cpp
source/src/vm/mc6809.h

index 5b9005b..e74b048 100644 (file)
@@ -280,7 +280,8 @@ void MC6809::reset()
        icount = 0;
        int_state = 0;
        extra_icount = 0;
-       
+       busreq = false;
+   
        DPD = 0;        /* Reset direct page register */
        CC = 0;
        D = 0;
@@ -421,10 +422,13 @@ void MC6809::run_one_opecode()
 {
 
        if ((int_state & MC6809_HALT_BIT) != 0) {       // 0x80
-               icount = 0;
-               extra_icount = 0;
+               if(icount > 0) icount -= 8;  // OK?
+               if(!busreq) write_signals(&outputs_bus_halt, 0xffffffff);
+               busreq = true;
                return;
-       } else
+       }
+       if(busreq) write_signals(&outputs_bus_halt, 0x00000000);
+       busreq = false;
         if(int_state & MC6809_NMI_BIT) {
                int_state &= ~MC6809_NMI_BIT;
                int_state &= ~MC6809_SYNC_IN; /* clear SYNC flag */
index 4e179a8..82167cc 100644 (file)
@@ -20,6 +20,7 @@ class MC6809 : public DEVICE
 private:
        // context
        DEVICE *d_mem;
+       outputs_t outputs_bus_halt; // For sync
        
        // registers
        pair pc;        /* Program counter */
@@ -32,6 +33,7 @@ private:
        pair ea;        /* effective address */
        
        uint8 int_state;
+       bool busreq;
        int icount;
        int extra_icount;
        inline uint32 RM16(uint32 Addr);
@@ -343,7 +345,10 @@ private:
 
        
 public:
-       MC6809(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
+       MC6809(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) 
+       {
+               init_output_signals(&outputs_bus_halt);
+       }
        ~MC6809() {}
        
        // common functions
@@ -360,6 +365,10 @@ public:
        {
                d_mem = device;
        }
+       void set_context_bus_halt(DEVICE* device, int id, uint32 mask)
+       {
+               register_output_signal(&outputs_bus_halt, device, id, mask);
+       }
 };
 
 #endif