diff --git a/emulator_shell.c b/emulator_shell.c index 65388f1..b0002fa 100644 --- a/emulator_shell.c +++ b/emulator_shell.c @@ -78,7 +78,7 @@ int emulate8080(State8080* state) { uint32_t res = h1 + bc; state->h = (res & 0xff) >> 8; state->l = res & 0xff; - state->cc.cy = ((res & 0xffff0000) > 0); + state->cc.cy = ((res & 0xffff0000) != 0); break; case 0x0d: // DCR C @@ -134,6 +134,12 @@ int emulate8080(State8080* state) { state->h = opcode[1]; state->pc += 1; break; + case 0x29: // DAD H + uint32_t h1 = (state->h << 8) | state->l; + uint32_t res = hl + hl; + state->h = (res & 0xff00) >> 8; + state->l = res & 0xff; + state->cc.cy = ((res & 0xffff0000) != 0); case 0x31: // LXI SP, word state->sp = (opcode[2] << 8) | opcode[1]); state->pc += 2;