Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Mar 3, 2021
2 parents 46a9816 + deb9309 commit 2bd5743
Show file tree
Hide file tree
Showing 83 changed files with 1,576 additions and 1,338 deletions.
12 changes: 6 additions & 6 deletions Emulator/Agnus/AgnusDma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,30 +466,30 @@ Agnus::updateBplEvents(u16 dmacon, u16 bplcon0, int first, int last)
// Allocate slots
if (hires) {

for (int i = first; i <= last; i++)
for (isize i = first; i <= last; i++)
bplEvent[i] =
inHiresDmaAreaOdd(i) ? bplDMA[1][channels][i] :
inHiresDmaAreaEven(i) ? bplDMA[1][channels][i] : EVENT_NONE;

// Add extra shift register events if the even/odd DDF windows differ
// These events are like BPL_H0 events without performing DMA.
for (int i = ddfHires.strtEven; i < ddfHires.strtOdd; i++)
for (isize i = ddfHires.strtEven; i < ddfHires.strtOdd; i++)
if ((i & 3) == 3 && bplEvent[i] == EVENT_NONE) bplEvent[i] = BPL_SR;
for (int i = ddfHires.stopOdd; i < ddfHires.stopEven; i++)
for (isize i = ddfHires.stopOdd; i < ddfHires.stopEven; i++)
if ((i & 3) == 3 && bplEvent[i] == EVENT_NONE) bplEvent[i] = BPL_SR;

} else {

for (int i = first; i <= last; i++)
for (isize i = first; i <= last; i++)
bplEvent[i] =
inLoresDmaAreaOdd(i) ? bplDMA[0][channels][i] :
inLoresDmaAreaEven(i) ? bplDMA[0][channels][i] : EVENT_NONE;

// Add extra shift register events if the even/odd DDF windows differ
// These events are like BPL_L0 events without performing DMA.
for (int i = ddfLores.strtEven; i < ddfLores.strtOdd; i++)
for (isize i = ddfLores.strtEven; i < ddfLores.strtOdd; i++)
if ((i & 7) == 7 && bplEvent[i] == EVENT_NONE) bplEvent[i] = BPL_SR;
for (int i = ddfLores.stopOdd; i < ddfLores.stopEven; i++)
for (isize i = ddfLores.stopOdd; i < ddfLores.stopEven; i++)
if ((i & 7) == 7 && bplEvent[i] == EVENT_NONE) bplEvent[i] = BPL_SR;
}

Expand Down
2 changes: 1 addition & 1 deletion Emulator/Agnus/Blitter/FastBlitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ Blitter::doFastLineBlit()
bool single_dot = false;
u8 minterm = (u8)(bltcon >> 16);

