libgambatte: Remove unused interrupter

This commit is contained in:
MrWint 2019-05-26 12:33:32 +02:00
parent af42fbb714
commit b58554f62e
12 changed files with 61 additions and 150 deletions

View File

@ -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 \

View File

@ -197,7 +197,6 @@
<ClCompile Include="src\cpu.cpp" />
<ClCompile Include="src\gambatte.cpp" />
<ClCompile Include="src\initstate.cpp" />
<ClCompile Include="src\interrupter.cpp" />
<ClCompile Include="src\interruptrequester.cpp" />
<ClCompile Include="src\memory.cpp" />
<ClCompile Include="src\mem\cartridge.cpp" />

View File

@ -161,9 +161,6 @@
<ClCompile Include="src\mem\rtc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\interrupter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\video\next_m0_time.cpp">
<Filter>Source Files</Filter>
</ClCompile>

View File

@ -23,7 +23,7 @@
namespace gambatte {
CPU::CPU()
: mem_(Interrupter(sp, pc), sp, pc)
: mem_(sp, pc)
, cycleCounter_(0)
, pc(0x100)
, sp(0xFFFE)

View File

@ -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 <sinamas at users.sourceforge.net>
//
// 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);

View File

@ -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 <sinamas at users.sourceforge.net>
//
// 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 <cstdint>
namespace gambatte {
void setInitState(struct SaveState &state, bool cgb, bool gbaCgbMode, std::uint32_t now, unsigned div);
}

View File

@ -1,21 +1,20 @@
/***************************************************************************
* Copyright (C) 2007 by Sindre Aam<EFBFBD>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 <sinamas at users.sourceforge.net>
//
// 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<typename T>
inline void insertionSort(T *const start, T *const end) {
inline void insertionSort(T *start, T *end) {
insertionSort(start, end, std::less<T>());
}

View File

@ -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;
}
}

View File

@ -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 <string>
#include <vector>
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

View File

@ -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);

View File

@ -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(); }

Binary file not shown.