Fixing style and inputs

This commit is contained in:
SergioMartin86 2024-07-28 16:52:05 +02:00
parent 6ca0537d45
commit c7f1c233ca
102 changed files with 2483 additions and 1684 deletions

View File

@ -4,10 +4,10 @@
// by eien86
#include <cstdint>
#include <string>
#include <sstream>
#include <jaffarCommon/exceptions.hpp>
#include <jaffarCommon/json.hpp>
#include <sstream>
#include <string>
namespace jaffar
{
@ -22,12 +22,16 @@ struct input_t
port_t port2 = 0;
};
class InputParser
{
public:
enum controller_t { none, joypad, fourscore1, fourscore2 };
enum controller_t
{
none,
joypad,
fourscore1,
fourscore2
};
InputParser(const nlohmann::json &config)
{
@ -35,10 +39,26 @@ public:
{
bool isTypeRecognized = false;
const auto controller1Type = jaffarCommon::json::getString(config, "Controller 1 Type");
if (controller1Type == "None") { _controller1Type = controller_t::none; isTypeRecognized = true; }
if (controller1Type == "Joypad") { _controller1Type = controller_t::joypad; isTypeRecognized = true; }
if (controller1Type == "FourScore1") { _controller1Type = controller_t::fourscore1; isTypeRecognized = true; }
if (controller1Type == "FourScore2") { _controller1Type = controller_t::fourscore2; isTypeRecognized = true; }
if (controller1Type == "None")
{
_controller1Type = controller_t::none;
isTypeRecognized = true;
}
if (controller1Type == "Joypad")
{
_controller1Type = controller_t::joypad;
isTypeRecognized = true;
}
if (controller1Type == "FourScore1")
{
_controller1Type = controller_t::fourscore1;
isTypeRecognized = true;
}
if (controller1Type == "FourScore2")
{
_controller1Type = controller_t::fourscore2;
isTypeRecognized = true;
}
if (isTypeRecognized == false) JAFFAR_THROW_LOGIC("Controller 1 type not recognized: '%s'\n", controller1Type.c_str());
}
@ -46,13 +66,28 @@ public:
{
bool isTypeRecognized = false;
const auto controller2Type = jaffarCommon::json::getString(config, "Controller 2 Type");
if (controller2Type == "None") { _controller2Type = controller_t::none; isTypeRecognized = true; }
if (controller2Type == "Joypad") { _controller2Type = controller_t::joypad; isTypeRecognized = true; }
if (controller2Type == "FourScore1") { _controller2Type = controller_t::fourscore1; isTypeRecognized = true; }
if (controller2Type == "FourScore2") { _controller2Type = controller_t::fourscore2; isTypeRecognized = true; }
if (controller2Type == "None")
{
_controller2Type = controller_t::none;
isTypeRecognized = true;
}
if (controller2Type == "Joypad")
{
_controller2Type = controller_t::joypad;
isTypeRecognized = true;
}
if (controller2Type == "FourScore1")
{
_controller2Type = controller_t::fourscore1;
isTypeRecognized = true;
}
if (controller2Type == "FourScore2")
{
_controller2Type = controller_t::fourscore2;
isTypeRecognized = true;
}
if (isTypeRecognized == false) JAFFAR_THROW_LOGIC("Controller 2 type not recognized: '%s'\n", controller2Type.c_str());
}
}
inline input_t parseInputString(const std::string &inputString) const
@ -86,7 +121,6 @@ public:
}
private:
static inline void reportBadInputString(const std::string &inputString)
{
JAFFAR_THROW_LOGIC("Could not decode input string: '%s'\n", inputString.c_str());
@ -144,7 +178,11 @@ public:
static void parseControllerInputs(const controller_t type, port_t &port, std::istringstream &ss, const std::string &inputString)
{
// If no controller assigned then, its port is all zeroes.
if (type == controller_t::none) { port = 0; return; }
if (type == controller_t::none)
{
port = 0;
return;
}
// Controller separator
if (ss.get() != '|') reportBadInputString(inputString);

View File

@ -1,9 +1,9 @@
#pragma once
#include "inputParser.hpp"
#include "jaffarCommon/logger.hpp"
#include "jaffarCommon/serializers/contiguous.hpp"
#include "jaffarCommon/serializers/differential.hpp"
#include "jaffarCommon/logger.hpp"
#include "inputParser.hpp"
// Size of image generated in graphics buffer
static const uint16_t image_width = 256;
@ -12,7 +12,6 @@ static const uint16_t image_height = 240;
class NESInstanceBase
{
public:
NESInstanceBase(const nlohmann::json &config)
{
_inputParser = std::make_unique<jaffar::InputParser>(config);
@ -74,7 +73,6 @@ class NESInstanceBase
virtual void setNTABBlockSize(const size_t size) {};
protected:
virtual void enableStateBlockImpl(const std::string &block) = 0;
virtual void disableStateBlockImpl(const std::string &block) = 0;
virtual bool loadROMImpl(const uint8_t *romData, const size_t romSize) = 0;
@ -86,8 +84,6 @@ class NESInstanceBase
bool _doRendering = true;
private:
// Input parser instance
std::unique_ptr<jaffar::InputParser> _inputParser;
};

View File

@ -1,15 +1,15 @@
#pragma once
#include <string>
#include <unistd.h>
#include "nesInstance.hpp"
#include <SDL.h>
#include <SDL_image.h>
#include <extern/hqn/hqn.h>
#include <extern/hqn/hqn_gui_controller.h>
#include <jaffarCommon/serializers/contiguous.hpp>
#include <jaffarCommon/deserializers/contiguous.hpp>
#include <jaffarCommon/hash.hpp>
#include "nesInstance.hpp"
#include <jaffarCommon/serializers/contiguous.hpp>
#include <string>
#include <unistd.h>
#define _INVERSE_FRAME_RATE 16667
@ -233,7 +233,6 @@ class PlaybackInstance
}
private:
// Internal sequence information
std::vector<stepData_t> _stepSequence;

View File

@ -1,12 +1,12 @@
#include <cstdlib>
#include "argparse/argparse.hpp"
#include "jaffarCommon/serializers/contiguous.hpp"
#include "jaffarCommon/deserializers/contiguous.hpp"
#include "jaffarCommon/file.hpp"
#include "jaffarCommon/logger.hpp"
#include "jaffarCommon/serializers/contiguous.hpp"
#include "jaffarCommon/string.hpp"
#include "nesInstance.hpp"
#include "playbackInstance.hpp"
#include <cstdlib>
SDL_Window *launchOutputWindow()
{

View File

@ -1,10 +1,10 @@
#pragma once
#include "jaffarCommon/serializers/base.hpp"
#include "jaffarCommon/deserializers/base.hpp"
#include "../nesInstanceBase.hpp"
#include "core/nes_emu/Nes_Emu.h"
#include "core/nes_emu/Nes_State.h"
#include "../nesInstanceBase.hpp"
#include "jaffarCommon/deserializers/base.hpp"
#include "jaffarCommon/serializers/base.hpp"
#define _DUMMY_SIZE 65536
@ -17,7 +17,6 @@ extern void register_mapper_70();
class NESInstance final : public NESInstanceBase
{
public:
NESInstance(const nlohmann::json &config) : NESInstanceBase(config)
{
// If running the original QuickNES, register extra mappers now
@ -68,7 +67,6 @@ class NESInstance final : public NESInstanceBase
}
protected:
bool loadROMImpl(const uint8_t *romData, const size_t romSize) override
{
// Loading rom data
@ -81,9 +79,7 @@ class NESInstance final : public NESInstanceBase
void enableStateBlockImpl(const std::string &block) override {};
void disableStateBlockImpl(const std::string &block) override {};
private:
// Emulator instance
emulator_t _nes;
};

View File

@ -82,4 +82,4 @@ void Nes_Effects_Buffer::RestoreAudioBufferState()
{
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// Effects_Buffer with non-linear sound
// Nes_Emu 0.7.0
#include "effectsBuffer.hpp"
#include "buffer.hpp"
#include "effectsBuffer.hpp"
namespace quickerNES
{
@ -38,4 +38,4 @@ class Nes_Effects_Buffer : public Effects_Buffer
friend Multi_Buffer *set_apu(Nes_Effects_Buffer *, Apu *);
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -372,4 +372,4 @@ int Apu::read_status(nes_time_t time)
return result;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,9 +3,9 @@
// NES 2A03 APU sound chip emulator
// Snd_Emu 0.1.7
#include "oscs.hpp"
#include <climits>
#include <cstdint>
#include "oscs.hpp"
namespace quickerNES
{
@ -360,4 +360,4 @@ inline void Apu::load_state(apu_state_t const &state)
dmc.run(last_time, last_time);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,11 +1,11 @@
// Blip_Buffer 0.4.0. http://www.slack.net/~ant/
#include "blipBuffer.hpp"
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "blipBuffer.hpp"
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser
@ -419,4 +419,4 @@ void Blip_Buffer::RestoreAudioBufferState()
memcpy(buffer_, extra_buffer, sizeof(extra_buffer));
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -377,4 +377,4 @@ inline int Blip_Reader::begin(Blip_Buffer &blip_buf)
int const blip_max_length = 0;
int const blip_default_length = 250;
} // namespace quickNES
} // namespace quickerNES

View File

@ -227,4 +227,4 @@ void Nonlinearizer::RestoreAudioBufferState()
prev = extra_prev;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// NES non-linear audio buffer
// Emu 0.7.0
#include <cstdint>
#include "multiBuffer.hpp"
#include <cstdint>
namespace quickerNES
{
@ -79,4 +79,4 @@ class Buffer : public Multi_Buffer
virtual void RestoreAudioBufferState();
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,7 +1,7 @@
// Game_Music_Emu 0.3.0. http://www.slack.net/~ant/
#include <cstring>
#include "effectsBuffer.hpp"
#include <cstring>
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser
@ -515,4 +515,4 @@ void Effects_Buffer::mix_enhanced(blip_sample_t *out, long count)
r2.end(bufs[6]);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// Multi-channel effects buffer with panning, echo and reverb
// Game_Music_Emu 0.3.0
#include <stdint.h>
#include "multiBuffer.hpp"
#include <stdint.h>
namespace quickerNES
{
@ -101,4 +101,4 @@ inline Effects_Buffer::channel_t Effects_Buffer::channel(int i)
return channels[i % chan_count];
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -105,4 +105,4 @@ void Fme7_Apu::run_until(blip_time_t end_time)
last_time = end_time;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// Sunsoft FME-7 sound emulator
// Emu 0.7.0
#include <cstdint>
#include "../blipBuffer.hpp"
#include <cstdint>
namespace quickerNES
{
@ -152,4 +152,4 @@ inline void Fme7_Apu::load_state(fme7_apu_state_t const &in)
run_until(last_time);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,8 +1,8 @@
// Blip_Buffer 0.4.0. http://www.slack.net/~ant/
#include <cstdint>
#include "multiBuffer.hpp"
#include <cstdint>
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser
@ -284,4 +284,4 @@ void Stereo_Buffer::RestoreAudioBufferState()
right()->RestoreAudioBufferState();
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -199,4 +199,4 @@ inline long Mono_Buffer::read_samples(blip_sample_t *p, long s) { return buf.rea
inline long Mono_Buffer::samples_avail() const { return buf.samples_avail(); }
} // namespace quickNES
} // namespace quickerNES

View File

@ -180,4 +180,4 @@ void Namco_Apu::load_state(namco_state_t const &in)
run_until(last_time);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// Namco 106 sound chip emulator
// Snd_Emu 0.1.7
#include <cstdint>
#include "../apu.hpp"
#include <cstdint>
namespace quickerNES
{
@ -112,4 +112,4 @@ inline void Namco_Apu::write_data(nes_time_t time, int data)
access() = data;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -679,4 +679,4 @@ void Noise::run(nes_time_t time, nes_time_t end_time)
delay = time - end_time;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -169,4 +169,4 @@ struct Dmc : Osc
nes_time_t next_read_time() const;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -212,4 +212,4 @@ void Vrc6_Apu::run_saw(nes_time_t end_time)
osc.last_amp = last_amp;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -4,9 +4,9 @@
// Konami VRC6 sound chip emulator
// Snd_Emu 0.1.7
#include <cstdint>
#include "../blipBuffer.hpp"
#include "../apu.hpp"
#include "../blipBuffer.hpp"
#include <cstdint>
namespace quickerNES
{
@ -109,4 +109,4 @@ inline void Vrc6_Apu::treble_eq(blip_eq_t const &eq)
square_synth.treble_eq(eq);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,6 +1,6 @@
#include <cstring>
#include "apu_vrc7.hpp"
#include "emu2413.hpp"
#include <cstring>
namespace quickerNES
{
@ -208,4 +208,4 @@ void Vrc7::update_last_amp()
}
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -4,9 +4,9 @@
// Konami VRC7 sound chip emulator
// Snd_Emu 0.1.7. Copyright (C) 2003-2005 Shay Green. GNU LGPL license.
#include <cstdint>
#include "../blipBuffer.hpp"
#include "emu2413_state.hpp"
#include <cstdint>
namespace quickerNES
{
@ -76,4 +76,4 @@ inline void Vrc7::osc_output(int i, Blip_Buffer *buf)
oscs[i].output = buf;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -1152,4 +1152,4 @@ void OPLL_writeIO(OPLL *opll, e_uint32 adr, e_uint32 val)
opll->adr = val;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -220,4 +220,4 @@ extern "C"
}
#endif
} // namespace quickNES
} // namespace quickerNES

View File

@ -38,4 +38,4 @@ extern "C"
}
#endif
} // namespace quickNES
} // namespace quickerNES

View File

@ -114,4 +114,4 @@ class Cart
unsigned mapper;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -15,16 +15,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// Emu 0.7.0
#include <stdexcept>
#include "cpu.hpp"
#include "apu/apu.hpp"
#include "cpu.hpp"
#include "mappers/mapper.hpp"
#include "ppu/ppu.hpp"
#include <cstdio>
#include <string>
#include <cstdint>
#include <jaffarCommon/serializers/base.hpp>
#include <cstdio>
#include <jaffarCommon/deserializers/base.hpp>
#include <jaffarCommon/serializers/base.hpp>
#include <stdexcept>
#include <string>
namespace quickerNES
{
@ -58,7 +58,6 @@ struct nes_state_lite_t
uint8_t frame_count; // number of frames emulated since power-up
};
struct joypad_state_t
{
uint32_t joypad_latches[2]; // joypad 1 & 2 shift registers
@ -84,7 +83,6 @@ class Core : private Cpu
typedef Cpu cpu;
public:
size_t _NTABBlockSize = 0x1000;
// Flags for lite state storage
@ -399,42 +397,136 @@ void enableStateBlock(const std::string& block)
{
bool recognizedBlock = false;
if (block == "TIME") { TIMEBlockEnabled = true; recognizedBlock = true; }
if (block == "CPUR") { CPURBlockEnabled = true; recognizedBlock = true; }
if (block == "PPUR") { PPURBlockEnabled = true; recognizedBlock = true; }
if (block == "APUR") { APURBlockEnabled = true; recognizedBlock = true; }
if (block == "CTRL") { CTRLBlockEnabled = true; recognizedBlock = true; }
if (block == "MAPR") { MAPRBlockEnabled = true; recognizedBlock = true; }
if (block == "LRAM") { LRAMBlockEnabled = true; recognizedBlock = true; }
if (block == "SPRT") { SPRTBlockEnabled = true; recognizedBlock = true; }
if (block == "NTAB") { NTABBlockEnabled = true; recognizedBlock = true; }
if (block == "CHRR") { CHRRBlockEnabled = true; recognizedBlock = true; }
if (block == "SRAM") { SRAMBlockEnabled = true; recognizedBlock = true; }
if (block == "TIME")
{
TIMEBlockEnabled = true;
recognizedBlock = true;
}
if (block == "CPUR")
{
CPURBlockEnabled = true;
recognizedBlock = true;
}
if (block == "PPUR")
{
PPURBlockEnabled = true;
recognizedBlock = true;
}
if (block == "APUR")
{
APURBlockEnabled = true;
recognizedBlock = true;
}
if (block == "CTRL")
{
CTRLBlockEnabled = true;
recognizedBlock = true;
}
if (block == "MAPR")
{
MAPRBlockEnabled = true;
recognizedBlock = true;
}
if (block == "LRAM")
{
LRAMBlockEnabled = true;
recognizedBlock = true;
}
if (block == "SPRT")
{
SPRTBlockEnabled = true;
recognizedBlock = true;
}
if (block == "NTAB")
{
NTABBlockEnabled = true;
recognizedBlock = true;
}
if (block == "CHRR")
{
CHRRBlockEnabled = true;
recognizedBlock = true;
}
if (block == "SRAM")
{
SRAMBlockEnabled = true;
recognizedBlock = true;
}
if (recognizedBlock == false) { fprintf(stderr, "Unrecognized block type: %s\n", block.c_str()); exit(-1);}
if (recognizedBlock == false)
{
fprintf(stderr, "Unrecognized block type: %s\n", block.c_str());
exit(-1);
}
};
void disableStateBlock(const std::string &block)
{
bool recognizedBlock = false;
if (block == "TIME") { TIMEBlockEnabled = false; recognizedBlock = true; }
if (block == "CPUR") { CPURBlockEnabled = false; recognizedBlock = true; }
if (block == "PPUR") { PPURBlockEnabled = false; recognizedBlock = true; }
if (block == "APUR") { APURBlockEnabled = false; recognizedBlock = true; }
if (block == "CTRL") { CTRLBlockEnabled = false; recognizedBlock = true; }
if (block == "MAPR") { MAPRBlockEnabled = false; recognizedBlock = true; }
if (block == "LRAM") { LRAMBlockEnabled = false; recognizedBlock = true; }
if (block == "SPRT") { SPRTBlockEnabled = false; recognizedBlock = true; }
if (block == "NTAB") { NTABBlockEnabled = false; recognizedBlock = true; }
if (block == "CHRR") { CHRRBlockEnabled = false; recognizedBlock = true; }
if (block == "SRAM") { SRAMBlockEnabled = false; recognizedBlock = true; }
if (block == "TIME")
{
TIMEBlockEnabled = false;
recognizedBlock = true;
}
if (block == "CPUR")
{
CPURBlockEnabled = false;
recognizedBlock = true;
}
if (block == "PPUR")
{
PPURBlockEnabled = false;
recognizedBlock = true;
}
if (block == "APUR")
{
APURBlockEnabled = false;
recognizedBlock = true;
}
if (block == "CTRL")
{
CTRLBlockEnabled = false;
recognizedBlock = true;
}
if (block == "MAPR")
{
MAPRBlockEnabled = false;
recognizedBlock = true;
}
if (block == "LRAM")
{
LRAMBlockEnabled = false;
recognizedBlock = true;
}
if (block == "SPRT")
{
SPRTBlockEnabled = false;
recognizedBlock = true;
}
if (block == "NTAB")
{
NTABBlockEnabled = false;
recognizedBlock = true;
}
if (block == "CHRR")
{
CHRRBlockEnabled = false;
recognizedBlock = true;
}
if (block == "SRAM")
{
SRAMBlockEnabled = false;
recognizedBlock = true;
}
if (recognizedBlock == false) { fprintf(stderr, "Unrecognized block type: %s\n", block.c_str()); exit(-1);}
if (recognizedBlock == false)
{
fprintf(stderr, "Unrecognized block type: %s\n", block.c_str());
exit(-1);
}
};
void reset(bool full_reset, bool erase_battery_ram)
{
if (full_reset)
@ -1001,4 +1093,4 @@ inline void Core::cpu_write(nes_addr_t addr, int data, nes_time_t time)
static_cast<Core &>(*cpu).cpu_write(addr, data, time); \
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,10 +1,10 @@
// Emu 0.7.0. http://www.slack.net/~ant/nes-emu/
#include <cstring>
#include <climits>
#include <cstdio>
#include "cpu.hpp"
#include "core.hpp"
#include <climits>
#include <cstdio>
#include <cstring>
/**
* Optimizations by Sergio Martin (eien86) 2023-2024
@ -44,9 +44,12 @@ namespace quickerNES
#define HANDLE_PAGE_CROSSING(lsb) clock_count += (lsb) >> 8;
#define INC_DEC_XY( reg, n ) reg = uint8_t (nz = reg + n); goto loop;
#define INC_DEC_XY(reg, n) \
reg = uint8_t(nz = reg + n); \
goto loop;
#define IND_Y(r,c) { \
#define IND_Y(r, c) \
{ \
int32_t temp = READ_LOW(data) + y; \
data = temp + 0x100 * READ_LOW(uint8_t(data + 1)); \
if (c) HANDLE_PAGE_CROSSING(temp); \
@ -54,7 +57,8 @@ namespace quickerNES
READ(data - (temp & 0x100)); \
}
#define IND_X { \
#define IND_X \
{ \
int32_t temp = data + x; \
data = 0x100 * READ_LOW(uint8_t(temp + 1)) + READ_LOW(uint8_t(temp)); \
}
@ -76,7 +80,8 @@ case op + 0x14: /* abs,Y */ \
goto ind##op; \
case op + 0x18: /* abs,X */ \
data += x; \
ind##op: { \
ind##op: \
{ \
HANDLE_PAGE_CROSSING(data); \
uint32_t temp = data; \
ADD_PAGE \
@ -86,10 +91,9 @@ ind##op: { \
} \
case op + 0x08: /* abs */ \
ADD_PAGE \
ptr##op: \
data = READ( data ); \
ptr##op : data = READ(data); \
case op + 0x04: /* imm */ \
imm##op: \
imm##op:
#define ARITH_ADDR_MODES_PTR(op) \
case op - 0x04: /* (ind,x) */ \
@ -106,7 +110,8 @@ case op + 0x14: /* abs,Y */ \
goto ind##op; \
case op + 0x18: /* abs,X */ \
data += x; \
ind##op: { \
ind##op: \
{ \
uint32_t temp = data; \
ADD_PAGE \
READ(data - (temp & 0x100)); \
@ -115,7 +120,7 @@ ind##op: { \
case op + 0x08: /* abs */ \
ADD_PAGE \
case op + 0x00: /* zp */ \
imm##op: \
imm##op:
// Adding likely to fail because typically for loops exit conditions fail until the last one
#define BRANCH(cond) \
@ -123,14 +128,17 @@ imm##op: \
pc++; \
int offset = (int8_t)data; \
int extra_clock = (pc & 0xFF) + offset; \
if ( !(cond) ) {clock_count--; goto loop; } \
if (!(cond)) \
{ \
clock_count--; \
goto loop; \
} \
pc += offset; \
pc = uint16_t(pc); \
clock_count += (extra_clock >> 8) & 1; \
goto loop; \
}
void Cpu::reset(void const *unmapped_page)
{
r.status = 0;
@ -163,7 +171,10 @@ void Cpu::reset( void const* unmapped_page )
#define READ_LIKELY_PPU(addr) (NES_CPU_READ_PPU(this, (addr), (clock_count)))
#define READ(addr) (NES_CPU_READ(this, (addr), (clock_count)))
#define WRITE( addr, data ) {NES_CPU_WRITE( this, (addr), (data), (clock_count) );}
#define WRITE(addr, data) \
{ \
NES_CPU_WRITE(this, (addr), (data), (clock_count)); \
}
#define READ_LOW(addr) (low_mem[int32_t(addr)])
#define WRITE_LOW(addr, data) (void)(READ_LOW(addr) = (data))
@ -177,14 +188,16 @@ void Cpu::reset( void const* unmapped_page )
#define IS_NEG (nz & 0x880)
#define CALC_STATUS( out ) do { \
#define CALC_STATUS(out) \
do { \
out = status & (st_v | st_d | st_i); \
out |= (c >> 8) & st_c; \
if (IS_NEG) out |= st_n; \
if (!(nz & 0xFF)) out |= st_z; \
} while (0)
#define SET_STATUS( in ) do { \
#define SET_STATUS(in) \
do { \
status = in & (st_v | st_d | st_i); \
c = in << 8; \
nz = (in << 4) & 0x800; \
@ -204,29 +217,270 @@ inline void Cpu::write( nes_addr_t addr, int value )
// status flags
uint8_t clock_table[256] = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
7,6,2,8,3,3,5,5,3,2,2,2,4,4,6,6,// 0
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 1
6,6,2,8,3,3,5,5,4,2,2,2,4,4,6,6,// 2
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 3
6,6,2,8,3,3,5,5,3,2,2,2,3,4,6,6,// 4
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 5
6,6,2,8,3,3,5,5,4,2,2,2,5,4,6,6,// 6
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// 7
2,6,2,6,3,3,3,3,2,2,2,2,4,4,4,4,// 8
3,6,2,6,4,4,4,4,2,5,2,5,5,5,5,5,// 9
2,6,2,6,3,3,3,3,2,2,2,2,4,4,4,4,// A
3,5,2,5,4,4,4,4,2,4,2,4,4,4,4,4,// B
2,6,2,8,3,3,5,5,2,2,2,2,4,4,6,6,// C
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7,// D
2,6,2,8,3,3,5,5,2,2,2,2,4,4,6,6,// E
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7 // F
7,
6,
2,
8,
3,
3,
5,
5,
3,
2,
2,
2,
4,
4,
6,
6, // 0
3,
5,
2,
8,
4,
4,
6,
6,
2,
4,
2,
7,
4,
4,
7,
7, // 1
6,
6,
2,
8,
3,
3,
5,
5,
4,
2,
2,
2,
4,
4,
6,
6, // 2
3,
5,
2,
8,
4,
4,
6,
6,
2,
4,
2,
7,
4,
4,
7,
7, // 3
6,
6,
2,
8,
3,
3,
5,
5,
3,
2,
2,
2,
3,
4,
6,
6, // 4
3,
5,
2,
8,
4,
4,
6,
6,
2,
4,
2,
7,
4,
4,
7,
7, // 5
6,
6,
2,
8,
3,
3,
5,
5,
4,
2,
2,
2,
5,
4,
6,
6, // 6
3,
5,
2,
8,
4,
4,
6,
6,
2,
4,
2,
7,
4,
4,
7,
7, // 7
2,
6,
2,
6,
3,
3,
3,
3,
2,
2,
2,
2,
4,
4,
4,
4, // 8
3,
6,
2,
6,
4,
4,
4,
4,
2,
5,
2,
5,
5,
5,
5,
5, // 9
2,
6,
2,
6,
3,
3,
3,
3,
2,
2,
2,
2,
4,
4,
4,
4, // A
3,
5,
2,
5,
4,
4,
4,
4,
2,
4,
2,
4,
4,
4,
4,
4, // B
2,
6,
2,
8,
3,
3,
5,
5,
2,
2,
2,
2,
4,
4,
6,
6, // C
3,
5,
2,
8,
4,
4,
6,
6,
2,
4,
2,
7,
4,
4,
7,
7, // D
2,
6,
2,
8,
3,
3,
5,
5,
2,
2,
2,
2,
4,
4,
6,
6, // E
3,
5,
2,
8,
4,
4,
6,
6,
2,
4,
2,
7,
4,
4,
7,
7 // F
};
// This optimization is only possible with the GNU compiler -- MSVC does not allow function alignment
#ifdef __GNUC__
__attribute__((optimize("align-functions=1024")))
#endif
Cpu::result_t Cpu::run ( nes_time_t end )
Cpu::result_t
Cpu::run(nes_time_t end)
{
set_end_time_(end);
clock_count = 0;
@ -260,7 +514,8 @@ loop:
opcode = page[pc++];
data = page[pc];
if ( clock_count >= clock_limit ) [[unlikely]] goto stop;
if (clock_count >= clock_limit) [[unlikely]]
goto stop;
// If traceback support is enabled, trigger it here
#ifdef _QUICKERNES_ENABLE_TRACEBACK_SUPPORT
@ -282,7 +537,6 @@ loop:
switch (opcode)
{
// Often-Used
case 0xB5: // LDA zp,x
@ -295,7 +549,8 @@ loop:
case 0xD0: // BNE
BRANCH((uint8_t)nz);
case 0x20: { // JSR
case 0x20:
{ // JSR
int32_t temp = pc + 1;
pc = GET_OPERAND16(pc);
WRITE_LOW(0x100 | (sp - 1), temp >> 8);
@ -380,7 +635,8 @@ loop:
case 0xB9: // LDA abs,Y
data += y;
data -= x;
case 0xBD:{// LDA abs,X
case 0xBD:
{ // LDA abs,X
pc++;
uint32_t msb = GET_OPERAND(pc);
data += x;
@ -398,7 +654,8 @@ loop:
goto loop;
}
case 0xB1:{// LDA (ind),Y
case 0xB1:
{ // LDA (ind),Y
uint32_t msb = READ_LOW((uint8_t)(data + 1));
data = READ_LOW(data) + y;
// indexed common
@ -482,7 +739,8 @@ loop:
case 0xBC: // LDY abs,X
data += x;
HANDLE_PAGE_CROSSING(data);
case 0xAC:{// LDY abs
case 0xAC:
{ // LDY abs
pc++;
uint32_t addr = data + 0x100 * GET_OPERAND(pc);
if (data & 0x100)
@ -495,7 +753,8 @@ loop:
case 0xBE: // LDX abs,y
data += y;
HANDLE_PAGE_CROSSING(data);
case 0xAE:{// LDX abs
case 0xAE:
{ // LDX abs
pc++;
uint32_t addr = data + 0x100 * GET_OPERAND(pc);
pc++;
@ -522,7 +781,8 @@ loop:
// Compare
case 0xEC:{// CPX abs
case 0xEC:
{ // CPX abs
uint32_t addr = GET_ADDR();
pc++;
data = READ(addr);
@ -539,7 +799,8 @@ loop:
nz &= 0xFF;
goto loop;
case 0xCC:{// CPY abs
case 0xCC:
{ // CPY abs
uint32_t addr = GET_ADDR();
pc++;
data = READ(addr);
@ -573,7 +834,8 @@ loop:
pc++;
goto loop;
case 0x2C:{// BIT abs
case 0x2C:
{ // BIT abs
uint32_t addr = GET_ADDR();
pc += 2;
status &= ~st_v;
@ -605,7 +867,8 @@ loop:
goto adc_imm;
ARITH_ADDR_MODES(0x65) // ADC
adc_imm: {
adc_imm:
{
int32_t carry = (c >> 8) & 1;
int32_t ov = (a ^ 0x80) + carry + (int8_t)data; // sign-extend
status &= ~st_v;
@ -634,7 +897,8 @@ loop:
a = (uint8_t)nz;
goto loop;
case 0x2A: { // ROL A
case 0x2A:
{ // ROL A
nz = a << 1;
int32_t temp = (c >> 8) & 1;
c = nz;
@ -652,7 +916,8 @@ loop:
case 0x0E: // ASL abs
c = 0;
case 0x2E: // ROL abs
rol_abs: {
rol_abs:
{
int32_t temp = data;
ADD_PAGE
if (opcode == 0x1E || opcode == 0x3E) READ(data - (temp & 0x100));
@ -674,7 +939,8 @@ loop:
case 0x4E: // LSR abs
c = 0;
case 0x6E: // ROR abs
ror_abs: {
ror_abs:
{
int32_t temp = data;
ADD_PAGE
if (opcode == 0x5E || opcode == 0x7E) READ(data - (temp & 0x100));
@ -693,7 +959,8 @@ loop:
case 0x46: // LSR zp
c = 0;
case 0x66: // ROR zp
ror_zp: {
ror_zp:
{
int32_t temp = READ_LOW(data);
nz = ((c >> 1) & 0x80) | (temp >> 1);
c = temp << 8;
@ -737,7 +1004,8 @@ loop:
WRITE_LOW(data, nz);
goto loop;
case 0xFE: { // INC abs,x
case 0xFE:
{ // INC abs,x
int32_t temp = data + x;
data = x + GET_ADDR();
READ(data - (temp & 0x100));
@ -750,7 +1018,8 @@ loop:
nz = 1;
goto inc_common;
case 0xDE: { // DEC abs,x
case 0xDE:
{ // DEC abs,x
int32_t temp = data + x;
data = x + GET_ADDR();
READ(data - (temp & 0x100));
@ -761,7 +1030,8 @@ loop:
data = GET_ADDR();
dec_ptr:
nz = -1;
inc_common: {
inc_common:
{
int32_t temp;
WRITE(data, temp = READ(data));
nz += temp;
@ -820,7 +1090,8 @@ loop:
clock_limit = irq_time_;
goto loop;
case 0x28:{// PLP
case 0x28:
{ // PLP
int32_t temp = READ_LOW(sp);
sp = (sp - 0xFF) | 0x100;
data = status;
@ -832,7 +1103,8 @@ loop:
goto handle_sei;
}
case 0x08: { // PHP
case 0x08:
{ // PHP
int32_t temp;
CALC_STATUS(temp);
PUSH(temp | st_b | st_r);
@ -845,7 +1117,8 @@ loop:
pc |= READ((data & 0xFF00) | ((data + 1) & 0xFF)) << 8;
goto loop;
case 0x00: { // BRK
case 0x00:
{ // BRK
pc++;
WRITE_LOW(0x100 | (sp - 1), pc >> 8);
WRITE_LOW(0x100 | (sp - 2), pc);
@ -914,7 +1187,13 @@ loop:
goto end;
// Unofficial
case 0x1C: case 0x3C: case 0x5C: case 0x7C: case 0xDC: case 0xFC: { // SKW
case 0x1C:
case 0x3C:
case 0x5C:
case 0x7C:
case 0xDC:
case 0xFC:
{ // SKW
data += x;
HANDLE_PAGE_CROSSING(data);
int32_t addr = GET_ADDR() + x;
@ -924,10 +1203,28 @@ loop:
}
case 0x0C: // SKW
pc++;
case 0x74: case 0x04: case 0x14: case 0x34: case 0x44: case 0x54: case 0x64: // SKB
case 0x80: case 0x82: case 0x89: case 0xC2: case 0xD4: case 0xE2: case 0xF4:
case 0x74:
case 0x04:
case 0x14:
case 0x34:
case 0x44:
case 0x54:
case 0x64: // SKB
case 0x80:
case 0x82:
case 0x89:
case 0xC2:
case 0xD4:
case 0xE2:
case 0xF4:
pc++;
case 0xEA: case 0x1A: case 0x3A: case 0x5A: case 0x7A: case 0xDA: case 0xFA: // NOP
case 0xEA:
case 0x1A:
case 0x3A:
case 0x5A:
case 0x7A:
case 0xDA:
case 0xFA: // NOP
goto loop;
ARITH_ADDR_MODES_PTR(0xC7) // DCP
@ -947,7 +1244,8 @@ loop:
data = nz ^ 0xFF;
goto adc_imm;
ARITH_ADDR_MODES_PTR( 0x27 ) { // RLA
ARITH_ADDR_MODES_PTR(0x27)
{ // RLA
WRITE(data, nz = READ(data));
int32_t temp = c;
c = nz << 1;
@ -958,7 +1256,8 @@ loop:
goto loop;
}
ARITH_ADDR_MODES_PTR( 0x67 ) { // RRA
ARITH_ADDR_MODES_PTR(0x67)
{ // RRA
int32_t temp;
WRITE(data, temp = READ(data));
nz = ((c >> 1) & 0x80) | (temp >> 1);
@ -1027,7 +1326,8 @@ loop:
data = READ_LOW(data);
goto lax_imm;
case 0xBF: {
case 0xBF:
{
data += y;
HANDLE_PAGE_CROSSING(data);
int32_t temp = data;
@ -1077,7 +1377,8 @@ loop:
WRITE(data, uint8_t(a & x & ((data >> 8) + 1)));
goto loop;
case 0x9F: { // SHA abs,Y
case 0x9F:
{ // SHA abs,Y
data += y;
int32_t temp = data;
ADD_PAGE
@ -1087,7 +1388,8 @@ loop:
goto loop;
}
case 0x9E: { // SHX abs,Y
case 0x9E:
{ // SHX abs,Y
data += y;
int32_t temp = data;
ADD_PAGE
@ -1098,7 +1400,8 @@ loop:
goto loop;
}
case 0x9C: { // SHY abs,X
case 0x9C:
{ // SHY abs,X
data += x;
int32_t temp = data;
ADD_PAGE
@ -1109,7 +1412,8 @@ loop:
goto loop;
}
case 0x9B: { // SHS abs,Y
case 0x9B:
{ // SHS abs,Y
data += y;
int32_t temp = data;
ADD_PAGE
@ -1120,7 +1424,8 @@ loop:
goto loop;
}
case 0xBB: { // LAS abs,Y
case 0xBB:
{ // LAS abs,Y
data += y;
HANDLE_PAGE_CROSSING(data);
int32_t temp = data;
@ -1186,5 +1491,4 @@ end:
return result;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -14,7 +14,6 @@ typedef unsigned nes_addr_t; // 16-bit address
class Cpu
{
public:
void set_tracecb(void (*cb)(unsigned int *data))
{
tracecb = cb;
@ -158,4 +157,4 @@ class Cpu
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,10 +1,10 @@
// Emu 0.7.0. http://www.slack.net/~ant/
#include <cstring>
#include "mappers/mapper.hpp"
#include "emu.hpp"
#include "apu/NESEffectsBuffer.hpp"
#include "apu/buffer.hpp"
#include "mappers/mapper.hpp"
#include <cstring>
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser
@ -71,7 +71,6 @@ inline const char * Emu::auto_init()
return 0;
}
inline void Emu::clear_sound_buf()
{
fade_sound_out = false;
@ -311,136 +310,519 @@ long Emu::read_samples( short* out, long out_size )
Emu::rgb_t const Emu::nes_colors[color_table_size] =
{
// generated with nes_ntsc default settings
{102,102,102},{ 0, 42,136},{ 20, 18,168},{ 59, 0,164},
{ 92, 0,126},{110, 0, 64},{108, 7, 0},{ 87, 29, 0},
{ 52, 53, 0},{ 12, 73, 0},{ 0, 82, 0},{ 0, 79, 8},
{ 0, 64, 78},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{174,174,174},{ 21, 95,218},{ 66, 64,254},{118, 39,255},
{161, 27,205},{184, 30,124},{181, 50, 32},{153, 79, 0},
{108,110, 0},{ 56,135, 0},{ 13,148, 0},{ 0,144, 50},
{ 0,124,142},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{254,254,254},{100,176,254},{147,144,254},{199,119,254},
{243,106,254},{254,110,205},{254,130,112},{235,159, 35},
{189,191, 0},{137,217, 0},{ 93,229, 48},{ 69,225,130},
{ 72,206,223},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{254,254,254},{193,224,254},{212,211,254},{233,200,254},
{251,195,254},{254,197,235},{254,205,198},{247,217,166},
{229,230,149},{208,240,151},{190,245,171},{180,243,205},
{181,236,243},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{102, 102, 102},
{0, 42, 136},
{20, 18, 168},
{59, 0, 164},
{92, 0, 126},
{110, 0, 64},
{108, 7, 0},
{87, 29, 0},
{52, 53, 0},
{12, 73, 0},
{0, 82, 0},
{0, 79, 8},
{0, 64, 78},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{174, 174, 174},
{21, 95, 218},
{66, 64, 254},
{118, 39, 255},
{161, 27, 205},
{184, 30, 124},
{181, 50, 32},
{153, 79, 0},
{108, 110, 0},
{56, 135, 0},
{13, 148, 0},
{0, 144, 50},
{0, 124, 142},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{254, 254, 254},
{100, 176, 254},
{147, 144, 254},
{199, 119, 254},
{243, 106, 254},
{254, 110, 205},
{254, 130, 112},
{235, 159, 35},
{189, 191, 0},
{137, 217, 0},
{93, 229, 48},
{69, 225, 130},
{72, 206, 223},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{254, 254, 254},
{193, 224, 254},
{212, 211, 254},
{233, 200, 254},
{251, 195, 254},
{254, 197, 235},
{254, 205, 198},
{247, 217, 166},
{229, 230, 149},
{208, 240, 151},
{190, 245, 171},
{180, 243, 205},
{181, 236, 243},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{114, 83, 79},{ 0, 23,113},{ 32, 0,145},{ 71, 0,141},
{104, 0,103},{122, 0, 41},{120, 0, 0},{ 99, 10, 0},
{ 64, 34, 0},{ 24, 54, 0},{ 0, 63, 0},{ 0, 60, 0},
{ 0, 45, 54},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{190,148,143},{ 37, 69,187},{ 83, 38,228},{134, 13,224},
{177, 1,174},{200, 4, 92},{198, 24, 1},{170, 53, 0},
{124, 84, 0},{ 73,109, 0},{ 30,122, 0},{ 6,118, 19},
{ 9, 98,110},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{254,222,215},{122,142,254},{168,110,254},{220, 85,254},
{254, 72,247},{254, 76,164},{254, 96, 71},{254,125, 0},
{210,157, 0},{158,183, 0},{114,195, 7},{ 90,191, 89},
{ 93,172,182},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{254,222,215},{214,190,233},{233,177,250},{254,166,248},
{254,161,228},{254,163,194},{254,171,157},{254,183,125},
{250,196,108},{229,206,110},{211,211,130},{201,210,164},
{203,202,202},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 75,106, 64},{ 0, 46, 98},{ 0, 22,130},{ 32, 3,126},
{ 65, 0, 88},{ 82, 0, 26},{ 80, 11, 0},{ 59, 34, 0},
{ 24, 58, 0},{ 0, 77, 0},{ 0, 86, 0},{ 0, 83, 0},
{ 0, 68, 39},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{136,180,122},{ 0,101,166},{ 29, 69,208},{ 80, 44,203},
{123, 32,153},{146, 36, 72},{144, 55, 0},{116, 84, 0},
{ 70,116, 0},{ 19,141, 0},{ 0,153, 0},{ 0,149, 0},
{ 0,130, 90},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{207,254,188},{ 51,183,233},{ 98,151,254},{150,126,254},
{193,113,220},{217,117,137},{214,137, 45},{186,166, 0},
{140,198, 0},{ 88,224, 0},{ 44,236, 0},{ 20,232, 63},
{ 23,213,155},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{207,254,188},{144,231,207},{163,218,224},{184,207,222},
{201,202,201},{211,204,168},{210,212,130},{198,224, 99},
{180,237, 81},{159,247, 83},{141,252,104},{131,251,137},
{132,243,175},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 83, 83, 55},{ 0, 23, 89},{ 0, 0,121},{ 40, 0,117},
{ 73, 0, 79},{ 90, 0, 17},{ 88, 0, 0},{ 67, 10, 0},
{ 32, 34, 0},{ 0, 53, 0},{ 0, 63, 0},{ 0, 60, 0},
{ 0, 45, 30},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{147,148,110},{ 0, 69,154},{ 40, 38,196},{ 91, 12,191},
{134, 0,141},{157, 4, 60},{155, 23, 0},{127, 52, 0},
{ 81, 84, 0},{ 30,109, 0},{ 0,121, 0},{ 0,117, 0},
{ 0, 98, 78},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{221,222,173},{ 65,142,217},{112,110,254},{164, 84,255},
{208, 72,204},{231, 76,122},{229, 95, 29},{200,125, 0},
{154,157, 0},{102,182, 0},{ 58,195, 0},{ 34,191, 47},
{ 37,171,140},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{221,222,173},{158,189,191},{177,176,208},{198,166,206},
{216,161,185},{225,163,152},{224,171,114},{213,183, 83},
{194,195, 66},{173,206, 68},{155,211, 88},{145,209,122},
{146,201,159},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 87, 87,133},{ 0, 26,167},{ 5, 2,198},{ 44, 0,195},
{ 77, 0,157},{ 95, 0, 94},{ 93, 0, 25},{ 71, 14, 0},
{ 36, 38, 0},{ 0, 57, 0},{ 0, 66, 0},{ 0, 63, 38},
{ 0, 49,108},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{153,153,216},{ 0, 74,254},{ 46, 43,254},{ 97, 17,254},
{140, 5,247},{164, 9,165},{161, 28, 74},{133, 57, 0},
{ 87, 89, 0},{ 36,114, 0},{ 0,126, 10},{ 0,122, 92},
{ 0,103,183},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{229,228,254},{ 74,148,254},{120,116,254},{172, 91,254},
{216, 78,254},{239, 82,254},{237,102,166},{208,131, 89},
{162,163, 46},{110,189, 51},{ 66,201,102},{ 42,197,184},
{ 45,178,254},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{229,228,254},{166,196,254},{185,183,254},{206,172,254},
{224,167,254},{233,169,254},{232,177,252},{221,189,220},
{202,202,203},{181,212,205},{163,217,226},{153,216,254},
{154,208,254},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 90, 71, 97},{ 0, 11,130},{ 8, 0,162},{ 47, 0,158},
{ 80, 0,120},{ 98, 0, 58},{ 96, 0, 0},{ 74, 0, 0},
{ 39, 22, 0},{ 0, 42, 0},{ 0, 51, 0},{ 0, 48, 2},
{ 0, 33, 72},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{158,132,166},{ 4, 53,210},{ 50, 22,252},{101, 0,247},
{144, 0,197},{168, 0,116},{165, 7, 25},{137, 36, 0},
{ 91, 68, 0},{ 40, 93, 0},{ 0,105, 0},{ 0,101, 42},
{ 0, 82,134},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{234,201,246},{ 79,121,254},{125, 89,254},{177, 63,254},
{221, 51,254},{245, 55,195},{242, 74,102},{214,104, 24},
{167,136, 0},{115,161, 0},{ 71,174, 37},{ 48,170,120},
{ 50,150,213},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{234,201,246},{171,168,254},{190,155,254},{211,145,254},
{229,140,254},{239,142,225},{237,150,187},{226,162,156},
{207,174,139},{186,185,141},{168,190,161},{159,188,195},
{160,180,232},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 66, 85, 88},{ 0, 25,121},{ 0, 1,153},{ 23, 0,149},
{ 56, 0,111},{ 74, 0, 49},{ 72, 0, 0},{ 51, 12, 0},
{ 16, 36, 0},{ 0, 55, 0},{ 0, 65, 0},{ 0, 62, 0},
{ 0, 47, 63},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{125,151,154},{ 0, 72,198},{ 17, 40,240},{ 69, 15,235},
{112, 3,185},{135, 7,104},{132, 26, 12},{104, 55, 0},
{ 59, 87, 0},{ 7,112, 0},{ 0,124, 0},{ 0,120, 30},
{ 0,101,121},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{192,225,230},{ 37,145,254},{ 83,114,254},{135, 88,254},
{179, 76,254},{202, 80,179},{200, 99, 86},{171,129, 8},
{125,160, 0},{ 73,186, 0},{ 29,198, 21},{ 5,194,104},
{ 8,175,197},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{192,225,230},{129,193,248},{148,180,254},{169,170,254},
{187,165,242},{196,166,209},{195,174,171},{184,186,140},
{165,199,123},{144,209,125},{126,214,145},{116,213,179},
{118,205,216},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 69, 69, 69},{ 0, 16,110},{ 0, 0,142},{ 33, 0,138},
{ 66, 0,100},{ 84, 0, 38},{ 82, 0, 0},{ 60, 3, 0},
{ 25, 27, 0},{ 0, 46, 0},{ 0, 56, 0},{ 0, 53, 0},
{ 0, 38, 51},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{134,134,134},{ 0, 64,187},{ 35, 32,228},{ 86, 7,223},
{129, 0,174},{153, 0, 92},{150, 18, 1},{122, 47, 0},
{ 76, 79, 0},{ 25,104, 0},{ 0,116, 0},{ 0,112, 19},
{ 0, 93,110},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{207,207,207},{ 60,136,254},{107,104,254},{159, 79,254},
{203, 66,248},{226, 70,165},{224, 90, 72},{195,119, 0},
{149,151, 0},{ 97,177, 0},{ 53,189, 8},{ 29,185, 91},
{ 32,166,183},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{207,207,207},{148,178,229},{166,165,246},{188,155,244},
{205,150,224},{215,152,190},{214,159,152},{202,171,121},
{183,184,104},{162,195,106},{145,200,126},{135,198,160},
{136,190,197},{184,184,184},{ 0, 0, 0},{ 0, 0, 0}
};
{114, 83, 79},
{0, 23, 113},
{32, 0, 145},
{71, 0, 141},
{104, 0, 103},
{122, 0, 41},
{120, 0, 0},
{99, 10, 0},
{64, 34, 0},
{24, 54, 0},
{0, 63, 0},
{0, 60, 0},
{0, 45, 54},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{190, 148, 143},
{37, 69, 187},
{83, 38, 228},
{134, 13, 224},
{177, 1, 174},
{200, 4, 92},
{198, 24, 1},
{170, 53, 0},
{124, 84, 0},
{73, 109, 0},
{30, 122, 0},
{6, 118, 19},
{9, 98, 110},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{254, 222, 215},
{122, 142, 254},
{168, 110, 254},
{220, 85, 254},
{254, 72, 247},
{254, 76, 164},
{254, 96, 71},
{254, 125, 0},
{210, 157, 0},
{158, 183, 0},
{114, 195, 7},
{90, 191, 89},
{93, 172, 182},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{254, 222, 215},
{214, 190, 233},
{233, 177, 250},
{254, 166, 248},
{254, 161, 228},
{254, 163, 194},
{254, 171, 157},
{254, 183, 125},
{250, 196, 108},
{229, 206, 110},
{211, 211, 130},
{201, 210, 164},
{203, 202, 202},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{75, 106, 64},
{0, 46, 98},
{0, 22, 130},
{32, 3, 126},
{65, 0, 88},
{82, 0, 26},
{80, 11, 0},
{59, 34, 0},
{24, 58, 0},
{0, 77, 0},
{0, 86, 0},
{0, 83, 0},
{0, 68, 39},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{136, 180, 122},
{0, 101, 166},
{29, 69, 208},
{80, 44, 203},
{123, 32, 153},
{146, 36, 72},
{144, 55, 0},
{116, 84, 0},
{70, 116, 0},
{19, 141, 0},
{0, 153, 0},
{0, 149, 0},
{0, 130, 90},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{207, 254, 188},
{51, 183, 233},
{98, 151, 254},
{150, 126, 254},
{193, 113, 220},
{217, 117, 137},
{214, 137, 45},
{186, 166, 0},
{140, 198, 0},
{88, 224, 0},
{44, 236, 0},
{20, 232, 63},
{23, 213, 155},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{207, 254, 188},
{144, 231, 207},
{163, 218, 224},
{184, 207, 222},
{201, 202, 201},
{211, 204, 168},
{210, 212, 130},
{198, 224, 99},
{180, 237, 81},
{159, 247, 83},
{141, 252, 104},
{131, 251, 137},
{132, 243, 175},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{83, 83, 55},
{0, 23, 89},
{0, 0, 121},
{40, 0, 117},
{73, 0, 79},
{90, 0, 17},
{88, 0, 0},
{67, 10, 0},
{32, 34, 0},
{0, 53, 0},
{0, 63, 0},
{0, 60, 0},
{0, 45, 30},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{147, 148, 110},
{0, 69, 154},
{40, 38, 196},
{91, 12, 191},
{134, 0, 141},
{157, 4, 60},
{155, 23, 0},
{127, 52, 0},
{81, 84, 0},
{30, 109, 0},
{0, 121, 0},
{0, 117, 0},
{0, 98, 78},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{221, 222, 173},
{65, 142, 217},
{112, 110, 254},
{164, 84, 255},
{208, 72, 204},
{231, 76, 122},
{229, 95, 29},
{200, 125, 0},
{154, 157, 0},
{102, 182, 0},
{58, 195, 0},
{34, 191, 47},
{37, 171, 140},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{221, 222, 173},
{158, 189, 191},
{177, 176, 208},
{198, 166, 206},
{216, 161, 185},
{225, 163, 152},
{224, 171, 114},
{213, 183, 83},
{194, 195, 66},
{173, 206, 68},
{155, 211, 88},
{145, 209, 122},
{146, 201, 159},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{87, 87, 133},
{0, 26, 167},
{5, 2, 198},
{44, 0, 195},
{77, 0, 157},
{95, 0, 94},
{93, 0, 25},
{71, 14, 0},
{36, 38, 0},
{0, 57, 0},
{0, 66, 0},
{0, 63, 38},
{0, 49, 108},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{153, 153, 216},
{0, 74, 254},
{46, 43, 254},
{97, 17, 254},
{140, 5, 247},
{164, 9, 165},
{161, 28, 74},
{133, 57, 0},
{87, 89, 0},
{36, 114, 0},
{0, 126, 10},
{0, 122, 92},
{0, 103, 183},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{229, 228, 254},
{74, 148, 254},
{120, 116, 254},
{172, 91, 254},
{216, 78, 254},
{239, 82, 254},
{237, 102, 166},
{208, 131, 89},
{162, 163, 46},
{110, 189, 51},
{66, 201, 102},
{42, 197, 184},
{45, 178, 254},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{229, 228, 254},
{166, 196, 254},
{185, 183, 254},
{206, 172, 254},
{224, 167, 254},
{233, 169, 254},
{232, 177, 252},
{221, 189, 220},
{202, 202, 203},
{181, 212, 205},
{163, 217, 226},
{153, 216, 254},
{154, 208, 254},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{90, 71, 97},
{0, 11, 130},
{8, 0, 162},
{47, 0, 158},
{80, 0, 120},
{98, 0, 58},
{96, 0, 0},
{74, 0, 0},
{39, 22, 0},
{0, 42, 0},
{0, 51, 0},
{0, 48, 2},
{0, 33, 72},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{158, 132, 166},
{4, 53, 210},
{50, 22, 252},
{101, 0, 247},
{144, 0, 197},
{168, 0, 116},
{165, 7, 25},
{137, 36, 0},
{91, 68, 0},
{40, 93, 0},
{0, 105, 0},
{0, 101, 42},
{0, 82, 134},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{234, 201, 246},
{79, 121, 254},
{125, 89, 254},
{177, 63, 254},
{221, 51, 254},
{245, 55, 195},
{242, 74, 102},
{214, 104, 24},
{167, 136, 0},
{115, 161, 0},
{71, 174, 37},
{48, 170, 120},
{50, 150, 213},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{234, 201, 246},
{171, 168, 254},
{190, 155, 254},
{211, 145, 254},
{229, 140, 254},
{239, 142, 225},
{237, 150, 187},
{226, 162, 156},
{207, 174, 139},
{186, 185, 141},
{168, 190, 161},
{159, 188, 195},
{160, 180, 232},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{66, 85, 88},
{0, 25, 121},
{0, 1, 153},
{23, 0, 149},
{56, 0, 111},
{74, 0, 49},
{72, 0, 0},
{51, 12, 0},
{16, 36, 0},
{0, 55, 0},
{0, 65, 0},
{0, 62, 0},
{0, 47, 63},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{125, 151, 154},
{0, 72, 198},
{17, 40, 240},
{69, 15, 235},
{112, 3, 185},
{135, 7, 104},
{132, 26, 12},
{104, 55, 0},
{59, 87, 0},
{7, 112, 0},
{0, 124, 0},
{0, 120, 30},
{0, 101, 121},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{192, 225, 230},
{37, 145, 254},
{83, 114, 254},
{135, 88, 254},
{179, 76, 254},
{202, 80, 179},
{200, 99, 86},
{171, 129, 8},
{125, 160, 0},
{73, 186, 0},
{29, 198, 21},
{5, 194, 104},
{8, 175, 197},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{192, 225, 230},
{129, 193, 248},
{148, 180, 254},
{169, 170, 254},
{187, 165, 242},
{196, 166, 209},
{195, 174, 171},
{184, 186, 140},
{165, 199, 123},
{144, 209, 125},
{126, 214, 145},
{116, 213, 179},
{118, 205, 216},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{69, 69, 69},
{0, 16, 110},
{0, 0, 142},
{33, 0, 138},
{66, 0, 100},
{84, 0, 38},
{82, 0, 0},
{60, 3, 0},
{25, 27, 0},
{0, 46, 0},
{0, 56, 0},
{0, 53, 0},
{0, 38, 51},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{134, 134, 134},
{0, 64, 187},
{35, 32, 228},
{86, 7, 223},
{129, 0, 174},
{153, 0, 92},
{150, 18, 1},
{122, 47, 0},
{76, 79, 0},
{25, 104, 0},
{0, 116, 0},
{0, 112, 19},
{0, 93, 110},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{207, 207, 207},
{60, 136, 254},
{107, 104, 254},
{159, 79, 254},
{203, 66, 248},
{226, 70, 165},
{224, 90, 72},
{195, 119, 0},
{149, 151, 0},
{97, 177, 0},
{53, 189, 8},
{29, 185, 91},
{32, 166, 183},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{207, 207, 207},
{148, 178, 229},
{166, 165, 246},
{188, 155, 244},
{205, 150, 224},
{215, 152, 190},
{214, 159, 152},
{202, 171, 121},
{183, 184, 104},
{162, 195, 106},
{145, 200, 126},
{135, 198, 160},
{136, 190, 197},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0}};
void Emu::SaveAudioBufferState()
{
@ -457,4 +839,4 @@ void Emu::RestoreAudioBufferState()
sound_buf->RestoreAudioBufferState();
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -4,9 +4,9 @@
// Emu 0.7.0
#include "apu/multiBuffer.hpp"
#include "cart.hpp"
#include "core.hpp"
#include "apu/multiBuffer.hpp"
namespace quickerNES
{
@ -294,14 +294,12 @@ class Emu
void SaveAudioBufferState();
void RestoreAudioBufferState();
inline void *get_pixels_base_ptr()
{
return pixels_base_ptr;
}
};
inline void Emu::set_pixels(void *p, long n)
{
pixels_base_ptr = p;
@ -319,4 +317,4 @@ inline long Emu::chr_size() const
return cart()->chr_size() ? cart()->chr_size() : emu.ppu.chr_addr_size;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -291,4 +291,4 @@ Mapper *Mapper::getMapperFromCode(const int mapperCode)
return mapper;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,9 +3,9 @@
// NES mapper interface
// Emu 0.7.0
#include <climits>
#include "../cart.hpp"
#include "../cpu.hpp"
#include <climits>
namespace quickerNES
{
@ -209,4 +209,4 @@ inline bool Mapper::write_intercepted(nes_time_t, nes_addr_t, int) { return fals
inline int Mapper::read(nes_time_t, nes_addr_t) { return -1; } // signal to caller
} // namespace quickNES
} // namespace quickerNES

View File

@ -35,4 +35,4 @@ class Mapper000 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -126,4 +126,4 @@ class Mapper001 : public Mapper, mmc1_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -45,4 +45,4 @@ class Mapper002 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -44,4 +44,4 @@ class Mapper003 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -255,4 +255,4 @@ class Mapper004 : public Mapper, mmc3_state_t
int counter_just_clocked; // used only for debugging
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -149,4 +149,4 @@ class Mapper005 : public Mapper, mmc5_state_t
nes_time_t irq_time;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -52,4 +52,4 @@ class Mapper007 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -78,4 +78,4 @@ class Mapper009 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -76,4 +76,4 @@ class Mapper010 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -52,4 +52,4 @@ class Mapper011 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -94,4 +94,4 @@ class Mapper015 : public Mapper, Mapper015_state_t
unsigned long int i;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -199,4 +199,4 @@ class Mapper019 : public Mapper, namco106_state_t
nes_time_t last_time;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -256,4 +256,4 @@ void Mapper_VRC2_4<type_a, type_b>::write_irq(nes_time_t time,
typedef Mapper_VRC2_4<true, true> Mapper021;
} // namespace quickNES
} // namespace quickerNES

View File

@ -34,4 +34,4 @@ namespace quickerNES
typedef Mapper_VRC2_4<false, true> Mapper022;
} // namespace quickNES
} // namespace quickerNES

View File

@ -33,4 +33,4 @@ namespace quickerNES
typedef Mapper_VRC2_4<false, false> Mapper023;
} // namespace quickNES
} // namespace quickerNES

View File

@ -233,4 +233,4 @@ class Mapper_Vrc6 : public Mapper, vrc6_state_t
typedef Mapper_Vrc6<0> Mapper024;
} // namespace quickNES
} // namespace quickerNES

View File

@ -33,4 +33,4 @@ namespace quickerNES
typedef Mapper_VRC2_4<true, false> Mapper025;
} // namespace quickNES
} // namespace quickerNES

View File

@ -11,4 +11,4 @@ namespace quickerNES
typedef Mapper_Vrc6<3> Mapper026;
} // namespace quickNES
} // namespace quickerNES

View File

@ -53,4 +53,4 @@ class Mapper030 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -126,4 +126,4 @@ class Mapper032 : public Mapper, mapper32_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -103,4 +103,4 @@ class Mapper033 : public Mapper, tc0190_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -44,4 +44,4 @@ class Mapper034 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -53,4 +53,4 @@ class Mapper060 : public Mapper
uint8_t game_sel, last_game;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -52,4 +52,4 @@ class Mapper066 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -190,4 +190,4 @@ class Mapper069 : public Mapper, fme7_state_t
Fme7_Apu sound;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -84,4 +84,4 @@ class Mapper_74x161x162x32 : public Mapper
typedef Mapper_74x161x162x32<70> Mapper070;
} // namespace quickNES
} // namespace quickerNES

View File

@ -54,4 +54,4 @@ class Mapper071 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -134,4 +134,4 @@ class Mapper073 : public Mapper, vrc3_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -110,4 +110,4 @@ class Mapper075 : public Mapper, vrc1_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -77,4 +77,4 @@ class Mapper078 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -95,4 +95,4 @@ void Mapper_AveNina<multicart>::write_regs()
typedef Mapper_AveNina<false> Mapper079;
} // namespace quickNES
} // namespace quickerNES

View File

@ -225,4 +225,4 @@ class Mapper085 : public Mapper, vrc7_state_t
};
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -26,4 +26,4 @@ namespace quickerNES
typedef Mapper_74x161x162x32<86> Mapper086;
} // namespace quickNES
} // namespace quickerNES

View File

@ -50,4 +50,4 @@ class Mapper087 : public Mapper
void write(nes_time_t, nes_addr_t, int) {}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -111,5 +111,4 @@ class Mapper_Namco_34x3 : public Mapper, namco_34x3_state_t
typedef Mapper_Namco_34x3<false> Mapper088;
} // namespace quickNES
} // namespace quickerNES

View File

@ -59,4 +59,4 @@ class Mapper089 : public Mapper
uint8_t regs;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -58,4 +58,4 @@ class Mapper093 : public Mapper
uint8_t regs;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -57,4 +57,4 @@ class Mapper094 : public Mapper
uint8_t bank;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -66,4 +66,4 @@ class Mapper097 : public Mapper
uint8_t bank;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -30,4 +30,4 @@ namespace quickerNES
typedef Mapper_AveNina<true> Mapper113;
} // namespace quickNES
} // namespace quickerNES

View File

@ -66,4 +66,4 @@ class Mapper140 : public Mapper
uint8_t regs;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -26,4 +26,4 @@ namespace quickerNES
typedef Mapper_74x161x162x32<152> Mapper152;
} // namespace quickNES
} // namespace quickerNES

View File

@ -30,4 +30,4 @@ namespace quickerNES
typedef Mapper_Namco_34x3<true> Mapper154;
} // namespace quickNES
} // namespace quickerNES

View File

@ -62,4 +62,4 @@ class Mapper156 : public Mapper, m156_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -57,4 +57,4 @@ class Mapper180 : public Mapper
uint8_t bank;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -67,4 +67,4 @@ class Mapper184 : public Mapper
uint8_t regs;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -57,4 +57,4 @@ class Mapper190 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -78,4 +78,4 @@ class Mapper193 : public Mapper
uint8_t regs[4];
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -100,4 +100,4 @@ class Mapper206 : public Mapper, namco_34xx_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -93,4 +93,4 @@ class Mapper207 : public Mapper, taito_x1005_state_t
virtual void write(nes_time_t, nes_addr_t addr, int data) {}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -56,4 +56,4 @@ class Mapper232 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -66,4 +66,4 @@ class Mapper240 : public Mapper
uint8_t regs;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -55,4 +55,4 @@ class Mapper241 : public Mapper
uint8_t bank;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -72,4 +72,4 @@ class Mapper244 : public Mapper, mapper244_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -77,4 +77,4 @@ class Mapper246 : public Mapper
uint8_t regs[8];
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,9 +3,9 @@
// Emu 0.7.0. http://www.slack.net/~ant/
#include <cstring>
#include "ppu.hpp"
#include "../core.hpp"
#include <cstring>
namespace quickerNES
{
@ -656,4 +656,4 @@ nes_time_t Ppu::earliest_open_bus_decay()
return (decay_low < decay_high) ? decay_low : decay_high;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// NES PPU emulator
// Emu 0.7.0
#include <climits>
#include "ppuRendering.hpp"
#include <climits>
namespace quickerNES
{
@ -143,4 +143,4 @@ inline void Ppu::update_open_bus(nes_time_t time)
if (time >= decay_high) open_bus &= ~0xE0;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -433,4 +433,4 @@ long Ppu_Impl::recalc_sprite_max(int scanline)
return 0;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -260,4 +260,4 @@ inline void Ppu_Impl::begin_frame()
addr_inc = w2000 & 4 ? 32 : 1;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -503,4 +503,4 @@ void Ppu_Rendering::draw_background(int start, int count)
}
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -61,4 +61,4 @@ inline void Ppu_Rendering::draw_sprites(int start, int count)
draw_scanlines(start, count, host_pixels + host_row_bytes * start, host_row_bytes, 2);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,14 +1,13 @@
#pragma once
#include "core/emu.hpp"
#include "../nesInstanceBase.hpp"
#include "core/emu.hpp"
typedef quickerNES::Emu emulator_t;
class NESInstance final : public NESInstanceBase
{
public:
NESInstance(const nlohmann::json &config) : NESInstanceBase(config) {}
uint8_t *getLowMem() const override { return _nes.get_low_mem(); };
@ -59,7 +58,6 @@ class NESInstance final : public NESInstanceBase
}
protected:
bool loadROMImpl(const uint8_t *romData, const size_t romSize) override
{
// Loading rom data
@ -70,9 +68,7 @@ class NESInstance final : public NESInstanceBase
void enableStateBlockImpl(const std::string &block) override { _nes.enableStateBlock(block); };
void disableStateBlockImpl(const std::string &block) override { _nes.disableStateBlock(block); };
private:
// Emulator instance
emulator_t _nes;
};

Some files were not shown because too many files have changed in this diff Show More