Mercurial > repos > blastem
comparison genesis.c @ 1901:5433252329fb
Set version reg and TAS behavior based on model config
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 16 Feb 2020 10:46:35 -0800 |
parents | 377f110e4cea |
children | 32a3aa7b4a45 |
comparison
equal
deleted
inserted
replaced
1900:93960907807a | 1901:5433252329fb |
---|---|
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 #include "jcart.h" |
21 #include "config.h" | |
21 #define MCLKS_NTSC 53693175 | 22 #define MCLKS_NTSC 53693175 |
22 #define MCLKS_PAL 53203395 | 23 #define MCLKS_PAL 53203395 |
23 | 24 |
24 uint32_t MCLKS_PER_68K; | 25 uint32_t MCLKS_PER_68K; |
25 #define MCLKS_PER_YM 7 | 26 #define MCLKS_PER_YM 7 |
1403 gen->header.serialize = serialize; | 1404 gen->header.serialize = serialize; |
1404 gen->header.deserialize = deserialize; | 1405 gen->header.deserialize = deserialize; |
1405 gen->header.type = SYSTEM_GENESIS; | 1406 gen->header.type = SYSTEM_GENESIS; |
1406 gen->header.info = *rom; | 1407 gen->header.info = *rom; |
1407 set_region(gen, rom, force_region); | 1408 set_region(gen, rom, force_region); |
1409 tern_node *model = get_model(config, SYSTEM_GENESIS); | |
1410 uint8_t tmss = !strcmp(tern_find_ptr_default(model, "tmss", "off"), "on"); | |
1411 if (tmss) { | |
1412 gen->version_reg |= 1; | |
1413 } | |
1408 | 1414 |
1409 gen->vdp = init_vdp_context(gen->version_reg & 0x40); | 1415 gen->vdp = init_vdp_context(gen->version_reg & 0x40); |
1410 gen->vdp->system = &gen->header; | 1416 gen->vdp->system = &gen->header; |
1411 gen->frame_end = vdp_cycles_to_frame_end(gen->vdp); | 1417 gen->frame_end = vdp_cycles_to_frame_end(gen->vdp); |
1412 char * config_cycles = tern_find_path(config, "clocks\0max_cycles\0", TVAL_PTR).ptrval; | 1418 char * config_cycles = tern_find_path(config, "clocks\0max_cycles\0", TVAL_PTR).ptrval; |
1502 } | 1508 } |
1503 } | 1509 } |
1504 | 1510 |
1505 m68k_options *opts = malloc(sizeof(m68k_options)); | 1511 m68k_options *opts = malloc(sizeof(m68k_options)); |
1506 init_m68k_opts(opts, rom->map, rom->map_chunks, MCLKS_PER_68K); | 1512 init_m68k_opts(opts, rom->map, rom->map_chunks, MCLKS_PER_68K); |
1507 //TODO: make this configurable | 1513 if (!strcmp(tern_find_ptr_default(model, "tas", "broken"), "broken")) { |
1508 opts->gen.flags |= M68K_OPT_BROKEN_READ_MODIFY; | 1514 opts->gen.flags |= M68K_OPT_BROKEN_READ_MODIFY; |
1515 } | |
1509 gen->m68k = init_68k_context(opts, NULL); | 1516 gen->m68k = init_68k_context(opts, NULL); |
1510 gen->m68k->system = gen; | 1517 gen->m68k->system = gen; |
1511 opts->address_log = (system_opts & OPT_ADDRESS_LOG) ? fopen("address.log", "w") : NULL; | 1518 opts->address_log = (system_opts & OPT_ADDRESS_LOG) ? fopen("address.log", "w") : NULL; |
1512 | 1519 |
1513 //This must happen after the 68K context has been allocated | 1520 //This must happen after the 68K context has been allocated |