From 1d5dce07c97ad0b8c7c63239e7ddc6d4cdff2d93 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Thu, 21 Jun 2018 22:25:13 -0400 Subject: fix instrs --- ops.yaml | 20 +++++++++----------- test.c | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ops.yaml b/ops.yaml index 3bd90f5..d91617d 100644 --- a/ops.yaml +++ b/ops.yaml @@ -391,6 +391,7 @@ ops: h: c: code: | + cpu_ww(ctx, RW_PC, old_pc + 2); jr(ctx, old_pc + 1); - id: ADD HL, DE hex: 0x19 @@ -518,11 +519,10 @@ ops: h: c: code: | + cpu_ww(ctx, RW_PC, old_pc + 2); if (!FLAG(ctx, Z)) { jr(ctx, old_pc + 1); clock = 12; - } else { - cpu_ww(ctx, RW_PC, old_pc + 2); } - id: LD HL, d16 hex: 0x21 @@ -555,7 +555,8 @@ ops: h: c: code: | - mmu_ww(ctx, RW_HL, mmu_rw(ctx, cpu_rw(ctx, RW_HL)) + cpu_rb(ctx, RB_A)); + mmu_wb(ctx, cpu_rw(ctx, RW_HL), cpu_rb(ctx, RB_A)); + cpu_ww(ctx, RW_HL, cpu_rw(ctx, RW_HL) + 1); - id: INC HL hex: 0x23 cat: "16-bit math" @@ -683,11 +684,8 @@ ops: h: c: code: | - { - const uint16_t addr = cpu_rw(ctx, RW_HL); - cpu_ww(ctx, RW_HL, addr + 1); - cpu_wb(ctx, RB_A, mmu_rb(ctx, addr)); - } + cpu_wb(ctx, RB_A, mmu_rb(ctx, cpu_rw(ctx, RW_HL))); + cpu_ww(ctx, RW_HL, cpu_rw(ctx, RW_HL) + 1); - id: DEC HL hex: 0x2B cat: "16-bit math" @@ -816,7 +814,7 @@ ops: c: code: | mmu_wb(ctx, cpu_rw(ctx, RW_HL), cpu_rb(ctx, RB_A)); - cpu_wb(ctx, cpu_rw(ctx, RW_HL), cpu_rw(ctx, RW_HL) - 1); + cpu_ww(ctx, RW_HL, cpu_rw(ctx, RW_HL) - 1); - id: INC SP hex: 0x33 cat: "16-bit math" @@ -877,7 +875,7 @@ ops: h: c: code: | - mmu_wb(ctx, cpu_rw(ctx, RW_HL), old_pc + 1); + mmu_wb(ctx, cpu_rw(ctx, RW_HL), mmu_rb(ctx, old_pc + 1)); - id: SCF hex: 0x37 cat: "8-bit math" @@ -3814,7 +3812,7 @@ ops: h: c: code: | - cpu_wb(ctx, RB_A, mmu_rb(ctx, 0xFF00 + old_pc + 1)); + cpu_wb(ctx, RB_A, mmu_rb(ctx, 0xFF00 + mmu_rb(ctx, old_pc + 1))); - id: POP AF hex: 0xF1 cat: "16-bit load/store/move" diff --git a/test.c b/test.c index 8979a99..8ca1068 100644 --- a/test.c +++ b/test.c @@ -10,7 +10,7 @@ #include "gb.h" #define NUM_FRAMES 600 -#define NUM_STEPS 100 +#define NUM_STEPS 20000 static uint32_t file_size( -- cgit v1.2.3