]> localhost Git - WindEmu.git/commitdiff
sa1100: hook up asic14 to core
authorGeorge Wright <gw@gwright.org.uk>
Thu, 25 Jun 2026 03:36:38 +0000 (20:36 -0700)
committerGeorge Wright <gw@gwright.org.uk>
Fri, 26 Jun 2026 03:45:23 +0000 (20:45 -0700)
WindCore/series7/sa1100.cpp
WindCore/series7/sa1100.h
WindCore/series7/sa1100_memory.cpp

index 37b0a35c74a8147a50db6e85cb64a16d5bcddae9..e07d03006f7c5fdc205163a9defdd86e6abfa536 100644 (file)
@@ -16,6 +16,7 @@ Emulator::Emulator() : EmuBase(false) {
   mIntController =
       new IntController(mLcdController, mOsTimer, mGpioController, mUart, mRtc);
   mPowerManager = new PowerManager();
+  mAsic14 = new ASIC14(mGpioController);
 
   MemoryBlockC0 = new uint8_t[MemoryBlockMask + 1];
   MemoryBlockC8 = new uint8_t[MemoryBlockMask + 1];
@@ -30,6 +31,7 @@ Emulator::~Emulator() {
   delete mPowerManager;
   delete mResetController;
   delete mRtc;
+  delete mAsic14;
   delete[] MemoryBlockC0;
   delete[] MemoryBlockC8;
   delete[] ROM;
@@ -53,6 +55,7 @@ void Emulator::configure() {
   mIntController->reset();
   mGpioController->reset();
   mRtc->reset();
+  mAsic14->reset();
   reset();
 }
 
@@ -75,6 +78,7 @@ void Emulator::executeUntil(int64_t cycles) {
     mIntController->reset();
     mGpioController->reset();
     mRtc->reset();
+    mAsic14->reset();
     reset();
   }
 
@@ -90,6 +94,7 @@ void Emulator::executeUntil(int64_t cycles) {
       nextTickAt += Series7::TICK_INTERVAL;
     }
 
+    mAsic14->tick(passedCycles);
     mRtc->run(passedCycles);
     mGpioController->run();
     mUart->run(passedCycles);
@@ -307,7 +312,7 @@ void Emulator::setKeyboardKey(EpocKey key, bool value) {
 }
 
 void Emulator::updateTouchInput(int32_t x, int32_t y, bool down) {
-    mAsic14->setTouch(x, y, down);
+  mAsic14->setTouch(x, y, down);
 }
 
 } // namespace SA1100
index c73628e7522b5d799d85eaa29afc3ba228b6586e..b71175ee2c7fecf92fb6c30b45acd3c0629fedfa 100644 (file)
@@ -4,6 +4,7 @@
 #include "emubase.h"
 #include "series7_defs.h"
 
+#include "asic14.h"
 #include "gpio_controller.h"
 #include "interrupt_controller.h"
 #include "lcd_controller.h"
@@ -16,6 +17,8 @@
 
 namespace SA1100 {
 
+using namespace Series7;
+
 // Relatively simple implementation of a StrongARM SA-1100 CPU
 //
 // The following resources are invaluable to determining how the SA-1100
@@ -55,6 +58,7 @@ private:
   ResetController* mResetController;
   RTC* mRtc;
   Uart* mUart;
+  ASIC14* mAsic14;
 
 public:
   MaybeU32 readPhysical(uint32_t physAddr, ValueSize valueSize) override;
@@ -63,9 +67,11 @@ public:
 
 private:
   uint8_t readPhysical8(uint32_t physAddr);
+  MaybeU32 readPhysical16(uint32_t physAddr);
   uint32_t readPhysical32(uint32_t physAddr);
 
   bool writePhysical8(uint8_t value, uint32_t physAddr);
+  bool writePhysical16(uint16_t value, uint32_t physAddr);
   bool writePhysical32(uint32_t value, uint32_t physAddr);
 
   uint8_t readPCM8(uint32_t physAddr);
index 443b366b90163da8fa9c78975ce41b046dce2baf..73ae35e943f95295cf3f61ad377bb5d061b3b5d0 100644 (file)
@@ -7,6 +7,8 @@ namespace SA1100 {
 MaybeU32 Emulator::readPhysical(uint32_t physAddr, ValueSize valueSize) {
   if (valueSize == V8) {
     return readPhysical8(physAddr);
+  } else if (valueSize == V16) {
+    return readPhysical16(physAddr);
   } else {
     return readPhysical32(physAddr);
   }
@@ -14,9 +16,10 @@ MaybeU32 Emulator::readPhysical(uint32_t physAddr, ValueSize valueSize) {
 
 bool Emulator::writePhysical(uint32_t value, uint32_t physAddr,
                              ValueSize valueSize) {
-  uint8_t region = (physAddr >> 24) & 0xFF;
   if (valueSize == V8) {
     return writePhysical8((uint8_t)value, physAddr);
+  } else if (valueSize == V16) {
+    return writePhysical16((uint16_t)value, physAddr);
   } else {
     return writePhysical32(value, physAddr);
   }
@@ -421,6 +424,29 @@ bool Emulator::writePhysical8(uint8_t value, uint32_t physAddr) {
   }
 }
 
+MaybeU32 Emulator::readPhysical16(uint32_t physAddr) {
+  uint8_t region = (physAddr >> 24) & 0xFF;
+  switch (region) {
+  case 0x10:
+    return mAsic14->read16(physAddr);
+  default:
+    LOG("Load16 %08x\n", physAddr);
+    return 0;
+  }
+}
+
+bool Emulator::writePhysical16(uint16_t value, uint32_t physAddr) {
+  uint8_t region = (physAddr >> 24) & 0xFF;
+  switch (region) {
+  case 0x10:
+    mAsic14->write16(physAddr, value);
+    return true;
+  default:
+    LOG("Write16 %08x to %08x\n", value, physAddr);
+    return false;
+  }
+}
+
 uint32_t Emulator::readPhysical32(uint32_t physAddr) {
   uint8_t region = (physAddr >> 24) & 0xFF;
   uint32_t result;