From 32837712fedf4557ff44df7d5b8ddbd40c5f7990 Mon Sep 17 00:00:00 2001 From: kotorifan Date: Fri, 23 Jan 2026 15:15:48 +0100 Subject: Stupid problems with the old git repo. New one, unfortunately. --- src/Processor.hpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/Processor.hpp (limited to 'src/Processor.hpp') diff --git a/src/Processor.hpp b/src/Processor.hpp new file mode 100644 index 0000000..b00c02c --- /dev/null +++ b/src/Processor.hpp @@ -0,0 +1,51 @@ +#pragma once + +#include +#include "Memory.hpp" + +namespace DMG01 +{ + class SM83 + { + public: + struct Cycles + { + uint32_t total_cycles; + }; + union Registers + { + uint16_t word; + struct + { + uint8_t higher; + uint8_t lower; + } byte; + }; + Registers af; + Registers hl; + Registers de; + Registers bc; + uint16_t pc; + uint16_t sp; + Cycles cycles; + bool stop_state; + inline void add_cycles(Cycles& cycles, const uint32_t count); + inline void set_flag(uint8_t& f, uint8_t index, bool on=true); + inline bool test_flag(uint8_t& f, const uint8_t index); + void load_bin(const std::string& filename, Memory& memory); + template + inline void ld_imm(T1& reg, const T2& data); + template + inline void ld_reg(T1& reg1, const T2& reg2); + template + inline void inc_reg(T& val); + template + inline void dec_reg(T& val); + inline void rlca(SM83& sm83); + template + inline void add_reg(T1& aug, const T2& add); + inline void rrca(SM83& sm83); + inline void stop(SM83& sm83, Memory& memory); + void process_opcodes(const uint8_t opcode, Memory& memory, SM83& sm83); + }; +} -- cgit v1.3