diff --git a/src/cpu/h6280/h6280.c b/src/cpu/h6280/h6280.c index e9a54362..63c5ca2f 100644 --- a/src/cpu/h6280/h6280.c +++ b/src/cpu/h6280/h6280.c @@ -60,6 +60,7 @@ #include "memory.h" #include "cpuintrf.h" +#include "state.h" #include "mamedbg.h" #include "h6280.h" @@ -138,6 +139,31 @@ UINT8 H6280_debug_mmr[8]; /*****************************************************************************/ void h6280_init(void) { + int cpu = cpu_getactivecpu(); + + state_save_register_UINT32("h6280", cpu, "PPC", &h6280.ppc.d, 1); + state_save_register_UINT32("h6280", cpu, "PC", &h6280.pc.d, 1); + state_save_register_UINT32("h6280", cpu, "SP", &h6280.sp.d, 1); + state_save_register_UINT32("h6280", cpu, "ZP", &h6280.zp.d, 1); + state_save_register_UINT32("h6280", cpu, "EA", &h6280.ea.d, 1); + state_save_register_UINT8("h6280", cpu, "A", &h6280.a, 1); + state_save_register_UINT8("h6280", cpu, "X", &h6280.x, 1); + state_save_register_UINT8("h6280", cpu, "Y", &h6280.y, 1); + state_save_register_UINT8("h6280", cpu, "P", &h6280.p, 1); + state_save_register_UINT8("h6280", cpu, "MMR", h6280.mmr, 8); + state_save_register_UINT8("h6280", cpu, "IRQ_MASK", &h6280.irq_mask, 1); + state_save_register_UINT8("h6280", cpu, "TIMER_STATUS", &h6280.timer_status, 1); + state_save_register_UINT8("h6280", cpu, "TIMER_ACK", &h6280.timer_ack, 1); + state_save_register_int("h6280", cpu, "TIMER_VALUE", &h6280.timer_value); + state_save_register_int("h6280", cpu, "TIMER_LOAD", &h6280.timer_load); + state_save_register_int("h6280", cpu, "EXTRA_CYCLES", &h6280.extra_cycles); + state_save_register_int("h6280", cpu, "NMI_STATE", &h6280.nmi_state); + state_save_register_int("h6280", cpu, "IRQ1_STATE", &h6280.irq_state[0]); + state_save_register_int("h6280", cpu, "IRQ2_STATE", &h6280.irq_state[1]); + state_save_register_int("h6280", cpu, "IRQT_STATE", &h6280.irq_state[2]); +#if LAZY_FLAGS + state_save_register_int("h6280", cpu, "NZ", &h6280.NZ); +#endif } void h6280_reset(void *param) diff --git a/src/drivers/battlera.c b/src/drivers/battlera.c index 153fede4..61e9ba0d 100644 --- a/src/drivers/battlera.c +++ b/src/drivers/battlera.c @@ -23,6 +23,7 @@ #include "driver.h" #include "vidhrdw/generic.h" #include "cpu/h6280/h6280.h" +#include "state.h" VIDEO_UPDATE( battlera ); VIDEO_START( battlera ); @@ -107,11 +108,10 @@ static WRITE_HANDLER( YM2203_w ) } static int msm5205next; +static int toggle; static void battlera_adpcm_int(int data) { - static int toggle; - MSM5205_data_w(0,msm5205next >> 4); msm5205next<<=4; @@ -368,5 +368,14 @@ ROM_END /******************************************************************************/ -GAMEX( 1988, battlera, 0, battlera, battlera, 0, ROT0, "Data East Corporation", "Battle Rangers (World)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) -GAMEX( 1988, bldwolf, battlera, battlera, battlera, 0, ROT0, "Data East USA", "Bloody Wolf (US)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) +static DRIVER_INIT( battlera ) +{ + state_save_register_int("battlera", 0, "control_port_select", &control_port_select); + state_save_register_int("battlera", 0, "msm5205next", &msm5205next); + state_save_register_int("battlera", 0, "adpcm_toggle", &toggle); +} + +/******************************************************************************/ + +GAMEX( 1988, battlera, 0, battlera, battlera, battlera, ROT0, "Data East Corporation", "Battle Rangers (World)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) +GAMEX( 1988, bldwolf, battlera, battlera, battlera, battlera, ROT0, "Data East USA", "Bloody Wolf (US)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) diff --git a/src/vidhrdw/battlera_vidhrdw.c b/src/vidhrdw/battlera_vidhrdw.c index a21f6d40..f7153641 100644 --- a/src/vidhrdw/battlera_vidhrdw.c +++ b/src/vidhrdw/battlera_vidhrdw.c @@ -10,6 +10,7 @@ #include "driver.h" #include "vidhrdw/generic.h" #include "cpu/h6280/h6280.h" +#include "state.h" static int HuC6270_registers[20]; static int VDC_register,vram_ptr; @@ -18,6 +19,9 @@ static struct mame_bitmap *tile_bitmap,*front_bitmap; static int current_scanline,inc_value; static int irq_enable,rcr_enable,sb_enable,bb_enable,bldwolf_vblank; +static int last_line; + +static void battlera_postload(void); @@ -45,10 +49,44 @@ VIDEO_START( battlera ) inc_value=1; current_scanline=0; irq_enable=rcr_enable=sb_enable=bb_enable=0; + last_line=0; + + state_save_register_UINT8("battlera_video", 0, "HuC6270_vram", HuC6270_vram, 0x20000); + state_save_register_INT32("battlera_video", 0, "HuC6270_registers", (INT32 *)HuC6270_registers, 20); + state_save_register_int("battlera_video", 0, "VDC_register", &VDC_register); + state_save_register_int("battlera_video", 0, "vram_ptr", &vram_ptr); + state_save_register_int("battlera_video", 0, "current_scanline", ¤t_scanline); + state_save_register_int("battlera_video", 0, "inc_value", &inc_value); + state_save_register_int("battlera_video", 0, "irq_enable", &irq_enable); + state_save_register_int("battlera_video", 0, "rcr_enable", &rcr_enable); + state_save_register_int("battlera_video", 0, "sb_enable", &sb_enable); + state_save_register_int("battlera_video", 0, "bb_enable", &bb_enable); + state_save_register_int("battlera_video", 0, "bldwolf_vblank", &bldwolf_vblank); + state_save_register_int("battlera_video", 0, "last_line", &last_line); + state_save_register_UINT8("battlera_video", 0, "paletteram", paletteram, 0x400); + state_save_register_func_postload(battlera_postload); return 0; } +static void battlera_postload(void) +{ + int offs,r,g,b,pal_word; + + memset(tile_dirty,1,0x1000); + memset(sprite_dirty,1,0x400); + memset(vram_dirty,1,0x1000); + + for (offs = 0; offs < 0x400; offs += 2) + { + pal_word=paletteram[offs] | (paletteram[offs+1]<<8); + r = ((pal_word >> 3) & 7) << 5; + g = ((pal_word >> 6) & 7) << 5; + b = ((pal_word >> 0) & 7) << 5; + palette_set_color(offs/2, r, g, b); + } +} + /******************************************************************************/ WRITE_HANDLER( battlera_palette_w ) @@ -436,8 +474,6 @@ void battlera_raster_partial_refresh(struct mame_bitmap *bitmap,int start_line,i INTERRUPT_GEN( battlera_interrupt ) { - static int last_line=0; - current_scanline=255-cpu_getiloops(); /* 8 lines clipped at top */ /* If raster interrupt occurs, refresh screen _up_ to this point */