Mercurial > repos > blastem
changeset 272:9b04b57434b5
Implement LDI
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 02 May 2013 22:26:47 -0700 |
parents | 969ee17471c5 |
children | 719b9fea2fe9 |
files | render_sdl.c z80_to_x86.c |
diffstat | 2 files changed, 20 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/render_sdl.c Thu May 02 22:21:41 2013 -0700 +++ b/render_sdl.c Thu May 02 22:26:47 2013 -0700 @@ -366,7 +366,7 @@ } } //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 @@ } 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); }
--- a/z80_to_x86.c Thu May 02 22:21:41 2013 -0700 +++ b/z80_to_x86.c Thu May 02 22:26:47 2013 -0700 @@ -507,7 +507,21 @@ 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);