Mercurial > repos > blastem
comparison sms.c @ 1377:e587f16e7d3d
Implemented SMS pause button
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 28 May 2017 21:03:55 -0700 |
parents | 5b20840711c1 |
children | 65f1d6558e9e |
comparison
equal
deleted
inserted
replaced
1376:70d88d9bfe13 | 1377:e587f16e7d3d |
---|---|
191 | 191 |
192 static void run_sms(system_header *system) | 192 static void run_sms(system_header *system) |
193 { | 193 { |
194 render_disable_ym(); | 194 render_disable_ym(); |
195 sms_context *sms = (sms_context *)system; | 195 sms_context *sms = (sms_context *)system; |
196 uint32_t target_cycle = sms->z80->current_cycle + 3420*262; | 196 uint32_t target_cycle = sms->z80->current_cycle + 3420*16; |
197 //TODO: PAL support | 197 //TODO: PAL support |
198 render_set_video_standard(VID_NTSC); | 198 render_set_video_standard(VID_NTSC); |
199 while (!sms->should_return) | 199 while (!sms->should_return) |
200 { | 200 { |
201 if (system->enter_debugger && sms->z80->pc) { | 201 if (system->enter_debugger && sms->z80->pc) { |
202 system->enter_debugger = 0; | 202 system->enter_debugger = 0; |
203 zdebugger(sms->z80, sms->z80->pc); | 203 zdebugger(sms->z80, sms->z80->pc); |
204 } | 204 } |
205 if (sms->z80->nmi_start == CYCLE_NEVER) { | |
206 uint32_t nmi = vdp_next_nmi(sms->vdp); | |
207 if (nmi != CYCLE_NEVER) { | |
208 z80_assert_nmi(sms->z80, nmi); | |
209 } | |
210 } | |
205 z80_run(sms->z80, target_cycle); | 211 z80_run(sms->z80, target_cycle); |
206 if (sms->z80->reset) { | 212 if (sms->z80->reset) { |
207 z80_clear_reset(sms->z80, sms->z80->current_cycle + 128*15); | 213 z80_clear_reset(sms->z80, sms->z80->current_cycle + 128*15); |
208 } | 214 } |
209 target_cycle = sms->z80->current_cycle; | 215 target_cycle = sms->z80->current_cycle; |
210 vdp_run_context(sms->vdp, target_cycle); | 216 vdp_run_context(sms->vdp, target_cycle); |
211 psg_run(sms->psg, target_cycle); | 217 psg_run(sms->psg, target_cycle); |
212 target_cycle += 3420*262; | 218 target_cycle += 3420*16; |
213 if (target_cycle > 0x10000000) { | 219 if (target_cycle > 0x10000000) { |
214 uint32_t adjust = sms->z80->current_cycle - 3420*262*2; | 220 uint32_t adjust = sms->z80->current_cycle - 3420*262*2; |
215 io_adjust_cycles(sms->io.ports, sms->z80->current_cycle, adjust); | 221 io_adjust_cycles(sms->io.ports, sms->z80->current_cycle, adjust); |
216 io_adjust_cycles(sms->io.ports+1, sms->z80->current_cycle, adjust); | 222 io_adjust_cycles(sms->io.ports+1, sms->z80->current_cycle, adjust); |
217 z80_adjust_cycles(sms->z80, adjust); | 223 z80_adjust_cycles(sms->z80, adjust); |
353 sms->header.get_open_bus_value = get_open_bus_value; | 359 sms->header.get_open_bus_value = get_open_bus_value; |
354 sms->header.request_exit = request_exit; | 360 sms->header.request_exit = request_exit; |
355 sms->header.soft_reset = soft_reset; | 361 sms->header.soft_reset = soft_reset; |
356 sms->header.inc_debug_mode = inc_debug_mode; | 362 sms->header.inc_debug_mode = inc_debug_mode; |
357 sms->header.inc_debug_pal = inc_debug_pal; | 363 sms->header.inc_debug_pal = inc_debug_pal; |
364 sms->header.type = SYSTEM_SMS; | |
358 | 365 |
359 return sms; | 366 return sms; |
360 } | 367 } |