comparison z80_to_x86.c @ 285:021aeb6df19b

Implement HALT (sort of tested)
author Mike Pavone <pavone@retrodev.com>
date Sat, 04 May 2013 16:23:28 -0700
parents ed7098f717d7
children 872a8911e0f4
comparison
equal deleted inserted replaced
284:ed7098f717d7 285:021aeb6df19b
33 void z80_do_sync(); 33 void z80_do_sync();
34 void z80_handle_cycle_limit_int(); 34 void z80_handle_cycle_limit_int();
35 void z80_retrans_stub(); 35 void z80_retrans_stub();
36 void z80_io_read(); 36 void z80_io_read();
37 void z80_io_write(); 37 void z80_io_write();
38 void z80_halt();
38 39
39 uint8_t z80_size(z80inst * inst) 40 uint8_t z80_size(z80inst * inst)
40 { 41 {
41 uint8_t reg = (inst->reg & 0x1F); 42 uint8_t reg = (inst->reg & 0x1F);
42 if (reg != Z80_UNUSED && reg != Z80_USE_IMMED) { 43 if (reg != Z80_UNUSED && reg != Z80_USE_IMMED) {
896 dst = jmp(dst, (uint8_t *)z80_print_regs_exit); 897 dst = jmp(dst, (uint8_t *)z80_print_regs_exit);
897 } else { 898 } else {
898 dst = zcycles(dst, 4 * inst->immed); 899 dst = zcycles(dst, 4 * inst->immed);
899 } 900 }
900 break; 901 break;
901 //case Z80_HALT: 902 case Z80_HALT:
903 dst = zcycles(dst, 4);
904 dst = mov_ir(dst, address, SCRATCH1, SZ_W);
905 uint8_t * call_inst = dst;
906 dst = call(dst, (uint8_t *)z80_halt);
907 dst = jmp(dst, call_inst);
908 break;
902 case Z80_DI: 909 case Z80_DI:
903 dst = zcycles(dst, 4); 910 dst = zcycles(dst, 4);
904 dst = mov_irdisp8(dst, 0, CONTEXT, offsetof(z80_context, iff1), SZ_B); 911 dst = mov_irdisp8(dst, 0, CONTEXT, offsetof(z80_context, iff1), SZ_B);
905 dst = mov_irdisp8(dst, 0, CONTEXT, offsetof(z80_context, iff2), SZ_B); 912 dst = mov_irdisp8(dst, 0, CONTEXT, offsetof(z80_context, iff2), SZ_B);
906 dst = mov_rdisp8r(dst, CONTEXT, offsetof(z80_context, sync_cycle), ZLIMIT, SZ_D); 913 dst = mov_rdisp8r(dst, CONTEXT, offsetof(z80_context, sync_cycle), ZLIMIT, SZ_D);