Mercurial > repos > blastem
comparison z80_to_x86.c @ 1648:b7ecd0d6a77b mame_interp
Merge from default
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 25 Dec 2018 11:12:26 -0800 |
parents | 31effaadf877 |
children | 873a1330c3a9 |
comparison
equal
deleted
inserted
replaced
1509:36732f5c2281 | 1648:b7ecd0d6a77b |
---|---|
2073 jmp_r(code, opts->gen.scratch1); | 2073 jmp_r(code, opts->gen.scratch1); |
2074 } | 2074 } |
2075 break; | 2075 break; |
2076 } | 2076 } |
2077 case Z80_JPCC: { | 2077 case Z80_JPCC: { |
2078 cycles(&opts->gen, num_cycles + 3);//T States: 4,3 | 2078 cycles(&opts->gen, num_cycles + 6);//T States: 4,3,3 |
2079 uint8_t cond = CC_Z; | 2079 uint8_t cond = CC_Z; |
2080 switch (inst->reg) | 2080 switch (inst->reg) |
2081 { | 2081 { |
2082 case Z80_CC_NZ: | 2082 case Z80_CC_NZ: |
2083 cond = CC_NZ; | 2083 cond = CC_NZ; |
2100 cmp_irdisp(code, 0, opts->gen.context_reg, zf_off(ZF_S), SZ_B); | 2100 cmp_irdisp(code, 0, opts->gen.context_reg, zf_off(ZF_S), SZ_B); |
2101 break; | 2101 break; |
2102 } | 2102 } |
2103 uint8_t *no_jump_off = code->cur+1; | 2103 uint8_t *no_jump_off = code->cur+1; |
2104 jcc(code, cond, code->cur+2); | 2104 jcc(code, cond, code->cur+2); |
2105 cycles(&opts->gen, 5);//T States: 5 | |
2106 uint16_t dest_addr = inst->immed; | 2105 uint16_t dest_addr = inst->immed; |
2107 code_ptr call_dst = z80_get_native_address(context, dest_addr); | 2106 code_ptr call_dst = z80_get_native_address(context, dest_addr); |
2108 if (!call_dst) { | 2107 if (!call_dst) { |
2109 opts->gen.deferred = defer_address(opts->gen.deferred, dest_addr, code->cur + 1); | 2108 opts->gen.deferred = defer_address(opts->gen.deferred, dest_addr, code->cur + 1); |
2110 //fake address to force large displacement | 2109 //fake address to force large displacement |
3670 } | 3669 } |
3671 } | 3670 } |
3672 | 3671 |
3673 void z80_options_free(z80_options *opts) | 3672 void z80_options_free(z80_options *opts) |
3674 { | 3673 { |
3674 for (uint32_t address = 0; address < opts->gen.address_mask; address += NATIVE_CHUNK_SIZE) | |
3675 { | |
3676 uint32_t chunk = address / NATIVE_CHUNK_SIZE; | |
3677 if (opts->gen.native_code_map[chunk].base) { | |
3678 free(opts->gen.native_code_map[chunk].offsets); | |
3679 } | |
3680 } | |
3675 free(opts->gen.native_code_map); | 3681 free(opts->gen.native_code_map); |
3682 uint32_t ram_inst_slots = ram_size(&opts->gen) / 1024; | |
3683 for (uint32_t i = 0; i < ram_inst_slots; i++) | |
3684 { | |
3685 free(opts->gen.ram_inst_sizes[i]); | |
3686 } | |
3676 free(opts->gen.ram_inst_sizes); | 3687 free(opts->gen.ram_inst_sizes); |
3677 free(opts); | 3688 free(opts); |
3678 } | 3689 } |
3679 | 3690 |
3680 void z80_assert_reset(z80_context * context, uint32_t cycle) | 3691 void z80_assert_reset(z80_context * context, uint32_t cycle) |