mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-11 13:29:22 +00:00
Finishing the main and disabling the invalid opcode throw for now
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "sources/Renderer/IRenderer.hpp"
|
||||
#include "sources/SNES.hpp"
|
||||
#include "sources/Renderer/SFRenderer.hpp"
|
||||
|
||||
@@ -23,6 +22,8 @@ int main(int argc, char **argv)
|
||||
unsigned cycleCount = snes.cpu->update();
|
||||
snes.ppu->update(cycleCount);
|
||||
snes.apu->update(cycleCount);
|
||||
|
||||
renderer.getEvents();
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
std::cerr << "An error occurred: " << e.what() << std::endl;
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ namespace ComSquare::APU
|
||||
}
|
||||
}
|
||||
|
||||
bool APU::update(unsigned cycles)
|
||||
void APU::update(unsigned cycles)
|
||||
{
|
||||
(void)cycles;
|
||||
}
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ namespace ComSquare::APU
|
||||
//! @param data The new value of the register.
|
||||
//! @throw InvalidAddress will be thrown if the address is more than $FF (the number of register).
|
||||
void write(uint24_t addr, uint8_t data) override;
|
||||
bool update(unsigned cycles);
|
||||
void update(unsigned cycles);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -218,7 +218,8 @@ namespace ComSquare::CPU
|
||||
case Instructions::ADC_ABSXl:return this->ADC(this->_getAbsoluteIndexedByXLongAddr());
|
||||
|
||||
default:
|
||||
throw InvalidOpcode("CPU", opcode);
|
||||
return 0;
|
||||
//throw InvalidOpcode("CPU", opcode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,5 +9,7 @@ namespace ComSquare::CPU
|
||||
int CPU::ADC(uint24_t valueAddr)
|
||||
{
|
||||
// this->_registers.a +=
|
||||
(void)valueAddr;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@@ -7,19 +7,19 @@
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <ios>
|
||||
#include <sstream>
|
||||
|
||||
namespace ComSquare
|
||||
{
|
||||
//! @brief Exception thrown when someone tries to load an invalid rom.
|
||||
class InvalidOpcode : std::exception {
|
||||
class InvalidOpcode : public std::exception {
|
||||
private:
|
||||
std::string _msg;
|
||||
public:
|
||||
explicit InvalidOpcode(const std::string &pu, unsigned opcode)
|
||||
{
|
||||
std::stringstream stream;
|
||||
stream << "The " + pu + ": 0x" << std::hex << opcode;
|
||||
stream << "The " + pu + " got an invalid opcode: 0x" << std::hex << opcode;
|
||||
this->_msg = stream.str();
|
||||
}
|
||||
const char *what() const noexcept override { return this->_msg.c_str(); }
|
||||
|
||||
Reference in New Issue
Block a user