Mercurial > repos > blastem
comparison gst.c @ 744:fc68992cf18d
Merge windows branch with latest changes
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 28 May 2015 21:19:55 -0700 |
parents | 61faa298af07 |
children | cbf97d335444 |
comparison
equal
deleted
inserted
replaced
743:cf78cb045fa4 | 744:fc68992cf18d |
---|---|
1 /* | 1 /* |
2 Copyright 2013 Michael Pavone | 2 Copyright 2013 Michael Pavone |
3 This file is part of BlastEm. | 3 This file is part of BlastEm. |
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. | 4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. |
5 */ | 5 */ |
6 #include "gst.h" | 6 #include "gst.h" |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
205 } | 205 } |
206 context->regs[Z80_I] = *curpos; | 206 context->regs[Z80_I] = *curpos; |
207 curpos += 2; | 207 curpos += 2; |
208 context->iff1 = context->iff2 = *curpos; | 208 context->iff1 = context->iff2 = *curpos; |
209 curpos += 2; | 209 curpos += 2; |
210 reset = !*(curpos++); | 210 context->reset = !*(curpos++); |
211 busreq = *curpos; | 211 context->busreq = *curpos; |
212 curpos += 3; | 212 curpos += 3; |
213 uint32_t bank = read_le_32(curpos); | 213 uint32_t bank = read_le_32(curpos); |
214 if (bank < 0x400000) { | 214 if (bank < 0x400000) { |
215 context->mem_pointers[1] = context->mem_pointers[2] + bank; | 215 context->mem_pointers[1] = context->mem_pointers[2] + bank; |
216 } else { | 216 } else { |
348 } | 348 } |
349 *curpos = context->regs[Z80_I]; | 349 *curpos = context->regs[Z80_I]; |
350 curpos += 2; | 350 curpos += 2; |
351 *curpos = context->iff1; | 351 *curpos = context->iff1; |
352 curpos += 2; | 352 curpos += 2; |
353 *(curpos++) = !reset; | 353 *(curpos++) = !context->reset; |
354 *curpos = busreq; | 354 *curpos = context->busreq; |
355 curpos += 3; | 355 curpos += 3; |
356 uint32_t bank = context->bank_reg << 15; | 356 uint32_t bank = context->bank_reg << 15; |
357 write_le_32(curpos, bank); | 357 write_le_32(curpos, bank); |
358 fseek(gstfile, GST_Z80_REGS, SEEK_SET); | 358 fseek(gstfile, GST_Z80_REGS, SEEK_SET); |
359 if (fwrite(regdata, 1, sizeof(regdata), gstfile) != sizeof(regdata)) { | 359 if (fwrite(regdata, 1, sizeof(regdata), gstfile) != sizeof(regdata)) { |
421 char ident[5]; | 421 char ident[5]; |
422 if (fread(ident, 1, sizeof(ident), gstfile) != sizeof(ident)) { | 422 if (fread(ident, 1, sizeof(ident), gstfile) != sizeof(ident)) { |
423 fprintf(stderr, "Could not read ident code from %s\n", fname); | 423 fprintf(stderr, "Could not read ident code from %s\n", fname); |
424 goto error_close; | 424 goto error_close; |
425 } | 425 } |
426 if (memcmp(ident, "GST\x40\xE0", 5) != 0) { | 426 if (memcmp(ident, "GST\x40\xE0", 3) != 0) { |
427 fprintf(stderr, "%s doesn't appear to be a GST savestate. The ident code is %c%c%c\\x%X\\x%X instead of GST\\x40\\xE0.\n", fname, ident[0], ident[1], ident[2], ident[3], ident[4]); | 427 fprintf(stderr, "%s doesn't appear to be a GST savestate. The ident code is %c%c%c\\x%X\\x%X instead of GST\\x40\\xE0.\n", fname, ident[0], ident[1], ident[2], ident[3], ident[4]); |
428 goto error_close; | 428 goto error_close; |
429 } | 429 } |
430 uint32_t pc = m68k_load_gst(gen->m68k, gstfile); | 430 uint32_t pc = m68k_load_gst(gen->m68k, gstfile); |
431 if (!pc) { | 431 if (!pc) { |