Emulator: Change register type to uint32_t
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint> // int8_t, uint8_t, uint16_t, uint32_t
|
#include <cstdint> // int8_t, uint8_t, uint32_t
|
||||||
|
|
||||||
#include "processing-unit.h"
|
#include "processing-unit.h"
|
||||||
|
|
||||||
@@ -38,18 +38,18 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Registers
|
// Registers
|
||||||
uint8_t m_a { 0 }; // Accumulator
|
uint32_t m_a { 0 }; // Accumulator
|
||||||
uint16_t m_bc { 0 }; // BC
|
uint32_t m_bc { 0 }; // BC
|
||||||
uint16_t m_de { 0 }; // DE
|
uint32_t m_de { 0 }; // DE
|
||||||
uint16_t m_hl { 0 }; // HL
|
uint32_t m_hl { 0 }; // HL
|
||||||
uint16_t m_sp { 0 }; // Stack Pointer
|
uint32_t m_sp { 0 }; // Stack Pointer
|
||||||
uint16_t m_pc { 0 }; // Program Counter
|
uint32_t m_pc { 0 }; // Program Counter
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
uint8_t m_z { 0 }; // Zero flag
|
uint32_t m_z { 0 }; // Zero flag
|
||||||
uint8_t m_n { 0 }; // Subtraction flag (BCD)
|
uint32_t m_n { 0 }; // Subtraction flag (BCD)
|
||||||
uint8_t m_h { 0 }; // Half Carry flag (BCD)
|
uint32_t m_h { 0 }; // Half Carry flag (BCD)
|
||||||
uint8_t m_c { 0 }; // Carry flag
|
uint32_t m_c { 0 }; // Carry flag
|
||||||
|
|
||||||
int8_t m_wait_cycles { 0 };
|
int8_t m_wait_cycles { 0 };
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
#include <cstdint> // uint8_t, uint32_t
|
#include <cstdint> // uint32_t
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
@@ -42,7 +42,7 @@ void Emu::writeMemory(const char* memory_space, uint32_t location, uint32_t valu
|
|||||||
m_memory_spaces[memory_space][location] = value;
|
m_memory_spaces[memory_space][location] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Emu::readMemory(const char* memory_space, uint32_t location)
|
uint32_t Emu::readMemory(const char* memory_space, uint32_t location)
|
||||||
{
|
{
|
||||||
return m_memory_spaces[memory_space][location];
|
return m_memory_spaces[memory_space][location];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint> // uint8_t, uint32_t
|
#include <cstdint> // uint32_t
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -20,15 +20,14 @@ public:
|
|||||||
void addMemorySpace(const char* name, uint32_t size);
|
void addMemorySpace(const char* name, uint32_t size);
|
||||||
|
|
||||||
void writeMemory(const char* memory_space, uint32_t location, uint32_t value);
|
void writeMemory(const char* memory_space, uint32_t location, uint32_t value);
|
||||||
|
uint32_t readMemory(const char* memory_space, uint32_t location);
|
||||||
uint8_t readMemory(const char* memory_space, uint32_t location);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_frequency = 0;
|
uint32_t m_frequency { 0 };
|
||||||
double m_timestep = 0;
|
double m_timestep { 0 };
|
||||||
uint32_t m_cycle = 0;
|
uint32_t m_cycle { 0 };
|
||||||
double m_cycle_time = 0;
|
double m_cycle_time { 0 };
|
||||||
double m_previous_time = 0;
|
double m_previous_time { 0 };
|
||||||
|
|
||||||
ruc::Timer m_timer;
|
ruc::Timer m_timer;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user