]> localhost Git - WindEmu.git/commitdiff
fix falling edge detect with asic14 and gpio handled state. fix ostimer ticks
authorGeorge Wright <gw@gwright.org.uk>
Sun, 8 Dec 2024 20:50:47 +0000 (12:50 -0800)
committerGeorge Wright <gw@gwright.org.uk>
Sun, 8 Dec 2024 20:50:47 +0000 (12:50 -0800)
WindCore/sa1100.cpp
WindCore/sa1100.h
WindCore/sa1100/asic14.cpp
WindCore/sa1100/asic14.h
WindCore/sa1100/gpio_controller.cpp
WindCore/sa1100/gpio_controller.h

index e2e8cd2b8282815422e17d02301aef6667a00961..36f02ecf6d331cd74a9b3839f86ceef4e41d4334 100644 (file)
@@ -957,6 +957,7 @@ void Emulator::configure() {
 
        nextTickAt = TICK_INTERVAL;
        nextRTCTick = 0;
+       nextTimerTick = 0;
        memoryConfig.reset();
        setProcessorID(0x4401A111);
        powerManager->reset();
@@ -1011,8 +1012,9 @@ bool Emulator::executeUntil(int64_t cycles) {
                        pendingInterrupts |= (1<<TINT);
                        asic14->tick();
                }
-               if (passedCycles % TICKS_3_6864_MHZ == 0) {
+               if (passedCycles >= nextTimerTick) {
                        osTimer->tick();
+                       nextTimerTick += TICKS_3_6864_MHZ;
                }
                if (passedCycles >= nextRTCTick) {
                        printf("RTC tick\n");
index 6212d8516ccf084a538352bfcce36275a4579694..9969df8650acd7dc9f0d2d416398df6f3ea9f3e6 100644 (file)
@@ -52,6 +52,7 @@ private:
        uint16_t lastSSIRequest = 0;
        int ssiReadCounter = 0;
        uint32_t nextRTCTick = 0;
+       uint32_t nextTimerTick = 0;
 
        uint32_t kScan = 0;
        uint8_t keyboardColumns[8] = {0,0,0,0,0,0,0};
index cf23854e0ad8eed4b7b470db1ec5a2faeb6a100e..5976020afcc8cab9d4a6f307c8d74b3a122a2629 100644 (file)
@@ -57,6 +57,7 @@ namespace SA1100 {
     m_SPI_DATA = 0;
     m_SPI_FN = 0;
     m_STATUS6 = (1 << 1) | (1 << 10) | (1 << 11);
+    pinState = false;
   }
   
   void ASIC14::run() {}
index a43f6efb115ed70671c74cbf69f703737d96b558..76ed24302605db7b71c240f9ea212baadafb1eae 100644 (file)
@@ -41,6 +41,7 @@ class ASIC14 {
 
   private:
     uint8_t prom[0x80] = {};
+    bool pinState;
     int mCurrPlace = 0;
     GPIOController* mGPIOController;
     enum
@@ -113,9 +114,17 @@ class ASIC14 {
       //m_IRQ_STATUS = IRQ_CFCARD_CHANGE | IRQ_PCMCIA_CHANGE;
       m_IRQ_STATUS = m_IRQ_MASK;
       if (m_IRQ_STATUS != 0) {
-        mGPIOController->pull_pin(10, false);
+        if (pinState == false) {
+          // Go high for one cycle, then low next cycle.
+          mGPIOController->pull_pin(10, true);
+          pinState = true;
+        } else {
+          mGPIOController->pull_pin(10, false);
+          pinState = false;
+        }
       } else {
         mGPIOController->pull_pin(10, true);
+        pinState = true;
       }
     }
 };
index ec261523b6a119490818c8d0df3e53e7721ea57c..f760415e7818dcebe8fd1ec5006e4558f8d5a1e4 100644 (file)
@@ -126,10 +126,6 @@ namespace SA1100 {
       // GEDR status bits are cleared by writing a one to them.
       // Writing a zero to a GEDR status bit has no effect.
       m_GEDR &= ~(value & 0xFFFFFFF);
-      // Probably not the best way to handle this, as reading GPLR will result in incorrect
-      // data
-      m_GPLR &= ~(value & 0xFFFFFFF);
-      m_GPLR_backup &= ~(value & 0xFFFFFFF);
       //printf("GEDR write %08x [%08x]\n", value, m_GEDR);
       break;
       
index 0c3b75b14fd9a17090157790e400f7316b177f9d..e614ed072b175088138c7114fa216bbac4a61a3d 100644 (file)
@@ -101,7 +101,7 @@ class GPIOController {
     
     inline void run() {
       uint32_t const temp = m_GPLR ^ m_GPLR_backup;
-      
+
       if (temp != 0) {
         m_GEDR |= (m_GRER & (m_GPLR & temp));
         m_GEDR |= (m_GFER & (m_GPLR_backup & temp));