comparison genesis.c @ 1610:c206a422d466

Added J-Cart support
author Michael Pavone <pavone@retrodev.com>
date Tue, 14 Aug 2018 00:07:21 -0700
parents 360d5bab199f
children c4ba3177b72d
comparison
equal deleted inserted replaced
1609:9c8f58740450 1610:c206a422d466
15 #include "util.h" 15 #include "util.h"
16 #include "debug.h" 16 #include "debug.h"
17 #include "gdb_remote.h" 17 #include "gdb_remote.h"
18 #include "saves.h" 18 #include "saves.h"
19 #include "bindings.h" 19 #include "bindings.h"
20 #include "jcart.h"
20 #define MCLKS_NTSC 53693175 21 #define MCLKS_NTSC 53693175
21 #define MCLKS_PAL 53203395 22 #define MCLKS_PAL 53203395
22 23
23 uint32_t MCLKS_PER_68K; 24 uint32_t MCLKS_PER_68K;
24 #define MCLKS_PER_YM 7 25 #define MCLKS_PER_YM 7
328 uint32_t deduction = mclks - ADJUST_BUFFER; 329 uint32_t deduction = mclks - ADJUST_BUFFER;
329 vdp_adjust_cycles(v_context, deduction); 330 vdp_adjust_cycles(v_context, deduction);
330 io_adjust_cycles(gen->io.ports, context->current_cycle, deduction); 331 io_adjust_cycles(gen->io.ports, context->current_cycle, deduction);
331 io_adjust_cycles(gen->io.ports+1, context->current_cycle, deduction); 332 io_adjust_cycles(gen->io.ports+1, context->current_cycle, deduction);
332 io_adjust_cycles(gen->io.ports+2, context->current_cycle, deduction); 333 io_adjust_cycles(gen->io.ports+2, context->current_cycle, deduction);
334 if (gen->mapper_type == MAPPER_JCART) {
335 jcart_adjust_cycles(gen, deduction);
336 }
333 context->current_cycle -= deduction; 337 context->current_cycle -= deduction;
334 z80_adjust_cycles(z_context, deduction); 338 z80_adjust_cycles(z_context, deduction);
335 gen->ym->current_cycle -= deduction; 339 gen->ym->current_cycle -= deduction;
336 gen->psg->cycles -= deduction; 340 gen->psg->cycles -= deduction;
337 if (gen->ym->write_cycle != CYCLE_NEVER) { 341 if (gen->ym->write_cycle != CYCLE_NEVER) {
1206 1210
1207 static void gamepad_down(system_header *system, uint8_t gamepad_num, uint8_t button) 1211 static void gamepad_down(system_header *system, uint8_t gamepad_num, uint8_t button)
1208 { 1212 {
1209 genesis_context *gen = (genesis_context *)system; 1213 genesis_context *gen = (genesis_context *)system;
1210 io_gamepad_down(&gen->io, gamepad_num, button); 1214 io_gamepad_down(&gen->io, gamepad_num, button);
1215 if (gen->mapper_type == MAPPER_JCART) {
1216 jcart_gamepad_down(gen, gamepad_num, button);
1217 }
1211 } 1218 }
1212 1219
1213 static void gamepad_up(system_header *system, uint8_t gamepad_num, uint8_t button) 1220 static void gamepad_up(system_header *system, uint8_t gamepad_num, uint8_t button)
1214 { 1221 {
1215 genesis_context *gen = (genesis_context *)system; 1222 genesis_context *gen = (genesis_context *)system;
1216 io_gamepad_up(&gen->io, gamepad_num, button); 1223 io_gamepad_up(&gen->io, gamepad_num, button);
1224 if (gen->mapper_type == MAPPER_JCART) {
1225 jcart_gamepad_up(gen, gamepad_num, button);
1226 }
1217 } 1227 }
1218 1228
1219 static void mouse_down(system_header *system, uint8_t mouse_num, uint8_t button) 1229 static void mouse_down(system_header *system, uint8_t mouse_num, uint8_t button)
1220 { 1230 {
1221 genesis_context *gen = (genesis_context *)system; 1231 genesis_context *gen = (genesis_context *)system;