From 5d2ee7cbc91017d508d42a8ea08ea406b3ea3e09 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Mon, 22 Aug 2022 22:53:52 +0200 Subject: [PATCH] Emulator: Add opcodes $6/$16/$26/$36 --- src/cpu.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/cpu.cpp b/src/cpu.cpp index fae1d35..ddd5e76 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -63,13 +63,17 @@ void CPU::update() case 0x01: ld16(); break; case 0x02: ld8(); break; + case 0x06: ld8(); break; case 0x08: ld16(); break; case 0x11: ld16(); break; case 0x12: ld8(); break; + case 0x16: ld8(); break; case 0x21: ld16(); break; case 0x22: ld8(); break; + case 0x26: ld8(); break; case 0x31: ld16(); break; case 0x32: ld8(); break; + case 0x36: ld8(); break; case 0x3e: ld8(); break; case 0xc3: jp16(); break; case 0xc6: add(); break; @@ -120,11 +124,21 @@ void CPU::ld8() m_wait_cycles += 8; write(bc(), m_a); break; + case 0x06: + // LD B,n + m_wait_cycles += 8; + m_b = pcRead(); + break; case 0x12: // LD (DE),A m_wait_cycles += 8; write(de(), m_a); break; + case 0x16: + // LD D,n + m_wait_cycles += 8; + m_d = pcRead(); + break; case 0x22: { // LD (HL+),A == LD (HLI),A == LDI (HL),A m_wait_cycles += 8; @@ -139,6 +153,11 @@ void CPU::ld8() m_h = address >> 8; break; } + case 0x26: + // LD H,n + m_wait_cycles += 8; + m_h = pcRead(); + break; case 0x32: { // LD (HL-),A == LD (HLD),A == LDD (HL),A m_wait_cycles += 8; @@ -153,6 +172,11 @@ void CPU::ld8() m_h = address >> 8; break; } + case 0x36: + // LD (HL),n + m_wait_cycles += 12; + write(hl(), pcRead()); + break; case 0x3e: // LD A,n m_wait_cycles += 8;