diff options
| -rw-r--r-- | ops.yaml | 47 | 
1 files changed, 46 insertions, 1 deletions
| @@ -3302,6 +3302,7 @@ ops:          h:          c:        code: | +        cpu_ww(ctx, RW_PC, cpu_rw(ctx, RW_PC) + 3);          call_a16(ctx, old_pc + 1);      - id: ADC A, d8        hex: 0xCE @@ -3420,6 +3421,7 @@ ops:          h:          c:        code: | +        cpu_ww(ctx, RW_PC, cpu_rw(ctx, RW_PC) + 3);          if (!FLAG(ctx, C)) {            call_a16(ctx, old_pc + 1);            clock = 24; @@ -3781,6 +3783,8 @@ ops:          n:          h:          c: +      code: | +        xor_d8(ctx, old_pc + 1);      - id: RST 28H        hex: 0xEF        cat: "jumps/calls" @@ -3927,6 +3931,8 @@ ops:          n: "0"          h: H          c: C +      code: | +        ld_hl_sp_r8(ctx, old_pc + 1);      - id: LD SP, HL        hex: 0xF9        cat: "16-bit load/store/move" @@ -3957,6 +3963,8 @@ ops:          n:          h:          c: +      code: | +        cpu_wb(ctx, RB_A, mmu_rb(ctx, mmu_rw(ctx, old_pc + 1)));      - id: EI        hex: 0xFB        cat: "misc" @@ -9315,6 +9323,26 @@ templates:      }      static void +    ld_hl_sp_r8( +      gb_t * const ctx, +      const uint16_t addr +    ) { +      // get src values +      const uint16_t a = cpu_rw(ctx, RW_SP); +      const int8_t b = (int8_t) mmu_rb(ctx, addr); +      const uint16_t v = a + b; + +      // write dst value +      cpu_ww(ctx, RW_HL, v); + +      // set flags +      cpu_wf(ctx, F_Z | F_N | F_H | F_C, ( +        (((a & 0xF0) != (v & 0xF0)) ? F_H : 0) | +        (((a & 0xF00) != (v & 0xF00)) ? F_C : 0) +      )); +    } + +    static void      adc_rb(        gb_t * const ctx,        const rb_t reg @@ -9536,6 +9564,23 @@ templates:      }      static void +    xor_d8( +      gb_t * const ctx, +      const uint16_t addr +    ) { +      // get value +      const uint8_t v = cpu_rb(ctx, RB_A) ^ mmu_rb(ctx, addr); + +      // write value +      cpu_wb(ctx, RB_A, v); + +      // set flags +      cpu_wf(ctx, F_Z | F_N | F_H | F_C, ( +        (v ? 0 : F_Z) +      )); +    } + +    static void      or_rb(        gb_t * const ctx,        const rb_t reg @@ -9572,7 +9617,7 @@ templates:        const uint16_t addr      ) {        // get value -      const uint8_t v = cpu_rb(ctx, RB_A) ^ mmu_rb(ctx, addr); +      const uint8_t v = cpu_rb(ctx, RB_A) | mmu_rb(ctx, addr);        // write value        cpu_wb(ctx, RB_A, v); | 
