From e3e8912dae70da1fff03607e68610d21adf21002 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Fri, 21 Aug 2020 19:19:20 +0930 Subject: correct Fx55 and fx6 opcodes --- chip8.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'chip8.c') diff --git a/chip8.c b/chip8.c index 748cca4..7c966ed 100644 --- a/chip8.c +++ b/chip8.c @@ -341,26 +341,19 @@ chip8_cycle() case 0x55: /* LD [I], Vx (store registers V0 through Vx starting at memory location I) */ { // TODO: not tested - int reg = 0; - do + for(int i = 0; i <= x; ++i) { - memory[I+reg] = V[reg]; - reg++; + memory[I + i] = V[i]; } - while (reg <= V[x]); break; } case 0x65: /* LD Vx, [I] (read registers V0 through Vx from memory starting at I) */ { // TODO: not tested - int reg = 0; - int target = V[x]; - do + for(int i = 0; i <= x; ++i) { - V[reg] = memory[I+reg]; - reg++; + V[i] = memory[I + i]; } - while (reg < target); break; } break; -- cgit v1.2.3