for (int i = 0; i < height; ++i)
for (isize i = 0; i < height; ++i)
{
// Read C-data from memory if the C-channel is enabled
if (c_enabled) {
Expand Down
4 changes: 2 additions & 2 deletions Emulator/Agnus/Copper/Copper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Copper::findVerticalMatch(i16 vStrt, i16 vComp, i16 vMask, i16 &result) const
i16 vStop = agnus.frame.numLines();

// Iterate through all vertical positions
for (int v = vStrt; v < vStop; v++) {
for (isize v = vStrt; v < vStop; v++) {

// Check if the comparator triggers at this position
if ((v & vMask) >= (vComp & vMask)) {
Expand All @@ -151,7 +151,7 @@ Copper::findHorizontalMatch(i16 hStrt, i16 hComp, i16 hMask, i16 &result) const
i16 hStop = HPOS_CNT;

// Iterate through all horizontal positions
for (int h = hStrt; h < hStop; h++) {
for (isize h = hStrt; h < hStop; h++) {

// Check if the comparator triggers at this position
if ((h & hMask) >= (hComp & hMask)) {
Expand Down
12 changes: 4 additions & 8 deletions Emulator/Agnus/EventHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,16 @@
public:

// Returns true iff the specified slot contains any event
template<EventSlot s> bool hasEvent() const {
assert(s < SLOT_COUNT); return slot[s].id != (EventID)0; }
template<EventSlot s> bool hasEvent() const { return slot[s].id != (EventID)0; }

// Returns true iff the specified slot contains a specific event
template<EventSlot s> bool hasEvent(EventID id) const {
assert(s < SLOT_COUNT); return slot[s].id == id; }
template<EventSlot s> bool hasEvent(EventID id) const { return slot[s].id == id; }

// Returns true iff the specified slot contains a pending event
template<EventSlot s> bool isPending() const {
assert(s < SLOT_COUNT); return slot[s].triggerCycle != NEVER; }
template<EventSlot s> bool isPending() const { return slot[s].triggerCycle != NEVER; }

// Returns true iff the specified slot contains a due event
template<EventSlot s> bool isDue(Cycle cycle) const {
assert(s < SLOT_COUNT); return cycle >= slot[s].triggerCycle; }
template<EventSlot s> bool isDue(Cycle cycle) const { return cycle >= slot[s].triggerCycle; }


//
Expand Down
32 changes: 21 additions & 11 deletions Emulator/Amiga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ Amiga::getConfigItem(Option option) const
return agnus.getConfigItem(option);

case OPT_DENISE_REVISION:
case OPT_BRDRBLNK:
case OPT_HIDDEN_SPRITES:
case OPT_HIDDEN_LAYERS:
case OPT_HIDDEN_LAYER_ALPHA:
Expand Down Expand Up @@ -280,12 +279,15 @@ Amiga::getConfigItem(Option option, long id) const

case OPT_DRIVE_TYPE:
case OPT_EMULATE_MECHANICS:
case OPT_DRIVE_NOISE_ENABLE:
case OPT_DRIVE_EJECT_NOISE:
case OPT_DRIVE_INSERT_NOISE:
case OPT_DRIVE_STEP_NOISE:
case OPT_DRIVE_POLL_NOISE:

case OPT_DRIVE_PAN:
case OPT_STEP_VOLUME:
case OPT_POLL_VOLUME:
case OPT_INSERT_VOLUME:
case OPT_EJECT_VOLUME:
return df[id]->getConfigItem(option);

case OPT_DEFAULT_FILESYSTEM:
case OPT_DEFAULT_BOOTBLOCK:
return df[id]->getConfigItem(option);

case OPT_PULLUP_RESISTORS:
Expand All @@ -309,7 +311,7 @@ Amiga::configure(Option option, long value)
// Inform the GUI if the configuration has changed
if (changed) queue.put(MSG_CONFIG);

// Dump the current configuration in debugging mode
// Dump the current configuration in debug mode
if (changed && CNF_DEBUG) dump(Dump::Config);

return changed;
Expand All @@ -323,8 +325,8 @@ Amiga::configure(Option option, long id, long value)

// Inform the GUI if the configuration has changed
if (changed) queue.put(MSG_CONFIG);
// Dump the current configuration in debugging mode

// Dump the current configuration in debug mode
if (changed && CNF_DEBUG) dump(Dump::Config);

return changed;
Expand Down Expand Up @@ -365,7 +367,15 @@ void
Amiga::_dump(Dump::Category category, std::ostream& os) const
{
if (category & Dump::Config) {


if (CNF_DEBUG) {

df0.dump(Dump::Config);
paula.dump(Dump::Config);
paula.muxer.dump(Dump::Config);
ciaA.dump(Dump::Config);
denise.dump(Dump::Config);
}
}

if (category & Dump::State) {
Expand Down
14 changes: 8 additions & 6 deletions Emulator/AmigaPublicTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ enum_long(OPT)

// Denise
OPT_DENISE_REVISION,
OPT_BRDRBLNK,

// Real-time clock
OPT_RTC_MODEL,
Expand All @@ -43,17 +42,19 @@ enum_long(OPT)
// Disk controller
OPT_DRIVE_CONNECT,
OPT_DRIVE_SPEED,
OPT_DRIVE_NOISE_ENABLE,
OPT_DRIVE_EJECT_NOISE,
OPT_DRIVE_INSERT_NOISE,
OPT_DRIVE_STEP_NOISE,
OPT_DRIVE_POLL_NOISE,
OPT_LOCK_DSKSYNC,
OPT_AUTO_DSKSYNC,

// Drives
OPT_DRIVE_TYPE,
OPT_EMULATE_MECHANICS,
OPT_DRIVE_PAN,
OPT_STEP_VOLUME,
OPT_POLL_VOLUME,
OPT_INSERT_VOLUME,
OPT_EJECT_VOLUME,
OPT_DEFAULT_FILESYSTEM,
OPT_DEFAULT_BOOTBLOCK,

// Ports
OPT_SERIAL_DEVICE,
Expand All @@ -79,6 +80,7 @@ enum_long(OPT)

// Mouse
OPT_PULLUP_RESISTORS,
OPT_SHAKE_DETECTION,
OPT_MOUSE_VELOCITY,

// Paula audio
Expand Down
14 changes: 7 additions & 7 deletions Emulator/AmigaTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ struct OptionEnum : Reflection<OptionEnum, Option> {
case OPT_SLOW_RAM_MIRROR: return "SLOW_RAM_MIRROR";

case OPT_DENISE_REVISION: return "DENISE_REVISION";
case OPT_BRDRBLNK: return "BRDRBLNK";

case OPT_RTC_MODEL: return "RTC_MODEL";

Expand All @@ -47,17 +46,18 @@ struct OptionEnum : Reflection<OptionEnum, Option> {

case OPT_DRIVE_CONNECT: return "DRIVE_CONNECT";
case OPT_DRIVE_SPEED: return "DRIVE_SPEED";
case OPT_DRIVE_NOISE_ENABLE: return "DRIVE_NOISE_ENABLE";
case OPT_DRIVE_INSERT_NOISE: return "DRIVE_NOISE_INSERT";
case OPT_DRIVE_EJECT_NOISE: return "DRIVE_NOISE_EJECT";
case OPT_DRIVE_STEP_NOISE: return "DRIVE_NOISE_STEP";
case OPT_DRIVE_POLL_NOISE: return "DRIVE_NOISE_POLL";

case OPT_LOCK_DSKSYNC: return "LOCK_DSKSYNC";
case OPT_AUTO_DSKSYNC: return "AUTO_DSKSYNC";

case OPT_DRIVE_TYPE: return "DRIVE_TYPE";
case OPT_EMULATE_MECHANICS: return "EMULATE_MECHANICS";
case OPT_DRIVE_PAN: return "DRIVE_PAN";
case OPT_STEP_VOLUME: return "STEP_VOLUME";
case OPT_POLL_VOLUME: return "POLL_VOLUME";
case OPT_INSERT_VOLUME: return "INSERT_VOLUME";
case OPT_EJECT_VOLUME: return "EJECT_VOLUME";
case OPT_DEFAULT_FILESYSTEM: return "DEFAULT_FILESYSTEM";
case OPT_DEFAULT_BOOTBLOCK: return "DEFAULT_BOOTBLOCK";

case OPT_SERIAL_DEVICE: return "SERIAL_DEVICE";

Expand Down
15 changes: 15 additions & 0 deletions Emulator/Base/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SRC=$(wildcard *.cpp)
OBJ=$(SRC:.cpp=.o)

.PHONY: all clean

all: $(OBJ)
@echo > /dev/null

clean:
@echo "Cleaning up $(CURDIR)"
@rm -f *.o

%.o: %.cpp $(DEPS)
@echo "Compiling $<"
@$(MYCC) $(MYFLAGS) -c -o $@ $<
14 changes: 11 additions & 3 deletions Emulator/Base/MsgQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,23 @@ MsgQueue::addListener(const void *listener, Callback *func)

void
MsgQueue::removeListener(const void *listener)
{
put(MSG_UNREGISTER);
{
Callback *callback = nullptr;

synchronized {

for (auto it = listeners.begin(); it != listeners.end(); it++) {
if (it->first == listener) { listeners.erase(it); break; }

if (it->first == listener) {
callback = it->second;
listeners.erase(it);
break;
}
}
}

// Send a last message to the listener
if (callback) callback(listener, MSG_UNREGISTER, 0);
}

Message
Expand Down
7 changes: 2 additions & 5 deletions Emulator/Base/MsgQueuePublicTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,10 @@ enum_long(MSG_TYPE)
MSG_DRIVE_LED_OFF,
MSG_DRIVE_MOTOR_ON,
MSG_DRIVE_MOTOR_OFF,
MSG_DRIVE_HEAD,
MSG_DRIVE_HEAD_NOISE,
MSG_DRIVE_HEAD_POLL, // DEPRECATED
MSG_DRIVE_STEP,
MSG_DRIVE_POLL,
MSG_DISK_INSERT,
MSG_DISK_INSERT_NOISE,
MSG_DISK_EJECT,
MSG_DISK_EJECT_NOISE,
MSG_DISK_SAVED,
MSG_DISK_UNSAVED,
MSG_DISK_PROTECT,
Expand Down
7 changes: 2 additions & 5 deletions Emulator/Base/MsgQueueTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,10 @@ struct MsgTypeEnum : Reflection<MsgTypeEnum, MsgType> {
case MSG_DRIVE_LED_OFF: return "DRIVE_LED_OFF";
case MSG_DRIVE_MOTOR_ON: return "DRIVE_MOTOR_ON";
case MSG_DRIVE_MOTOR_OFF: return "DRIVE_MOTOR_OFF";
case MSG_DRIVE_HEAD: return "DRIVE_HEAD";
case MSG_DRIVE_HEAD_NOISE: return "DRIVE_HEAD_NOISE";
case MSG_DRIVE_HEAD_POLL: return "DRIVE_HEAD_POLL";
case MSG_DRIVE_STEP: return "DRIVE_STEP";
case MSG_DRIVE_POLL: return "DRIVE_POLL";
case MSG_DISK_INSERT: return "DISK_INSERT";
case MSG_DISK_INSERT_NOISE: return "DISK_INSERT_SOUND";
case MSG_DISK_EJECT: return "DISK_EJECT";
case MSG_DISK_EJECT_NOISE: return "DISK_EJECT_SOUND";
case MSG_DISK_SAVED: return "DISK_SAVED";
case MSG_DISK_UNSAVED: return "DISK_UNSAVED";
case MSG_DISK_PROTECT: return "DISK_PROTECT";
Expand Down
Loading

0 comments on commit 2bd5743

Please sign in to comment.