comparison z80_util.c @ 1759:6e4faa10f9ee

Store sync_cycle in context rather than in a local in CPU DSL. Fix the timing of a number of instructions in new Z80 core
author Michael Pavone <pavone@retrodev.com>
date Tue, 19 Feb 2019 22:51:33 -0800
parents 28635b733d97
children 72540af9c90a
comparison
equal deleted inserted replaced
1757:bb4d19c7c047 1759:6e4faa10f9ee
89 context->int_cycle = context->int_end_cycle = context->nmi_cycle = 0xFFFFFFFFU; 89 context->int_cycle = context->int_end_cycle = context->nmi_cycle = 0xFFFFFFFFU;
90 z80_invalidate_code_range(context, 0, 0xFFFF); 90 z80_invalidate_code_range(context, 0, 0xFFFF);
91 return context; 91 return context;
92 } 92 }
93 93
94 uint32_t z80_sync_cycle(z80_context *context, uint32_t target_cycle) 94 void z80_sync_cycle(z80_context *context, uint32_t target_cycle)
95 { 95 {
96 if (context->iff1 && context->int_cycle < target_cycle) { 96 if (context->iff1 && context->int_cycle < target_cycle) {
97 if (context->cycles > context->int_end_cycle) { 97 if (context->cycles > context->int_end_cycle) {
98 context->int_cycle = 0xFFFFFFFFU; 98 context->int_cycle = 0xFFFFFFFFU;
99 } else { 99 } else {
101 } 101 }
102 }; 102 };
103 if (context->nmi_cycle < target_cycle) { 103 if (context->nmi_cycle < target_cycle) {
104 target_cycle = context->nmi_cycle; 104 target_cycle = context->nmi_cycle;
105 } 105 }
106 return target_cycle; 106 context->sync_cycle = target_cycle;
107 } 107 }
108 108
109 void z80_run(z80_context *context, uint32_t target_cycle) 109 void z80_run(z80_context *context, uint32_t target_cycle)
110 { 110 {
111 if (context->reset || context->busack) { 111 if (context->reset || context->busack) {