mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
Moved tms6100 code into emu/machine/tms6100.[ch]. Added pinouts for TMS6100 and M58819. [Couriersud]
This commit is contained in:
parent
28f8e3643c
commit
690f98e05b
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -744,6 +744,8 @@ src/emu/machine/timekpr.c svneol=native#text/plain
|
||||
src/emu/machine/timekpr.h svneol=native#text/plain
|
||||
src/emu/machine/tmp68301.c svneol=native#text/plain
|
||||
src/emu/machine/tmp68301.h svneol=native#text/plain
|
||||
src/emu/machine/tms6100.c svneol=native#text/plain
|
||||
src/emu/machine/tms6100.h svneol=native#text/plain
|
||||
src/emu/machine/upd4701.c svneol=native#text/plain
|
||||
src/emu/machine/upd4701.h svneol=native#text/plain
|
||||
src/emu/machine/wd33c93.c svneol=native#text/plain
|
||||
|
@ -173,6 +173,7 @@ EMUMACHINEOBJS = \
|
||||
$(EMUMACHINE)/smc91c9x.o \
|
||||
$(EMUMACHINE)/timekpr.o \
|
||||
$(EMUMACHINE)/tmp68301.o \
|
||||
$(EMUMACHINE)/tms6100.o \
|
||||
$(EMUMACHINE)/upd4701.o \
|
||||
$(EMUMACHINE)/wd33c93.o \
|
||||
$(EMUMACHINE)/x2212.o \
|
||||
|
269
src/emu/machine/tms6100.c
Normal file
269
src/emu/machine/tms6100.c
Normal file
@ -0,0 +1,269 @@
|
||||
/**********************************************************************************************
|
||||
|
||||
TMS6100 simulator
|
||||
|
||||
Written for MAME by Couriersud
|
||||
|
||||
Todo:
|
||||
- implement CS
|
||||
- implement 4 bit mode (mask programmed)
|
||||
- implement chip addressing (0-15 mask programmed)
|
||||
|
||||
TMS6100:
|
||||
|
||||
+-----------------+
|
||||
VDD | 1 28 | NC
|
||||
NC | 2 27 | NC
|
||||
DATA/ADD1 | 3 26 | NC
|
||||
DATA/ADD2 | 4 25 | NC
|
||||
DATA/ADD4 | 5 24 | NC
|
||||
DATA/ADD8 | 6 23 | NC
|
||||
CLK | 7 22 | NC
|
||||
NC | 8 21 | NC
|
||||
NC | 9 20 | NC
|
||||
M0 | 10 19 | NC
|
||||
M1 | 11 18 | NC
|
||||
NC | 12 17 | NC
|
||||
/CS | 13 16 | NC
|
||||
VSS | 14 15 | NC
|
||||
+-----------------+
|
||||
|
||||
M58819 (from radarscope schematics):
|
||||
|
||||
+-----------------+
|
||||
AD0 | 1 40 | AD1
|
||||
GND | 2 39 | AD2
|
||||
-5V | 3 38 | AD3
|
||||
A0 | 4 37 | AD4
|
||||
NC | 5 36 | AD5
|
||||
NC | 6 35 | AD6
|
||||
A1 | 7 34 | AD7
|
||||
A2 | 8 33 | AD8
|
||||
A3 | 9 32 | AD9
|
||||
CLK | 10 31 | AD10
|
||||
NC | 11 30 | AD11
|
||||
-5V | 12 29 | AD12
|
||||
C0 | 13 28 | NC
|
||||
C1 | 14 27 | NC
|
||||
NC | 15 26 | I7
|
||||
NC | 16 25 | NC
|
||||
+5V | 17 24 | I6
|
||||
I0 | 18 23 | I5
|
||||
I1 | 19 22 | I4
|
||||
I2 | 20 21 | I3
|
||||
+-----------------+
|
||||
|
||||
The M58819 is used as an interface to external speech eproms.
|
||||
NC pins may have a function, although they are not connected in
|
||||
radarscope.
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "tms6100.h"
|
||||
|
||||
#define VERBOSE (0)
|
||||
|
||||
#if VERBOSE
|
||||
#define LOG(x) logerror x
|
||||
#else
|
||||
#define LOG(x)
|
||||
#endif
|
||||
|
||||
#define TMS6100_READ_PENDING 0x01
|
||||
#define TMS6100_NEXT_READ_IS_DUMMY 0x02
|
||||
|
||||
typedef struct _tms6100_state tms6100_state;
|
||||
struct _tms6100_state
|
||||
{
|
||||
/* Rom interface */
|
||||
UINT32 address;
|
||||
UINT32 address_latch;
|
||||
UINT8 loadptr;
|
||||
UINT8 m0;
|
||||
UINT8 m1;
|
||||
UINT8 addr_bits;
|
||||
UINT8 clock;
|
||||
UINT8 data;
|
||||
UINT8 state;
|
||||
|
||||
const UINT8 *rom;
|
||||
|
||||
running_device *device;
|
||||
|
||||
#if 0
|
||||
const tms5110_interface *intf;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**********************************************************************************************
|
||||
|
||||
get_safe_token -- get tms6100_state
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
INLINE tms6100_state *get_safe_token(running_device *device)
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type == TMS6100 ||
|
||||
device->type == M58819);
|
||||
return (tms6100_state *)device->token;
|
||||
}
|
||||
|
||||
/**********************************************************************************************
|
||||
|
||||
register_save_states -- register state vars for saving
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
static void register_for_save_states(tms6100_state *tms)
|
||||
{
|
||||
state_save_register_device_item(tms->device, 0, tms->addr_bits);
|
||||
state_save_register_device_item(tms->device, 0, tms->address);
|
||||
state_save_register_device_item(tms->device, 0, tms->address_latch);
|
||||
state_save_register_device_item(tms->device, 0, tms->data);
|
||||
state_save_register_device_item(tms->device, 0, tms->loadptr);
|
||||
state_save_register_device_item(tms->device, 0, tms->m0);
|
||||
state_save_register_device_item(tms->device, 0, tms->m1);
|
||||
state_save_register_device_item(tms->device, 0, tms->state);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
DEVICE_START( tms6100 ) -- allocate buffers and reset the 6100
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
static DEVICE_START( tms6100 )
|
||||
{
|
||||
//static const tms5110_interface dummy = { 0 };
|
||||
tms6100_state *tms = get_safe_token(device);
|
||||
|
||||
assert_always(tms != NULL, "Error creating TMS6100 chip");
|
||||
|
||||
//tms->intf = device->baseconfig().static_config ? (const tms5110_interface *)device->baseconfig().static_config : &dummy;
|
||||
tms->rom = *device->region;
|
||||
|
||||
tms->device = device;
|
||||
|
||||
register_for_save_states(tms);
|
||||
}
|
||||
|
||||
static DEVICE_START( m58819 )
|
||||
{
|
||||
//tms6100_state *tms = get_safe_token(device);
|
||||
DEVICE_START_CALL( tms6100 );
|
||||
//tms5110_set_variant(tms, TMS5110_IS_5100);
|
||||
}
|
||||
|
||||
static DEVICE_RESET( tms6100 )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token(device);
|
||||
|
||||
/* initialize the chip */
|
||||
tms->addr_bits = 0;
|
||||
tms->address = 0;
|
||||
tms->address_latch = 0;
|
||||
tms->loadptr = 0;
|
||||
tms->m0 = 0;
|
||||
tms->m1 = 0;
|
||||
tms->state = 0;
|
||||
tms->clock = 0;
|
||||
tms->data = 0;
|
||||
}
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_m0_w )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token(device);
|
||||
if (state != tms->m0)
|
||||
tms->m0 = state;
|
||||
}
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_m1_w )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token(device);
|
||||
if (state != tms->m1)
|
||||
tms->m1 = state;
|
||||
}
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_romclock_w )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token(device);
|
||||
|
||||
/* process on falling edge */
|
||||
if (tms->clock && !state)
|
||||
{
|
||||
switch ((tms->m1<<1) | tms->m0)
|
||||
{
|
||||
case 0x00:
|
||||
/* NOP in datasheet, not really ... */
|
||||
if (tms->state & TMS6100_READ_PENDING)
|
||||
{
|
||||
if (tms->state & TMS6100_NEXT_READ_IS_DUMMY)
|
||||
{
|
||||
tms->address = (tms->address_latch << 3);
|
||||
tms->address_latch = 0;
|
||||
tms->loadptr = 0;
|
||||
tms->state &= ~TMS6100_NEXT_READ_IS_DUMMY;
|
||||
LOG(("loaded address %08x\n", tms->address));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read bit at address */
|
||||
tms->data = (tms->rom[tms->address >> 3] >> ((tms->address & 0x07) ^ 0x07)) & 1;
|
||||
tms->address++;
|
||||
}
|
||||
tms->state &= ~TMS6100_READ_PENDING;
|
||||
}
|
||||
break;
|
||||
case 0x01:
|
||||
/* READ */
|
||||
tms->state |= TMS6100_READ_PENDING;
|
||||
break;
|
||||
case 0x02:
|
||||
/* LOAD ADDRESS */
|
||||
tms->state |= TMS6100_NEXT_READ_IS_DUMMY;
|
||||
tms->address_latch |= (tms->addr_bits << tms->loadptr);
|
||||
LOG(("loaded address latch %08x\n", tms->address_latch));
|
||||
tms->loadptr += 4;
|
||||
break;
|
||||
case 0x03:
|
||||
/* READ AND BRANCH */
|
||||
break;
|
||||
}
|
||||
}
|
||||
tms->clock = state;
|
||||
}
|
||||
|
||||
WRITE8_DEVICE_HANDLER( tms6100_addr_w )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token(device);
|
||||
if (data != tms->addr_bits)
|
||||
tms->addr_bits = data;
|
||||
}
|
||||
|
||||
READ_LINE_DEVICE_HANDLER( tms6100_data_r )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token(device);
|
||||
|
||||
return tms->data;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
TMS 6100 device definition
|
||||
-------------------------------------------------*/
|
||||
|
||||
static const char DEVTEMPLATE_SOURCE[] = __FILE__;
|
||||
|
||||
#define DEVTEMPLATE_ID(p,s) p##tms6100##s
|
||||
#define DEVTEMPLATE_FEATURES DT_HAS_START | DT_HAS_RESET
|
||||
#define DEVTEMPLATE_NAME "TMS6100"
|
||||
#define DEVTEMPLATE_FAMILY "TI Speech"
|
||||
#include "devtempl.h"
|
||||
|
||||
#define DEVTEMPLATE_DERIVED_ID(p,s) p##m58819##s
|
||||
#define DEVTEMPLATE_DERIVED_FEATURES DT_HAS_START
|
||||
#define DEVTEMPLATE_DERIVED_NAME "M58819"
|
||||
#include "devtempl.h"
|
||||
|
22
src/emu/machine/tms6100.h
Normal file
22
src/emu/machine/tms6100.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __TMS6100_H__
|
||||
#define __TMS6100_H__
|
||||
|
||||
|
||||
/* TMS 6100 memory controller */
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_m0_w );
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_m1_w );
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_romclock_w );
|
||||
WRITE8_DEVICE_HANDLER( tms6100_addr_w );
|
||||
|
||||
READ_LINE_DEVICE_HANDLER( tms6100_data_r );
|
||||
|
||||
DEVICE_GET_INFO( tms6100 );
|
||||
DEVICE_GET_INFO( m58819 );
|
||||
|
||||
#define TMS6100 DEVICE_GET_INFO_NAME( tms6100 )
|
||||
#define M58819 DEVICE_GET_INFO_NAME( m58819 )
|
||||
|
||||
#endif /* __TMS6100_H__ */
|
@ -165,32 +165,6 @@ struct _tms5110_state
|
||||
UINT8 romclk_hack_state;
|
||||
};
|
||||
|
||||
#define TMS6100_READ_PENDING 0x01
|
||||
#define TMS6100_NEXT_READ_IS_DUMMY 0x02
|
||||
|
||||
typedef struct _tms6100_state tms6100_state;
|
||||
struct _tms6100_state
|
||||
{
|
||||
/* Rom interface */
|
||||
UINT32 address;
|
||||
UINT32 address_latch;
|
||||
UINT8 loadptr;
|
||||
UINT8 m0;
|
||||
UINT8 m1;
|
||||
UINT8 addr_bits;
|
||||
UINT8 clock;
|
||||
UINT8 data;
|
||||
UINT8 state;
|
||||
|
||||
const UINT8 *rom;
|
||||
|
||||
running_device *device;
|
||||
|
||||
#if 0
|
||||
const tms5110_interface *intf;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _tmsprom_state tmsprom_state;
|
||||
struct _tmsprom_state
|
||||
{
|
||||
@ -237,15 +211,6 @@ INLINE tms5110_state *get_safe_token(running_device *device)
|
||||
return (tms5110_state *)device->token;
|
||||
}
|
||||
|
||||
INLINE tms6100_state *get_safe_token_6100(running_device *device)
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert(device->token != NULL);
|
||||
assert(device->type == TMS6100 ||
|
||||
device->type == M58819);
|
||||
return (tms6100_state *)device->token;
|
||||
}
|
||||
|
||||
INLINE tmsprom_state *get_safe_token_prom(running_device *device)
|
||||
{
|
||||
assert(device != NULL);
|
||||
@ -1337,139 +1302,6 @@ void tms5110_set_frequency(running_device *device, int frequency)
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
DEVICE_START( tms6100 ) -- allocate buffers and reset the 6100
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
static void register_for_save_states_6100(tms6100_state *tms)
|
||||
{
|
||||
state_save_register_device_item(tms->device, 0, tms->addr_bits);
|
||||
state_save_register_device_item(tms->device, 0, tms->address);
|
||||
state_save_register_device_item(tms->device, 0, tms->address_latch);
|
||||
state_save_register_device_item(tms->device, 0, tms->data);
|
||||
state_save_register_device_item(tms->device, 0, tms->loadptr);
|
||||
state_save_register_device_item(tms->device, 0, tms->m0);
|
||||
state_save_register_device_item(tms->device, 0, tms->m1);
|
||||
state_save_register_device_item(tms->device, 0, tms->state);
|
||||
}
|
||||
|
||||
static DEVICE_START( tms6100 )
|
||||
{
|
||||
//static const tms5110_interface dummy = { 0 };
|
||||
tms6100_state *tms = get_safe_token_6100(device);
|
||||
|
||||
assert_always(tms != NULL, "Error creating TMS6100 chip");
|
||||
|
||||
//tms->intf = device->baseconfig().static_config ? (const tms5110_interface *)device->baseconfig().static_config : &dummy;
|
||||
tms->rom = *device->region;
|
||||
|
||||
tms->device = device;
|
||||
|
||||
register_for_save_states_6100(tms);
|
||||
}
|
||||
|
||||
static DEVICE_START( m58819 )
|
||||
{
|
||||
//tms6100_state *tms = get_safe_token_6100(device);
|
||||
DEVICE_START_CALL( tms6100 );
|
||||
//tms5110_set_variant(tms, TMS5110_IS_5100);
|
||||
}
|
||||
|
||||
static DEVICE_RESET( tms6100 )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token_6100(device);
|
||||
|
||||
/* initialize the chip */
|
||||
tms->addr_bits = 0;
|
||||
tms->address = 0;
|
||||
tms->address_latch = 0;
|
||||
tms->loadptr = 0;
|
||||
tms->m0 = 0;
|
||||
tms->m1 = 0;
|
||||
tms->state = 0;
|
||||
tms->clock = 0;
|
||||
tms->data = 0;
|
||||
}
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_m0_w )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token_6100(device);
|
||||
if (state != tms->m0)
|
||||
tms->m0 = state;
|
||||
}
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_m1_w )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token_6100(device);
|
||||
if (state != tms->m1)
|
||||
tms->m1 = state;
|
||||
}
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_romclock_w )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token_6100(device);
|
||||
|
||||
/* process on falling edge */
|
||||
if (tms->clock && !state)
|
||||
{
|
||||
switch ((tms->m1<<1) | tms->m0)
|
||||
{
|
||||
case 0x00:
|
||||
/* NOP in datasheet, not really ... */
|
||||
if (tms->state & TMS6100_READ_PENDING)
|
||||
{
|
||||
if (tms->state & TMS6100_NEXT_READ_IS_DUMMY)
|
||||
{
|
||||
tms->address = (tms->address_latch << 3);
|
||||
tms->address_latch = 0;
|
||||
tms->loadptr = 0;
|
||||
tms->state &= ~TMS6100_NEXT_READ_IS_DUMMY;
|
||||
printf("loaded address %08x\n", tms->address);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read bit at address */
|
||||
tms->data = (tms->rom[tms->address >> 3] >> ((tms->address & 0x07) ^ 0x07)) & 1;
|
||||
tms->address++;
|
||||
}
|
||||
tms->state &= ~TMS6100_READ_PENDING;
|
||||
}
|
||||
break;
|
||||
case 0x01:
|
||||
/* READ */
|
||||
tms->state |= TMS6100_READ_PENDING;
|
||||
break;
|
||||
case 0x02:
|
||||
/* LOAD ADDRESS */
|
||||
tms->state |= TMS6100_NEXT_READ_IS_DUMMY;
|
||||
tms->address_latch |= (tms->addr_bits << tms->loadptr);
|
||||
printf("loaded address latch %08x\n", tms->address_latch);
|
||||
tms->loadptr += 4;
|
||||
break;
|
||||
case 0x03:
|
||||
/* READ AND BRANCH */
|
||||
break;
|
||||
}
|
||||
}
|
||||
tms->clock = state;
|
||||
}
|
||||
|
||||
WRITE8_DEVICE_HANDLER( tms6100_addr_w )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token_6100(device);
|
||||
if (data != tms->addr_bits)
|
||||
tms->addr_bits = data;
|
||||
}
|
||||
|
||||
READ_LINE_DEVICE_HANDLER( tms6100_data_r )
|
||||
{
|
||||
tms6100_state *tms = get_safe_token_6100(device);
|
||||
|
||||
return tms->data;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
DEVICE_START( tmsprom ) -- allocate buffers initialize
|
||||
@ -1661,25 +1493,6 @@ static const char DEVTEMPLATE_SOURCE[] = __FILE__;
|
||||
#define DEVTEMPLATE_DERIVED_NAME "M58817"
|
||||
#include "devtempl.h"
|
||||
|
||||
/*-------------------------------------------------
|
||||
TMS 6100 device definition
|
||||
-------------------------------------------------*/
|
||||
|
||||
#undef DEVTEMPLATE_ID
|
||||
#undef DEVTEMPLATE_NAME
|
||||
#undef DEVTEMPLATE_FEATURES
|
||||
|
||||
#define DEVTEMPLATE_ID(p,s) p##tms6100##s
|
||||
#define DEVTEMPLATE_FEATURES DT_HAS_START | DT_HAS_RESET
|
||||
#define DEVTEMPLATE_NAME "TMS6100"
|
||||
#define DEVTEMPLATE_FAMILY "TI Speech"
|
||||
#include "devtempl.h"
|
||||
|
||||
#define DEVTEMPLATE_DERIVED_ID(p,s) p##m58819##s
|
||||
#define DEVTEMPLATE_DERIVED_FEATURES DT_HAS_START
|
||||
#define DEVTEMPLATE_DERIVED_NAME "M58819"
|
||||
#include "devtempl.h"
|
||||
|
||||
/*-------------------------------------------------
|
||||
TMS PROM interface definition
|
||||
-------------------------------------------------*/
|
||||
|
@ -70,21 +70,6 @@ DEVICE_GET_INFO( m58817 );
|
||||
#define SOUND_CD2802 DEVICE_GET_INFO_NAME( cd2802 )
|
||||
#define SOUND_M58817 DEVICE_GET_INFO_NAME( m58817 )
|
||||
|
||||
/* TMS 6100 memory controller */
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_m0_w );
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_m1_w );
|
||||
WRITE_LINE_DEVICE_HANDLER( tms6100_romclock_w );
|
||||
WRITE8_DEVICE_HANDLER( tms6100_addr_w );
|
||||
|
||||
READ_LINE_DEVICE_HANDLER( tms6100_data_r );
|
||||
|
||||
DEVICE_GET_INFO( tms6100 );
|
||||
DEVICE_GET_INFO( m58819 );
|
||||
|
||||
#define TMS6100 DEVICE_GET_INFO_NAME( tms6100 )
|
||||
#define M58819 DEVICE_GET_INFO_NAME( m58819 )
|
||||
|
||||
/* PROM controlled TMS5110 interface */
|
||||
|
||||
typedef struct _tmsprom_interface tmsprom_interface;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "machine/latch8.h"
|
||||
|
||||
#include "sound/tms5110.h"
|
||||
#include "machine/tms6100.h"
|
||||
|
||||
#include "includes/dkong.h"
|
||||
|
||||
@ -23,7 +24,7 @@
|
||||
#define USE_LS629 (0) /* set to use new LS624 code */
|
||||
|
||||
/* Issue surrounded by this define need to be analyzed and
|
||||
* reviewed at a lator time.
|
||||
* reviewed at a later time.
|
||||
* Currently, the following issues exist:
|
||||
* - although not present on schematics, a 10K resistor is needed
|
||||
* as RF in the mixer stage. Without this resistor, the DAC
|
||||
|
Loading…
Reference in New Issue
Block a user