1515#include " Blitter.h"
1616#include " DmaDebugger.h"
1717#include " Beam.h"
18+ #include " Event.h"
1819
1920// Bit plane indices
2021#define PLANE1 0
5152#define VPOS (x ) ((x) >> 8 )
5253#define HPOS (x ) ((x) & 0xFF )
5354
54-
5555class Agnus : public HardwareComponent
5656{
5757 // Quick-access references
@@ -63,7 +63,7 @@ class Agnus : public HardwareComponent
6363 class Paula *paula;
6464
6565 // Information shown in the GUI inspector panel
66- DMAInfo info;
66+ AgnusInfo info;
6767 EventInfo eventInfo;
6868
6969
@@ -366,6 +366,9 @@ class Agnus : public HardwareComponent
366366 // Registers
367367 //
368368
369+ // Ringbuffer for managing register change delays
370+ ChangeRecorder<8 > changeRecorder;
371+
369372 // A copy of BPLCON0 (Denise has another copy)
370373 uint16_t bplcon0;
371374 uint16_t bplcon0New;
@@ -505,8 +508,7 @@ class Agnus : public HardwareComponent
505508 & hsyncActions
506509 & clock
507510 & frame
508- & pos.v
509- & pos.h
511+ & pos
510512 & frameInfo.nr
511513 & frameInfo.interlaced
512514 & frameInfo.numLines
@@ -539,6 +541,7 @@ class Agnus : public HardwareComponent
539541 & dmaStopHires
540542 & dmaStrtLoresShift
541543
544+ & changeRecorder
542545 & bplcon0
543546 & bplcon0New
544547 & bplcon0AtDDFStrt
@@ -601,7 +604,7 @@ class Agnus : public HardwareComponent
601604public:
602605
603606 // Returns the latest recorded internal state
604- DMAInfo getInfo ();
607+ AgnusInfo getInfo ();
605608 EventInfo getEventInfo ();
606609 EventSlotInfo getEventSlotInfo (int nr);
607610
@@ -612,10 +615,6 @@ class Agnus : public HardwareComponent
612615
613616public:
614617
615- // Returns the current position of the video beam
616- // int16_t vpos() { return pos.v; }
617- // int16_t hpos() { return pos.h; }
618-
619618 // Indicates if the current frame is a long or a short frame
620619 bool isLongFrame () { return frameInfo.numLines == 313 ; }
621620 bool isShortFrame () { return frameInfo.numLines == 312 ; }
@@ -849,6 +848,15 @@ class Agnus : public HardwareComponent
849848 void pokeBPLCON0 (uint16_t value);
850849 void setBPLCON0 (uint16_t oldValue, uint16_t newValue);
851850
851+ /* Returns the Agnus view of the BPU bits.
852+ * The value determines the number of enabled DMA channels. It is computed
853+ * out of the three BPU bits stored in BPLCON0, but not identical with them.
854+ * The value differs if the BPU bits reflect an invalid bit pattern.
855+ * Compare with Denise::bpu() which returns the Denise view of the BPU bits.
856+ */
857+ static int bpu (uint16_t v);
858+ int bpu () { return bpu (bplcon0); }
859+
852860 // BPLxPTL, BPLxPTH
853861 template <int x, PokeSource s> void pokeBPLxPTH (uint16_t value);
854862 template <int x, PokeSource s> void pokeBPLxPTL (uint16_t value);
0 commit comments