summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.gitattributes6
-rw-r--r--src/emu/emu.mak3
-rw-r--r--src/emu/machine/adc1038.c176
-rw-r--r--src/emu/machine/adc1038.h56
-rw-r--r--src/emu/machine/k033906.c171
-rw-r--r--src/emu/machine/k033906.h49
-rw-r--r--src/emu/machine/k056230.c145
-rw-r--r--src/emu/machine/k056230.h51
-rw-r--r--src/mame/drivers/gticlub.c295
-rw-r--r--src/mame/drivers/hornet.c19
-rw-r--r--src/mame/drivers/nwk-tr.c10
-rw-r--r--src/mame/drivers/zr107.c28
-rw-r--r--src/mame/machine/konppc.c154
-rw-r--r--src/mame/machine/konppc.h1
14 files changed, 822 insertions, 342 deletions
diff --git a/.gitattributes b/.gitattributes
index 6c5a5a8ae46..e88c6347600 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -632,6 +632,8 @@ src/emu/machine/8257dma.c svneol=native#text/plain
src/emu/machine/8257dma.h svneol=native#text/plain
src/emu/machine/adc083x.c svneol=native#text/plain
src/emu/machine/adc083x.h svneol=native#text/plain
+src/emu/machine/adc1038.c svneol=native#text/plain
+src/emu/machine/adc1038.h svneol=native#text/plain
src/emu/machine/adc1213x.c svneol=native#text/plain
src/emu/machine/adc1213x.h svneol=native#text/plain
src/emu/machine/am53cf96.c svneol=native#text/plain
@@ -668,6 +670,10 @@ src/emu/machine/idectrl.c svneol=native#text/plain
src/emu/machine/idectrl.h svneol=native#text/plain
src/emu/machine/intelfsh.c svneol=native#text/plain
src/emu/machine/intelfsh.h svneol=native#text/plain
+src/emu/machine/k033906.c svneol=native#text/plain
+src/emu/machine/k033906.h svneol=native#text/plain
+src/emu/machine/k056230.c svneol=native#text/plain
+src/emu/machine/k056230.h svneol=native#text/plain
src/emu/machine/laserdsc.h svneol=native#text/plain
src/emu/machine/latch8.c svneol=native#text/plain
src/emu/machine/latch8.h svneol=native#text/plain
diff --git a/src/emu/emu.mak b/src/emu/emu.mak
index 37bcbd25528..e432e0670bb 100644
--- a/src/emu/emu.mak
+++ b/src/emu/emu.mak
@@ -124,6 +124,7 @@ EMUMACHINEOBJS = \
$(EMUMACHINE)/8257dma.o \
$(EMUMACHINE)/8255ppi.o \
$(EMUMACHINE)/adc083x.o \
+ $(EMUMACHINE)/adc1038.o \
$(EMUMACHINE)/adc1213x.o \
$(EMUMACHINE)/am53cf96.o \
$(EMUMACHINE)/at28c16.o \
@@ -141,6 +142,8 @@ EMUMACHINEOBJS = \
$(EMUMACHINE)/i2cmemdev.o \
$(EMUMACHINE)/idectrl.o \
$(EMUMACHINE)/intelfsh.o \
+ $(EMUMACHINE)/k033906.o \
+ $(EMUMACHINE)/k056230.o \
$(EMUMACHINE)/latch8.o \
$(EMUMACHINE)/ldcore.o \
$(EMUMACHINE)/ldpr8210.o \
diff --git a/src/emu/machine/adc1038.c b/src/emu/machine/adc1038.c
new file mode 100644
index 00000000000..a25b20a27f1
--- /dev/null
+++ b/src/emu/machine/adc1038.c
@@ -0,0 +1,176 @@
+/***************************************************************************
+
+ National Semiconductor ADC1038
+
+ 10-Bit Serial I/O A/D Converters with Analog Multiplexer and
+ Track/hold Function
+
+***************************************************************************/
+
+#include "driver.h"
+#include "adc1038.h"
+
+/***************************************************************************
+ TYPE DEFINITIONS
+***************************************************************************/
+
+typedef struct _adc1038_state adc1038_state;
+struct _adc1038_state
+{
+ int cycle;
+ int clk;
+ int adr;
+ int data_in;
+ int data_out;
+ int adc_data;
+ int sars;
+ adc1038_input_read_func input_callback_r;
+
+ int gticlub_hack;
+};
+
+/*****************************************************************************
+ INLINE FUNCTIONS
+*****************************************************************************/
+
+INLINE adc1038_state *adc1038_get_safe_token( const device_config *device )
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == ADC1038);
+
+ return (adc1038_state *)device->token;
+}
+
+INLINE const adc1038_interface *adc1038_get_interface( const device_config *device )
+{
+ assert(device != NULL);
+ assert((device->type == ADC1038));
+ return (const adc1038_interface *) device->static_config;
+}
+
+/*****************************************************************************
+ DEVICE HANDLERS
+*****************************************************************************/
+
+READ_LINE_DEVICE_HANDLER( adc1038_do_read )
+{
+ adc1038_state *adc1038 = adc1038_get_safe_token(device);
+
+ //printf("ADC DO\n");
+ return adc1038->data_out;
+}
+
+WRITE_LINE_DEVICE_HANDLER( adc1038_di_write )
+{
+ adc1038_state *adc1038 = adc1038_get_safe_token(device);
+
+ adc1038->data_in = state;
+}
+
+WRITE_LINE_DEVICE_HANDLER( adc1038_clk_write )
+{
+ adc1038_state *adc1038 = adc1038_get_safe_token(device);
+
+ // GTI Club doesn't sync on SARS
+ if (adc1038->gticlub_hack)
+ {
+ if (adc1038->clk == 0 && state == 0)
+ {
+ adc1038->cycle = 0;
+
+ /* notice that adc1038->adr is always < 7! */
+ adc1038->adc_data = adc1038->input_callback_r(device, adc1038->adr);
+ }
+ }
+
+ if (state == 1)
+ {
+ //printf("ADC CLK, DI = %d, cycle = %d\n", adc1038->data_in, adc1038->cycle);
+
+ if (adc1038->cycle == 0) // A2
+ {
+ adc1038->adr = 0;
+ adc1038->adr |= (adc1038->data_in << 2);
+ }
+ else if (adc1038->cycle == 1) // A1
+ {
+ adc1038->adr |= (adc1038->data_in << 1);
+ }
+ else if (adc1038->cycle == 2) // A0
+ {
+ adc1038->adr |= (adc1038->data_in << 0);
+ }
+
+ adc1038->data_out = (adc1038->adc_data & 0x200) ? 1 : 0;
+ adc1038->adc_data <<= 1;
+
+ adc1038->cycle++;
+ }
+
+ adc1038->clk = state;
+}
+
+READ_LINE_DEVICE_HANDLER( adc1038_sars_read )
+{
+ adc1038_state *adc1038 = adc1038_get_safe_token(device);
+
+ adc1038->cycle = 0;
+
+ /* notice that adc1038->adr is always < 7! */
+ adc1038->adc_data = adc1038->input_callback_r(device, adc1038->adr);
+
+ adc1038->data_out = (adc1038->adc_data & 0x200) ? 1 : 0;
+ adc1038->adc_data <<= 1;
+
+ adc1038->sars ^= 1;
+ return adc1038->sars;
+}
+
+
+/*****************************************************************************
+ DEVICE INTERFACE
+*****************************************************************************/
+
+static DEVICE_START( adc1038 )
+{
+ adc1038_state *adc1038 = adc1038_get_safe_token(device);
+ const adc1038_interface *intf = adc1038_get_interface(device);
+
+ adc1038->gticlub_hack = intf->gticlub_hack;
+ adc1038->input_callback_r = intf->input_callback_r;
+
+ state_save_register_device_item(device, 0, adc1038->cycle);
+ state_save_register_device_item(device, 0, adc1038->clk);
+ state_save_register_device_item(device, 0, adc1038->adr);
+ state_save_register_device_item(device, 0, adc1038->data_in);
+ state_save_register_device_item(device, 0, adc1038->data_out);
+ state_save_register_device_item(device, 0, adc1038->adc_data);
+ state_save_register_device_item(device, 0, adc1038->sars);
+}
+
+static DEVICE_RESET( adc1038 )
+{
+ adc1038_state *adc1038 = adc1038_get_safe_token(device);
+
+ adc1038->cycle = 0;
+ adc1038->clk = 0;
+ adc1038->adr = 0;
+ adc1038->data_in = 0;
+ adc1038->data_out = 0;
+ adc1038->adc_data = 0;
+ adc1038->sars = 1;
+}
+
+/*-------------------------------------------------
+ device definition
+-------------------------------------------------*/
+
+static const char DEVTEMPLATE_SOURCE[] = __FILE__;
+
+#define DEVTEMPLATE_ID( p, s ) p##adc1038##s
+#define DEVTEMPLATE_FEATURES DT_HAS_START | DT_HAS_RESET
+#define DEVTEMPLATE_NAME "A/D Converters 1038"
+#define DEVTEMPLATE_FAMILY "National Semiconductor A/D Converters 1038"
+#define DEVTEMPLATE_CLASS DEVICE_CLASS_PERIPHERAL
+#include "devtempl.h"
diff --git a/src/emu/machine/adc1038.h b/src/emu/machine/adc1038.h
new file mode 100644
index 00000000000..ca5cf6a85cf
--- /dev/null
+++ b/src/emu/machine/adc1038.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+
+ National Semiconductor ADC1038
+
+ 10-Bit Serial I/O A/D Converters with Analog Multiplexer and
+ Track/hold Function
+
+***************************************************************************/
+
+#ifndef __ADC1038_H__
+#define __ADC1038_H__
+
+#include "devcb.h"
+
+/***************************************************************************
+ TYPE DEFINITIONS
+***************************************************************************/
+
+typedef int (*adc1038_input_read_func)(const device_config *device, int input);
+
+typedef struct _adc1038_interface adc1038_interface;
+struct _adc1038_interface
+{
+ int gticlub_hack;
+ adc1038_input_read_func input_callback_r;
+};
+
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+DEVICE_GET_INFO( adc1038 );
+
+
+/***************************************************************************
+ MACROS / CONSTANTS
+***************************************************************************/
+
+#define ADC1038 DEVICE_GET_INFO_NAME( adc1038 )
+
+#define MDRV_ADC1038_ADD(_tag, _config) \
+ MDRV_DEVICE_ADD(_tag, ADC1038, 0) \
+ MDRV_DEVICE_CONFIG(_config)
+
+
+/***************************************************************************
+ DEVICE I/O FUNCTIONS
+***************************************************************************/
+
+extern READ_LINE_DEVICE_HANDLER( adc1038_do_read );
+extern READ_LINE_DEVICE_HANDLER( adc1038_sars_read );
+extern WRITE_LINE_DEVICE_HANDLER( adc1038_di_write );
+extern WRITE_LINE_DEVICE_HANDLER( adc1038_clk_write );
+
+#endif /* __ADC1038_H__ */
diff --git a/src/emu/machine/k033906.c b/src/emu/machine/k033906.c
new file mode 100644
index 00000000000..3ea9739e3b4
--- /dev/null
+++ b/src/emu/machine/k033906.c
@@ -0,0 +1,171 @@
+/***************************************************************************
+
+ Konami IC 033906 (PCI bridge)
+
+***************************************************************************/
+
+#include "driver.h"
+#include "k033906.h"
+#include "video/voodoo.h"
+
+/***************************************************************************
+ TYPE DEFINITIONS
+***************************************************************************/
+
+typedef struct _k033906_state k033906_state;
+struct _k033906_state
+{
+ UINT32 * reg;
+ UINT32 * ram;
+
+ int reg_set; // 1 = access reg / 0 = access ram
+
+ const device_config *voodoo;
+};
+
+/*****************************************************************************
+ INLINE FUNCTIONS
+*****************************************************************************/
+
+INLINE k033906_state *k033906_get_safe_token( const device_config *device )
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == K033906);
+
+ return (k033906_state *)device->token;
+}
+
+INLINE const k033906_interface *k033906_get_interface( const device_config *device )
+{
+ assert(device != NULL);
+ assert((device->type == K033906));
+ return (const k033906_interface *) device->static_config;
+}
+
+/*****************************************************************************
+ DEVICE HANDLERS
+*****************************************************************************/
+
+void k033906_set_reg( const device_config *device, int state )
+{
+ k033906_state *k033906 = k033906_get_safe_token(device);
+ k033906->reg_set = state;
+}
+
+static UINT32 k033906_reg_r( const device_config *device, int reg )
+{
+ k033906_state *k033906 = k033906_get_safe_token(device);
+
+ switch (reg)
+ {
+ case 0x00: return 0x0001121a; // PCI Vendor ID (0x121a = 3dfx), Device ID (0x0001 = Voodoo)
+ case 0x02: return 0x04000000; // Revision ID
+ case 0x04: return k033906->reg[0x04]; // memBaseAddr
+ case 0x0f: return k033906->reg[0x0f]; // interrupt_line, interrupt_pin, min_gnt, max_lat
+
+ default:
+ fatalerror("%s: k033906_reg_r: %08X", cpuexec_describe_context(device->machine), reg);
+ }
+ return 0;
+}
+
+static void k033906_reg_w( const device_config *device, int reg, UINT32 data )
+{
+ k033906_state *k033906 = k033906_get_safe_token(device);
+
+ switch (reg)
+ {
+ case 0x00:
+ break;
+
+ case 0x01: // command register
+ break;
+
+ case 0x04: // memBaseAddr
+ {
+ if (data == 0xffffffff)
+ k033906->reg[0x04] = 0xff000000;
+ else
+ k033906->reg[0x04] = data & 0xff000000;
+ break;
+ }
+
+ case 0x0f: // interrupt_line, interrupt_pin, min_gnt, max_lat
+ {
+ k033906->reg[0x0f] = data;
+ break;
+ }
+
+ case 0x10: // initEnable
+ {
+ voodoo_set_init_enable(k033906->voodoo, data);
+ break;
+ }
+
+ case 0x11: // busSnoop0
+ case 0x12: // busSnoop1
+ break;
+
+ case 0x38: // ???
+ break;
+
+ default:
+ fatalerror("%s:K033906_w: %08X, %08X", cpuexec_describe_context(device->machine), data, reg);
+ }
+}
+
+READ32_DEVICE_HANDLER( k033906_r )
+{
+ k033906_state *k033906 = k033906_get_safe_token(device);
+
+ if (k033906->reg_set)
+ return k033906_reg_r(device, offset);
+ else
+ return k033906->ram[offset];
+}
+
+WRITE32_DEVICE_HANDLER( k033906_w )
+{
+ k033906_state *k033906 = k033906_get_safe_token(device);
+
+ if (k033906->reg_set)
+ k033906_reg_w(device, offset, data);
+ else
+ k033906->ram[offset] = data;
+}
+
+
+/*****************************************************************************
+ DEVICE INTERFACE
+*****************************************************************************/
+
+static DEVICE_START( k033906 )
+{
+ k033906_state *k033906 = k033906_get_safe_token(device);
+ const k033906_interface *intf = k033906_get_interface(device);
+
+ k033906->voodoo = devtag_get_device(device->machine, intf->voodoo);
+
+ k033906->reg = auto_alloc_array(device->machine, UINT32, 256);
+ k033906->ram = auto_alloc_array(device->machine, UINT32, 32768);
+
+ k033906->reg_set = 0;
+
+ state_save_register_device_item_pointer(device, 0, k033906->reg, 256);
+ state_save_register_device_item_pointer(device, 0, k033906->ram, 32768);
+ state_save_register_device_item(device, 0, k033906->reg_set);
+}
+
+/*-------------------------------------------------
+ device definition
+-------------------------------------------------*/
+
+static const char DEVTEMPLATE_SOURCE[] = __FILE__;
+
+#define DEVTEMPLATE_ID( p, s ) p##k033906##s
+#define DEVTEMPLATE_FEATURES DT_HAS_START
+#define DEVTEMPLATE_NAME "Konami 033906"
+#define DEVTEMPLATE_FAMILY "Konami PCI Bridge 033906"
+#define DEVTEMPLATE_CLASS DEVICE_CLASS_PERIPHERAL
+#include "devtempl.h"
diff --git a/src/emu/machine/k033906.h b/src/emu/machine/k033906.h
new file mode 100644
index 00000000000..3627b4bd536
--- /dev/null
+++ b/src/emu/machine/k033906.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+
+ Konami 033906
+
+***************************************************************************/
+
+#ifndef __K033906_H__
+#define __K033906_H__
+
+#include "devcb.h"
+
+/***************************************************************************
+ TYPE DEFINITIONS
+***************************************************************************/
+
+typedef struct _k033906_interface k033906_interface;
+struct _k033906_interface
+{
+ const char *voodoo;
+};
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+DEVICE_GET_INFO( k033906 );
+
+
+/***************************************************************************
+ MACROS / CONSTANTS
+***************************************************************************/
+
+#define K033906 DEVICE_GET_INFO_NAME( k033906 )
+
+#define MDRV_K033906_ADD(_tag, _config) \
+ MDRV_DEVICE_ADD(_tag, K033906, 0) \
+ MDRV_DEVICE_CONFIG(_config)
+
+
+/***************************************************************************
+ DEVICE I/O FUNCTIONS
+***************************************************************************/
+
+extern READ32_DEVICE_HANDLER( k033906_r );
+extern WRITE32_DEVICE_HANDLER( k033906_w );
+extern void k033906_set_reg( const device_config *device, int state );
+
+
+#endif /* __K033906_H__ */
diff --git a/src/emu/machine/k056230.c b/src/emu/machine/k056230.c
new file mode 100644
index 00000000000..fe55c4bbeab
--- /dev/null
+++ b/src/emu/machine/k056230.c
@@ -0,0 +1,145 @@
+/***************************************************************************
+
+ Konami IC 056230 (LANC)
+
+***************************************************************************/
+
+#include "driver.h"
+#include "k056230.h"
+
+/***************************************************************************
+ TYPE DEFINITIONS
+***************************************************************************/
+
+typedef struct _k056230_state k056230_state;
+struct _k056230_state
+{
+ UINT32 * ram;
+ int is_thunderh;
+
+ const device_config *cpu;
+};
+
+/*****************************************************************************
+ INLINE FUNCTIONS
+*****************************************************************************/
+
+INLINE k056230_state *k056230_get_safe_token( const device_config *device )
+{
+ assert(device != NULL);
+ assert(device->token != NULL);
+ assert(device->type == K056230);
+
+ return (k056230_state *)device->token;
+}
+
+INLINE const k056230_interface *k056230_get_interface( const device_config *device )
+{
+ assert(device != NULL);
+ assert((device->type == K056230));
+ return (const k056230_interface *) device->static_config;
+}
+
+/*****************************************************************************
+ DEVICE HANDLERS
+*****************************************************************************/
+
+READ8_DEVICE_HANDLER( k056230_r )
+{
+ switch (offset)
+ {
+ case 0: // Status register
+ {
+ return 0x08;
+ }
+ }
+
+// mame_printf_debug("k056230_r: %d at %08X\n", offset, cpu_get_pc(space->cpu));
+
+ return 0;
+}
+
+static TIMER_CALLBACK( network_irq_clear )
+{
+ k056230_state *k056230 = (k056230_state *)ptr;
+ cpu_set_input_line(k056230->cpu, INPUT_LINE_IRQ2, CLEAR_LINE);
+}
+
+WRITE8_DEVICE_HANDLER( k056230_w )
+{
+ k056230_state *k056230 = k056230_get_safe_token(device);
+
+ switch (offset)
+ {
+ case 0: // Mode register
+ {
+ break;
+ }
+ case 1: // Control register
+ {
+ if (data & 0x20)
+ {
+ // Thunder Hurricane breaks otherwise...
+ if (!k056230->is_thunderh)
+ {
+ cpu_set_input_line(k056230->cpu, INPUT_LINE_IRQ2, ASSERT_LINE);
+ timer_set(device->machine, ATTOTIME_IN_USEC(10), k056230, 0, network_irq_clear);
+ }
+ }
+// else
+// cpu_set_input_line(k056230->cpu, INPUT_LINE_IRQ2, CLEAR_LINE);
+ break;
+ }
+ case 2: // Sub ID register
+ {
+ break;
+ }
+ }
+// mame_printf_debug("k056230_w: %d, %02X at %08X\n", offset, data, cpu_get_pc(space->cpu));
+}
+
+READ32_DEVICE_HANDLER( lanc_ram_r )
+{
+ k056230_state *k056230 = k056230_get_safe_token(device);
+
+ //mame_printf_debug("LANC_RAM_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(space->cpu));
+ return k056230->ram[offset & 0x7ff];
+}
+
+WRITE32_DEVICE_HANDLER( lanc_ram_w )
+{
+ k056230_state *k056230 = k056230_get_safe_token(device);
+
+ //mame_printf_debug("LANC_RAM_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(space->cpu));
+ COMBINE_DATA(k056230->ram + (offset & 0x7ff));
+}
+
+/*****************************************************************************
+ DEVICE INTERFACE
+*****************************************************************************/
+
+static DEVICE_START( k056230 )
+{
+ k056230_state *k056230 = k056230_get_safe_token(device);
+ const k056230_interface *intf = k056230_get_interface(device);
+
+ k056230->cpu = devtag_get_device(device->machine, intf->cpu);
+ k056230->is_thunderh = intf->is_thunderh;
+
+ k056230->ram = auto_alloc_array(device->machine, UINT32, 0x2000);
+
+ state_save_register_device_item_pointer(device, 0, k056230->ram, 0x2000);
+}
+
+/*-------------------------------------------------
+ device definition
+-------------------------------------------------*/
+
+static const char DEVTEMPLATE_SOURCE[] = __FILE__;
+
+#define DEVTEMPLATE_ID( p, s ) p##k056230##s
+#define DEVTEMPLATE_FEATURES DT_HAS_START
+#define DEVTEMPLATE_NAME "Konami 056230"
+#define DEVTEMPLATE_FAMILY "Konami Network Board 056230"
+#define DEVTEMPLATE_CLASS DEVICE_CLASS_PERIPHERAL
+#include "devtempl.h"
diff --git a/src/emu/machine/k056230.h b/src/emu/machine/k056230.h
new file mode 100644
index 00000000000..95daba0ffa0
--- /dev/null
+++ b/src/emu/machine/k056230.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+
+ Konami 056230
+
+***************************************************************************/
+
+#ifndef __K056230_H__
+#define __K056230_H__
+
+#include "devcb.h"
+
+/***************************************************************************
+ TYPE DEFINITIONS
+***************************************************************************/
+
+typedef struct _k056230_interface k056230_interface;
+struct _k056230_interface
+{
+ const char *cpu;
+ int is_thunderh;
+};
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+DEVICE_GET_INFO( k056230 );
+
+
+/***************************************************************************
+ MACROS / CONSTANTS
+***************************************************************************/
+
+#define K056230 DEVICE_GET_INFO_NAME( k056230 )
+
+#define MDRV_K056230_ADD(_tag, _config) \
+ MDRV_DEVICE_ADD(_tag, K056230, 0) \
+ MDRV_DEVICE_CONFIG(_config)
+
+
+/***************************************************************************
+ DEVICE I/O FUNCTIONS
+***************************************************************************/
+
+extern READ32_DEVICE_HANDLER( lanc_ram_r );
+extern WRITE32_DEVICE_HANDLER( lanc_ram_w );
+extern READ8_DEVICE_HANDLER( k056230_r );
+extern WRITE8_DEVICE_HANDLER( k056230_w );
+
+
+#endif /* __K056230_H__ */
diff --git a/src/mame/drivers/gticlub.c b/src/mame/drivers/gticlub.c
index 956356655fa..e2a90f2f088 100644
--- a/src/mame/drivers/gticlub.c
+++ b/src/mame/drivers/gticlub.c
@@ -224,6 +224,9 @@ Hang Pilot (uses an unknown but similar video board) 12W
#include "cpu/powerpc/ppc.h"
#include "cpu/sharc/sharc.h"
#include "machine/konppc.h"
+#include "machine/adc1038.h"
+#include "machine/k056230.h"
+#include "machine/k033906.h"
#include "sound/rf5c400.h"
#include "video/voodoo.h"
#include "video/gticlub.h"
@@ -352,115 +355,10 @@ static void eeprom_handler(running_machine *machine, mame_file *file, int read_o
}
}
-static int adc1038_cycle;
-static int adc1038_clk;
-static int adc1038_adr;
-static int adc1038_data_in;
-static int adc1038_data_out;
-static int adc1038_adc_data;
-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)
-{
- //printf("ADC DO\n");
- return adc1038_data_out & 1;
-}
-
-static void adc1038_di_w(int bit)
-{
- adc1038_data_in = bit & 1;
-}
-
-static void adc1038_clk_w(running_machine *machine, int bit)
-{
- // GTI Club doesn't sync on SARS
- if (adc1038_gticlub_hack)
- {
- if (adc1038_clk == 0 && bit == 0)
- {
- adc1038_cycle = 0;
-
- switch (adc1038_adr)
- {
- case 0: adc1038_adc_data = input_port_read(machine, "AN0"); break;
- case 1: adc1038_adc_data = input_port_read(machine, "AN1"); break;
- case 2: adc1038_adc_data = input_port_read(machine, "AN2"); break;
- case 3: adc1038_adc_data = input_port_read(machine, "AN3"); break;
- case 4: adc1038_adc_data = 0x000; break;
- case 5: adc1038_adc_data = 0x000; break;
- case 6: adc1038_adc_data = 0x000; break;
- case 7: adc1038_adc_data = 0x000; break;
- }
- }
- }
-
- if (bit == 1)
- {
- //printf("ADC CLK, DI = %d, cycle = %d\n", adc1038_data_in, adc1038_cycle);
-
- if (adc1038_cycle == 0) // A2
- {
- adc1038_adr = 0;
- adc1038_adr |= (adc1038_data_in << 2);
- }
- else if (adc1038_cycle == 1) // A1
- {
- adc1038_adr |= (adc1038_data_in << 1);
- }
- else if (adc1038_cycle == 2) // A0
- {
- adc1038_adr |= (adc1038_data_in << 0);
- }
-
- adc1038_data_out = (adc1038_adc_data & 0x200) ? 1 : 0;
- adc1038_adc_data <<= 1;
-
- adc1038_cycle++;
- }
-
- adc1038_clk = bit;
-}
-
-static int adc1038_sars_r(running_machine *machine)
-{
- adc1038_cycle = 0;
-
- switch (adc1038_adr)
- {
- case 0: adc1038_adc_data = input_port_read(machine, "AN0"); break;
- case 1: adc1038_adc_data = input_port_read(machine, "AN1"); break;
- case 2: adc1038_adc_data = input_port_read(machine, "AN2"); break;
- case 3: adc1038_adc_data = input_port_read(machine, "AN3"); break;
- case 4: adc1038_adc_data = 0x000; break;
- case 5: adc1038_adc_data = 0x000; break;
- case 6: adc1038_adc_data = 0x000; break;
- case 7: adc1038_adc_data = 0x000; break;
- }
-
- adc1038_data_out = (adc1038_adc_data & 0x200) ? 1 : 0;
- adc1038_adc_data <<= 1;
-
- adc1038_sars ^= 1;
- return adc1038_sars;
-}
-
static READ8_HANDLER( sysreg_r )
{
static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" };
+ const device_config *adc1038 = devtag_get_device(space->machine, "adc1038");
switch (offset)
{
@@ -470,7 +368,7 @@ static READ8_HANDLER( sysreg_r )
return input_port_read(space->machine, portnames[offset]);
case 2:
- return adc1038_sars_r(space->machine) << 7;
+ return adc1038_sars_read(adc1038) << 7;
case 4:
{
@@ -481,7 +379,7 @@ static READ8_HANDLER( sysreg_r )
// e = EEPROM data out
UINT32 eeprom_bit = (eeprom_read_bit() << 1);
- UINT32 adc_bit = (adc1038_do_r() << 2);
+ UINT32 adc_bit = (adc1038_do_read(adc1038) << 2);
return (eeprom_bit | adc_bit);
}
@@ -494,6 +392,8 @@ static READ8_HANDLER( sysreg_r )
static WRITE8_HANDLER( sysreg_w )
{
+ const device_config *adc1038 = devtag_get_device(space->machine, "adc1038");
+
switch (offset)
{
case 0:
@@ -517,79 +417,14 @@ static WRITE8_HANDLER( sysreg_w )
if (data & 0x40) /* CG Board 0 IRQ Ack */
cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_IRQ0, CLEAR_LINE);
- adc1038_di_w((data >> 0) & 1);
- adc1038_clk_w(space->machine, (data >> 1) & 1);
+ adc1038_di_write(adc1038, (data >> 0) & 1);
+ adc1038_clk_write(adc1038, (data >> 1) & 1);
set_cgboard_id((data >> 4) & 0x3);
break;
}
}
-/* Konami K056230 (LANC) */
-READ8_HANDLER( K056230_r )
-{
- switch (offset)
- {
- case 0: // Status register
- {
- return 0x08;
- }
- }
-
-// mame_printf_debug("K056230_r: %d at %08X\n", offset, cpu_get_pc(space->cpu));
-
- return 0;
-}
-
-static TIMER_CALLBACK( network_irq_clear )
-{
- cputag_set_input_line(machine, "maincpu", INPUT_LINE_IRQ2, CLEAR_LINE);
-}
-
-WRITE8_HANDLER( K056230_w )
-{
- switch (offset)
- {
- case 0: // Mode register
- {
- break;
- }
- case 1: // Control register
- {
- if (data & 0x20)
- {
- // Thunder Hurricane breaks otherwise...
- if (mame_stricmp(space->machine->gamedrv->name, "thunderh") != 0)
- {
- cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_IRQ2, ASSERT_LINE);
- timer_set(space->machine, ATTOTIME_IN_USEC(10), NULL, 0, network_irq_clear);
- }
- }
-// else
-// cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_IRQ2, CLEAR_LINE);
- break;
- }
- case 2: // Sub ID register
- {
- break;
- }
- }
-// mame_printf_debug("K056230_w: %d, %02X at %08X\n", offset, data, cpu_get_pc(space->cpu));
-}
-
-UINT32 *lanc_ram;
-READ32_HANDLER( lanc_ram_r )
-{
-// mame_printf_debug("LANC_RAM_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(space->cpu));
- return lanc_ram[offset & 0x7ff];
-}
-
-WRITE32_HANDLER( lanc_ram_w )
-{
-// mame_printf_debug("LANC_RAM_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(space->cpu));
- COMBINE_DATA(lanc_ram + (offset & 0x7ff));
-}
-
/******************************************************************/
static MACHINE_START( gticlub )
@@ -612,8 +447,8 @@ static ADDRESS_MAP_START( gticlub_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x78080000, 0x7808000f) AM_READWRITE(K001006_1_r, K001006_1_w)
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_BASE(&lanc_ram)
+ AM_RANGE(0x7e008000, 0x7e009fff) AM_DEVREADWRITE8("k056230", k056230_r, k056230_w, 0xffffffff)
+ AM_RANGE(0x7e00a000, 0x7e00bfff) AM_DEVREADWRITE("k056230", lanc_ram_r, lanc_ram_w)
AM_RANGE(0x7e00c000, 0x7e00c007) AM_DEVWRITE("k056800", k056800_host_w)
AM_RANGE(0x7e00c000, 0x7e00c007) AM_DEVREAD("k056800", k056800_host_r) // Hang Pilot
AM_RANGE(0x7e00c008, 0x7e00c00f) AM_DEVREAD("k056800", k056800_host_r)
@@ -911,11 +746,55 @@ static void sound_irq_callback( running_machine *machine, int irq )
timer_set(machine, ATTOTIME_IN_USEC(1), NULL, line, irq_off);
}
-static const k056800_interface gticlub_k056800_interface =
+static const k056800_interface gticlub_k056800_interface =
{
sound_irq_callback
};
+
+static int adc1038_input_callback( const device_config *device, int input )
+{
+ int value = 0;
+ switch (input)
+ {
+ case 0: value = input_port_read(device->machine, "AN0"); break;
+ case 1: value = input_port_read(device->machine, "AN1"); break;
+ case 2: value = input_port_read(device->machine, "AN2"); break;
+ case 3: value = input_port_read(device->machine, "AN3"); break;
+ case 4: value = 0x000; break;
+ case 5: value = 0x000; break;
+ case 6: value = 0x000; break;
+ case 7: value = 0x000; break;
+ }
+
+ return value;
+}
+
+static const adc1038_interface gticlub_adc1038_intf =
+{
+ 1,
+ adc1038_input_callback
+};
+
+static const adc1038_interface thunderh_adc1038_intf =
+{
+ 0,
+ adc1038_input_callback
+};
+
+static const k056230_interface gticlub_k056230_intf =
+{
+ "maincpu",
+ 0
+};
+
+static const k056230_interface thunderh_k056230_intf =
+{
+ "maincpu",
+ 1
+};
+
+
static MACHINE_RESET( gticlub )
{
cputag_set_input_line(machine, "dsp", INPUT_LINE_RESET, ASSERT_LINE);
@@ -941,6 +820,10 @@ static MACHINE_DRIVER_START( gticlub )
MDRV_MACHINE_START(gticlub)
MDRV_MACHINE_RESET(gticlub)
+ MDRV_ADC1038_ADD("adc1038", gticlub_adc1038_intf)
+
+ MDRV_K056230_ADD("k056230", gticlub_k056230_intf)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@@ -962,6 +845,36 @@ static MACHINE_DRIVER_START( gticlub )
MDRV_SOUND_ROUTE(1, "rspeaker", 1.0)
MACHINE_DRIVER_END
+static MACHINE_DRIVER_START( thunderh )
+
+ MDRV_IMPORT_FROM(gticlub)
+
+ MDRV_DEVICE_REMOVE("adc1038")
+ MDRV_ADC1038_ADD("adc1038", thunderh_adc1038_intf)
+
+ MDRV_DEVICE_REMOVE("k056230")
+ MDRV_K056230_ADD("k056230", thunderh_k056230_intf)
+MACHINE_DRIVER_END
+
+static MACHINE_DRIVER_START( slrasslt )
+
+ MDRV_IMPORT_FROM(gticlub)
+
+ MDRV_DEVICE_REMOVE("adc1038")
+ MDRV_ADC1038_ADD("adc1038", thunderh_adc1038_intf)
+MACHINE_DRIVER_END
+
+
+static const k033906_interface hangplt_k033906_intf_0 =
+{
+ "voodoo0"
+};
+
+static const k033906_interface hangplt_k033906_intf_1 =
+{
+ "voodoo1"
+};
+
static MACHINE_RESET( hangplt )
{
cputag_set_input_line(machine, "dsp", INPUT_LINE_RESET, ASSERT_LINE);
@@ -991,6 +904,9 @@ static MACHINE_DRIVER_START( hangplt )
MDRV_MACHINE_START(gticlub)
MDRV_MACHINE_RESET(hangplt)
+ MDRV_ADC1038_ADD("adc1038", thunderh_adc1038_intf)
+ MDRV_K056230_ADD("k056230", gticlub_k056230_intf)
+
MDRV_3DFX_VOODOO_1_ADD("voodoo0", STD_VOODOO_1_CLOCK, 2, "lscreen")
MDRV_3DFX_VOODOO_CPU("dsp")
MDRV_3DFX_VOODOO_TMU_MEMORY(0, 2)
@@ -1003,6 +919,9 @@ static MACHINE_DRIVER_START( hangplt )
MDRV_3DFX_VOODOO_TMU_MEMORY(1, 2)
MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_1)
+ MDRV_K033906_ADD("k033906_1", hangplt_k033906_intf_0)
+ MDRV_K033906_ADD("k033906_2", hangplt_k033906_intf_1)
+
/* video hardware */
MDRV_PALETTE_LENGTH(65536)
@@ -1231,8 +1150,6 @@ static DRIVER_INIT(gticlub)
gticlub_led_reg0 = gticlub_led_reg1 = 0x7f;
K001005_preprocess_texture_data(memory_region(machine, "gfx1"), memory_region_length(machine, "gfx1"), 1);
-
- adc1038_init(machine);
}
static DRIVER_INIT(hangplt)
@@ -1244,18 +1161,14 @@ static DRIVER_INIT(hangplt)
sharc_dataram_0 = auto_alloc_array(machine, UINT32, 0x100000/4);
sharc_dataram_1 = auto_alloc_array(machine, UINT32, 0x100000/4);
gticlub_led_reg0 = gticlub_led_reg1 = 0x7f;
-
- K033906_init(machine);
-
- adc1038_init(machine);
}
/*************************************************************************/
-GAME( 1996, gticlub, 0, gticlub, gticlub, gticlub, ROT0, "Konami", "GTI Club (ver EAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
-GAME( 1996, gticluba, gticlub, gticlub, gticlub, gticlub, ROT0, "Konami", "GTI Club (ver AAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
-GAME( 1996, gticlubj, gticlub, gticlub, gticlub, gticlub, ROT0, "Konami", "GTI Club (ver JAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
-GAME( 1996, thunderh, 0, gticlub, thunderh, gticlub, ROT0, "Konami", "Operation Thunder Hurricane (ver EAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
-GAME( 1996, thunderhu,thunderh, gticlub, thunderh, gticlub, ROT0, "Konami", "Operation Thunder Hurricane (ver UAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
-GAME( 1997, slrasslt, 0, gticlub, slrasslt, gticlub, ROT0, "Konami", "Solar Assault (ver UAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
-GAMEL( 1997, hangplt, 0, hangplt, hangplt, hangplt, ROT0, "Konami", "Hang Pilot", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND, layout_dualhovu )
+GAME( 1996, gticlub, 0, gticlub, gticlub, gticlub, ROT0, "Konami", "GTI Club (ver EAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
+GAME( 1996, gticluba, gticlub, gticlub, gticlub, gticlub, ROT0, "Konami", "GTI Club (ver AAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
+GAME( 1996, gticlubj, gticlub, gticlub, gticlub, gticlub, ROT0, "Konami", "GTI Club (ver JAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
+GAME( 1996, thunderh, 0, thunderh, thunderh, gticlub, ROT0, "Konami", "Operation Thunder Hurricane (ver EAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
+GAME( 1996, thunderhu,thunderh, thunderh, thunderh, gticlub, ROT0, "Konami", "Operation Thunder Hurricane (ver UAA)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
+GAME( 1997, slrasslt, 0, slrasslt, slrasslt, gticlub, ROT0, "Konami", "Solar Assault (ver UAA)", GAME_NOT_WORKING | GAME_IMPERFECT_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 e6373c4ac20..9bfe4ec90e3 100644
--- a/src/mame/drivers/hornet.c
+++ b/src/mame/drivers/hornet.c
@@ -319,6 +319,7 @@
#include "rendlay.h"
#include "machine/adc1213x.h"
#include "sound/k056800.h"
+#include "machine/k033906.h"
static UINT8 led_reg0, led_reg1;
static UINT32 *workram;
@@ -1100,6 +1101,16 @@ static const k056800_interface hornet_k056800_interface =
sound_irq_callback
};
+static const k033906_interface hornet_k033906_intf_0 =
+{
+ "voodoo0"
+};
+
+static const k033906_interface hornet_k033906_intf_1 =
+{
+ "voodoo1"
+};
+
static MACHINE_DRIVER_START( hornet )
/* basic machine hardware */
@@ -1125,6 +1136,8 @@ static MACHINE_DRIVER_START( hornet )
MDRV_3DFX_VOODOO_TMU_MEMORY(0, 4)
MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_0)
+ MDRV_K033906_ADD("k033906_1", hornet_k033906_intf_0)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@@ -1192,6 +1205,8 @@ static MACHINE_DRIVER_START( hornet_2board )
MDRV_3DFX_VOODOO_TMU_MEMORY(0, 4)
MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_1)
+ MDRV_K033906_ADD("k033906_2", hornet_k033906_intf_1)
+
/* video hardware */
MDRV_PALETTE_LENGTH(65536)
@@ -1382,8 +1397,6 @@ static DRIVER_INIT(hornet)
init_konami_cgboard(machine, 1, CGBOARD_TYPE_HORNET);
set_cgboard_texture_bank(machine, 0, "bank5", memory_region(machine, "user5"));
- K033906_init(machine);
-
led_reg0 = led_reg1 = 0x7f;
ppc4xx_spu_set_tx_handler(cputag_get_cpu(machine, "maincpu"), jamma_jvs_w);
@@ -1395,8 +1408,6 @@ static DRIVER_INIT(hornet_2board)
set_cgboard_texture_bank(machine, 0, "bank5", memory_region(machine, "user5"));
set_cgboard_texture_bank(machine, 1, "bank6", memory_region(machine, "user5"));
- K033906_init(machine);
-
led_reg0 = led_reg1 = 0x7f;
ppc4xx_spu_set_tx_handler(cputag_get_cpu(machine, "maincpu"), jamma_jvs_w);
diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c
index a2d9e0c58e7..3365908c151 100644
--- a/src/mame/drivers/nwk-tr.c
+++ b/src/mame/drivers/nwk-tr.c
@@ -222,6 +222,7 @@ Thrill Drive 713A13 - 713A14 -
#include "video/voodoo.h"
#include "machine/timekpr.h"
#include "sound/k056800.h"
+#include "machine/k033906.h"
static UINT8 led_reg0, led_reg1;
@@ -1042,6 +1043,11 @@ static const k056800_interface nwktr_k056800_interface =
sound_irq_callback
};
+static const k033906_interface nwktr_k033906_interface =
+{
+ "voodoo"
+};
+
static MACHINE_RESET( nwktr )
{
cputag_set_input_line(machine, "dsp", INPUT_LINE_RESET, ASSERT_LINE);
@@ -1071,6 +1077,8 @@ static MACHINE_DRIVER_START( nwktr )
MDRV_3DFX_VOODOO_TMU_MEMORY(1, 2)
MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_0)
+ MDRV_K033906_ADD("k033906_1", nwktr_k033906_interface)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@@ -1106,8 +1114,6 @@ static DRIVER_INIT(nwktr)
sharc_dataram = auto_alloc_array(machine, UINT32, 0x100000/4);
led_reg0 = led_reg1 = 0x7f;
- K033906_init(machine);
-
lanc2_init(machine);
}
diff --git a/src/mame/drivers/zr107.c b/src/mame/drivers/zr107.c
index 1606199d22b..ed1ecd4e2d4 100644
--- a/src/mame/drivers/zr107.c
+++ b/src/mame/drivers/zr107.c
@@ -170,6 +170,7 @@ Check gticlub.c for details on the bottom board.
#include "sound/k054539.h"
#include "machine/konppc.h"
#include "machine/adc083x.h"
+#include "machine/k056230.h"
#include "machine/eepromdev.h"
#include "video/konicdev.h"
#include "video/gticlub.h"
@@ -178,13 +179,6 @@ Check gticlub.c for details on the bottom board.
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);
-
// defined in drivers/nwk-tr.c
int K001604_vh_start(running_machine *machine, int chip);
@@ -416,8 +410,8 @@ static ADDRESS_MAP_START( zr107_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x78040000, 0x7804000f) AM_READWRITE(K001006_0_r, K001006_0_w)
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) AM_BASE(&lanc_ram) /* LANC Buffer RAM (27E) */
+ AM_RANGE(0x7e008000, 0x7e009fff) AM_DEVREADWRITE8("k056230", k056230_r, k056230_w, 0xffffffff) /* LANC registers */
+ AM_RANGE(0x7e00a000, 0x7e00bfff) AM_DEVREADWRITE("k056230", lanc_ram_r, lanc_ram_w) /* LANC Buffer RAM (27E) */
AM_RANGE(0x7e00c000, 0x7e00c007) AM_DEVWRITE("k056800", k056800_host_w)
AM_RANGE(0x7e00c008, 0x7e00c00f) AM_DEVREAD("k056800", k056800_host_r)
AM_RANGE(0x7f800000, 0x7f9fffff) AM_ROM AM_SHARE("share2")
@@ -444,8 +438,8 @@ static ADDRESS_MAP_START( jetwave_map, ADDRESS_SPACE_PROGRAM, 32 )
AM_RANGE(0x78080000, 0x7808000f) AM_MIRROR(0x80000000) AM_READWRITE(K001006_1_r, K001006_1_w)
AM_RANGE(0x780c0000, 0x780c0007) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc)
AM_RANGE(0x7e000000, 0x7e003fff) AM_MIRROR(0x80000000) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
- AM_RANGE(0x7e008000, 0x7e009fff) AM_MIRROR(0x80000000) AM_READWRITE8(K056230_r, K056230_w, 0xffffffff) /* LANC registers */
- AM_RANGE(0x7e00a000, 0x7e00bfff) AM_MIRROR(0x80000000) AM_READWRITE(lanc_ram_r, lanc_ram_w) AM_BASE(&lanc_ram) /* LANC Buffer RAM (27E) */
+ AM_RANGE(0x7e008000, 0x7e009fff) AM_MIRROR(0x80000000) AM_DEVREADWRITE8("k056230", k056230_r, k056230_w, 0xffffffff) /* LANC registers */
+ AM_RANGE(0x7e00a000, 0x7e00bfff) AM_MIRROR(0x80000000) AM_DEVREADWRITE("k056230", lanc_ram_r, lanc_ram_w) /* LANC Buffer RAM (27E) */
AM_RANGE(0x7e00c000, 0x7e00c007) AM_MIRROR(0x80000000) AM_DEVWRITE("k056800", k056800_host_w)
AM_RANGE(0x7e00c008, 0x7e00c00f) AM_MIRROR(0x80000000) AM_DEVREAD("k056800", k056800_host_r)
AM_RANGE(0x7f000000, 0x7f3fffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION("user2", 0)
@@ -691,7 +685,7 @@ static void sound_irq_callback( running_machine *machine, int irq )
timer_set(machine, ATTOTIME_IN_USEC(1), NULL, line, irq_off);
}
-static const k056800_interface zr107_k056800_interface =
+static const k056800_interface zr107_k056800_interface =
{
sound_irq_callback
};
@@ -705,6 +699,12 @@ static const k056832_interface zr107_k056832_intf =
game_tile_callback, "none"
};
+static const k056230_interface zr107_k056230_intf =
+{
+ "maincpu",
+ 0
+};
+
/* PowerPC interrupts
IRQ0: Vblank
@@ -742,6 +742,8 @@ static MACHINE_DRIVER_START( zr107 )
MDRV_MACHINE_START(zr107)
MDRV_MACHINE_RESET(zr107)
+ MDRV_K056230_ADD("k056230", zr107_k056230_intf)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@@ -793,6 +795,8 @@ static MACHINE_DRIVER_START( jetwave )
MDRV_MACHINE_START(zr107)
MDRV_MACHINE_RESET(zr107)
+ MDRV_K056230_ADD("k056230", zr107_k056230_intf)
+
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
diff --git a/src/mame/machine/konppc.c b/src/mame/machine/konppc.c
index eff0ed148ee..f2a5209aeff 100644
--- a/src/mame/machine/konppc.c
+++ b/src/mame/machine/konppc.c
@@ -2,6 +2,7 @@
#include "driver.h"
#include "cpu/sharc/sharc.h"
+#include "machine/k033906.h"
#include "video/voodoo.h"
#include "konppc.h"
@@ -21,7 +22,6 @@ static UINT32 *dsp_shared_ram[MAX_CG_BOARDS];
#define DSP_BANK_SIZE_WORD (DSP_BANK_SIZE / 4)
static UINT32 dsp_state[MAX_CG_BOARDS];
-static UINT32 pci_bridge_enable[MAX_CG_BOARDS];
static UINT32 nwk_device_sel[MAX_CG_BOARDS];
static const char *texture_bank[MAX_CG_BOARDS];
@@ -53,7 +53,6 @@ void init_konami_cgboard(running_machine *machine, int num_boards, int type)
dsp_state[i] = 0x80;
texture_bank[i] = NULL;
- pci_bridge_enable[i] = 0;
nwk_device_sel[i] = 0;
nwk_fifo_read_ptr[i] = 0;
nwk_fifo_write_ptr[i] = 0;
@@ -66,7 +65,6 @@ void init_konami_cgboard(running_machine *machine, int num_boards, int type)
state_save_register_item(machine, "konppc", NULL, i, dsp_shared_ram_bank[i]);
state_save_register_item_pointer(machine, "konppc", NULL, i, dsp_shared_ram[i], DSP_BANK_SIZE * 2 / sizeof(dsp_shared_ram[i][0]));
state_save_register_item(machine, "konppc", NULL, i, dsp_state[i]);
- state_save_register_item(machine, "konppc", NULL, i, pci_bridge_enable[i]);
state_save_register_item(machine, "konppc", NULL, i, nwk_device_sel[i]);
state_save_register_item(machine, "konppc", NULL, i, nwk_fifo_read_ptr[i]);
state_save_register_item(machine, "konppc", NULL, i, nwk_fifo_write_ptr[i]);
@@ -143,6 +141,9 @@ READ32_HANDLER( cgboard_dsp_comm_r_ppc )
WRITE32_HANDLER( cgboard_dsp_comm_w_ppc )
{
const char *dsptag = (cgboard_id == 0) ? "dsp" : "dsp2";
+ const char *pcitag = (cgboard_id == 0) ? "k033906_1" : "k033906_2";
+ const device_config *dsp = devtag_get_device(space->machine, dsptag);
+ const device_config *k033906 = devtag_get_device(space->machine, pcitag);
// mame_printf_debug("dsp_cmd_w: (board %d) %08X, %08X, %08X at %08X\n", cgboard_id, data, offset, mem_mask, cpu_get_pc(space->cpu));
if (cgboard_id < MAX_CG_BOARDS)
@@ -156,18 +157,19 @@ WRITE32_HANDLER( cgboard_dsp_comm_w_ppc )
if (data & 0x80000000)
dsp_state[cgboard_id] |= 0x10;
- pci_bridge_enable[cgboard_id] = (data & 0x20000000) ? 1 : 0;
+ if (k033906 != NULL) /* zr107.c has no PCI and some games only have one PCI Bridge */
+ k033906_set_reg(k033906, (data & 0x20000000) ? 1 : 0);
if (data & 0x10000000)
- cputag_set_input_line(space->machine, dsptag, INPUT_LINE_RESET, CLEAR_LINE);
+ cpu_set_input_line(dsp, INPUT_LINE_RESET, CLEAR_LINE);
else
- cputag_set_input_line(space->machine, dsptag, INPUT_LINE_RESET, ASSERT_LINE);
+ cpu_set_input_line(dsp, INPUT_LINE_RESET, ASSERT_LINE);
if (data & 0x02000000)
- cputag_set_input_line(space->machine, dsptag, INPUT_LINE_IRQ0, ASSERT_LINE);
+ cpu_set_input_line(dsp, INPUT_LINE_IRQ0, ASSERT_LINE);
if (data & 0x04000000)
- cputag_set_input_line(space->machine, dsptag, INPUT_LINE_IRQ1, ASSERT_LINE);
+ cpu_set_input_line(dsp, INPUT_LINE_IRQ1, ASSERT_LINE);
}
if (ACCESSING_BITS_0_7)
@@ -403,148 +405,36 @@ static void nwk_fifo_w(running_machine *machine, int board, UINT32 data)
/*****************************************************************************/
-/* Konami K033906 PCI bridge */
+/* Konami K033906 PCI bridge (most emulation is now in src/emu/machine/k033906.c ) */
-#define MAX_K033906_CHIPS 2
-
-static UINT32 *K033906_reg[MAX_K033906_CHIPS];
-static UINT32 *K033906_ram[MAX_K033906_CHIPS];
-
-void K033906_init(running_machine *machine)
-{
- int i;
- for (i=0; i < MAX_K033906_CHIPS; i++)
- {
- K033906_reg[i] = auto_alloc_array(machine, UINT32, 256);
- K033906_ram[i] = auto_alloc_array(machine, UINT32, 32768);
- state_save_register_item_pointer(machine, "K033906", NULL, i, K033906_reg[i], 256);
- state_save_register_item_pointer(machine, "K033906", NULL, i, K033906_ram[i], 32768);
- }
-}
-
-static UINT32 K033906_r(const address_space *space, int chip, int reg)
-{
- switch(reg)
- {
- case 0x00: return 0x0001121a; // PCI Vendor ID (0x121a = 3dfx), Device ID (0x0001 = Voodoo)
- case 0x02: return 0x04000000; // Revision ID
- case 0x04: return K033906_reg[chip][0x04]; // memBaseAddr
- case 0x0f: return K033906_reg[chip][0x0f]; // interrupt_line, interrupt_pin, min_gnt, max_lat
-
- default:
- fatalerror("%s:K033906_r: %d, %08X", cpuexec_describe_context(space->machine), chip, reg);
- }
- return 0;
-}
-
-static void K033906_w(const address_space *space, int chip, int reg, UINT32 data)
-{
- switch(reg)
- {
- case 0x00:
- break;
-
- case 0x01: // command register
- break;
-
- case 0x04: // memBaseAddr
- {
- if (data == 0xffffffff)
- {
- K033906_reg[chip][0x04] = 0xff000000;
- }
- else
- {
- K033906_reg[chip][0x04] = data & 0xff000000;
- }
- break;
- }
-
- case 0x0f: // interrupt_line, interrupt_pin, min_gnt, max_lat
- {
- K033906_reg[chip][0x0f] = data;
- break;
- }
-
- case 0x10: // initEnable
- {
- const device_config *device = device_list_find_by_index(&space->machine->config->devicelist, VOODOO_GRAPHICS, chip);
- voodoo_set_init_enable(device, data);
- break;
- }
-
- case 0x11: // busSnoop0
- case 0x12: // busSnoop1
- break;
-
- case 0x38: // ???
- break;
-
- default:
- fatalerror("%s:K033906_w: %d, %08X, %08X", cpuexec_describe_context(space->machine), chip, data, reg);
- }
-}
-
-READ32_HANDLER(K033906_0_r)
+READ32_HANDLER( K033906_0_r )
{
+ const device_config *k033906_1 = devtag_get_device(space->machine, "k033906_1");
if (nwk_device_sel[0] & 0x01)
- {
return nwk_fifo_r(space, 0);
- }
else
- {
- if (pci_bridge_enable[0])
- {
- return K033906_r(space, 0, offset);
- }
- else
- {
- return K033906_ram[0][offset];
- }
- }
+ return k033906_r(k033906_1, offset, mem_mask);
}
-WRITE32_HANDLER(K033906_0_w)
+WRITE32_HANDLER( K033906_0_w )
{
- if (pci_bridge_enable[0])
- {
- K033906_w(space, 0, offset, data);
- }
- else
- {
- K033906_ram[0][offset] = data;
- }
+ const device_config *k033906_1 = devtag_get_device(space->machine, "k033906_1");
+ k033906_w(k033906_1, offset, data, mem_mask);
}
-READ32_HANDLER(K033906_1_r)
+READ32_HANDLER( K033906_1_r )
{
+ const device_config *k033906_2 = devtag_get_device(space->machine, "k033906_2");
if (nwk_device_sel[1] & 0x01)
- {
return nwk_fifo_r(space, 1);
- }
else
- {
- if (pci_bridge_enable[1])
- {
- return K033906_r(space, 1, offset);
- }
- else
- {
- return K033906_ram[1][offset];
- }
- }
+ return k033906_r(k033906_2, offset, mem_mask);
}
WRITE32_HANDLER(K033906_1_w)
{
- if (pci_bridge_enable[1])
- {
- K033906_w(space, 1, offset, data);
- }
- else
- {
- K033906_ram[1][offset] = data;
- }
+ const device_config *k033906_2 = devtag_get_device(space->machine, "k033906_2");
+ k033906_w(k033906_2, offset, data, mem_mask);
}
/*****************************************************************************/
diff --git a/src/mame/machine/konppc.h b/src/mame/machine/konppc.h
index 9518658b33b..5e691f101b7 100644
--- a/src/mame/machine/konppc.h
+++ b/src/mame/machine/konppc.h
@@ -26,7 +26,6 @@ WRITE32_HANDLER( cgboard_1_comm_sharc_w );
READ32_HANDLER( cgboard_1_shared_sharc_r );
WRITE32_HANDLER( cgboard_1_shared_sharc_w );
-void K033906_init(running_machine *machine);
READ32_HANDLER(K033906_0_r);
WRITE32_HANDLER(K033906_0_w);
READ32_HANDLER(K033906_1_r);