From 5c8eaca55c025d3344f8789ce485763e104c354b Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Sun, 8 Dec 2024 16:50:54 +0200 Subject: [PATCH] take last nibble of font address in VX --- src/emulator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emulator.rs b/src/emulator.rs index 84c913c..39329fd 100644 --- a/src/emulator.rs +++ b/src/emulator.rs @@ -365,7 +365,7 @@ where } } ProcessorInstruction::FontCharacter(vx) => { - self.index_register = 0xF0 + (self.registers[vx as usize] as u16) * 5u16; + self.index_register = 0xF0 + (self.registers[vx as usize] as u16 & 0xF) * 5u16; } ProcessorInstruction::BinaryCodedDecimalConversion(vx) => { let number = self.registers[vx as usize];