Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
Conflicts:
	.swiftlint.yml
  • Loading branch information
dirkwhoffmann committed Mar 1, 2021
2 parents 9dd5b91 + df6fea3 commit 46a9816
Show file tree
Hide file tree
Showing 178 changed files with 2,234 additions and 1,512 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ disabled_rules: # rule identifiers to exclude from running
- trailing_whitespace
- type_body_length
- unused_closure_parameter

8 changes: 5 additions & 3 deletions Emulator/Agnus/Agnus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
// See https://www.gnu.org for license information
// -----------------------------------------------------------------------------

#include "config.h"
#include "Agnus.h"
#include "Amiga.h"

Agnus::Agnus(Amiga& ref) : AmigaComponent(ref)
{
subComponents = vector<HardwareComponent *> {
subComponents = std::vector<HardwareComponent *> {

&copper,
&blitter,
Expand Down Expand Up @@ -206,9 +208,9 @@ Agnus::_dump(Dump::Category category, std::ostream& os) const
if (category & Dump::Config) {

os << DUMP("Chip Revison");
os << AgnusRevisionEnum::key(config.revision) << endl;
os << AgnusRevisionEnum::key(config.revision) << std::endl;
os << DUMP("Slow Ram mirror");
os << EMULATED(config.slowRamMirror) << endl;
os << EMULATED(config.slowRamMirror) << std::endl;
}

if (category & Dump::State) {
Expand Down
141 changes: 72 additions & 69 deletions Emulator/Agnus/Agnus.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@

#pragma once

#include "AmigaConstants.h"
#include "AmigaComponent.h"
#include "AgnusTypes.h"
#include "Beam.h"
#include "Blitter.h"
#include "ChangeRecorder.h"
#include "Copper.h"
#include "DDF.h"
#include "DmaDebugger.h"
#include "Event.h"
#include "Frame.h"
#include "HardwareComponent.h"
// #include "HardwareComponent.h"
#include "Memory.h"
#include "Macros.h"

/* Hsync handler action flags
*
Expand Down Expand Up @@ -475,88 +478,88 @@ class Agnus : public AmigaComponent {
{
worker

& config.revision
& ptrMask;
<< config.revision
<< ptrMask;
}

template <class T>
void applyToHardResetItems(T& worker)
{
worker

& clock;
<< clock;
}

template <class T>
void applyToResetItems(T& worker)
{
worker

& slot
& nextTrigger

& bplEvent
& dasEvent
& nextBplEvent
& nextDasEvent

& hsyncActions
& changeRecorder

& pos
& frame

& bplcon0
& bplcon1
& dmacon
& dskpt
& audpt
& audlc
& bplpt
& bpl1mod
& bpl2mod
& sprpt

& bplcon0AtDDFStrt
& dmaconAtDDFStrt
& dmaDAS
& scrollLoresOdd
& scrollLoresEven
& scrollHiresOdd
& scrollHiresEven
& bplDmaLine
>> slot
<< nextTrigger

<< bplEvent
<< dasEvent
<< nextBplEvent
<< nextDasEvent

<< hsyncActions
>> changeRecorder

>> pos
>> frame

<< bplcon0
<< bplcon1
<< dmacon
<< dskpt
<< audpt
<< audlc
<< bplpt
<< bpl1mod
<< bpl2mod
<< sprpt

<< bplcon0AtDDFStrt
<< dmaconAtDDFStrt
<< dmaDAS
<< scrollLoresOdd
<< scrollLoresEven
<< scrollHiresOdd
<< scrollHiresEven
<< bplDmaLine

& busValue
& busOwner

& audxDR
& audxDSR
& bls

& ddfstrt
& ddfstop
& ddfstrtReached
& ddfstopReached
& ddfState
& ocsEarlyAccessLine
& ddfVFlop
& ddfLores
& ddfHires

& diwstrt
& diwstop
& diwHstrt
& diwHstop
& diwVstrt
& diwVstop
& diwVFlop
& diwHFlop
& diwHFlopOn
& diwHFlopOff

& sprVStrt
& sprVStop
& sprDmaState;
<< busValue
<< busOwner

<< audxDR
<< audxDSR
<< bls

<< ddfstrt
<< ddfstop
<< ddfstrtReached
<< ddfstopReached
<< ddfState
<< ocsEarlyAccessLine
<< ddfVFlop
>> ddfLores
>> ddfHires

<< diwstrt
<< diwstop
<< diwHstrt
<< diwHstop
<< diwVstrt
<< diwVstop
<< diwVFlop
<< diwHFlop
<< diwHFlopOn
<< diwHFlopOff

<< sprVStrt
<< sprVStop
<< sprDmaState;
}

isize _size() override { COMPUTE_SNAPSHOT_SIZE }
Expand Down
9 changes: 6 additions & 3 deletions Emulator/Agnus/AgnusDma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
// See https://www.gnu.org for license information
// -----------------------------------------------------------------------------

#include "Amiga.h"
#include "config.h"
#include "Agnus.h"

#include "Denise.h"

/* A central element in the emulation of an Amiga is the accurate modeling of
* the DMA timeslot allocation table (Fig. 6-9 im the HRM, 3rd revision). All
Expand Down Expand Up @@ -232,8 +235,8 @@ Agnus::enableBplDmaECS()

i16 posh = pos.h + 4;
// debug("posh = %d MAX = %d\n", posh, MAX(posh, ddfstrtReached));
ddfLores.compute(MAX(posh, ddfstrtReached), ddfstopReached, bplcon1);
ddfHires.compute(MAX(posh, ddfstrtReached), ddfstopReached, bplcon1);
ddfLores.compute(std::max(posh, ddfstrtReached), ddfstopReached, bplcon1);
ddfHires.compute(std::max(posh, ddfstrtReached), ddfstopReached, bplcon1);
hsyncActions |= HSYNC_PREDICT_DDF;

updateBplEvents();
Expand Down
21 changes: 15 additions & 6 deletions Emulator/Agnus/AgnusEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@
// See https://www.gnu.org for license information
// -----------------------------------------------------------------------------

#include "config.h"
#include "Agnus.h"

#include "Amiga.h"
#include "CIA.h"
#include "ControlPort.h"
#include "CPU.h"
#include "Denise.h"
#include "Paula.h"
#include "SerialPort.h"

void
Agnus::serviceVblEvent()
Expand All @@ -32,7 +41,7 @@ Agnus::serviceVblEvent()
assert(pos.h == 84);

// Increment the TOD counter of CIA A
amiga.ciaA.tod.increment();
ciaa.tod.increment();

// Schedule next event
scheduleStrobe2Event();
Expand Down Expand Up @@ -600,17 +609,17 @@ Agnus::serviceINSEvent()

case INS_NONE: break;
case INS_AMIGA: amiga.inspect(); break;
case INS_CPU: amiga.cpu.inspect(); break;
case INS_CPU: cpu.inspect(); break;
case INS_MEM: mem.inspect(); break;
case INS_CIA: ciaa.inspect(); ciab.inspect(); break;
case INS_AGNUS: inspect(); break;
case INS_PAULA: paula.inspect(); break;
case INS_DENISE: denise.inspect(); break;
case INS_PORTS:
amiga.serialPort.inspect();
amiga.paula.uart.inspect();
amiga.controlPort1.inspect();
amiga.controlPort2.inspect();
serialPort.inspect();
paula.uart.inspect();
controlPort1.inspect();
controlPort2.inspect();
break;
case INS_EVENTS: inspectEvents(); break;
default: assert(false);
Expand Down
6 changes: 5 additions & 1 deletion Emulator/Agnus/AgnusRegisters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
// See https://www.gnu.org for license information
// -----------------------------------------------------------------------------

#include "Amiga.h"
#include "config.h"
#include "Agnus.h"

#include "Denise.h"
#include "Paula.h"

void
Agnus::pokeDSKPTH(u16 value)
Expand Down
3 changes: 3 additions & 0 deletions Emulator/Agnus/AgnusTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include "AgnusPublicTypes.h"
#include "Reflection.h"

#include "BlitterTypes.h"
#include "CopperTypes.h"

//
// Reflection APIs
//
Expand Down
17 changes: 10 additions & 7 deletions Emulator/Foundation/Beam.h → Emulator/Agnus/Beam.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#pragma once

#include "Aliases.h"
#include "Constants.h"

struct Beam
{
// Counters for the vertical and horizontal beam position
Expand All @@ -19,17 +22,17 @@ struct Beam
i16 vLatched;
i16 hLatched;

template <class T>
void applyToItems(T& worker)
template <class W>
void operator<<(W& worker)
{
worker

& v
& h
& vLatched
& hLatched;
<< v
<< h
<< vLatched
<< hLatched;
}

Beam(i16 v, i16 h) : v(v), h(h) { }
Beam(u32 cycle = 0) : Beam((i16)(cycle / HPOS_CNT), (i16)(cycle % HPOS_CNT)) { }

Expand Down
20 changes: 12 additions & 8 deletions Emulator/Agnus/Blitter/Blitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
// See https://www.gnu.org for license information
// -----------------------------------------------------------------------------

#include "Amiga.h"
#include "config.h"
#include "Blitter.h"

#include "Agnus.h"
#include "Checksum.h"

Blitter::Blitter(Amiga& ref) : AmigaComponent(ref)
{
Expand Down Expand Up @@ -85,9 +89,9 @@ Blitter::setConfigItem(Option option, long value)
return false;
}

amiga.suspend();
suspend();
config.accuracy = (int)value;
amiga.resume();
resume();

return true;

Expand Down Expand Up @@ -164,8 +168,8 @@ Blitter::_dump(Dump::Category category, std::ostream& os) const
os << DUMP("CHOLD") << HEX16 << chold << std::endl;
os << DUMP("DHOLD") << HEX16 << dhold << std::endl;
os << DUMP("SHIFT") << HEX32 << ashift << std::endl;
os << DUMP("BBUSY") << YESNO(bbusy) << endl;
os << DUMP("BZERO") << YESNO(bzero) << endl;
os << DUMP("BBUSY") << YESNO(bbusy) << std::endl;
os << DUMP("BZERO") << YESNO(bzero) << std::endl;

}

Expand All @@ -177,18 +181,18 @@ Blitter::_dump(Dump::Category category, std::ostream& os) const
os << DUMP("USEB") << YESNO(bltconUSEB()) << std::endl;
os << DUMP("USEC") << YESNO(bltconUSEC()) << std::endl;
os << DUMP("USED") << YESNO(bltconUSED()) << std::endl;
os << endl;
os << std::endl;
os << DUMP("BLTCON1") << HEX16 << bltcon1 << std::endl;
os << DUMP("BSH") << HEX16 << bltconBSH() << std::endl;
os << DUMP("EFE") << YESNO(bltconEFE()) << std::endl;
os << DUMP("IFE") << YESNO(bltconIFE()) << std::endl;
os << DUMP("FCI") << YESNO(bltconFCI()) << std::endl;
os << DUMP("DESC") << YESNO(bltconDESC()) << std::endl;
os << DUMP("LINE") << YESNO(bltconLINE()) << std::endl;
os << endl;
os << std::endl;
os << DUMP("BLTSIZEH") << HEX16 << bltsizeV << std::endl;
os << DUMP("BLTSIZEW") << HEX16 << bltsizeH << std::endl;
os << endl;
os << std::endl;
os << DUMP("BLTAPT") << HEX32 << bltapt << std::endl;
os << DUMP("BLTBPT") << HEX32 << bltbpt << std::endl;
os << DUMP("BLTCPT") << HEX32 << bltcpt << std::endl;
Expand Down
Loading

0 comments on commit 46a9816

Please sign in to comment.