Lots of code cleanup (#32)
### Description <!-- What is the purpose of this PR and what it adds? --> ### Will this Pull Request break anything? <!-- Will it break the compiling? --> ### Suggested Testing Steps <!-- See if the compiling fails/break anything in the game. -->
This commit is contained in:
@@ -8,8 +8,9 @@
|
||||
#include "cpu.h"
|
||||
#include "snes.h"
|
||||
#include "../types.h"
|
||||
#include "../ida_types.h"
|
||||
#include "../enemy_types.h"
|
||||
#include "../variables.h"
|
||||
|
||||
static const int cyclesPerOpcode[256] = {
|
||||
7, 6, 7, 4, 5, 3, 5, 6, 3, 2, 2, 4, 6, 4, 6, 5,
|
||||
2, 5, 5, 7, 5, 4, 6, 6, 2, 4, 2, 2, 6, 4, 7, 5,
|
||||
@@ -44,6 +45,8 @@ static void cpu_writeWord(Cpu* cpu, uint32_t adrl, uint32_t adrh, uint16_t value
|
||||
static void cpu_doInterrupt(Cpu* cpu, bool irq);
|
||||
static void cpu_doOpcode(Cpu* cpu, uint8_t opcode);
|
||||
|
||||
extern Snes *g_snes; // for debugging
|
||||
|
||||
// addressing modes and opcode functions not declared, only used after defintions
|
||||
|
||||
static uint8_t cpu_read(Cpu* cpu, uint32_t adr) {
|
||||
|
||||
@@ -164,7 +164,7 @@ void snes_handle_pos_stuff(Snes *snes) {
|
||||
}
|
||||
}
|
||||
|
||||
#define IS_ADR(x) (x == 0xfffff )
|
||||
#define IS_ADR(x) (x == 0xfffff)
|
||||
|
||||
void snes_catchupApu(Snes* snes) {
|
||||
if (snes->apuCatchupCycles > 10000)
|
||||
@@ -407,9 +407,11 @@ uint8_t snes_read(Snes* snes, uint32_t adr) {
|
||||
}
|
||||
|
||||
void LogWrite(Snes *snes, uint32_t adr, uint8_t val) {
|
||||
printf("@%d: Write to 0x%x = 0x%.2x: 0x%x: 0x%x: x = 0x%x, y = 0x%x, c = %d\n",
|
||||
printf("@%d: Write to 0x%x = 0x%.2x: 0x%x: r18=0x%x: r20=0x%x: a = 0x%x, x = 0x%x, y = 0x%x, c = %d\n",
|
||||
snes_frame_counter, adr, val, snes->cpu->k << 16 | snes->cpu->pc,
|
||||
snes->ram[0x12] | snes->ram[0x13] << 8, snes->cpu->x, snes->cpu->y, snes->cpu->c);
|
||||
snes->ram[0x12] | snes->ram[0x13] << 8,
|
||||
snes->ram[0x14] | snes->ram[0x15] << 8,
|
||||
snes->cpu->a, snes->cpu->x, snes->cpu->y, snes->cpu->c);
|
||||
}
|
||||
|
||||
void snes_write(Snes* snes, uint32_t adr, uint8_t val) {
|
||||
|
||||
Reference in New Issue
Block a user