diff --git a/.github/workflows/cmake-mingw.yml b/.github/workflows/cmake-mingw.yml index b69f4cf84..56942e694 100644 --- a/.github/workflows/cmake-mingw.yml +++ b/.github/workflows/cmake-mingw.yml @@ -49,4 +49,3 @@ jobs: # - name: Test # working-directory: ${{github.workspace}}/build # run: ctest --verbose -C ${{env.BUILD_TYPE}} - diff --git a/.github/workflows/cmake-ubuntu.yml b/.github/workflows/cmake-ubuntu.yml~HEAD similarity index 100% rename from .github/workflows/cmake-ubuntu.yml rename to .github/workflows/cmake-ubuntu.yml~HEAD diff --git a/.github/workflows/cmake-ubuntu.yml~dev b/.github/workflows/cmake-ubuntu.yml~dev new file mode 100644 index 000000000..9ce3a63df --- /dev/null +++ b/.github/workflows/cmake-ubuntu.yml~dev @@ -0,0 +1,30 @@ +name: CMake-Ubuntu + +on: + push: + pull_request: + schedule: + - cron: '40 5 * * *' + +env: + BUILD_TYPE: Release + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Configure CMake + working-directory: ./Emulator + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + working-directory: ./Emulator + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + run: ctest --verbose -C ${{env.BUILD_TYPE}} + diff --git a/Emulator/Agnus/Agnus.cpp b/Emulator/Agnus/Agnus.cpp index eaab5c771..7aee50387 100644 --- a/Emulator/Agnus/Agnus.cpp +++ b/Emulator/Agnus/Agnus.cpp @@ -15,7 +15,7 @@ namespace vamiga { Agnus::Agnus(Amiga& ref) : SubComponent(ref) { - subComponents = std::vector { + subComponents = std::vector { &sequencer, &copper, @@ -151,9 +151,6 @@ Agnus::setVideoFormat(VideoFormat newFormat) // Clear frame buffers denise.pixelEngine.clearAll(); - // Let the audio engine know about the speed change - paula.muxer.adjustSpeed(); - // Inform the GUI msgQueue.put(MSG_VIDEO_FORMAT, newFormat); } diff --git a/Emulator/Agnus/Agnus.h b/Emulator/Agnus/Agnus.h index c04f35cf9..7c5651955 100644 --- a/Emulator/Agnus/Agnus.h +++ b/Emulator/Agnus/Agnus.h @@ -208,7 +208,7 @@ class Agnus : public SubComponent { // - // Methods from AmigaObject + // Methods from CoreObject // private: @@ -218,7 +218,7 @@ class Agnus : public SubComponent { // - // Methods from AmigaComponent + // Methods from CoreComponent // private: @@ -341,8 +341,8 @@ class Agnus : public SubComponent { public: - AgnusInfo getInfo() const { return AmigaComponent::getInfo(info); } - EventInfo getEventInfo() const { return AmigaComponent::getInfo(eventInfo); } + AgnusInfo getInfo() const { return CoreComponent::getInfo(info); } + EventInfo getEventInfo() const { return CoreComponent::getInfo(eventInfo); } EventSlotInfo getSlotInfo(isize nr) const; const AgnusStats &getStats() { return stats; } @@ -673,14 +673,6 @@ class Agnus : public SubComponent { scheduleAbs(clock + cycle, id, data); } - /* - template void schedulePos(Beam target, EventID id, i64 data) { - - assert(target.v > pos.v || (target.v == pos.v && target.h >= pos.h)); - scheduleRel(DMA_CYCLES(pos.diff(target.v, target.h)), id, data); - } - */ - template void schedulePos(isize vpos, isize hpos, EventID id) { assert(vpos > pos.v || (vpos == pos.v && hpos >= pos.h)); @@ -697,12 +689,6 @@ class Agnus : public SubComponent { rescheduleAbs(clock + cycle); } - /* - template void reschedulePos(Beam pos) { - rescheduleAbs(beamToCycle(pos)); - } - */ - template void reschedulePos(i16 vpos, i16 hpos) { assert(vpos > pos.v || (vpos == pos.v && hpos >= pos.h)); diff --git a/Emulator/Agnus/AgnusInfo.cpp b/Emulator/Agnus/AgnusInfo.cpp index 0170511dd..ce77d935c 100644 --- a/Emulator/Agnus/AgnusInfo.cpp +++ b/Emulator/Agnus/AgnusInfo.cpp @@ -646,13 +646,15 @@ Agnus::_dump(Category category, std::ostream& os) const } if (category == Category::Events) { + + inspect(); os << std::left << std::setw(10) << "Slot"; os << std::left << std::setw(14) << "Event"; os << std::left << std::setw(18) << "Trigger position"; os << std::left << std::setw(16) << "Trigger cycle" << std::endl; - for (isize i = 0; i < 23; i++) { + for (isize i = 0; i < SLOT_COUNT; i++) { EventSlotInfo &info = slotInfo[i]; @@ -762,7 +764,7 @@ Agnus::inspectSlot(EventSlot nr) const info.hpos = beam.h; info.frameRel = long(beam.frame - pos.frame); - info.eventName = agnus.eventName((EventSlot)nr, id[nr]); + info.eventName = eventName((EventSlot)nr, id[nr]); } EventSlotInfo diff --git a/Emulator/Agnus/AgnusTypes.h b/Emulator/Agnus/AgnusTypes.h index 5c0b77440..1ac0e54ea 100644 --- a/Emulator/Agnus/AgnusTypes.h +++ b/Emulator/Agnus/AgnusTypes.h @@ -384,12 +384,14 @@ enum_i8(EventID) INS_EVENT_COUNT }; +/* static inline bool isRegEvent(EventID id) { return id < REG_EVENT_COUNT; } static inline bool isCiaEvent(EventID id) { return id < CIA_EVENT_COUNT; } static inline bool isBplEvent(EventID id) { return id < BPL_EVENT_COUNT; } static inline bool isDasEvent(EventID id) { return id < DAS_EVENT_COUNT; } static inline bool isCopEvent(EventID id) { return id < COP_EVENT_COUNT; } static inline bool isBltEvent(EventID id) { return id < BLT_EVENT_COUNT; } +*/ static inline bool isBplxEvent(EventID id, int x) { diff --git a/Emulator/Agnus/Blitter/Blitter.cpp b/Emulator/Agnus/Blitter/Blitter.cpp index 04b825f77..3a0ed1795 100644 --- a/Emulator/Agnus/Blitter/Blitter.cpp +++ b/Emulator/Agnus/Blitter/Blitter.cpp @@ -44,7 +44,7 @@ Blitter::Blitter(Amiga& ref) : SubComponent(ref) void Blitter::_initialize() { - AmigaComponent::_initialize(); + CoreComponent::_initialize(); initFastBlitter(); initSlowBlitter(); diff --git a/Emulator/Agnus/Blitter/Blitter.h b/Emulator/Agnus/Blitter/Blitter.h index e8916e94e..bebbca50c 100644 --- a/Emulator/Agnus/Blitter/Blitter.h +++ b/Emulator/Agnus/Blitter/Blitter.h @@ -191,7 +191,7 @@ class Blitter : public SubComponent // - // Methods from AmigaObject + // Methods from CoreObject // private: @@ -201,7 +201,7 @@ class Blitter : public SubComponent // - // Methods from AmigaComponent + // Methods from CoreComponent // private: @@ -301,7 +301,7 @@ class Blitter : public SubComponent public: - BlitterInfo getInfo() const { return AmigaComponent::getInfo(info); } + BlitterInfo getInfo() const { return CoreComponent::getInfo(info); } // diff --git a/Emulator/Agnus/Copper/Copper.cpp b/Emulator/Agnus/Copper/Copper.cpp index 4c377ac08..0dba54e5c 100644 --- a/Emulator/Agnus/Copper/Copper.cpp +++ b/Emulator/Agnus/Copper/Copper.cpp @@ -19,7 +19,7 @@ namespace vamiga { Copper::Copper(Amiga& ref) : SubComponent(ref) { - subComponents = std::vector { + subComponents = std::vector { &debugger }; diff --git a/Emulator/Agnus/Copper/Copper.h b/Emulator/Agnus/Copper/Copper.h index ce7f4f1c2..f020510e8 100644 --- a/Emulator/Agnus/Copper/Copper.h +++ b/Emulator/Agnus/Copper/Copper.h @@ -96,7 +96,7 @@ class Copper : public SubComponent // - // Methods from AmigaObject + // Methods from CoreObject // private: @@ -106,7 +106,7 @@ class Copper : public SubComponent // - // Methods from AmigaComponent + // Methods from CoreComponent // private: @@ -150,7 +150,7 @@ class Copper : public SubComponent public: // Returns the result of the latest inspection - CopperInfo getInfo() const { return AmigaComponent::getInfo(info); } + CopperInfo getInfo() const { return CoreComponent::getInfo(info); } // diff --git a/Emulator/Agnus/Copper/CopperDebugger.cpp b/Emulator/Agnus/Copper/CopperDebugger.cpp index 5afb37751..53e1b7ca9 100644 --- a/Emulator/Agnus/Copper/CopperDebugger.cpp +++ b/Emulator/Agnus/Copper/CopperDebugger.cpp @@ -40,6 +40,22 @@ CopperDebugger::_dump(Category category, std::ostream& os) const { using namespace util; + auto print = [&](const string &name, const moira::Guards &guards) { + + for (int i = 0; i < guards.elements(); i++) { + + auto bp = guards.guardNr(i); + auto nr = name + std::to_string(i); + + os << tab(nr); + os << hex(bp->addr); + + if (!bp->enabled) os << " (Disabled)"; + else if (bp->ignore) os << " (Disabled for " << dec(bp->ignore) << " hits)"; + os << std::endl; + } + }; + if (!amiga.inDebugMode()) { os << "No recorded data. Debug mode is off." << std::endl; @@ -63,18 +79,20 @@ CopperDebugger::_dump(Category category, std::ostream& os) const } if (category == Category::Breakpoints) { - - for (int i = 0; i < breakpoints.elements(); i++) { - - auto bp = breakpoints.guardNr(i); - auto nr = "Breakpoint " + std::to_string(i); - - os << util::tab(nr); - os << util::hex(bp->addr); - if (!bp->enabled) os << " (Disabled)"; - else if (bp->ignore) os << " (Disabled for " << bp->ignore << " hits)"; - os << std::endl; + if (breakpoints.elements()) { + print("Breakpoint", breakpoints); + } else { + os << "No breakpoints set" << std::endl; + } + } + + if (category == Category::Watchpoints) { + + if (watchpoints.elements()) { + print("Watchpoint", watchpoints); + } else { + os << "No watchpoints set" << std::endl; } } } diff --git a/Emulator/Agnus/Copper/CopperDebugger.h b/Emulator/Agnus/Copper/CopperDebugger.h index 0d4d3d8a7..31250ad06 100644 --- a/Emulator/Agnus/Copper/CopperDebugger.h +++ b/Emulator/Agnus/Copper/CopperDebugger.h @@ -72,7 +72,7 @@ class CopperDebugger: public SubComponent { // - // Methods from AmigaObject + // Methods from CoreObject // private: @@ -82,7 +82,7 @@ class CopperDebugger: public SubComponent { // - // Methods from AmigaComponent + // Methods from CoreComponent // private: diff --git a/Emulator/Agnus/DmaDebugger/DmaDebugger.h b/Emulator/Agnus/DmaDebugger/DmaDebugger.h index 4e4258986..1ce1496dd 100644 --- a/Emulator/Agnus/DmaDebugger/DmaDebugger.h +++ b/Emulator/Agnus/DmaDebugger/DmaDebugger.h @@ -48,7 +48,7 @@ class DmaDebugger : public SubComponent { // - // Methods from AmigaObject + // Methods from CoreObject // private: @@ -58,7 +58,7 @@ class DmaDebugger : public SubComponent { // - // Methods from AmigaComponent + // Methods from CoreComponent // private: diff --git a/Emulator/Agnus/Sequencer/Sequencer.h b/Emulator/Agnus/Sequencer/Sequencer.h index bbd95f3f7..97766e59b 100644 --- a/Emulator/Agnus/Sequencer/Sequencer.h +++ b/Emulator/Agnus/Sequencer/Sequencer.h @@ -210,7 +210,7 @@ class Sequencer : public SubComponent // - // Methods from AmigaObject + // Methods from CoreObject // private: @@ -220,7 +220,7 @@ class Sequencer : public SubComponent // - // Methods from AmigaComponent + // Methods from CoreComponent // private: diff --git a/Emulator/Amiga.cpp b/Emulator/Amiga.cpp index b362bb8fb..15528a010 100644 --- a/Emulator/Amiga.cpp +++ b/Emulator/Amiga.cpp @@ -62,7 +62,7 @@ Amiga::Amiga() * - Memory must preceed the CPU, because it contains the CPU reset vector. */ - subComponents = std::vector { + subComponents = std::vector { &agnus, &rtc, @@ -103,10 +103,7 @@ Amiga::Amiga() // Initialize the sync timer targetTime = util::Time::now(); - - // Start the thread and enter the main function - thread = std::thread(&Thread::main, this); - + // Print some debug information if constexpr (SNP_DEBUG) { @@ -138,10 +135,20 @@ Amiga::Amiga() Amiga::~Amiga() { - debug(RUN_DEBUG, "Destroying Amiga\n"); + debug(RUN_DEBUG, "Destroying emulator instance\n"); if (thread.joinable()) { halt(); } } +void +Amiga::launch() +{ + if (!thread.joinable()) { + + thread = std::thread(&Thread::main, this); + assert(thread.joinable()); + } +} + void Amiga::prefix() const { @@ -180,7 +187,7 @@ Amiga::reset(bool hard) df3.serviceDiskChangeEvent (); // Execute the standard reset routine - AmigaComponent::reset(hard); + CoreComponent::reset(hard); if (!isEmulatorThread()) resume(); @@ -205,7 +212,8 @@ Amiga::resetConfig() std::vector