diff --git a/fc1004.c b/fc1004.c index 5b1150e..987ecb5 100644 --- a/fc1004.c +++ b/fc1004.c @@ -26,7 +26,7 @@ #include "fc1004.h" -void FC1004_Init(fc1004_t *chip) +void FC1004_InitPointers(fc1004_t *chip) { chip->arb.ext_vaddress_out = &chip->o_vaddress; chip->arb.ext_data_out = &chip->o_vdata; @@ -34,6 +34,11 @@ void FC1004_Init(fc1004_t *chip) chip->ioc.ext_zdata_out = &chip->o_zdata; chip->ioc.ext_vaddress_out = &chip->o_vaddress; chip->tmss.ext_data_out = &chip->o_vdata; +} + +void FC1004_Init(fc1004_t *chip) +{ + FC1004_InitPointers(chip); ARB_Init(&chip->arb); } diff --git a/fc1004.h b/fc1004.h index 8532705..e74fa7b 100644 --- a/fc1004.h +++ b/fc1004.h @@ -144,6 +144,7 @@ typedef struct #pragma pack(pop) +void FC1004_InitPointers(fc1004_t *chip); void FC1004_Init(fc1004_t *chip); void FC1004_Destroy(fc1004_t* chip); void FC1004_Clock(fc1004_t *chip, int mclk, uint64_t cycles); diff --git a/savestate.c b/savestate.c index b66492b..a696637 100644 --- a/savestate.c +++ b/savestate.c @@ -133,6 +133,8 @@ int load_state(const char* filename) if (load_blob(&ym, sizeof(ym), f)) return -1; + // The chip's internal pointers in the file are the writer's addresses: aim them again + FC1004_InitPointers(&ym); if (load_blob(&tmss_rom, sizeof(tmss_rom), f)) return -1;