add a basic structure for disassembler + executor

Instructions added
Branch and Exchange (BX)
Branch and Link (B)
Multiply and Accumulate (MUL, MLA)
Multiply Long and Accumulate (SMULL, SMLAL, UMULL, UMLAL)
Single data swap (SWP)
[WIP] Halfword Transfer (STRH, LDRH)

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2023-09-13 03:44:36 +05:30
parent 904e2b698e
commit 8a04eade92
22 changed files with 571 additions and 50 deletions

View File

@@ -9,7 +9,8 @@ using std::size_t;
class Cpu {
public:
Cpu(Bus bus);
Cpu(std::shared_ptr<Bus> bus);
void step();
private:
static constexpr size_t GPR_FIQ_BANKED_FIRST = 8;
@@ -35,7 +36,7 @@ class Cpu {
uint32_t gpr[GPR_VISIBLE_COUNT]; // general purpose registers
Psr cpsr; // current program status register
Psr spsr; // status program status register
Bus bus;
std::shared_ptr<Bus> bus;
struct {
uint32_t fiq[GPR_FIQ_BANKED_COUNT];
@@ -57,7 +58,5 @@ class Cpu {
} spsr_banked; // banked saved program status registers
void chg_mode(Mode from, Mode to);
uint32_t& operator[](uint8_t idx);
const uint32_t& operator[](uint8_t idx) const;
std::string exec_arm(uint32_t insn);
};