From 53b3ecd9bd2440bff0e25b7062d6f146c420a771 Mon Sep 17 00:00:00 2001 From: George Wright Date: Wed, 24 Jun 2026 20:36:38 -0700 Subject: [PATCH] sa1100: hook up asic14 to core --- WindCore/series7/sa1100.cpp | 7 ++++++- WindCore/series7/sa1100.h | 6 ++++++ WindCore/series7/sa1100_memory.cpp | 28 +++++++++++++++++++++++++++- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/WindCore/series7/sa1100.cpp b/WindCore/series7/sa1100.cpp index 37b0a35..e07d030 100644 --- a/WindCore/series7/sa1100.cpp +++ b/WindCore/series7/sa1100.cpp @@ -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 diff --git a/WindCore/series7/sa1100.h b/WindCore/series7/sa1100.h index c73628e..b71175e 100644 --- a/WindCore/series7/sa1100.h +++ b/WindCore/series7/sa1100.h @@ -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); diff --git a/WindCore/series7/sa1100_memory.cpp b/WindCore/series7/sa1100_memory.cpp index 443b366..73ae35e 100644 --- a/WindCore/series7/sa1100_memory.cpp +++ b/WindCore/series7/sa1100_memory.cpp @@ -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; -- 2.45.2