refactoring and small tweaks in cpu
This commit is contained in:
parent
58bc38688e
commit
b970262005
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include "audio/apu.h"
|
||||
#include "apu/apu.h"
|
||||
#include "Nes_Cpu.h"
|
||||
#include "Nes_Ppu.h"
|
||||
#include "mappers/mapper.h"
|
||||
|
|
|
@ -118,11 +118,10 @@ imm##op: \
|
|||
{ \
|
||||
pc++; \
|
||||
int offset = (int8_t) data; \
|
||||
int extra_clock = (pc & 0xFF) + offset; \
|
||||
if ( !(cond) ) {clock_count--; goto loop; } \
|
||||
pc += offset; \
|
||||
pc = uint16_t( pc ); \
|
||||
clock_count += (extra_clock >> 8) & 1; \
|
||||
clock_count += (((pc & 0xFF) + offset) >> 8) & 1; \
|
||||
goto loop; \
|
||||
}
|
||||
|
||||
|
@ -198,27 +197,7 @@ inline void Nes_Cpu::write( nes_addr_t addr, int value )
|
|||
}
|
||||
|
||||
// status flags
|
||||
|
||||
|
||||
constexpr 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
|
||||
};
|
||||
extern uint8_t clock_table [256];
|
||||
|
||||
__attribute__((optimize("align-functions=" _PAGE_SIZE)))
|
||||
Nes_Cpu::result_t Nes_Cpu::run ( nes_time_t end )
|
||||
|
@ -1166,3 +1145,23 @@ end:
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
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
|
||||
};
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Nes_Emu 0.7.0
|
||||
|
||||
#include "audio/Multi_Buffer.h"
|
||||
#include "apu/Multi_Buffer.h"
|
||||
#include "Nes_Cart.h"
|
||||
#include "Nes_Core.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Nes_Emu 0.7.0. http://www.slack.net/~ant/libs/
|
||||
|
||||
#include "audio/Nes_Buffer.h"
|
||||
#include "audio/apu.h"
|
||||
#include "apu/Nes_Buffer.h"
|
||||
#include "apu/apu.h"
|
||||
|
||||
/* Library Copyright (C) 2003-2006 Shay Green. This library is free software;
|
||||
you can redistribute it and/or modify it under the terms of the GNU Lesser
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
// Nes_Emu 0.7.0. http://www.slack.net/~ant/libs/
|
||||
|
||||
#include "audio/Nes_Effects_Buffer.h"
|
||||
#include "audio/apu.h"
|
||||
#include "apu/Nes_Effects_Buffer.h"
|
||||
#include "apu/apu.h"
|
||||
|
||||
/* 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
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
// Nes_Emu 0.7.0. http://www.slack.net/~ant/
|
||||
|
||||
#include "audio/fme7/apu.h"
|
||||
#include "apu/fme7/apu.h"
|
||||
#include <cstring>
|
||||
|
||||
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
|
|
@ -4,7 +4,7 @@
|
|||
// Nes_Emu 0.7.0
|
||||
|
||||
#include <cstdint>
|
||||
#include "audio/Blip_Buffer.h"
|
||||
#include "apu/Blip_Buffer.h"
|
||||
|
||||
struct fme7_apu_state_t
|
||||
{
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
// Nes_Snd_Emu 0.1.7. http://www.slack.net/~ant/
|
||||
|
||||
#include "audio/Blip_Buffer.h"
|
||||
#include "audio/namco/apu.h"
|
||||
#include "apu/Blip_Buffer.h"
|
||||
#include "apu/namco/apu.h"
|
||||
|
||||
/* 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
|
|
@ -4,7 +4,7 @@
|
|||
// Nes_Snd_Emu 0.1.7
|
||||
|
||||
#include <cstdint>
|
||||
#include "audio/apu.h"
|
||||
#include "apu/apu.h"
|
||||
|
||||
struct namco_state_t
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
// Nes_Snd_Emu 0.1.7. http://www.slack.net/~ant/
|
||||
|
||||
#include "audio/vrc6/apu.h"
|
||||
#include "apu/vrc6/apu.h"
|
||||
|
||||
/* 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
|
|
@ -5,8 +5,8 @@
|
|||
// Nes_Snd_Emu 0.1.7
|
||||
|
||||
#include <cstdint>
|
||||
#include "audio/apu.h"
|
||||
#include "audio/Blip_Buffer.h"
|
||||
#include "apu/apu.h"
|
||||
#include "apu/Blip_Buffer.h"
|
||||
|
||||
struct vrc6_apu_state_t;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "audio/vrc7/apu.h"
|
||||
#include "audio/vrc7/emu2413.h"
|
||||
#include "apu/vrc7/apu.h"
|
||||
#include "apu/vrc7/emu2413.h"
|
||||
#include <cstring>
|
||||
|
||||
#define BYTESWAP(xxxx) {uint32_t _temp = (uint32_t)(xxxx);\
|
|
@ -5,8 +5,8 @@
|
|||
// Nes_Snd_Emu 0.1.7. Copyright (C) 2003-2005 Shay Green. GNU LGPL license.
|
||||
|
||||
#include <cstdint>
|
||||
#include "audio/vrc7/emu2413_state.h"
|
||||
#include "audio/Blip_Buffer.h"
|
||||
#include "apu/vrc7/emu2413_state.h"
|
||||
#include "apu/Blip_Buffer.h"
|
||||
|
||||
struct vrc7_snapshot_t;
|
||||
typedef long nes_time_t;
|
|
@ -5,7 +5,7 @@
|
|||
// Nes_Emu 0.7.0. http://www.slack.net/~ant/
|
||||
|
||||
#include "mappers/mapper.h"
|
||||
#include "audio/namco/apu.h"
|
||||
#include "apu/namco/apu.h"
|
||||
|
||||
/* 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
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
// Konami VRC6 mapper
|
||||
// Nes_Emu 0.7.0. http://www.slack.net/~ant/
|
||||
|
||||
#include <cstring>
|
||||
#include "mappers/mapper.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "audio/vrc6/apu.h"
|
||||
#include "apu/vrc6/apu.h"
|
||||
|
||||
/* 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
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// Nes_Emu 0.7.0. http://www.slack.net/~ant/libs/
|
||||
|
||||
#include "mappers/mapper.h"
|
||||
#include "audio/fme7/apu.h"
|
||||
#include "apu/fme7/apu.h"
|
||||
|
||||
/* Copyright (C) 2005 Chris Moeller */
|
||||
/* Copyright (C) 2005-2006 Shay Green. This module is free software; you
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <cstring>
|
||||
#include "mappers/mapper.h"
|
||||
#include "audio/vrc7/apu.h"
|
||||
#include "apu/vrc7/apu.h"
|
||||
|
||||
/* Copyright (C) 2004-2005 Shay Green. This module is free software; you
|
||||
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
# quickerNES Core sources
|
||||
|
||||
quickerNESAudioSrc = [
|
||||
'audio/apu.cpp',
|
||||
'audio/Nes_Oscs.cpp',
|
||||
'audio/Nes_Buffer.cpp',
|
||||
'audio/Blip_Buffer.cpp',
|
||||
'audio/Effects_Buffer.cpp',
|
||||
'audio/Nes_Effects_Buffer.cpp',
|
||||
'audio/Multi_Buffer.cpp',
|
||||
'audio/namco/apu.cpp',
|
||||
'audio/vrc6/apu.cpp',
|
||||
'audio/vrc7/emu2413.cpp',
|
||||
'audio/vrc7/emu2413_state.cpp',
|
||||
'audio/vrc7/apu.cpp',
|
||||
'audio/fme7/apu.cpp',
|
||||
'apu/apu.cpp',
|
||||
'apu/Nes_Oscs.cpp',
|
||||
'apu/Nes_Buffer.cpp',
|
||||
'apu/Blip_Buffer.cpp',
|
||||
'apu/Effects_Buffer.cpp',
|
||||
'apu/Nes_Effects_Buffer.cpp',
|
||||
'apu/Multi_Buffer.cpp',
|
||||
'apu/namco/apu.cpp',
|
||||
'apu/vrc6/apu.cpp',
|
||||
'apu/vrc7/emu2413.cpp',
|
||||
'apu/vrc7/emu2413_state.cpp',
|
||||
'apu/vrc7/apu.cpp',
|
||||
'apu/fme7/apu.cpp',
|
||||
]
|
||||
|
||||
quickerNESSrc = quickerNESAudioSrc + [
|
||||
|
|
Loading…
Reference in New Issue