summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-07-24 05:06:35 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-07-24 05:06:35 +0000
commite6da3368973ddc40e06ee2c5a50bfa21c5b847e5 (patch)
tree869c110e163f38b4c1487f6c583a9a8619250fbd
parentb00f50959db2e8f8d15cddfa7ce069c7efd2b1a0 (diff)
From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Fix zr107 multisession issues Hi mamedev, The attached patch makes the initialization of various Konami PPC drivers consistent from run to run, hopefully fixing most multisession issues. I confirmed that this resolves running midnrun multisession, but it is possible other issues remain. The patch also moves some allocations from static to dynamic storage. ~aa
-rw-r--r--src/mame/drivers/gticlub.c44
-rw-r--r--src/mame/drivers/hornet.c75
-rw-r--r--src/mame/drivers/nwk-tr.c45
-rw-r--r--src/mame/drivers/zr107.c28
-rw-r--r--src/mame/video/gticlub.c59
-rw-r--r--src/mame/video/gticlub.h1
6 files changed, 171 insertions, 81 deletions
diff --git a/src/mame/drivers/gticlub.c b/src/mame/drivers/gticlub.c
index b338f302aa9..c364e3e630f 100644
--- a/src/mame/drivers/gticlub.c
+++ b/src/mame/drivers/gticlub.c
@@ -232,8 +232,8 @@ Hang Pilot (uses an unknown but similar video board) 12W
static UINT32 *work_ram;
-UINT8 gticlub_led_reg0 = 0x7f;
-UINT8 gticlub_led_reg1 = 0x7f;
+UINT8 gticlub_led_reg0;
+UINT8 gticlub_led_reg1;
int K001604_vh_start(running_machine *machine, int chip);
void K001604_tile_update(running_machine *machine, int chip);
@@ -361,8 +361,21 @@ static int adc1038_adr;
static int adc1038_data_in;
static int adc1038_data_out;
static int adc1038_adc_data;
-static int adc1038_sars = 1;
-static int adc1038_gticlub_hack = 0;
+static int adc1038_sars;
+static int adc1038_gticlub_hack;
+
+static void adc1038_init(running_machine *machine)
+{
+ adc1038_cycle = 0;
+ adc1038_clk = 0;
+ adc1038_adr = 0;
+ adc1038_data_in = 0;
+ adc1038_data_out = 0;
+ adc1038_adc_data = 0;
+ adc1038_sars = 1;
+ adc1038_gticlub_hack = (mame_stricmp(machine->gamedrv->name, "gticlub") == 0 ||
+ mame_stricmp(machine->gamedrv->name, "gticlubj") == 0) ? 1 : 0;
+}
static int adc1038_do_r(void)
{
@@ -450,7 +463,7 @@ static int adc1038_sars_r(running_machine *machine)
static READ8_HANDLER( sysreg_r )
{
- static const char *portnames[] = { "IN0", "IN1", "IN2", "IN3" };
+ static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" };
switch (offset)
{
@@ -567,7 +580,7 @@ WRITE8_HANDLER( K056230_w )
// mame_printf_debug("K056230_w: %d, %02X at %08X\n", offset, data, activecpu_get_pc());
}
-static UINT32 lanc_ram[0x2000/4];
+UINT32 *lanc_ram;
READ32_HANDLER( lanc_ram_r )
{
// mame_printf_debug("LANC_RAM_r: %08X, %08X at %08X\n", offset, mem_mask, activecpu_get_pc());
@@ -607,7 +620,7 @@ static ADDRESS_MAP_START( gticlub_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x780c0000, 0x780c0003) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc)
AM_RANGE(0x7e000000, 0x7e003fff) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
AM_RANGE(0x7e008000, 0x7e009fff) AM_READWRITE8(K056230_r, K056230_w, 0xffffffff)
- AM_RANGE(0x7e00a000, 0x7e00bfff) AM_READWRITE(lanc_ram_r, lanc_ram_w)
+ AM_RANGE(0x7e00a000, 0x7e00bfff) AM_READWRITE(lanc_ram_r, lanc_ram_w) AM_BASE(&lanc_ram)
AM_RANGE(0x7e00c000, 0x7e00c007) AM_WRITE(K056800_host_w)
AM_RANGE(0x7e00c000, 0x7e00c007) AM_READ(K056800_host_r) // Hang Pilot
AM_RANGE(0x7e00c008, 0x7e00c00f) AM_READ(K056800_host_r)
@@ -1156,18 +1169,15 @@ static void sound_irq_callback(running_machine *machine, int irq)
static DRIVER_INIT(gticlub)
{
init_konami_cgboard(1, CGBOARD_TYPE_GTICLUB);
+
sharc_dataram_0 = auto_malloc(0x100000);
+ gticlub_led_reg0 = gticlub_led_reg1 = 0x7f;
K001005_preprocess_texture_data(memory_region(machine, REGION_GFX1), memory_region_length(machine, REGION_GFX1), 1);
K056800_init(sound_irq_callback);
- // we'll need this for now
- if (mame_stricmp(machine->gamedrv->name, "gticlub") == 0 ||
- mame_stricmp(machine->gamedrv->name, "gticlubj") == 0)
- {
- adc1038_gticlub_hack = 1;
- }
+ adc1038_init(machine);
}
static DRIVER_INIT(hangplt)
@@ -1178,14 +1188,12 @@ static DRIVER_INIT(hangplt)
sharc_dataram_0 = auto_malloc(0x100000);
sharc_dataram_1 = auto_malloc(0x100000);
+ gticlub_led_reg0 = gticlub_led_reg1 = 0x7f;
K056800_init(sound_irq_callback);
K033906_init();
-}
-static DRIVER_INIT(slrasslt)
-{
- DRIVER_INIT_CALL(gticlub);
+ adc1038_init(machine);
}
/*************************************************************************/
@@ -1193,5 +1201,5 @@ static DRIVER_INIT(slrasslt)
GAME( 1996, gticlub, 0, gticlub, gticlub, gticlub, ROT0, "Konami", "GTI Club (ver AAA)", GAME_NOT_WORKING|GAME_NO_SOUND )
GAME( 1996, gticlubj, gticlub, gticlub, gticlub, gticlub, ROT0, "Konami", "GTI Club (ver JAA)", GAME_NOT_WORKING|GAME_NO_SOUND )
GAME( 1996, thunderh, 0, gticlub, thunderh, gticlub, ROT0, "Konami", "Operation Thunder Hurricane (ver UAA)", GAME_NOT_WORKING|GAME_NO_SOUND )
-GAME( 1997, slrasslt, 0, gticlub, slrasslt, slrasslt, ROT0, "Konami", "Solar Assault (ver UAA)", GAME_NOT_WORKING|GAME_NO_SOUND )
+GAME( 1997, slrasslt, 0, gticlub, slrasslt, gticlub, ROT0, "Konami", "Solar Assault (ver UAA)", GAME_NOT_WORKING|GAME_NO_SOUND )
GAMEL( 1997, hangplt, 0, hangplt, hangplt, hangplt, ROT0, "Konami", "Hang Pilot", GAME_NOT_WORKING|GAME_IMPERFECT_SOUND, layout_dualhovu )
diff --git a/src/mame/drivers/hornet.c b/src/mame/drivers/hornet.c
index 0f8b69063af..cefcd9df955 100644
--- a/src/mame/drivers/hornet.c
+++ b/src/mame/drivers/hornet.c
@@ -318,10 +318,10 @@
#include "sound/rf5c400.h"
#include "rendlay.h"
-static UINT8 led_reg0 = 0x7f, led_reg1 = 0x7f;
+static UINT8 led_reg0, led_reg1;
static UINT32 *workram;
static UINT32 *sharc_dataram[2];
-static UINT8 jvs_sdata[1024];
+static UINT8 *jvs_sdata;
static UINT32 jvs_sdata_ptr = 0;
static UINT8 *backup_ram;
@@ -335,7 +335,7 @@ static UINT32 *K037122_char_ram[MAX_K037122_CHIPS];
static UINT8 *K037122_dirty_map[MAX_K037122_CHIPS];
static int K037122_gfx_index[MAX_K037122_CHIPS], K037122_char_dirty[MAX_K037122_CHIPS];
static tilemap *K037122_layer[MAX_K037122_CHIPS][2];
-static UINT32 K037122_reg[MAX_K037122_CHIPS][256];
+static UINT32 *K037122_reg[MAX_K037122_CHIPS];
#define K037122_NUM_TILES 16384
@@ -431,6 +431,8 @@ static int K037122_vh_start(running_machine *machine, int chip)
K037122_dirty_map[chip] = auto_malloc(K037122_NUM_TILES);
+ K037122_reg[chip] = auto_malloc(0x400);
+
if (chip == 0)
{
K037122_layer[chip][0] = tilemap_create(K037122_0_tile_info_layer0, tilemap_scan_rows, 8, 8, 256, 64);
@@ -448,13 +450,14 @@ static int K037122_vh_start(running_machine *machine, int chip)
memset(K037122_char_ram[chip], 0, 0x200000);
memset(K037122_tile_ram[chip], 0, 0x20000);
memset(K037122_dirty_map[chip], 0, K037122_NUM_TILES);
+ memset(K037122_reg[chip], 0, 0x400);
machine->gfx[K037122_gfx_index[chip]] = allocgfx(&K037122_char_layout);
decodegfx(machine->gfx[K037122_gfx_index[chip]], (UINT8*)K037122_char_ram[chip], 0, machine->gfx[K037122_gfx_index[chip]]->total_elements);
machine->gfx[K037122_gfx_index[chip]]->total_colors = machine->config->total_colors / 16;
- state_save_register_item_array("K037122", chip, K037122_reg[chip]);
+ state_save_register_item_pointer("K037122", chip, K037122_reg[chip], 0x400/sizeof(K037122_reg[chip][0]));
state_save_register_item_pointer("K037122", chip, K037122_char_ram[chip], 0x200000/sizeof(K037122_char_ram[chip][0]));
state_save_register_item_pointer("K037122", chip, K037122_tile_ram[chip], 0x20000/sizeof(K037122_tile_ram[chip][0]));
state_save_register_postload(machine, K037122_postload, (void *)(FPTR)chip);
@@ -665,7 +668,7 @@ static VIDEO_UPDATE( hornet_2board )
static READ8_HANDLER( sysreg_r )
{
UINT8 r = 0;
- static const char *portnames[] = { "IN0", "IN1", "IN2" };
+ static const char *const portnames[] = { "IN0", "IN1", "IN2" };
switch (offset)
{
@@ -987,7 +990,7 @@ static const struct RF5C400interface rf5c400_interface =
REGION_SOUND1
};
-static sharc_config sharc_cfg =
+static const sharc_config sharc_cfg =
{
BOOT_MODE_EPROM
};
@@ -1004,6 +1007,10 @@ static sharc_config sharc_cfg =
static MACHINE_START( hornet )
{
+ jvs_sdata_ptr = 0;
+ jvs_sdata = auto_malloc(1024);
+ memset(jvs_sdata, 0, 1024);
+
/* set conservative DRC options */
cpunum_set_info_int(0, CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
@@ -1016,7 +1023,7 @@ static MACHINE_START( hornet )
state_save_register_global(led_reg0);
state_save_register_global(led_reg1);
- state_save_register_global_array(jvs_sdata);
+ state_save_register_global_pointer(jvs_sdata, 1024);
state_save_register_global(jvs_sdata_ptr);
}
@@ -1239,7 +1246,7 @@ static void jamma_jvs_cmd_exec(void)
length = jvs_decode_data(&jvs_sdata[3], data, byte_num-1);
- /*
+#if 0
printf("jvs input data:\n");
for (i=0; i < byte_num; i++)
{
@@ -1253,7 +1260,7 @@ static void jamma_jvs_cmd_exec(void)
printf("%02X ", data[i]);
}
printf("\n\n");
- */
+#endif
// clear return data
memset(rdata, 0, sizeof(rdata));
@@ -1306,7 +1313,7 @@ static void sound_irq_callback(running_machine *machine, int irq)
cpunum_set_input_line(machine, 1, INPUT_LINE_IRQ2, PULSE_LINE);
}
-static void init_hornet(running_machine *machine, const UINT8 *backupdef)
+static void init_hornet(running_machine *machine)
{
init_konami_cgboard(1, CGBOARD_TYPE_HORNET);
set_cgboard_texture_bank(0, 5, memory_region(machine, REGION_USER5));
@@ -1314,14 +1321,13 @@ static void init_hornet(running_machine *machine, const UINT8 *backupdef)
K056800_init(sound_irq_callback);
K033906_init();
- backup_ram = auto_malloc(0x2000);
- memcpy(backup_ram, backupdef, 0x2000);
+ led_reg0 = led_reg1 = 0x7f;
timekeeper_init(machine, 0, TIMEKEEPER_M48T58, backup_ram);
ppc4xx_spu_set_tx_handler(0, jamma_jvs_w);
}
-static void init_hornet_2board(running_machine *machine, const UINT8 *backupdef)
+static void init_hornet_2board(running_machine *machine)
{
init_konami_cgboard(2, CGBOARD_TYPE_HORNET);
set_cgboard_texture_bank(0, 5, memory_region(machine, REGION_USER5));
@@ -1330,8 +1336,7 @@ static void init_hornet_2board(running_machine *machine, const UINT8 *backupdef)
K056800_init(sound_irq_callback);
K033906_init();
- backup_ram = auto_malloc(0x2000);
- memcpy(backup_ram, backupdef, 0x2000);
+ led_reg0 = led_reg1 = 0x7f;
timekeeper_init(machine, 0, TIMEKEEPER_M48T58, backup_ram);
ppc4xx_spu_set_tx_handler(0, jamma_jvs_w);
@@ -1339,7 +1344,10 @@ static void init_hornet_2board(running_machine *machine, const UINT8 *backupdef)
static DRIVER_INIT(gradius4)
{
- UINT8 backupdef[0x2000] = { 0 };
+ UINT8 *backupdef;
+
+ backupdef = auto_malloc(0x2000);
+ memset(backupdef, 0, 0x2000);
/* RTC data */
backupdef[0x00] = 0x47; // 'G'
@@ -1359,15 +1367,19 @@ static DRIVER_INIT(gradius4)
backupdef[0x0e] = 0x02; // checksum
backupdef[0x0f] = 0xd7; // checksum
- init_hornet(machine, backupdef);
+ backup_ram = backupdef;
+ init_hornet(machine);
}
static DRIVER_INIT(nbapbp)
{
- UINT8 backupdef[0x2000] = { 0 };
+ UINT8 *backupdef;
int i;
UINT16 checksum;
+ backupdef = auto_malloc(0x2000);
+ memset(backupdef, 0, 0x2000);
+
/* RTC data */
backupdef[0x00] = 0x47; // 'G'
backupdef[0x01] = 0x58; // 'X'
@@ -1393,15 +1405,19 @@ static DRIVER_INIT(nbapbp)
backupdef[0x0e] = (checksum >> 8) & 0xff; // checksum
backupdef[0x0f] = (checksum >> 0) & 0xff; // checksum
- init_hornet(machine, backupdef);
+ backup_ram = backupdef;
+ init_hornet(machine);
}
static DRIVER_INIT(terabrst)
{
- UINT8 backupdef[0x2000] = { 0 };
+ UINT8 *backupdef;
int i;
UINT16 checksum;
+ backupdef = auto_malloc(0x2000);
+ memset(backupdef, 0, 0x2000);
+
/* RTC data */
backupdef[0x00] = 0x47; // 'G'
backupdef[0x01] = 0x4e; // 'N'
@@ -1427,15 +1443,19 @@ static DRIVER_INIT(terabrst)
backupdef[0x0e] = (checksum >> 8) & 0xff; // checksum
backupdef[0x0f] = (checksum >> 0) & 0xff; // checksum
- init_hornet_2board(machine, backupdef);
+ backup_ram = backupdef;
+ init_hornet_2board(machine);
}
static DRIVER_INIT(sscope)
{
- UINT8 backupdef[0x2000] = { 0 };
+ UINT8 *backupdef;
int i;
UINT16 checksum;
+ backupdef = auto_malloc(0x2000);
+ memset(backupdef, 0, 0x2000);
+
/* RTC data */
backupdef[0x00] = 0x47; // 'G'
backupdef[0x01] = 0x51; // 'Q'
@@ -1461,15 +1481,19 @@ static DRIVER_INIT(sscope)
backupdef[0x0e] = (checksum >> 8) & 0xff; // checksum
backupdef[0x0f] = (checksum >> 0) & 0xff; // checksum
- init_hornet_2board(machine, backupdef);
+ backup_ram = backupdef;
+ init_hornet_2board(machine);
}
static DRIVER_INIT(sscope2)
{
- UINT8 backupdef[0x2000] = { 0 };
+ UINT8 *backupdef;
int i;
int checksum;
+ backupdef = auto_malloc(0x2000);
+ memset(backupdef, 0, 0x2000);
+
/* RTC data */
backupdef[0x00] = 0x47; // 'G'
backupdef[0x01] = 0x4b; // 'K'
@@ -1523,7 +1547,8 @@ static DRIVER_INIT(sscope2)
backupdef[0x1f4e] = (checksum >> 8) & 0xff; // checksum
backupdef[0x1f4f] = (checksum >> 0) & 0xff; // checksum
- init_hornet_2board(machine, backupdef);
+ backup_ram = backupdef;
+ init_hornet_2board(machine);
}
/*****************************************************************************/
diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c
index 8a800149493..35b1b4c09d8 100644
--- a/src/mame/drivers/nwk-tr.c
+++ b/src/mame/drivers/nwk-tr.c
@@ -223,10 +223,10 @@ Thrill Drive 713A13 - 713A14 -
#include "video/voodoo.h"
#include "machine/timekpr.h"
-static UINT8 led_reg0 = 0x7f, led_reg1 = 0x7f;
+static UINT8 led_reg0, led_reg1;
static UINT32 *work_ram;
-static UINT8 backup_ram[0x2000];
+static UINT8 *backup_ram;
static WRITE32_HANDLER( paletteram32_w )
@@ -251,7 +251,7 @@ static int K001604_tilemap_offset;
static tilemap *K001604_layer_roz[MAX_K001604_CHIPS][2];
static int K001604_roz_size[MAX_K001604_CHIPS];
-static UINT32 K001604_reg[MAX_K001604_CHIPS][256];
+static UINT32 *K001604_reg[MAX_K001604_CHIPS];
static int K001604_layer_size;
@@ -426,6 +426,7 @@ int K001604_vh_start(running_machine *machine, int chip)
K001604_dirty_map[chip][0] = auto_malloc(K001604_NUM_TILES_LAYER0);
K001604_dirty_map[chip][1] = auto_malloc(K001604_NUM_TILES_LAYER1);
+ K001604_reg[chip] = auto_malloc(0x400);
if (chip == 0)
{
@@ -455,6 +456,7 @@ int K001604_vh_start(running_machine *machine, int chip)
memset(K001604_tile_ram[chip], 0, 0x10000);
memset(K001604_dirty_map[chip][0], 0, K001604_NUM_TILES_LAYER0);
memset(K001604_dirty_map[chip][1], 0, K001604_NUM_TILES_LAYER1);
+ memset(K001604_reg[chip], 0, 0x400);
machine->gfx[K001604_gfx_index[chip][0]] = allocgfx(&K001604_char_layout_layer_8x8);
@@ -826,7 +828,15 @@ static WRITE32_HANDLER( sysreg_w )
static int fpga_uploaded = 0;
static int lanc2_ram_r = 0;
static int lanc2_ram_w = 0;
-static UINT8 lanc2_ram[0x8000];
+static UINT8 *lanc2_ram;
+
+static void lanc2_init(void)
+{
+ fpga_uploaded = 0;
+ lanc2_ram_r = 0;
+ lanc2_ram_w = 0;
+ lanc2_ram = auto_malloc(0x8000);
+}
static READ32_HANDLER( lanc1_r )
{
@@ -1141,12 +1151,13 @@ static void sound_irq_callback(running_machine *machine, int irq)
cpunum_set_input_line(machine, 1, INPUT_LINE_IRQ2, PULSE_LINE);
}
-static DRIVER_INIT( nwktr )
+static void init_nwktr(running_machine *machine)
{
init_konami_cgboard(1, CGBOARD_TYPE_NWKTR);
set_cgboard_texture_bank(0, 5, memory_region(machine, REGION_USER5));
sharc_dataram = auto_malloc(0x100000);
+ led_reg0 = led_reg1 = 0x7f;
timekeeper_init(machine, 0, TIMEKEEPER_M48T58, backup_ram);
K056800_init(sound_irq_callback);
@@ -1156,12 +1167,16 @@ static DRIVER_INIT( nwktr )
// cpunum_set_info_fct(0, CPUINFO_PTR_SPU_RX_HANDLER, (genf *)jamma_jvs_r);
adc1213x_init(0, adc12138_input_callback);
+ lanc2_init();
}
static DRIVER_INIT(thrilld)
{
int i;
UINT16 checksum;
+
+ backup_ram = auto_malloc(0x2000);
+ memset(backup_ram, 0, 0x2000);
/* RTC data */
backup_ram[0x00] = 0x47; // 'G'
@@ -1190,7 +1205,7 @@ static DRIVER_INIT(thrilld)
backup_ram[0x0e] = (checksum >> 8) & 0xff; // checksum
backup_ram[0x0f] = (checksum >> 0) & 0xff; // checksum
- DRIVER_INIT_CALL(nwktr);
+ init_nwktr(machine);
}
static DRIVER_INIT(racingj)
@@ -1198,6 +1213,9 @@ static DRIVER_INIT(racingj)
int i;
UINT32 checksum;
+ backup_ram = auto_malloc(0x2000);
+ memset(backup_ram, 0, 0x2000);
+
/* RTC data */
backup_ram[0x00] = 0x47; // 'G'
backup_ram[0x01] = 0x6e; // 'n'
@@ -1215,16 +1233,16 @@ static DRIVER_INIT(racingj)
backup_ram[0x0d] = 0x00; //
checksum = 0;
- for (i=0; i < 14; i+=2)
- {
+ for (i=0; i < 14; i+=2)
+ {
checksum += (backup_ram[i] << 8) | (backup_ram[i+1]);
- checksum &= 0xffff;
- }
+ checksum &= 0xffff;
+ }
checksum = -1 - checksum;
backup_ram[0x0e] = (checksum >> 8) & 0xff; // checksum
backup_ram[0x0f] = (checksum >> 0) & 0xff; // checksum
- DRIVER_INIT_CALL(nwktr);
+ init_nwktr(machine);
}
static DRIVER_INIT(racingj2)
@@ -1232,6 +1250,9 @@ static DRIVER_INIT(racingj2)
int i;
UINT32 checksum;
+ backup_ram = auto_malloc(0x2000);
+ memset(backup_ram, 0, 0x2000);
+
/* RTC data */
backup_ram[0x00] = 0x47; // 'G'
backup_ram[0x01] = 0x6e; // 'n'
@@ -1258,7 +1279,7 @@ static DRIVER_INIT(racingj2)
backup_ram[0x0e] = (checksum >> 8) & 0xff; // checksum
backup_ram[0x0f] = (checksum >> 0) & 0xff; // checksum
- DRIVER_INIT_CALL(nwktr);
+ init_nwktr(machine);
}
diff --git a/src/mame/drivers/zr107.c b/src/mame/drivers/zr107.c
index 2aac88375cc..13fdb1a1eca 100644
--- a/src/mame/drivers/zr107.c
+++ b/src/mame/drivers/zr107.c
@@ -186,12 +186,13 @@ Check gticlub.c for details on the bottom board.
#include "video/gticlub.h"
-static UINT8 led_reg0 = 0x7f, led_reg1 = 0x7f;
+static UINT8 led_reg0, led_reg1;
// defined in drivers/gticlub.c
extern READ8_HANDLER(K056230_r);
extern WRITE8_HANDLER(K056230_w);
+extern UINT32 *lanc_ram;
extern READ32_HANDLER(lanc_ram_r);
extern WRITE32_HANDLER(lanc_ram_w);
@@ -219,6 +220,7 @@ READ32_HANDLER(K001604_reg_r);
static VIDEO_START( jetwave )
{
K001005_init(machine);
+ K001006_init(machine);
K001604_vh_start(machine, 0);
}
@@ -267,6 +269,7 @@ static VIDEO_START( zr107 )
};
K056832_vh_start(machine, REGION_GFX2, K056832_BPP_8, 1, scrolld, game_tile_callback, 0);
+ K001006_init(machine);
K001005_init(machine);
}
@@ -483,7 +486,7 @@ static ADDRESS_MAP_START( zr107_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x780c0000, 0x780c0007) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc)
AM_RANGE(0x7e000000, 0x7e003fff) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
AM_RANGE(0x7e008000, 0x7e009fff) AM_READWRITE8(K056230_r, K056230_w, 0xffffffff) /* LANC registers */
- AM_RANGE(0x7e00a000, 0x7e00bfff) AM_READWRITE(lanc_ram_r, lanc_ram_w) /* LANC Buffer RAM (27E) */
+ AM_RANGE(0x7e00a000, 0x7e00bfff) AM_READWRITE(lanc_ram_r, lanc_ram_w) AM_BASE(&lanc_ram) /* LANC Buffer RAM (27E) */
AM_RANGE(0x7e00c000, 0x7e00c007) AM_WRITE(K056800_host_w)
AM_RANGE(0x7e00c008, 0x7e00c00f) AM_READ(K056800_host_r)
AM_RANGE(0x7f800000, 0x7f9fffff) AM_ROM AM_SHARE(2)
@@ -714,7 +717,7 @@ static INPUT_PORTS_START( jetwave )
INPUT_PORTS_END
-static sharc_config sharc_cfg =
+static const sharc_config sharc_cfg =
{
BOOT_MODE_EPROM
};
@@ -835,10 +838,11 @@ static void sound_irq_callback(running_machine *machine, int irq)
cpunum_set_input_line(machine, 1, INPUT_LINE_IRQ2, PULSE_LINE);
}
-static DRIVER_INIT(zr107)
+static void init_zr107(running_machine *machine)
{
- init_konami_cgboard(1, CGBOARD_TYPE_ZR107);
sharc_dataram = auto_malloc(0x100000);
+ led_reg0 = led_reg1 = 0x7f;
+ ccu_vcth = ccu_vctl = 0;
K001005_preprocess_texture_data(memory_region(machine, REGION_GFX1), memory_region_length(machine, REGION_GFX1), 0);
@@ -847,16 +851,16 @@ static DRIVER_INIT(zr107)
adc083x_init(0, ADC0838, adc0838_callback);
}
+static DRIVER_INIT(zr107)
+{
+ init_konami_cgboard(1, CGBOARD_TYPE_ZR107);
+ init_zr107(machine);
+}
+
static DRIVER_INIT(jetwave)
{
init_konami_cgboard(1, CGBOARD_TYPE_GTICLUB);
- sharc_dataram = auto_malloc(0x100000);
-
- K001005_preprocess_texture_data(memory_region(machine, REGION_GFX1), memory_region_length(machine, REGION_GFX1), 0);
-
- K056800_init(sound_irq_callback);
-
- adc083x_init(0, ADC0838, adc0838_callback);
+ init_zr107(machine);
}
/*****************************************************************************/
diff --git a/src/mame/video/gticlub.c b/src/mame/video/gticlub.c
index 9b0b853deda..9ed8d3827d4 100644
--- a/src/mame/video/gticlub.c
+++ b/src/mame/video/gticlub.c
@@ -27,8 +27,6 @@ void K001604_draw_back_layer(int chip, bitmap_t *bitmap, const rectangle *clipre
extern UINT8 gticlub_led_reg0;
extern UINT8 gticlub_led_reg1;
-static poly_manager *poly;
-
/*****************************************************************************/
@@ -36,12 +34,28 @@ static poly_manager *poly;
#define MAX_K001006_CHIPS 2
-static UINT16 K001006_pal_ram[MAX_K001006_CHIPS][0x800];
-static UINT16 K001006_unknown_ram[MAX_K001006_CHIPS][0x1000];
+static UINT16 *K001006_pal_ram[MAX_K001006_CHIPS];
+static UINT16 *K001006_unknown_ram[MAX_K001006_CHIPS];
static UINT32 K001006_addr[MAX_K001006_CHIPS] = { 0, 0 };
static int K001006_device_sel[MAX_K001006_CHIPS] = { 0, 0 };
-static UINT32 K001006_palette[MAX_K001006_CHIPS][0x800];
+static UINT32 *K001006_palette[MAX_K001006_CHIPS];
+
+void K001006_init(running_machine *machine)
+{
+ int i;
+ for (i=0; i<MAX_K001006_CHIPS; i++)
+ {
+ K001006_pal_ram[i] = auto_malloc(0x800*sizeof(UINT16));
+ memset(K001006_pal_ram[i], 0, 0x800*sizeof(UINT16));
+ K001006_unknown_ram[i] = auto_malloc(0x1000*sizeof(UINT16));
+ memset(K001006_unknown_ram[i], 0, 0x1000*sizeof(UINT16));
+ K001006_addr[i] = 0;
+ K001006_device_sel[i] = 0;
+ K001006_palette[i] = auto_malloc(0x800*sizeof(UINT32));
+ memset(K001006_palette[i], 0, 0x800*sizeof(UINT32));
+ }
+}
static UINT32 K001006_r(running_machine *machine, int chip, int offset, UINT32 mem_mask)
{
@@ -176,6 +190,11 @@ static int tex_mirror_table[4][128];
static int K001005_bitmap_page = 0;
+static poly_manager *poly;
+static poly_vertex prev_v[4];
+static int prev_poly_type;
+
+
void K001005_swap_buffers(running_machine *machine);
static void K001005_exit(running_machine *machine)
@@ -213,6 +232,16 @@ void K001005_init(running_machine *machine)
tex_mirror_table[2][i] = ((i & 0x3f) >= 0x20) ? (0x1f - (i & 0x1f)) : i & 0x1f;
tex_mirror_table[3][i] = ((i & 0x7f) >= 0x40) ? (0x3f - (i & 0x3f)) : i & 0x3f;
}
+
+ K001005_status = 0;
+ K001005_ram_ptr = 0;
+ K001005_fifo_read_ptr = 0;
+ K001005_fifo_write_ptr = 0;
+ K001005_3d_fifo_ptr = 0;
+ K001005_bitmap_page = 0;
+
+ memset(prev_v, 0, sizeof(prev_v));
+ prev_poly_type = 0;
}
// rearranges the texture data to a more practical order
@@ -524,9 +553,6 @@ static void draw_scanline_tex(void *dest, INT32 scanline, const poly_extent *ext
}
}
-static poly_vertex prev_v[4];
-static int prev_poly_type;
-
static void render_polygons(running_machine *machine)
{
int i, j;
@@ -955,16 +981,21 @@ void K001005_swap_buffers(running_machine *machine)
}
}
+static int tick = 0;
+static int debug_tex_page = 0;
+static int debug_tex_palette = 0;
+
VIDEO_START( gticlub )
{
+ tick = 0;
+ debug_tex_page = 0;
+ debug_tex_palette = 0;
+
+ K001006_init(machine);
K001005_init(machine);
K001604_vh_start(machine, 0);
}
-static int tick = 0;
-static int debug_tex_page = 0;
-static int debug_tex_palette = 0;
-
VIDEO_UPDATE( gticlub )
{
K001604_tile_update(screen->machine, 0);
@@ -1000,7 +1031,7 @@ VIDEO_UPDATE( gticlub )
debug_tex_palette = 0;
}
- /*
+#if 0
if (debug_tex_page > 0)
{
char string[200];
@@ -1022,7 +1053,7 @@ VIDEO_UPDATE( gticlub )
sprintf(string, "Texture page %d\nPalette %d", debug_tex_page, debug_tex_palette);
//popmessage("%s", string);
}
- */
+#endif
draw_7segment_led(bitmap, 3, 3, gticlub_led_reg0);
draw_7segment_led(bitmap, 9, 3, gticlub_led_reg1);
diff --git a/src/mame/video/gticlub.h b/src/mame/video/gticlub.h
index a40f4a3cf91..f9b48c2abd6 100644
--- a/src/mame/video/gticlub.h
+++ b/src/mame/video/gticlub.h
@@ -6,6 +6,7 @@ void K001005_preprocess_texture_data(UINT8 *rom, int length, int gticlub);
READ32_HANDLER(K001005_r);
WRITE32_HANDLER(K001005_w);
+void K001006_init(running_machine *machine);
READ32_HANDLER(K001006_0_r);
WRITE32_HANDLER(K001006_0_w);
READ32_HANDLER(K001006_1_r);