comparison gst.c @ 668:5439ae7946ca

Made the Z80 core more contained by refactoring some code in blastem.c into z80_to_x86.c
author Michael Pavone <pavone@retrodev.com>
date Sat, 03 Jan 2015 18:23:04 -0800
parents 140af5509ce7
children 61faa298af07
comparison
equal deleted inserted replaced
667:30ccf56842d6 668:5439ae7946ca
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)) {