comparison sms.c @ 1773:0a26f3657295 mame_interp

Remove MAME Z80 core in favor of my new Z80 core
author Michael Pavone <pavone@retrodev.com>
date Tue, 12 Mar 2019 21:59:52 -0700
parents 8fe162bdb038
children 49f65d240299
comparison
equal deleted inserted replaced
1772:75172d440900 1773:0a26f3657295
7 #include "util.h" 7 #include "util.h"
8 #include "debug.h" 8 #include "debug.h"
9 #include "saves.h" 9 #include "saves.h"
10 #include "bindings.h" 10 #include "bindings.h"
11 11
12 #ifdef NEW_CORE 12 #ifndef USE_NATIVE
13 #define Z80_CYCLE cycles 13 #define Z80_CYCLE cycles
14 #define Z80_OPTS opts 14 #define Z80_OPTS opts
15 #define z80_handle_code_write(...) 15 #define z80_handle_code_write(...)
16 #else 16 #else
17 #define Z80_CYCLE current_cycle 17 #define Z80_CYCLE current_cycle
68 68
69 static void update_interrupts(sms_context *sms) 69 static void update_interrupts(sms_context *sms)
70 { 70 {
71 uint32_t vint = vdp_next_vint(sms->vdp); 71 uint32_t vint = vdp_next_vint(sms->vdp);
72 uint32_t hint = vdp_next_hint(sms->vdp); 72 uint32_t hint = vdp_next_hint(sms->vdp);
73 #ifdef NEW_CORE 73 #ifndef USE_NATIVE
74 sms->z80->int_cycle = vint < hint ? vint : hint; 74 sms->z80->int_cycle = vint < hint ? vint : hint;
75 z80_sync_cycle(sms->z80, sms->z80->sync_cycle); 75 z80_sync_cycle(sms->z80, sms->z80->sync_cycle);
76 #else 76 #else
77 sms->z80->int_pulse_start = vint < hint ? vint : hint; 77 sms->z80->int_pulse_start = vint < hint ? vint : hint;
78 #endif 78 #endif
355 static uint8_t load_state(system_header *system, uint8_t slot) 355 static uint8_t load_state(system_header *system, uint8_t slot)
356 { 356 {
357 sms_context *sms = (sms_context *)system; 357 sms_context *sms = (sms_context *)system;
358 char *statepath = get_slot_name(system, slot, "state"); 358 char *statepath = get_slot_name(system, slot, "state");
359 uint8_t ret; 359 uint8_t ret;
360 #if !defined(NEW_CORE) && defined(USE_NATIVE) 360 #ifdef USE_NATIVE
361 if (!sms->z80->native_pc) { 361 if (!sms->z80->native_pc) {
362 ret = get_modification_time(statepath) != 0; 362 ret = get_modification_time(statepath) != 0;
363 if (ret) { 363 if (ret) {
364 system->delayed_load_slot = slot + 1; 364 system->delayed_load_slot = slot + 1;
365 } 365 }
389 } 389 }
390 if (system->enter_debugger && sms->z80->pc) { 390 if (system->enter_debugger && sms->z80->pc) {
391 system->enter_debugger = 0; 391 system->enter_debugger = 0;
392 zdebugger(sms->z80, sms->z80->pc); 392 zdebugger(sms->z80, sms->z80->pc);
393 } 393 }
394 #endif 394 if (sms->z80->nmi_start == CYCLE_NEVER) {
395 #ifdef NEW_CORE 395 #else
396 if (sms->z80->nmi_cycle == CYCLE_NEVER) { 396 if (sms->z80->nmi_cycle == CYCLE_NEVER) {
397 #else
398 if (sms->z80->nmi_start == CYCLE_NEVER) {
399 #endif 397 #endif
400 uint32_t nmi = vdp_next_nmi(sms->vdp); 398 uint32_t nmi = vdp_next_nmi(sms->vdp);
401 if (nmi != CYCLE_NEVER) { 399 if (nmi != CYCLE_NEVER) {
402 z80_assert_nmi(sms->z80, nmi); 400 z80_assert_nmi(sms->z80, nmi);
403 } 401 }
474 472
475 static void soft_reset(system_header *system) 473 static void soft_reset(system_header *system)
476 { 474 {
477 sms_context *sms = (sms_context *)system; 475 sms_context *sms = (sms_context *)system;
478 z80_assert_reset(sms->z80, sms->z80->Z80_CYCLE); 476 z80_assert_reset(sms->z80, sms->z80->Z80_CYCLE);
479 #if !defined(NEW_CORE) && defined(USE_NATIVE) 477 #ifdef USE_NATIVE
480 sms->z80->target_cycle = sms->z80->sync_cycle = sms->z80->current_cycle; 478 sms->z80->target_cycle = sms->z80->sync_cycle = sms->z80->current_cycle;
481 #endif 479 #endif
482 } 480 }
483 481
484 static void free_sms(system_header *system) 482 static void free_sms(system_header *system)
499 static void request_exit(system_header *system) 497 static void request_exit(system_header *system)
500 { 498 {
501 sms_context *sms = (sms_context *)system; 499 sms_context *sms = (sms_context *)system;
502 sms->should_return = 1; 500 sms->should_return = 1;
503 #ifdef USE_NATIVE 501 #ifdef USE_NATIVE
504 #ifndef NEW_CORE
505 sms->z80->target_cycle = sms->z80->sync_cycle = sms->z80->Z80_CYCLE; 502 sms->z80->target_cycle = sms->z80->sync_cycle = sms->z80->Z80_CYCLE;
506 #endif
507 #endif 503 #endif
508 } 504 }
509 505
510 static void inc_debug_mode(system_header *system) 506 static void inc_debug_mode(system_header *system)
511 { 507 {