diff options
-rw-r--r-- | render_sdl.c | 10 | ||||
-rw-r--r-- | z80_to_x86.c | 16 |
2 files changed, 20 insertions, 6 deletions
diff --git a/render_sdl.c b/render_sdl.c index 499b16a..a884fe4 100644 --- a/render_sdl.c +++ b/render_sdl.c @@ -366,7 +366,7 @@ int wait_render_frame(vdp_context * context) } } //TODO: Adjust frame delay so we actually get 60 FPS rather than 62.5 FPS - uint32_t current = SDL_GetTicks(); + /*uint32_t current = SDL_GetTicks(); uint32_t desired = last_frame + FRAME_DELAY; if (current < desired) { uint32_t delay = last_frame + FRAME_DELAY - current; @@ -376,14 +376,14 @@ int wait_render_frame(vdp_context * context) } while ((desired) >= SDL_GetTicks()) { } - } + }*/ render_context(context); - /* + //TODO: Figure out why this causes segfaults - frame_counter++; + /*frame_counter++; if ((last_frame - start) > 1000) { - if (start) { + if (start && (last_frame-start)) { printf("\r%f fps", ((float)frame_counter) / (((float)(last_frame-start)) / 1000.0)); fflush(stdout); } diff --git a/z80_to_x86.c b/z80_to_x86.c index 6d2fb86..daf7f05 100644 --- a/z80_to_x86.c +++ b/z80_to_x86.c @@ -507,7 +507,21 @@ uint8_t * translate_z80inst(z80inst * inst, uint8_t * dst, z80_context * context dst = mov_rdisp8r(dst, CONTEXT, zar_off(Z80_E), opts->regs[Z80_DE], SZ_W); dst = mov_rrdisp8(dst, SCRATCH1, CONTEXT, zar_off(Z80_E), SZ_W); break; - //case Z80_LDI: + case Z80_LDI: { + dst = zcycles(dst, 8); + dst = mov_rr(dst, opts->regs[Z80_HL], SCRATCH1, SZ_W); + dst = call(dst, (uint8_t *)z80_read_byte); + dst = mov_rr(dst, opts->regs[Z80_DE], SCRATCH2, SZ_W); + dst = call(dst, (uint8_t *)z80_read_byte); + dst = zcycles(dst, 2); + dst = add_ir(dst, 1, opts->regs[Z80_DE], SZ_W); + dst = add_ir(dst, 1, opts->regs[Z80_HL], SZ_W); + dst = sub_ir(dst, 1, opts->regs[Z80_BC], SZ_W); + //TODO: Implement half-carry + dst = mov_irdisp8(dst, 0, CONTEXT, zf_off(ZF_N), SZ_B); + dst = setcc_rdisp8(dst, CC_NZ, CONTEXT, zf_off(ZF_PV)); + break; + } case Z80_LDIR: { dst = zcycles(dst, 8); dst = mov_rr(dst, opts->regs[Z80_HL], SCRATCH1, SZ_W); |