Minor changes

This commit is contained in:
Sergio Martin 2024-01-14 08:11:26 +01:00
parent 57c43b6d98
commit dba28a6b98
9 changed files with 17 additions and 22 deletions

View File

@ -14,6 +14,7 @@ Changes
=========
- Optimizations made in the CPU emulation core
- Minimize compiled code size to reduce pressure on L1i cache
- Sound is no longer emulated during skip frames
Credits

View File

@ -41,7 +41,7 @@ quickerNESCoreSrc = [
# quickerNES Core Configuration
quickerNESCoreDependency = declare_dependency(
compile_args : [ '-Wfatal-errors', '-Wall', '-Werror', '-Wno-multichar' ],
compile_args : [ '-Wfatal-errors', '-Wall', '-Werror', '-Wno-multichar', '-DNDEBUG' ],
include_directories : include_directories(['source', 'source/core', 'extern']),
sources : [ quickerNESCoreSrc, 'extern/metrohash128/metrohash128.cpp' ]
)

View File

@ -3,7 +3,8 @@
#include "Nes_Emu.h"
#include <string.h>
#include <cstdio>
#include <cstring>
#include "Nes_State.h"
#include "Nes_Mapper.h"

View File

@ -202,6 +202,10 @@ public:
enum { high_mem_size = 0x2000 };
uint8_t* high_mem() { return emu.impl->sram; }
// Sprite memory
uint8_t* spr_mem() { return emu.ppu.getSpriteRAM(); }
uint16_t spr_mem_size() { return emu.ppu.getSpriteRAMSize(); }
// End of public interface
public:
const char * set_sample_rate( long rate, class Nes_Buffer* );

View File

@ -213,13 +213,6 @@ void Nes_Mapper::mirror_manual( int page0, int page1, int page2, int page3 )
emu().ppu.set_nt_banks( page0, page1, page2, page3 );
}
#ifndef NDEBUG
int Nes_Mapper::handle_bus_conflict( nes_addr_t addr, int data )
{
return data;
}
#endif
Nes_Mapper* Nes_Mapper::create( Nes_Cart const* cart, Nes_Core* emu )
{

View File

@ -16,13 +16,6 @@ class Nes_Core;
class Nes_Mapper {
public:
// Register function that creates mapper for given code.
typedef Nes_Mapper* (*creator_func_t)();
static void register_mapper( int code, creator_func_t );
// Register optional mappers included with Nes_Emu
void register_optional_mappers();
// Create mapper appropriate for cartridge. Returns NULL if it uses unsupported mapper.
static Nes_Mapper* create( Nes_Cart const*, Nes_Core* );
@ -176,10 +169,7 @@ private:
};
#ifdef NDEBUG
inline int Nes_Mapper::handle_bus_conflict( nes_addr_t addr, int data ) { return data; }
#endif
inline void Nes_Mapper::mirror_horiz( int p ) { mirror_manual( p, p, p ^ 1, p ^ 1 ); }
inline void Nes_Mapper::mirror_vert( int p ) { mirror_manual( p, p ^ 1, p, p ^ 1 ); }
inline void Nes_Mapper::mirror_single( int p ) { mirror_manual( p, p, p, p ); }

View File

@ -28,7 +28,8 @@ public:
static const uint16_t image_left = 8;
static const uint16_t buffer_width = image_width + 16;
static const uint16_t buffer_height = image_height;
enum { spr_ram_size = 0x100 };
int write_2007( int );
// Host palette
@ -64,8 +65,11 @@ public:
static const uint16_t scanline_len = 341;
uint8_t* getSpriteRAM () { return spr_ram; }
uint16_t getSpriteRAMSize () { return spr_ram_size; }
protected:
uint8_t spr_ram [0x100];
uint8_t spr_ram [spr_ram_size];
void begin_frame();
void run_hblank( int );
int sprite_height() const { return (w2000 >> 2 & 8) + 8; }

View File

@ -38,7 +38,7 @@ public:
virtual void write( nes_time_t, nes_addr_t addr, int data )
{
bank = handle_bus_conflict( addr, data );
set_prg_bank( 0x8000, bank_16k, bank );
set_prg_bank( 0x8000, bank_16k, data );
}
};

View File

@ -52,6 +52,8 @@ class EmuInstance
uint8_t* getHighMem() { return _nes->high_mem();};
const uint8_t* getChrMem() { return _nes->chr_mem();};
size_t getChrMemSize() { return _nes->chr_size();};
uint8_t* getSpriteRAM() { return _nes->spr_mem(); }
uint16_t getSpriteRAMSize() { return _nes->spr_mem_size(); }
const std::string getRomSHA1() const { return _romSHA1String; };