diff --git a/libgambatte/Makefile b/libgambatte/Makefile
index 5ae56f6a29..1a2c7ddeed 100644
--- a/libgambatte/Makefile
+++ b/libgambatte/Makefile
@@ -25,7 +25,6 @@ SRCS = \
src/cpu.cpp \
src/gambatte.cpp \
src/initstate.cpp \
- src/interrupter.cpp \
src/interruptrequester.cpp \
src/memory.cpp \
src/mem/cartridge.cpp \
diff --git a/libgambatte/libgambatte.vcxproj b/libgambatte/libgambatte.vcxproj
index 4eecef7e04..33e0eb0aee 100644
--- a/libgambatte/libgambatte.vcxproj
+++ b/libgambatte/libgambatte.vcxproj
@@ -197,7 +197,6 @@
-
diff --git a/libgambatte/libgambatte.vcxproj.filters b/libgambatte/libgambatte.vcxproj.filters
index 614dad17ef..38cbfcdb7d 100644
--- a/libgambatte/libgambatte.vcxproj.filters
+++ b/libgambatte/libgambatte.vcxproj.filters
@@ -161,9 +161,6 @@
Source Files
-
- Source Files
-
Source Files
diff --git a/libgambatte/src/cpu.cpp b/libgambatte/src/cpu.cpp
index 2de9fc51c4..4032210208 100644
--- a/libgambatte/src/cpu.cpp
+++ b/libgambatte/src/cpu.cpp
@@ -23,7 +23,7 @@
namespace gambatte {
CPU::CPU()
-: mem_(Interrupter(sp, pc), sp, pc)
+: mem_(sp, pc)
, cycleCounter_(0)
, pc(0x100)
, sp(0xFFFE)
diff --git a/libgambatte/src/initstate.cpp b/libgambatte/src/initstate.cpp
index c52a530773..50b29b07f7 100644
--- a/libgambatte/src/initstate.cpp
+++ b/libgambatte/src/initstate.cpp
@@ -1,21 +1,21 @@
-/***************************************************************************
- * Copyright (C) 2008 by Sindre Aamås *
- * aamas@stud.ntnu.no *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License version 2 as *
- * published by the Free Software Foundation. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License version 2 for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * version 2 along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
+//
+// Copyright (C) 2008 by sinamas
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License version 2 for more details.
+//
+// You should have received a copy of the GNU General Public License
+// version 2 along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
#include "initstate.h"
#include "counterdef.h"
#include "savestate.h"
@@ -1218,7 +1218,7 @@ void gambatte::setInitState(SaveState &state, const bool cgb, const bool gbaCgbM
state.mem.gbIsCgb = cgb;
- for (unsigned i = 0x00; i < 0x40; i += 0x02) {
+ for (int i = 0x00; i < 0x40; i += 0x02) {
state.ppu.bgpData.ptr[i ] = 0xFF;
state.ppu.bgpData.ptr[i + 1] = 0x7F;
}
@@ -1231,7 +1231,7 @@ void gambatte::setInitState(SaveState &state, const bool cgb, const bool gbaCgbM
state.ppu.objpData.ptr[1] = state.mem.ioamhram.get()[0x149];
}
- for (unsigned pos = 0; pos < 80; ++pos)
+ for (int pos = 0; pos < 80; ++pos)
state.ppu.oamReaderBuf.ptr[pos] = state.mem.ioamhram.ptr[(pos * 2 & ~3) | (pos & 1)];
std::fill_n(state.ppu.oamReaderSzbuf.ptr, 40, false);
diff --git a/libgambatte/src/initstate.h b/libgambatte/src/initstate.h
index dd20a3d07a..02363941d8 100644
--- a/libgambatte/src/initstate.h
+++ b/libgambatte/src/initstate.h
@@ -1,27 +1,28 @@
-/***************************************************************************
- * Copyright (C) 2008 by Sindre Aams *
- * aamas@stud.ntnu.no *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License version 2 as *
- * published by the Free Software Foundation. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License version 2 for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * version 2 along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
+//
+// Copyright (C) 2008 by sinamas
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License version 2 for more details.
+//
+// You should have received a copy of the GNU General Public License
+// version 2 along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
#ifndef INITSTATE_H
#define INITSTATE_H
#include
namespace gambatte {
+
void setInitState(struct SaveState &state, bool cgb, bool gbaCgbMode, std::uint32_t now, unsigned div);
}
diff --git a/libgambatte/src/insertion_sort.h b/libgambatte/src/insertion_sort.h
index cfcd3fbd25..8b76d9385a 100644
--- a/libgambatte/src/insertion_sort.h
+++ b/libgambatte/src/insertion_sort.h
@@ -1,21 +1,20 @@
-/***************************************************************************
- * Copyright (C) 2007 by Sindre Aam�s *
- * aamas@stud.ntnu.no *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License version 2 as *
- * published by the Free Software Foundation. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License version 2 for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * version 2 along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
+//
+// Copyright (C) 2007 by sinamas
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License version 2 for more details.
+//
+// You should have received a copy of the GNU General Public License
+// version 2 along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
#ifndef INSERTION_SORT_H
#define INSERTION_SORT_H
@@ -30,8 +29,7 @@ void insertionSort(T *const start, T *const end, Less less) {
T *a = start;
while (++a < end) {
- const T e = *a;
-
+ T const e = *a;
T *b = a;
while (b != start && less(e, *(b - 1))) {
@@ -44,7 +42,7 @@ void insertionSort(T *const start, T *const end, Less less) {
}
template
-inline void insertionSort(T *const start, T *const end) {
+inline void insertionSort(T *start, T *end) {
insertionSort(start, end, std::less());
}
diff --git a/libgambatte/src/interrupter.cpp b/libgambatte/src/interrupter.cpp
deleted file mode 100644
index 4223c11a8b..0000000000
--- a/libgambatte/src/interrupter.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2007 by Sindre Aamås *
- * aamas@stud.ntnu.no *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License version 2 as *
- * published by the Free Software Foundation. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License version 2 for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * version 2 along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#include "interrupter.h"
-#include "memory.h"
-
-namespace gambatte {
-
-Interrupter::Interrupter(unsigned short &SP_in, unsigned short &PC_in) :
- SP(SP_in),
- PC(PC_in)
-{}
-
-unsigned long Interrupter::interrupt(const unsigned address, unsigned long cycleCounter, Memory &memory) {
- cycleCounter += 8;
- SP = (SP - 1) & 0xFFFF;
- memory.write(SP, PC >> 8, cycleCounter);
- cycleCounter += 4;
- SP = (SP - 1) & 0xFFFF;
- memory.write(SP, PC & 0xFF, cycleCounter);
- PC = address;
- cycleCounter += 8;
-
- return cycleCounter;
-}
-
-}
diff --git a/libgambatte/src/interrupter.h b/libgambatte/src/interrupter.h
deleted file mode 100644
index 903368c391..0000000000
--- a/libgambatte/src/interrupter.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2007 by Sindre Aamås *
- * aamas@stud.ntnu.no *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License version 2 as *
- * published by the Free Software Foundation. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License version 2 for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * version 2 along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifndef INTERRUPTER_H
-#define INTERRUPTER_H
-
-#include
-#include
-
-namespace gambatte {
-
-class Interrupter {
- unsigned short &SP;
- unsigned short &PC;
-public:
- Interrupter(unsigned short &SP, unsigned short &PC);
- unsigned long interrupt(const unsigned address, unsigned long cycleCounter, class Memory &memory);
-};
-
-}
-
-#endif
diff --git a/libgambatte/src/memory.cpp b/libgambatte/src/memory.cpp
index 50693a4b06..fc18337001 100644
--- a/libgambatte/src/memory.cpp
+++ b/libgambatte/src/memory.cpp
@@ -24,7 +24,7 @@
namespace gambatte {
-Memory::Memory(const Interrupter &interrupter_in, unsigned short &sp, unsigned short &pc)
+Memory::Memory(unsigned short &sp, unsigned short &pc)
: readCallback(0),
writeCallback(0),
execCallback(0),
@@ -34,7 +34,6 @@ Memory::Memory(const Interrupter &interrupter_in, unsigned short &sp, unsigned s
divLastUpdate(0),
lastOamDmaUpdate(disabled_time),
display(ioamhram, 0, VideoInterruptRequester(intreq)),
- interrupter(interrupter_in),
dmaSource(0),
dmaDestination(0),
oamDmaPos(0xFE),
@@ -1148,7 +1147,6 @@ SYNCFUNC(Memory)
SSS(tima);
SSS(display);
SSS(sound);
- //SSS(interrupter); // no state
NSS(dmaSource);
NSS(dmaDestination);
diff --git a/libgambatte/src/memory.h b/libgambatte/src/memory.h
index bf24eb33cf..7d4a250dc8 100644
--- a/libgambatte/src/memory.h
+++ b/libgambatte/src/memory.h
@@ -24,7 +24,6 @@ static unsigned char const agbOverride[0xD] = { 0xFF, 0x00, 0xCD, 0x03, 0x35, 0x
#include "mem/cartridge.h"
#include "video.h"
#include "sound.h"
-#include "interrupter.h"
#include "tima.h"
#include "newstate.h"
#include "gambatte.h"
@@ -61,7 +60,6 @@ class Memory {
Tima tima;
LCD display;
PSG sound;
- Interrupter interrupter;
unsigned short dmaSource;
unsigned short dmaDestination;
@@ -95,7 +93,7 @@ class Memory {
bool isDoubleSpeed() const { return display.isDoubleSpeed(); }
public:
- explicit Memory(const Interrupter &interrupter, unsigned short &sp, unsigned short &pc);
+ explicit Memory(unsigned short &sp, unsigned short &pc);
bool loaded() const { return cart.loaded(); }
unsigned curRomBank() const { return cart.curRomBank(); }
diff --git a/output/dll/libgambatte.dll b/output/dll/libgambatte.dll
index 4ae26f6e50..706b7f6471 100644
Binary files a/output/dll/libgambatte.dll and b/output/dll/libgambatte.dll differ