summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-08-21 19:19:20 +0930
committerDaniel Jones <admin@danieljon.es>2020-08-21 19:19:20 +0930
commite3e8912dae70da1fff03607e68610d21adf21002 (patch)
tree9c9522d7b0791a13304d8d974a281a46ff3ce92e
parent200bd42550a94487d6c0434c3ad8781b18a7a104 (diff)
downloadchip8-e3e8912dae70da1fff03607e68610d21adf21002.tar.gz
chip8-e3e8912dae70da1fff03607e68610d21adf21002.zip
correct Fx55 and fx6 opcodes
-rw-r--r--chip8.c15
-rw-r--r--main.c2
2 files changed, 5 insertions, 12 deletions
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;
diff --git a/main.c b/main.c
index ae6f34d..b00d5b2 100644
--- a/main.c
+++ b/main.c
@@ -205,7 +205,7 @@ int main(int argc, char *argv[])
init_video();
- const int fps = 500;
+ const int fps = 900;
const int frame_delay = 1000/fps;
uint32_t frame_start;
uint32_t frame_time;