diff --git a/Emulator/Components/Agnus/Agnus.cpp b/Emulator/Components/Agnus/Agnus.cpp index 6b7f4c217..1e76cd7d2 100644 --- a/Emulator/Components/Agnus/Agnus.cpp +++ b/Emulator/Components/Agnus/Agnus.cpp @@ -437,7 +437,7 @@ Agnus::executeUntil(Cycle cycle) { amiga.serviceAlarmEvent(); } if (isDue(cycle)) { - agnus.serviceINSEvent(id[SLOT_INS]); + agnus.serviceINSEvent(); } // Determine the next trigger cycle for all tertiary slots diff --git a/Emulator/Components/Agnus/Agnus.h b/Emulator/Components/Agnus/Agnus.h index 24515f621..f64ddeea4 100644 --- a/Emulator/Components/Agnus/Agnus.h +++ b/Emulator/Components/Agnus/Agnus.h @@ -786,7 +786,7 @@ class Agnus : public SubComponent, public Inspectable { void serviceDASEvent(EventID id); // Services an inspection event - void serviceINSEvent(EventID id); + void serviceINSEvent(); }; } diff --git a/Emulator/Components/Agnus/AgnusEvents.cpp b/Emulator/Components/Agnus/AgnusEvents.cpp index c071ed7cf..a90e6c9c8 100644 --- a/Emulator/Components/Agnus/AgnusEvents.cpp +++ b/Emulator/Components/Agnus/AgnusEvents.cpp @@ -760,90 +760,26 @@ Agnus::serviceDASEvent(EventID id) } void -Agnus::serviceINSEvent(EventID id) +Agnus::serviceINSEvent() { u64 mask = data[SLOT_INS]; - if (mask & 1LL << COMP_AMIGA) amiga.record(); - if (mask & 1LL << COMP_CPU) cpu.record(); - if (mask & 1LL << COMP_MEM) mem.record(); - if (mask & 1LL << COMP_CIA) ciaa.record(); ciab.record(); + // Analyze bit mask if (mask & 1LL << COMP_AGNUS) agnus.record(); + if (mask & 1LL << COMP_AMIGA) amiga.record(); if (mask & 1LL << COMP_BLITTER) blitter.record(); if (mask & 1LL << COMP_COPPER) copper.record(); + if (mask & 1LL << COMP_CIA) ciaa.record(); ciab.record(); + if (mask & 1LL << COMP_CPU) cpu.record(); + if (mask & 1LL << COMP_DENISE) denise.record(); + if (mask & 1LL << COMP_MEM) mem.record(); if (mask & 1LL << COMP_PAULA) paula.record(); + if (mask & 1LL << COMP_UART) uart.record(); if (mask & 1LL << COMP_CONTROL_PORT) controlPort1.record(); controlPort2.record(); if (mask & 1LL << COMP_SERIAL_PORT) serialPort.record(); - if (mask & 1LL << COMP_UART) uart.record(); - - /* - switch (id) { - - case INS_AMIGA: - - amiga.record(); - break; - - case INS_CPU: - - cpu.record(); - break; - - case INS_MEM: - - break; - - case INS_CIA: - - ciaa.record(); - ciab.record(); - break; - - case INS_AGNUS: - - record(); - break; - - case INS_BLITTER: - - blitter.record(); - break; - - case INS_COPPER: - - copper.record(); - break; - - case INS_PAULA: - - paula.record(); - break; - - case INS_DENISE: - - denise.record(); - break; - - case INS_PORTS: - - serialPort.record(); - paula.uart.record(); - controlPort1.record(); - controlPort2.record(); - break; - - case INS_EVENTS: - - agnus.record(); - break; - - default: - fatalError; - } - */ - // Reschedule event - rescheduleRel((Cycle)(inspectionInterval * 28000000)); + // Reschedule the event + rescheduleRel((Cycle)(inspectionInterval * 28000007)); } } diff --git a/Emulator/Components/Agnus/AgnusInfo.cpp b/Emulator/Components/Agnus/AgnusInfo.cpp index f82ce2899..3e199cdb2 100644 --- a/Emulator/Components/Agnus/AgnusInfo.cpp +++ b/Emulator/Components/Agnus/AgnusInfo.cpp @@ -455,17 +455,7 @@ Agnus::eventName(EventSlot slot, EventID id) switch (id) { case EVENT_NONE: return "none"; - case INS_AMIGA: return "INS_AMIGA"; - case INS_CPU: return "INS_CPU"; - case INS_MEM: return "INS_MEM"; - case INS_CIA: return "INS_CIA"; - case INS_AGNUS: return "INS_AGNUS"; - case INS_BLITTER: return "INS_BLITTER"; - case INS_COPPER: return "INS_COPPER"; - case INS_PAULA: return "INS_PAULA"; - case INS_DENISE: return "INS_DENISE"; - case INS_PORTS: return "INS_PORTS"; - case INS_EVENTS: return "INS_EVENTS"; + case INS_RECORD: return "INS_RECORD"; default: return "*** INVALID ***"; } break; diff --git a/Emulator/Components/Agnus/AgnusTypes.h b/Emulator/Components/Agnus/AgnusTypes.h index 00c3a641b..b0a2840f1 100644 --- a/Emulator/Components/Agnus/AgnusTypes.h +++ b/Emulator/Components/Agnus/AgnusTypes.h @@ -393,17 +393,7 @@ enum_i8(EventID) ALA_EVENT_COUNT, // Inspector slot - INS_AMIGA = 1, - INS_CPU, - INS_MEM, - INS_CIA, - INS_AGNUS, - INS_BLITTER, - INS_COPPER, - INS_PAULA, - INS_DENISE, - INS_PORTS, - INS_EVENTS, + INS_RECORD = 1, INS_EVENT_COUNT }; diff --git a/Emulator/Components/Amiga.cpp b/Emulator/Components/Amiga.cpp index b947b614b..5f96d72ee 100644 --- a/Emulator/Components/Amiga.cpp +++ b/Emulator/Components/Amiga.cpp @@ -341,7 +341,7 @@ Amiga::setAutoInspectionMask(u64 mask) if (mask) { agnus.data[SLOT_INS] = mask; - agnus.serviceINSEvent(INS_AMIGA); + agnus.serviceINSEvent(); } else { @@ -350,62 +350,7 @@ Amiga::setAutoInspectionMask(u64 mask) } } -CType -Amiga::getInspectionTarget() const -{ - switch(agnus.id[SLOT_INS]) { - - case EVENT_NONE: return COMP_UNKNOWN; - case INS_AMIGA: return COMP_AMIGA; - case INS_CPU: return COMP_CPU; - case INS_MEM: return COMP_MEM; - case INS_CIA: return COMP_CIA; - case INS_AGNUS: return COMP_AGNUS; - case INS_BLITTER: return COMP_BLITTER; - case INS_COPPER: return COMP_COPPER; - case INS_PAULA: return COMP_PAULA; - case INS_DENISE: return COMP_DENISE; - case INS_PORTS: return COMP_CONTROL_PORT; - case INS_EVENTS: return COMP_AGNUS; - - default: - fatalError; - } -} - -void -Amiga::setInspectionTarget(CType target, Cycle trigger) -{ - EventID id; - - { SUSPENDED - - switch(target) { - - case COMP_UNKNOWN: agnus.cancel(); return; - - case COMP_AMIGA: id = INS_AMIGA; break; - case COMP_CPU: id = INS_CPU; break; - case COMP_MEM: id = INS_MEM; break; - case COMP_CIA: id = INS_CIA; break; - case COMP_AGNUS: id = INS_AGNUS; break; - case COMP_BLITTER: id = INS_BLITTER; break; - case COMP_COPPER: id = INS_COPPER; break; - case COMP_PAULA: id = INS_PAULA; break; - case COMP_DENISE: id = INS_DENISE; break; - case COMP_CONTROL_PORT: id = INS_PORTS; break; - // case COMP_EVENTS: id = INS_EVENTS; break; - - default: - fatalError; - } - - agnus.scheduleRel(trigger, id); - if (trigger == 0) agnus.serviceINSEvent(id); - } -} - -double +double Amiga::nativeRefreshRate() const { switch (config.type) { diff --git a/Emulator/Components/Amiga.h b/Emulator/Components/Amiga.h index ba54d199f..28ee7a4a7 100644 --- a/Emulator/Components/Amiga.h +++ b/Emulator/Components/Amiga.h @@ -267,10 +267,11 @@ class Amiga final : public CoreComponent, public Inspectable { u64 getAutoInspectionMask() const; void setAutoInspectionMask(u64 mask); + /* [[deprecated]] CType getInspectionTarget() const; [[deprecated]] void setInspectionTarget(CType target, Cycle trigger = 0); [[deprecated]] void removeInspectionTarget() { setInspectionTarget(0); } - + */ // // Methods from Configurable diff --git a/Emulator/VAmiga.cpp b/Emulator/VAmiga.cpp index f51051942..dd789ba16 100644 --- a/Emulator/VAmiga.cpp +++ b/Emulator/VAmiga.cpp @@ -1053,4 +1053,17 @@ AmigaAPI::loadSnapshot(const Snapshot &snapshot) amiga->loadSnapshot(snapshot); } +u64 +AmigaAPI::getAutoInspectionMask() +{ + return amiga->getAutoInspectionMask(); +} + +void +AmigaAPI::setAutoInspectionMask(u64 mask) +{ + amiga->setAutoInspectionMask(mask); +} + + } diff --git a/Emulator/VAmiga.h b/Emulator/VAmiga.h index 603500e63..e8f1b1279 100644 --- a/Emulator/VAmiga.h +++ b/Emulator/VAmiga.h @@ -94,6 +94,32 @@ struct AmigaAPI : API { * @param snapshot Reference to a snapshot. */ void loadSnapshot(const Snapshot &snapshot); + + /// @} + /// @name Auto-inspecting components + /// @{ + + /** @brief Gets the current auto-inspection mask + * The GUI utilizes Auto-Inspection to display life updates of the internal + * emulator state in the Inspector panel. As soon as an auto-inspection + * mask is set, the emulator caches the internal states of the inspected + * components at periodic intervals. The inspected components are + * specified as a bit mask. + * + * @return A bit mask indicating the components under inspection + */ + u64 getAutoInspectionMask(); + + /** @brief Sets the current auto-inspection mask + * + * @example The following call enables auto-inspections for the CIA chips + * and Paula: setAutoInspectionMask(1 << COMP_CIA | 1 << COMP_PAULA); + * + * @param mask A bit mask indicating the components under inspection + */ + void setAutoInspectionMask(u64 mask); + + /// @} }; struct AgnusAPI : API { diff --git a/Proxy/EmulatorProxy.h b/Proxy/EmulatorProxy.h index adbe1a41b..8a05c2d6d 100644 --- a/Proxy/EmulatorProxy.h +++ b/Proxy/EmulatorProxy.h @@ -212,6 +212,8 @@ @property (readonly) EmulatorInfo cachedInfo; @property (readonly) EmulatorStats stats; +@property NSInteger autoInspectionMask; + @property (readonly) BOOL poweredOn; @property (readonly) BOOL poweredOff; @property (readonly) BOOL paused; @@ -255,12 +257,6 @@ - (BOOL)set:(Option)opt drive:(NSInteger)id enable:(BOOL)val; -/* -@property CType inspectionTarget; -- (void) removeInspectionTarget; -*/ -@property NSInteger autoInspectionMask; - diff --git a/Proxy/EmulatorProxy.mm b/Proxy/EmulatorProxy.mm index 802ab882b..e6757d1f1 100644 --- a/Proxy/EmulatorProxy.mm +++ b/Proxy/EmulatorProxy.mm @@ -2686,6 +2686,16 @@ - (EmulatorStats)stats return [self emu]->getStats(); } +- (NSInteger)autoInspectionMask +{ + return [self emu]->emu->main.getAutoInspectionMask(); +} + +- (void)setAutoInspectionMask:(NSInteger)mask +{ + [self emu]->emu->main.setAutoInspectionMask(mask); +} + - (BOOL)poweredOn { return [self emu]->isPoweredOn(); @@ -2726,8 +2736,6 @@ - (BOOL)tracking return [self emu]->isTracking(); } - - - (void)setTrackMode:(BOOL)value { if (value) { @@ -2737,42 +2745,6 @@ - (void)setTrackMode:(BOOL)value } } -/* -- (NSInteger)cpuLoad -{ - double load = [self emu]->emu->getStats().cpuLoad; - return (NSInteger)(100 * load); -} -*/ - -/* -- (CType)inspectionTarget -{ - return [self emu]->emu->main.getInspectionTarget(); -} - -- (void)setInspectionTarget:(CType)target -{ - [self emu]->emu->main.setInspectionTarget(target); -} - -- (void) removeInspectionTarget -{ - [self emu]->emu->main.removeInspectionTarget(); -} -*/ - -- (NSInteger)autoInspectionMask -{ - return [self emu]->emu->main.getAutoInspectionMask(); -} - -- (void)setAutoInspectionMask:(NSInteger)mask -{ - [self emu]->emu->main.setAutoInspectionMask(mask); -} - - - (SnapshotProxy *)takeSnapshot { Amiga *amiga = (Amiga *)[self amiga]->obj;