comparison gst.c @ 2229:f699f9d500b4

Fix build
author Michael Pavone <pavone@retrodev.com>
date Mon, 05 Sep 2022 23:48:17 -0700
parents 2d462aa78349
children 9ead0fe69d9b
comparison
equal deleted inserted replaced
2228:0db9dc6a9020 2229:f699f9d500b4
93 if (context->status & (1 << 5)) { 93 if (context->status & (1 << 5)) {
94 context->aregs[8] = read_le_32(buffer + GST_68K_USP_OFFSET); 94 context->aregs[8] = read_le_32(buffer + GST_68K_USP_OFFSET);
95 } else { 95 } else {
96 context->aregs[8] = read_le_32(buffer + GST_68K_SSP_OFFSET); 96 context->aregs[8] = read_le_32(buffer + GST_68K_SSP_OFFSET);
97 } 97 }
98 98
99 return pc; 99 return pc;
100 } 100 }
101 101
102 uint8_t m68k_save_gst(m68k_context * context, uint32_t pc, FILE * gstfile) 102 uint8_t m68k_save_gst(m68k_context * context, uint32_t pc, FILE * gstfile)
103 { 103 {
232 fputs("Failed to read VDP registers from savestate\n", stderr); 232 fputs("Failed to read VDP registers from savestate\n", stderr);
233 return 0; 233 return 0;
234 } 234 }
235 for (uint16_t i = 0; i < VDP_REGS; i++) 235 for (uint16_t i = 0; i < VDP_REGS; i++)
236 { 236 {
237 vdp_control_port_write(context, 0x8000 | (i << 8) | tmp_buf[i]); 237 vdp_control_port_write(context, 0x8000 | (i << 8) | tmp_buf[i], context->cycles);
238 } 238 }
239 if (fread(tmp_buf, 1, CRAM_SIZE*2, state_file) != CRAM_SIZE*2) { 239 if (fread(tmp_buf, 1, CRAM_SIZE*2, state_file) != CRAM_SIZE*2) {
240 fputs("Failed to read CRAM from savestate\n", stderr); 240 fputs("Failed to read CRAM from savestate\n", stderr);
241 return 0; 241 return 0;
242 } 242 }
431 } 431 }
432 uint32_t pc = m68k_load_gst(gen->m68k, gstfile); 432 uint32_t pc = m68k_load_gst(gen->m68k, gstfile);
433 if (!pc) { 433 if (!pc) {
434 goto error_close; 434 goto error_close;
435 } 435 }
436 436
437 if (!vdp_load_gst(gen->vdp, gstfile)) { 437 if (!vdp_load_gst(gen->vdp, gstfile)) {
438 goto error_close; 438 goto error_close;
439 } 439 }
440 if (!ym_load_gst(gen->ym, gstfile)) { 440 if (!ym_load_gst(gen->ym, gstfile)) {
441 goto error_close; 441 goto error_close;
443 if (!z80_load_gst(gen->z80, gstfile)) { 443 if (!z80_load_gst(gen->z80, gstfile)) {
444 goto error_close; 444 goto error_close;
445 } 445 }
446 gen->io.ports[0].control = 0x40; 446 gen->io.ports[0].control = 0x40;
447 gen->io.ports[1].control = 0x40; 447 gen->io.ports[1].control = 0x40;
448 448
449 fseek(gstfile, GST_68K_RAM, SEEK_SET); 449 fseek(gstfile, GST_68K_RAM, SEEK_SET);
450 for (int i = 0; i < (32*1024);) { 450 for (int i = 0; i < (32*1024);) {
451 if (fread(buffer, 1, sizeof(buffer), gstfile) != sizeof(buffer)) { 451 if (fread(buffer, 1, sizeof(buffer), gstfile) != sizeof(buffer)) {
452 fputs("Failed to read 68K RAM from savestate\n", stderr); 452 fputs("Failed to read 68K RAM from savestate\n", stderr);
453 return 0; 453 return 0;