diff --git a/src/emulator.rs b/src/emulator.rs index 79cf223..0c2fa58 100644 --- a/src/emulator.rs +++ b/src/emulator.rs @@ -363,6 +363,15 @@ where ProcessorInstruction::FontCharacter(vx) => { self.index_register = 0xF0 + (self.registers[vx as usize] & 0x0F) as u16; } + ProcessorInstruction::BinaryCodedDecimalConversion(vx) => { + todo!("must implement") + } + ProcessorInstruction::LoadMemory(vx) => { + todo!("must implement") + } + ProcessorInstruction::StoreMemory(vx) => { + todo!("must implement") + } _ => { warn!("Unknown instruction: {:04x}, skipping.", instruction); } diff --git a/src/instruction.rs b/src/instruction.rs index a2ac78d..892ffdc 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -72,6 +72,9 @@ pub enum ProcessorInstruction { AddToIndex(u8), /// Sets the index register to the hexadecimal character in VX. FontCharacter(u8), + BinaryCodedDecimalConversion(u8), + StoreMemory(u8), + LoadMemory(u8), /// Unknown instruction UnknownInstruction, } @@ -214,6 +217,21 @@ impl Instruction { (0xF, _, 0x2, 0x9) => { ProcessorInstruction::FontCharacter(Self::grab_first_nibble(data)) } + (0xF, _, 0x3, 0x3) => { + ProcessorInstruction::BinaryCodedDecimalConversion( + Self::grab_first_nibble(data) + ) + } + (0xF, _, 0x5, 0x5) => { + ProcessorInstruction::StoreMemory( + Self::grab_first_nibble(data) + ) + } + (0xF, _, 0x6, 0x5) => { + ProcessorInstruction::LoadMemory( + Self::grab_first_nibble(data) + ) + } // Unknown instruction _ => ProcessorInstruction::UnknownInstruction, }