diff vdp.c @ 1428:2540c05520f2

New savestates are working. New config file option for selecting format states will be saved in. Mostly complete, needs a little more work before release
author Michael Pavone <pavone@retrodev.com>
date Wed, 09 Aug 2017 23:26:51 -0700
parents 4e5797b3935a
children 030b40139de9
line wrap: on
line diff
--- a/vdp.c	Sun Aug 06 00:06:36 2017 -0700
+++ b/vdp.c	Wed Aug 09 23:26:51 2017 -0700
@@ -774,7 +774,16 @@
 //rough estimate of slot number at which border display starts
 #define BG_START_SLOT 6
 
-void write_cram(vdp_context * context, uint16_t address, uint16_t value)
+void write_cram_internal(vdp_context * context, uint16_t addr, uint16_t value)
+{
+	context->cram[addr] = value;
+	context->colors[addr] = color_map[value & CRAM_BITS];
+	context->colors[addr + CRAM_SIZE] = color_map[(value & CRAM_BITS) | FBUF_SHADOW];
+	context->colors[addr + CRAM_SIZE*2] = color_map[(value & CRAM_BITS) | FBUF_HILIGHT];
+	context->colors[addr + CRAM_SIZE*3] = color_map[(value & CRAM_BITS) | FBUF_MODE4];
+}
+
+static void write_cram(vdp_context * context, uint16_t address, uint16_t value)
 {
 	uint16_t addr;
 	if (context->regs[REG_MODE_2] & BIT_MODE_5) {
@@ -783,11 +792,7 @@
 		addr = address & 0x1F;
 		value = (value << 1 & 0xE) | (value << 2 & 0xE0) | (value & 0xE00);
 	}
-	context->cram[addr] = value;
-	context->colors[addr] = color_map[value & CRAM_BITS];
-	context->colors[addr + CRAM_SIZE] = color_map[(value & CRAM_BITS) | FBUF_SHADOW];
-	context->colors[addr + CRAM_SIZE*2] = color_map[(value & CRAM_BITS) | FBUF_HILIGHT];
-	context->colors[addr + CRAM_SIZE*3] = color_map[(value & CRAM_BITS) | FBUF_MODE4];
+	write_cram_internal(context, addr, value);
 	
 	if (context->hslot >= BG_START_SLOT && (
 		context->vcounter < context->inactive_start + context->border_bot