diff options
-rw-r--r-- | src/emu/machine/timekpr.c | 157 | ||||
-rw-r--r-- | src/emu/machine/timekpr.h | 22 | ||||
-rw-r--r-- | src/mame/drivers/itech32.c | 4 | ||||
-rw-r--r-- | src/mame/drivers/ksys573.c | 2 | ||||
-rw-r--r-- | src/mame/drivers/midzeus.c | 2 | ||||
-rw-r--r-- | src/mame/drivers/nwk-tr.c | 2 | ||||
-rw-r--r-- | src/mame/drivers/slapshot.c | 8 | ||||
-rw-r--r-- | src/mame/drivers/viper.c | 30 |
8 files changed, 52 insertions, 175 deletions
diff --git a/src/emu/machine/timekpr.c b/src/emu/machine/timekpr.c index 6758dedf53f..0c5cfa9ff8f 100644 --- a/src/emu/machine/timekpr.c +++ b/src/emu/machine/timekpr.c @@ -1,7 +1,11 @@ /* * STmicroelectronics TIMEKEEPER SRAM * - * Supports: MK48T08, M48T02 & M48T58 + * Supports: + * M48T02 + * M48T35 + * M48T58 + * MK48T08 * */ @@ -53,8 +57,8 @@ static struct timekeeper_chip timekeeper[ MAX_TIMEKEEPER_CHIPS ]; #define SECONDS_ST ( 0x80 ) #define DAY_FT ( 0x40 ) /* not emulated */ -#define DAY_CEB ( 0x20 ) /* M48T58 */ -#define DAY_CB ( 0x10 ) /* M48T58 */ +#define DAY_CEB ( 0x20 ) /* M48T35/M48T58 */ +#define DAY_CB ( 0x10 ) /* M48T35/M48T58 */ #define DATE_BLE ( 0x80 ) /* M48T58: not emulated */ #define DATE_BL ( 0x40 ) /* M48T58: not emulated */ @@ -199,9 +203,15 @@ static TIMER_CALLBACK( timekeeper_tick ) if( carry ) { carry = inc_bcd( &c->century, MASK_CENTURY, 0x00, 0x99 ); - if( c->type == TIMEKEEPER_M48T58 && ( c->day & DAY_CEB ) != 0 ) + switch( c->type ) { - c->day ^= DAY_CB; + case TIMEKEEPER_M48T35: + case TIMEKEEPER_M48T58: + if( ( c->day & DAY_CEB ) != 0 ) + { + c->day ^= DAY_CB; + } + break; } } @@ -242,6 +252,19 @@ void timekeeper_init( running_machine *machine, int chip, int type, UINT8 *data c->offset_flags = -1; c->size = 0x800; break; + case TIMEKEEPER_M48T35: + c->offset_control = 0x7ff8; + c->offset_seconds = 0x7ff9; + c->offset_minutes = 0x7ffa; + c->offset_hours = 0x7ffb; + c->offset_day = 0x7ffc; + c->offset_date = 0x7ffd; + c->offset_month = 0x7ffe; + c->offset_year = 0x7fff; + c->offset_century = -1; + c->offset_flags = -1; + c->size = 0x8000; + break; case TIMEKEEPER_M48T58: c->offset_control = 0x1ff8; c->offset_seconds = 0x1ff9; @@ -268,19 +291,6 @@ void timekeeper_init( running_machine *machine, int chip, int type, UINT8 *data c->offset_flags = 0x1ff0; c->size = 0x2000; break; - case TIMEKEEPER_MIDZEUS2: - c->offset_control = 0x7ff8; - c->offset_seconds = 0x7ff9; - c->offset_minutes = 0x7ffa; - c->offset_hours = 0x7ffb; - c->offset_day = 0x7ffc; - c->offset_date = 0x7ffd; - c->offset_month = 0x7ffe; - c->offset_year = 0x7fff; - c->offset_century = -1; - c->offset_flags = -1; - c->size = 0x8000; - break; } if( data == NULL ) @@ -379,9 +389,15 @@ static void timekeeper_write( UINT32 chip, offs_t offset, UINT8 data ) } c->control = data; } - else if( c->type == TIMEKEEPER_M48T58 && offset == c->offset_day ) + else if( offset == c->offset_day ) { - c->day = ( c->day & ~DAY_CEB ) | ( data & DAY_CEB ); + switch( c->type ) + { + case TIMEKEEPER_M48T35: + case TIMEKEEPER_M48T58: + c->day = ( c->day & ~DAY_CEB ) | ( data & DAY_CEB ); + break; + } } else if( c->type == TIMEKEEPER_M48T58 && offset == c->offset_date ) { @@ -396,7 +412,7 @@ static void timekeeper_write( UINT32 chip, offs_t offset, UINT8 data ) c->data[ offset ] = data; } -/* 8bit memory handlers */ +/* memory handlers */ READ8_HANDLER( timekeeper_0_r ) { @@ -407,102 +423,3 @@ WRITE8_HANDLER( timekeeper_0_w ) { timekeeper_write(0, offset, data); } - -/* 16bit memory handlers */ - -static UINT16 timekeeper_msb16_read( UINT32 chip, offs_t offset, UINT16 mem_mask ) -{ - UINT16 data = 0; - if( ACCESSING_BITS_8_15 ) - { - data |= timekeeper_read( chip, offset ) << 8; - } - return data; -} - -static void timekeeper_msb16_write( UINT32 chip, offs_t offset, UINT16 data, UINT16 mem_mask ) -{ - if( ACCESSING_BITS_8_15 ) - { - timekeeper_write( chip, offset, data >> 8 ); - } -} - -READ16_HANDLER( timekeeper_0_msb16_r ) { return timekeeper_msb16_read( 0, offset, mem_mask ); } -WRITE16_HANDLER( timekeeper_0_msb16_w ) { timekeeper_msb16_write( 0, offset, data, mem_mask ); } - -/* 32bit memory handlers */ - -static UINT32 timekeeper_32be_read( UINT32 chip, offs_t offset, UINT32 mem_mask ) -{ - UINT32 data = 0; - if( ACCESSING_BITS_24_31 ) - { - data |= timekeeper_read( chip, ( offset * 4 ) + 0 ) << 24; - } - if( ACCESSING_BITS_16_23 ) - { - data |= timekeeper_read( chip, ( offset * 4 ) + 1 ) << 16; - } - if( ACCESSING_BITS_8_15 ) - { - data |= timekeeper_read( chip, ( offset * 4 ) + 2 ) << 8; - } - if( ACCESSING_BITS_0_7 ) - { - data |= timekeeper_read( chip, ( offset * 4 ) + 3 ) << 0; - } - return data; -} - -static void timekeeper_32be_write( UINT32 chip, offs_t offset, UINT32 data, UINT32 mem_mask ) -{ - if( ACCESSING_BITS_24_31 ) - { - timekeeper_write( chip, ( offset * 4 ) + 0, data >> 24 ); - } - if( ACCESSING_BITS_16_23 ) - { - timekeeper_write( chip, ( offset * 4 ) + 1, data >> 16 ); - } - if( ACCESSING_BITS_8_15 ) - { - timekeeper_write( chip, ( offset * 4 ) + 2, data >> 8 ); - } - if( ACCESSING_BITS_0_7 ) - { - timekeeper_write( chip, ( offset * 4 ) + 3, data >> 0 ); - } -} - -READ32_HANDLER( timekeeper_0_32be_r ) { return timekeeper_32be_read( 0, offset, mem_mask ); } -WRITE32_HANDLER( timekeeper_0_32be_w ) { timekeeper_32be_write( 0, offset, data, mem_mask ); } - -static UINT32 timekeeper_32le_lsb16_read( UINT32 chip, offs_t offset, UINT32 mem_mask ) -{ - UINT32 data = 0; - if( ACCESSING_BITS_0_7 ) - { - data |= timekeeper_read( chip, ( offset * 2 ) + 0 ) << 0; - } - if( ACCESSING_BITS_16_23 ) - { - data |= timekeeper_read( chip, ( offset * 2 ) + 1 ) << 16; - } - return data; -} - -static void timekeeper_32le_lsb16_write( UINT32 chip, offs_t offset, UINT32 data, UINT32 mem_mask ) -{ - if( ACCESSING_BITS_0_7 ) - { - timekeeper_write( chip, ( offset * 2 ) + 0, data >> 0 ); - } - if( ACCESSING_BITS_16_23 ) - { - timekeeper_write( chip, ( offset * 2 ) + 1, data >> 16 ); - } -} - -READ32_HANDLER( timekeeper_0_32le_lsb16_r ) { return timekeeper_32le_lsb16_read( 0, offset, mem_mask ); } -WRITE32_HANDLER( timekeeper_0_32le_lsb16_w ) { timekeeper_32le_lsb16_write( 0, offset, data, mem_mask ); } diff --git a/src/emu/machine/timekpr.h b/src/emu/machine/timekpr.h index 91832d46ace..7c0891e2016 100644 --- a/src/emu/machine/timekpr.h +++ b/src/emu/machine/timekpr.h @@ -12,30 +12,18 @@ extern void timekeeper_init( running_machine *machine, int chip, int type, UINT8 #define MAX_TIMEKEEPER_CHIPS ( 1 ) -#define TIMEKEEPER_M48T58 ( 1 ) -#define TIMEKEEPER_M48T02 ( 2 ) -#define TIMEKEEPER_MK48T08 ( 3 ) -#define TIMEKEEPER_MIDZEUS2 ( 4 ) +#define TIMEKEEPER_M48T02 ( 1 ) +#define TIMEKEEPER_M48T35 ( 2 ) +#define TIMEKEEPER_M48T58 ( 3 ) +#define TIMEKEEPER_MK48T08 ( 4 ) /* nvram handlers */ extern NVRAM_HANDLER( timekeeper_0 ); -/* 8bit memory handlers */ +/* memory handlers */ extern READ8_HANDLER( timekeeper_0_r ); extern WRITE8_HANDLER( timekeeper_0_w ); -/* 16bit memory handlers */ - -extern READ16_HANDLER( timekeeper_0_msb16_r ); -extern WRITE16_HANDLER( timekeeper_0_msb16_w ); - -/* 32bit memory handlers */ - -extern READ32_HANDLER( timekeeper_0_32be_r ); -extern WRITE32_HANDLER( timekeeper_0_32be_w ); -extern READ32_HANDLER( timekeeper_0_32le_lsb16_r ); -extern WRITE32_HANDLER( timekeeper_0_32le_lsb16_w ); - #endif diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c index da9c4cd4959..5907a9faf17 100644 --- a/src/mame/drivers/itech32.c +++ b/src/mame/drivers/itech32.c @@ -3884,7 +3884,7 @@ static DRIVER_INIT( wcbowlt ) /* PIC 16C54 labeled as ITBWL-3 */ init_shuffle_bowl_common(machine, 0x111a); timekeeper_init( machine, 0, TIMEKEEPER_M48T02, NULL ); - memory_install_readwrite_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x681000, 0x6817ff, 0, 0, timekeeper_0_32be_r, timekeeper_0_32be_w); + memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x681000, 0x6817ff, 0, 0, timekeeper_0_r, timekeeper_0_w, 0xffffffff); } static void init_gt_common(running_machine *machine) @@ -3933,7 +3933,7 @@ static DRIVER_INIT( aamat ) */ DRIVER_INIT_CALL(aama); timekeeper_init( machine, 0, TIMEKEEPER_M48T02, NULL ); - memory_install_readwrite_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x681000, 0x6817ff, 0, 0, timekeeper_0_32be_r, timekeeper_0_32be_w); + memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x681000, 0x6817ff, 0, 0, timekeeper_0_r, timekeeper_0_w, 0xffffffff); } diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index 3b6d8873fef..b0f27de8b54 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -1299,7 +1299,7 @@ static ADDRESS_MAP_START( konami573_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x1f500000, 0x1f500003) AM_READWRITE( control_r, control_w ) // Konami can't make a game without a "control" register. AM_RANGE(0x1f560000, 0x1f560003) AM_WRITE( atapi_reset_w ) AM_RANGE(0x1f5c0000, 0x1f5c0003) AM_WRITENOP // watchdog? - AM_RANGE(0x1f620000, 0x1f623fff) AM_READWRITE( timekeeper_0_32le_lsb16_r, timekeeper_0_32le_lsb16_w ) + AM_RANGE(0x1f620000, 0x1f623fff) AM_READWRITE8(timekeeper_0_r, timekeeper_0_w, 0x00ff00ff) AM_RANGE(0x1f680000, 0x1f68001f) AM_READWRITE(mb89371_r, mb89371_w) AM_RANGE(0x1f6a0000, 0x1f6a0003) AM_READWRITE( security_r, security_w ) AM_RANGE(0x1f800000, 0x1f8003ff) AM_RAM /* scratchpad */ diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c index 0544bd0638b..d15e486303f 100644 --- a/src/mame/drivers/midzeus.c +++ b/src/mame/drivers/midzeus.c @@ -91,7 +91,7 @@ static MACHINE_START( midzeus ) static MACHINE_START( midzeus2 ) { - timekeeper_init(machine, 0, TIMEKEEPER_MIDZEUS2, NULL); + timekeeper_init(machine, 0, TIMEKEEPER_M48T35, NULL); MACHINE_START_CALL(midzeus); } diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c index 44792e23ad6..05589e7755f 100644 --- a/src/mame/drivers/nwk-tr.c +++ b/src/mame/drivers/nwk-tr.c @@ -970,7 +970,7 @@ static ADDRESS_MAP_START( nwktr_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x780c0000, 0x780c0003) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) AM_RANGE(0x7d000000, 0x7d00ffff) AM_READ(sysreg_r) AM_RANGE(0x7d010000, 0x7d01ffff) AM_WRITE(sysreg_w) - AM_RANGE(0x7d020000, 0x7d021fff) AM_READWRITE(timekeeper_0_32be_r, timekeeper_0_32be_w) /* M48T58Y RTC/NVRAM */ + AM_RANGE(0x7d020000, 0x7d021fff) AM_READWRITE8(timekeeper_0_r, timekeeper_0_w, 0xffffffff) /* M48T58Y RTC/NVRAM */ AM_RANGE(0x7d030000, 0x7d030007) AM_READ(K056800_host_r) AM_RANGE(0x7d030000, 0x7d030007) AM_WRITE(K056800_host_w) AM_RANGE(0x7d030008, 0x7d03000f) AM_WRITE(K056800_host_w) diff --git a/src/mame/drivers/slapshot.c b/src/mame/drivers/slapshot.c index 7ecce1c87b1..8218cfb6bcb 100644 --- a/src/mame/drivers/slapshot.c +++ b/src/mame/drivers/slapshot.c @@ -284,7 +284,7 @@ static ADDRESS_MAP_START( slapshot_readmem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x800000, 0x80ffff) AM_READ(TC0480SCP_word_r) /* tilemaps */ AM_RANGE(0x830000, 0x83002f) AM_READ(TC0480SCP_ctrl_word_r) AM_RANGE(0x900000, 0x907fff) AM_READ(color_ram_word_r) /* 8bpg palette */ - AM_RANGE(0xa00000, 0xa03fff) AM_READ(timekeeper_0_msb16_r) /* nvram (only low bytes used) */ + AM_RANGE(0xa00000, 0xa03fff) AM_READ8(timekeeper_0_r, 0xff00) /* nvram (only low bytes used) */ AM_RANGE(0xc00000, 0xc0000f) AM_READ(TC0640FIO_halfword_byteswap_r) AM_RANGE(0xc00020, 0xc0002f) AM_READ(slapshot_service_input_r) /* service mirror */ AM_RANGE(0xd00000, 0xd00003) AM_READ(slapshot_msb_sound_r) @@ -298,7 +298,7 @@ static ADDRESS_MAP_START( slapshot_writemem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x800000, 0x80ffff) AM_WRITE(TC0480SCP_word_w) /* tilemaps */ AM_RANGE(0x830000, 0x83002f) AM_WRITE(TC0480SCP_ctrl_word_w) AM_RANGE(0x900000, 0x907fff) AM_WRITE(color_ram_word_w) AM_BASE(&color_ram) - AM_RANGE(0xa00000, 0xa03fff) AM_WRITE(timekeeper_0_msb16_w) + AM_RANGE(0xa00000, 0xa03fff) AM_WRITE8(timekeeper_0_w, 0xff00) AM_RANGE(0xb00000, 0xb0001f) AM_WRITE(TC0360PRI_halfword_swap_w) /* priority chip */ AM_RANGE(0xc00000, 0xc0000f) AM_WRITE(TC0640FIO_halfword_byteswap_w) AM_RANGE(0xd00000, 0xd00003) AM_WRITE(slapshot_msb_sound_w) @@ -312,7 +312,7 @@ static ADDRESS_MAP_START( opwolf3_readmem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x800000, 0x80ffff) AM_READ(TC0480SCP_word_r) /* tilemaps */ AM_RANGE(0x830000, 0x83002f) AM_READ(TC0480SCP_ctrl_word_r) AM_RANGE(0x900000, 0x907fff) AM_READ(color_ram_word_r) /* 8bpg palette */ - AM_RANGE(0xa00000, 0xa03fff) AM_READ(timekeeper_0_msb16_r) /* nvram (only low bytes used) */ + AM_RANGE(0xa00000, 0xa03fff) AM_READ8(timekeeper_0_r, 0xff00) /* nvram (only low bytes used) */ AM_RANGE(0xc00000, 0xc0000f) AM_READ(TC0640FIO_halfword_byteswap_r) AM_RANGE(0xc00020, 0xc0002f) AM_READ(slapshot_service_input_r) /* service mirror */ AM_RANGE(0xd00000, 0xd00003) AM_READ(slapshot_msb_sound_r) @@ -327,7 +327,7 @@ static ADDRESS_MAP_START( opwolf3_writemem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x800000, 0x80ffff) AM_WRITE(TC0480SCP_word_w) /* tilemaps */ AM_RANGE(0x830000, 0x83002f) AM_WRITE(TC0480SCP_ctrl_word_w) AM_RANGE(0x900000, 0x907fff) AM_WRITE(color_ram_word_w) AM_BASE(&color_ram) - AM_RANGE(0xa00000, 0xa03fff) AM_WRITE(timekeeper_0_msb16_w) + AM_RANGE(0xa00000, 0xa03fff) AM_WRITE8(timekeeper_0_w, 0xff00) AM_RANGE(0xb00000, 0xb0001f) AM_WRITE(TC0360PRI_halfword_swap_w) /* priority chip */ AM_RANGE(0xc00000, 0xc0000f) AM_WRITE(TC0640FIO_halfword_byteswap_w) AM_RANGE(0xd00000, 0xd00003) AM_WRITE(slapshot_msb_sound_w) diff --git a/src/mame/drivers/viper.c b/src/mame/drivers/viper.c index f4431fa8a5c..ad1e25b77f8 100644 --- a/src/mame/drivers/viper.c +++ b/src/mame/drivers/viper.c @@ -549,34 +549,6 @@ static WRITE64_HANDLER(voodoo3_lfb_w) #endif -static READ64_HANDLER(m48t58_r) -{ - UINT64 r = 0; - - if (ACCESSING_BITS_32_63) - { - r |= (UINT64)timekeeper_0_32be_r(machine, (offset * 2) + 0, (UINT32)(mem_mask >> 32)) << 32; - } - if (ACCESSING_BITS_0_31) - { - r |= timekeeper_0_32be_r(machine, (offset * 2) + 1, (UINT32)(mem_mask)); - } - - return r; -} - -static WRITE64_HANDLER(m48t58_w) -{ - if (ACCESSING_BITS_32_63) - { - timekeeper_0_32be_w(machine, (offset * 2) + 0, (UINT32)(data >> 32), (UINT32)(mem_mask >> 32)); - } - if (ACCESSING_BITS_0_31) - { - timekeeper_0_32be_w(machine, (offset * 2) + 1, (UINT32)(data), (UINT32)(mem_mask)); - } -} - /*****************************************************************************/ static ADDRESS_MAP_START(viper_map, ADDRESS_SPACE_PROGRAM, 64) @@ -589,7 +561,7 @@ static ADDRESS_MAP_START(viper_map, ADDRESS_SPACE_PROGRAM, 64) AM_RANGE(0xfee00000, 0xfeefffff) AM_READWRITE(pci_config_data_r, pci_config_data_w) AM_RANGE(0xff300000, 0xff300fff) AM_DEVREADWRITE(IDE_CONTROLLER, "ide", ata_r, ata_w) AM_RANGE(0xffe10000, 0xffe10007) AM_READ(unk1_r) - AM_RANGE(0xffe30000, 0xffe31fff) AM_READWRITE(m48t58_r, m48t58_w) + AM_RANGE(0xffe30000, 0xffe31fff) AM_READWRITE8(timekeeper_0_r, timekeeper_0_w, U64(0xffffffffffffffff)) AM_RANGE(0xffe40000, 0xffe4000f) AM_NOP AM_RANGE(0xffe50000, 0xffe50007) AM_WRITE(unk2_w) AM_RANGE(0xffe80000, 0xffe80007) AM_WRITE(unk1a_w) |