h8: Implement the 8-bits timers, namcos23 coins work again [O. Galibert]

This commit is contained in:
Olivier Galibert 2014-04-05 17:24:50 +00:00
parent 52b2acd56a
commit 6cc5342925
21 changed files with 716 additions and 16 deletions

View File

@ -495,7 +495,7 @@ CPUOBJS += $(CPUOBJ)/h8/h8.o $(CPUOBJ)/h8/h8h.o $(CPUOBJ)/h8/h8s2000.o $(CPUOBJ)
$(CPUOBJ)/h8/h8s2245.o $(CPUOBJ)/h8/h8s2320.o $(CPUOBJ)/h8/h8s2357.o \
$(CPUOBJ)/h8/h8s2655.o \
$(CPUOBJ)/h8/h8_adc.o $(CPUOBJ)/h8/h8_port.o $(CPUOBJ)/h8/h8_intc.o \
$(CPUOBJ)/h8/h8_timer16.o $(CPUOBJ)/h8/h8_sci.o
$(CPUOBJ)/h8/h8_timer8.o $(CPUOBJ)/h8/h8_timer16.o $(CPUOBJ)/h8/h8_sci.o
DASMOBJS +=
endif
@ -527,6 +527,7 @@ $(CPUOBJ)/h8/h83337.o: $(CPUSRC)/h8/h83337.c \
$(CPUSRC)/h8/h8_intc.h \
$(CPUSRC)/h8/h8_adc.h \
$(CPUSRC)/h8/h8_port.h \
$(CPUSRC)/h8/h8_timer8.h \
$(CPUSRC)/h8/h8_timer16.h \
$(CPUSRC)/h8/h8_sci.h
@ -547,6 +548,7 @@ $(CPUOBJ)/h8/h83006.o: $(CPUSRC)/h8/h83006.c \
$(CPUSRC)/h8/h8_intc.h \
$(CPUSRC)/h8/h8_adc.h \
$(CPUSRC)/h8/h8_port.h \
$(CPUSRC)/h8/h8_timer8.h \
$(CPUSRC)/h8/h8_timer16.h \
$(CPUSRC)/h8/h8_sci.h
@ -557,6 +559,7 @@ $(CPUOBJ)/h8/h83008.o: $(CPUSRC)/h8/h83008.c \
$(CPUSRC)/h8/h8_intc.h \
$(CPUSRC)/h8/h8_adc.h \
$(CPUSRC)/h8/h8_port.h \
$(CPUSRC)/h8/h8_timer8.h \
$(CPUSRC)/h8/h8_timer16.h \
$(CPUSRC)/h8/h8_sci.h
@ -578,6 +581,7 @@ $(CPUOBJ)/h8/h8s2245.o: $(CPUSRC)/h8/h8s2245.c \
$(CPUSRC)/h8/h8_intc.h \
$(CPUSRC)/h8/h8_adc.h \
$(CPUSRC)/h8/h8_port.h \
$(CPUSRC)/h8/h8_timer8.h \
$(CPUSRC)/h8/h8_timer16.h \
$(CPUSRC)/h8/h8_sci.h
@ -589,6 +593,7 @@ $(CPUOBJ)/h8/h8s2320.o: $(CPUSRC)/h8/h8s2320.c \
$(CPUSRC)/h8/h8_intc.h \
$(CPUSRC)/h8/h8_adc.h \
$(CPUSRC)/h8/h8_port.h \
$(CPUSRC)/h8/h8_timer8.h \
$(CPUSRC)/h8/h8_timer16.h \
$(CPUSRC)/h8/h8_sci.h
@ -600,6 +605,7 @@ $(CPUOBJ)/h8/h8s2357.o: $(CPUSRC)/h8/h8s2357.c \
$(CPUSRC)/h8/h8_intc.h \
$(CPUSRC)/h8/h8_adc.h \
$(CPUSRC)/h8/h8_port.h \
$(CPUSRC)/h8/h8_timer8.h \
$(CPUSRC)/h8/h8_timer16.h \
$(CPUSRC)/h8/h8_sci.h
@ -612,6 +618,7 @@ $(CPUOBJ)/h8/h8s2655.o: $(CPUSRC)/h8/h8s2655.c \
$(CPUSRC)/h8/h8_intc.h \
$(CPUSRC)/h8/h8_adc.h \
$(CPUSRC)/h8/h8_port.h \
$(CPUSRC)/h8/h8_timer8.h \
$(CPUSRC)/h8/h8_timer16.h \
$(CPUSRC)/h8/h8_sci.h

View File

@ -2157,7 +2157,7 @@ macro jsr32 %opc %spreg
6e80 ff80 0 mov.b r8l r16d16h o
prefetch_start();
TMP1 = UINT16(r16_r(IR[0] >> 4) + IR[1]);
TMP1 = UINT16(r16_r((IR[0] >> 4) & 7) + IR[1]);
TMP2 = r8_r(IR[0]);
set_nzv8(TMP2);
write8(TMP1, TMP2);
@ -2189,7 +2189,7 @@ macro jsr32 %opc %spreg
6f80 ff80 0 mov.w r16l r16d16h o
prefetch_start();
TMP1 = UINT16(r16_r(IR[0] >> 4) + IR[1]);
TMP1 = UINT16(r16_r((IR[0] >> 4) & 7) + IR[1]);
TMP2 = r16_r(IR[0]);
set_nzv16(TMP2);
write16(TMP1, TMP2);

View File

@ -1,6 +1,5 @@
#include "emu.h"
#include "h83002.h"
#include "h8_adc.h"
const device_type H83002 = &device_creator<h83002_device>;

View File

@ -1,6 +1,5 @@
#include "emu.h"
#include "h83006.h"
#include "h8_adc.h"
const device_type H83006 = &device_creator<h83006_device>;
const device_type H83007 = &device_creator<h83007_device>;
@ -17,6 +16,10 @@ h83006_device::h83006_device(const machine_config &mconfig, device_type type, co
port9(*this, "port9"),
porta(*this, "porta"),
portb(*this, "portb"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer8_2(*this, "timer8_2"),
timer8_3(*this, "timer8_3"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -38,6 +41,10 @@ h83006_device::h83006_device(const machine_config &mconfig, const char *tag, dev
port9(*this, "port9"),
porta(*this, "porta"),
portb(*this, "portb"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer8_2(*this, "timer8_2"),
timer8_3(*this, "timer8_3"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -66,6 +73,10 @@ static MACHINE_CONFIG_FRAGMENT(h83006)
MCFG_H8_PORT_ADD("port9", h8_device::PORT_9, 0xc0, 0xc0)
MCFG_H8_PORT_ADD("porta", h8_device::PORT_A, 0x80, 0x00)
MCFG_H8_PORT_ADD("portb", h8_device::PORT_B, 0x00, 0x00)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_0", "intc", 36, 38, 39, "timer8_1", h8_timer8_channel_device::CHAIN_OVERFLOW, true, false)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_1", "intc", 37, 38, 39, "timer8_0", h8_timer8_channel_device::CHAIN_A, false, false)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_2", "intc", 40, 42, 43, "timer8_3", h8_timer8_channel_device::CHAIN_OVERFLOW, false, true)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_3", "intc", 41, 42, 43, "timer8_2", h8_timer8_channel_device::CHAIN_A, false, true)
MCFG_H8_TIMER16_ADD("timer16", 3, 0xf8)
MCFG_H8H_TIMER16_CHANNEL_ADD("timer16:0", 2, 2, "intc", 24)
MCFG_H8H_TIMER16_CHANNEL_ADD("timer16:1", 2, 2, "intc", 28)
@ -111,6 +122,22 @@ DEVICE_ADDRESS_MAP_START(map, 16, h83006_device)
AM_RANGE(0xffff78, 0xffff79) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tior_r, tior_w, 0x00ff)
AM_RANGE(0xffff7a, 0xffff7b) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tcnt_r, tcnt_w )
AM_RANGE(0xffff7c, 0xffff7f) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tgr_r, tgr_w )
AM_RANGE(0xffff80, 0xffff81) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcr_r, tcr_w, 0xff00)
AM_RANGE(0xffff80, 0xffff81) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcr_r, tcr_w, 0x00ff)
AM_RANGE(0xffff82, 0xffff83) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcsr_r, tcsr_w, 0xff00)
AM_RANGE(0xffff82, 0xffff83) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcsr_r, tcsr_w, 0x00ff)
AM_RANGE(0xffff84, 0xffff87) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcor_r, tcor_w, 0xff00)
AM_RANGE(0xffff84, 0xffff87) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcor_r, tcor_w, 0x00ff)
AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcnt_r, tcnt_w, 0xff00)
AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcnt_r, tcnt_w, 0x00ff)
AM_RANGE(0xffff90, 0xffff91) AM_DEVREADWRITE8("timer8_2", h8_timer8_channel_device, tcr_r, tcr_w, 0xff00)
AM_RANGE(0xffff90, 0xffff91) AM_DEVREADWRITE8("timer8_3", h8_timer8_channel_device, tcr_r, tcr_w, 0x00ff)
AM_RANGE(0xffff92, 0xffff93) AM_DEVREADWRITE8("timer8_2", h8_timer8_channel_device, tcsr_r, tcsr_w, 0xff00)
AM_RANGE(0xffff92, 0xffff93) AM_DEVREADWRITE8("timer8_3", h8_timer8_channel_device, tcsr_r, tcsr_w, 0x00ff)
AM_RANGE(0xffff94, 0xffff97) AM_DEVREADWRITE8("timer8_2", h8_timer8_channel_device, tcor_r, tcor_w, 0xff00)
AM_RANGE(0xffff94, 0xffff97) AM_DEVREADWRITE8("timer8_3", h8_timer8_channel_device, tcor_r, tcor_w, 0x00ff)
AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("timer8_2", h8_timer8_channel_device, tcnt_r, tcnt_w, 0xff00)
AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("timer8_3", h8_timer8_channel_device, tcnt_r, tcnt_w, 0x00ff)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("sci0", h8_sci_device, smr_r, smr_w, 0xff00)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("sci0", h8_sci_device, brr_r, brr_w, 0x00ff)

View File

@ -47,6 +47,7 @@
#include "h8_port.h"
#include "h8_intc.h"
#include "h8_sci.h"
#include "h8_timer8.h"
#include "h8_timer16.h"
class h83006_device : public h8h_device {
@ -67,6 +68,10 @@ protected:
required_device<h8_port_device> port9;
required_device<h8_port_device> porta;
required_device<h8_port_device> portb;
required_device<h8h_timer8_channel_device> timer8_0;
required_device<h8h_timer8_channel_device> timer8_1;
required_device<h8h_timer8_channel_device> timer8_2;
required_device<h8h_timer8_channel_device> timer8_3;
required_device<h8_timer16_device> timer16;
required_device<h8h_timer16_channel_device> timer16_0;
required_device<h8h_timer16_channel_device> timer16_1;

View File

@ -1,6 +1,5 @@
#include "emu.h"
#include "h83008.h"
#include "h8_adc.h"
const device_type H83008 = &device_creator<h83008_device>;
@ -15,6 +14,10 @@ h83008_device::h83008_device(const machine_config &mconfig, const char *tag, dev
port9(*this, "port9"),
porta(*this, "porta"),
portb(*this, "portb"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer8_2(*this, "timer8_2"),
timer8_3(*this, "timer8_3"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -34,6 +37,10 @@ static MACHINE_CONFIG_FRAGMENT(h83008)
MCFG_H8_PORT_ADD("port9", h8_device::PORT_9, 0xc0, 0xc0)
MCFG_H8_PORT_ADD("porta", h8_device::PORT_A, 0x80, 0x00)
MCFG_H8_PORT_ADD("portb", h8_device::PORT_B, 0x00, 0x00)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_0", "intc", 36, 38, 39, "timer8_1", h8_timer8_channel_device::CHAIN_OVERFLOW, true, false)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_1", "intc", 37, 38, 39, "timer8_0", h8_timer8_channel_device::CHAIN_A, false, false)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_2", "intc", 40, 42, 43, "timer8_3", h8_timer8_channel_device::CHAIN_OVERFLOW, false, true)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_3", "intc", 41, 42, 43, "timer8_2", h8_timer8_channel_device::CHAIN_A, false, true)
MCFG_H8_TIMER16_ADD("timer16", 3, 0xf8)
MCFG_H8H_TIMER16_CHANNEL_ADD("timer16:0", 2, 2, "intc", 24)
MCFG_H8H_TIMER16_CHANNEL_ADD("timer16:1", 2, 2, "intc", 28)
@ -78,6 +85,22 @@ DEVICE_ADDRESS_MAP_START(map, 16, h83008_device)
AM_RANGE(0xffff78, 0xffff79) AM_DEVREADWRITE8("timer16:2", h8_timer16_channel_device, tior_r, tior_w, 0x00ff)
AM_RANGE(0xffff7a, 0xffff7b) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tcnt_r, tcnt_w )
AM_RANGE(0xffff7c, 0xffff7f) AM_DEVREADWRITE( "timer16:2", h8_timer16_channel_device, tgr_r, tgr_w )
AM_RANGE(0xffff80, 0xffff81) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcr_r, tcr_w, 0xff00)
AM_RANGE(0xffff80, 0xffff81) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcr_r, tcr_w, 0x00ff)
AM_RANGE(0xffff82, 0xffff83) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcsr_r, tcsr_w, 0xff00)
AM_RANGE(0xffff82, 0xffff83) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcsr_r, tcsr_w, 0x00ff)
AM_RANGE(0xffff84, 0xffff87) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcor_r, tcor_w, 0xff00)
AM_RANGE(0xffff84, 0xffff87) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcor_r, tcor_w, 0x00ff)
AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcnt_r, tcnt_w, 0xff00)
AM_RANGE(0xffff88, 0xffff89) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcnt_r, tcnt_w, 0x00ff)
AM_RANGE(0xffff90, 0xffff91) AM_DEVREADWRITE8("timer8_2", h8_timer8_channel_device, tcr_r, tcr_w, 0xff00)
AM_RANGE(0xffff90, 0xffff91) AM_DEVREADWRITE8("timer8_3", h8_timer8_channel_device, tcr_r, tcr_w, 0x00ff)
AM_RANGE(0xffff92, 0xffff93) AM_DEVREADWRITE8("timer8_2", h8_timer8_channel_device, tcsr_r, tcsr_w, 0xff00)
AM_RANGE(0xffff92, 0xffff93) AM_DEVREADWRITE8("timer8_3", h8_timer8_channel_device, tcsr_r, tcsr_w, 0x00ff)
AM_RANGE(0xffff94, 0xffff97) AM_DEVREADWRITE8("timer8_2", h8_timer8_channel_device, tcor_r, tcor_w, 0xff00)
AM_RANGE(0xffff94, 0xffff97) AM_DEVREADWRITE8("timer8_3", h8_timer8_channel_device, tcor_r, tcor_w, 0x00ff)
AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("timer8_2", h8_timer8_channel_device, tcnt_r, tcnt_w, 0xff00)
AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("timer8_3", h8_timer8_channel_device, tcnt_r, tcnt_w, 0x00ff)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("sci0", h8_sci_device, smr_r, smr_w, 0xff00)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("sci0", h8_sci_device, brr_r, brr_w, 0x00ff)

View File

@ -47,6 +47,7 @@
#include "h8_port.h"
#include "h8_intc.h"
#include "h8_sci.h"
#include "h8_timer8.h"
#include "h8_timer16.h"
class h83008_device : public h8h_device {
@ -67,6 +68,10 @@ protected:
required_device<h8_port_device> port9;
required_device<h8_port_device> porta;
required_device<h8_port_device> portb;
required_device<h8h_timer8_channel_device> timer8_0;
required_device<h8h_timer8_channel_device> timer8_1;
required_device<h8h_timer8_channel_device> timer8_2;
required_device<h8h_timer8_channel_device> timer8_3;
required_device<h8_timer16_device> timer16;
required_device<h8h_timer16_channel_device> timer16_0;
required_device<h8h_timer16_channel_device> timer16_1;

View File

@ -1,13 +1,11 @@
#include "emu.h"
#include "h83048.h"
#include "h8_adc.h"
const device_type H83044 = &device_creator<h83044_device>;
const device_type H83045 = &device_creator<h83045_device>;
const device_type H83047 = &device_creator<h83047_device>;
const device_type H83048 = &device_creator<h83048_device>;
h83048_device::h83048_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
h8h_device(mconfig, type, name, tag, owner, clock, shortname, source, address_map_delegate(FUNC(h83048_device::map), this)),
intc(*this, "intc"),

View File

@ -1,6 +1,5 @@
#include "emu.h"
#include "h83337.h"
#include "h8_adc.h"
const device_type H83334 = &device_creator<h83334_device>;
const device_type H83336 = &device_creator<h83336_device>;
@ -20,6 +19,8 @@ h83337_device::h83337_device(const machine_config &mconfig, device_type type, co
port7(*this, "port7"),
port8(*this, "port8"),
port9(*this, "port9"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
sci0(*this, "sci0"),
@ -40,6 +41,8 @@ h83337_device::h83337_device(const machine_config &mconfig, const char *tag, dev
port7(*this, "port7"),
port8(*this, "port8"),
port9(*this, "port9"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
sci0(*this, "sci0"),
@ -72,6 +75,8 @@ static MACHINE_CONFIG_FRAGMENT(h83337)
MCFG_H8_PORT_ADD("port7", h8_device::PORT_7, 0x00, 0x00)
MCFG_H8_PORT_ADD("port8", h8_device::PORT_8, 0x80, 0x80)
MCFG_H8_PORT_ADD("port9", h8_device::PORT_9, 0x00, 0x00)
MCFG_H8_TIMER8_CHANNEL_ADD("timer8_0", "intc", 19, 20, 21, 8, 2, 64, 32, 1024, 256)
MCFG_H8_TIMER8_CHANNEL_ADD("timer8_1", "intc", 22, 23, 24, 8, 2, 64, 128, 1024, 2048)
MCFG_H8_TIMER16_ADD("timer16", 1, 0xff)
MCFG_H8_TIMER16_CHANNEL_ADD("timer16:0", 4, 0, "intc", 32)
MCFG_H8_SCI_ADD("sci0", "intc", 27, 28, 29, 30)
@ -115,11 +120,20 @@ DEVICE_ADDRESS_MAP_START(map, 16, h83337_device)
AM_RANGE(0xffbe, 0xffbf) AM_DEVREADWRITE8("port8", h8_port_device, port_r, dr_w, 0x00ff)
AM_RANGE(0xffc0, 0xffc1) AM_DEVWRITE8( "port9", h8_port_device, ddr_w, 0xff00)
AM_RANGE(0xffc0, 0xffc1) AM_DEVREADWRITE8("port9", h8_port_device, port_r, dr_w, 0x00ff)
AM_RANGE(0xffc2, 0xffc3) AM_READWRITE8( wscr_r, wscr_w, 0xff00)
AM_RANGE(0xffc2, 0xffc3) AM_READWRITE8( stcr_r, stcr_w, 0x00ff)
AM_RANGE(0xffc4, 0xffc5) AM_READWRITE8( syscr_r, syscr_w, 0xff00)
AM_RANGE(0xffc4, 0xffc5) AM_READWRITE8( mdcr_r, mdcr_w, 0x00ff)
AM_RANGE(0xffc6, 0xffc7) AM_DEVREADWRITE8("intc", h8_intc_device, iscr_r, iscr_w, 0xff00)
AM_RANGE(0xffc6, 0xffc7) AM_DEVREADWRITE8("intc", h8_intc_device, ier_r, ier_w, 0x00ff)
AM_RANGE(0xffc8, 0xffc9) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcr_r, tcr_w, 0xff00)
AM_RANGE(0xffc8, 0xffc9) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcsr_r, tcsr_w, 0x00ff)
AM_RANGE(0xffca, 0xffcb) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcor_r, tcor_w, 0xffff)
AM_RANGE(0xffcc, 0xffcd) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcnt_r, tcnt_w, 0xff00)
AM_RANGE(0xffd0, 0xffd1) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcr_r, tcr_w, 0xff00)
AM_RANGE(0xffd0, 0xffd1) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcsr_r, tcsr_w, 0x00ff)
AM_RANGE(0xffd2, 0xffd3) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcor_r, tcor_w, 0xffff)
AM_RANGE(0xffd4, 0xffd5) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcnt_r, tcnt_w, 0xff00)
AM_RANGE(0xffd8, 0xffd9) AM_DEVREADWRITE8("sci0", h8_sci_device, smr_r, smr_w, 0xff00)
AM_RANGE(0xffd8, 0xffd9) AM_DEVREADWRITE8("sci0", h8_sci_device, brr_r, brr_w, 0x00ff)
AM_RANGE(0xffda, 0xffdb) AM_DEVREADWRITE8("sci0", h8_sci_device, scr_r, scr_w, 0xff00)
@ -169,6 +183,8 @@ void h83337_device::internal_update(UINT64 current_time)
add_event(event_time, adc->internal_update(current_time));
add_event(event_time, sci0->internal_update(current_time));
add_event(event_time, sci1->internal_update(current_time));
add_event(event_time, timer8_0->internal_update(current_time));
add_event(event_time, timer8_1->internal_update(current_time));
add_event(event_time, timer16_0->internal_update(current_time));
recompute_bcount(event_time);
@ -195,3 +211,35 @@ WRITE8_MEMBER(h83337_device::syscr_w)
syscr = data;
logerror("%s: syscr = %02x\n", tag(), data);
}
READ8_MEMBER(h83337_device::wscr_r)
{
return 0x00;
}
WRITE8_MEMBER(h83337_device::wscr_w)
{
logerror("%s: wscr = %02x\n", tag(), data);
}
READ8_MEMBER(h83337_device::stcr_r)
{
return 0x00;
}
WRITE8_MEMBER(h83337_device::stcr_w)
{
logerror("%s: stcr = %02x\n", tag(), data);
timer8_0->set_extra_clock_bit(data & 0x01);
timer8_1->set_extra_clock_bit(data & 0x02);
}
READ8_MEMBER(h83337_device::mdcr_r)
{
return 0x00;
}
WRITE8_MEMBER(h83337_device::mdcr_w)
{
logerror("%s: mdcr = %02x\n", tag(), data);
}

View File

@ -53,6 +53,7 @@
#include "h8_adc.h"
#include "h8_port.h"
#include "h8_intc.h"
#include "h8_timer8.h"
#include "h8_timer16.h"
#include "h8_sci.h"
@ -61,8 +62,14 @@ public:
h83337_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
h83337_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ8_MEMBER(wscr_r);
DECLARE_WRITE8_MEMBER(wscr_w);
DECLARE_READ8_MEMBER(stcr_r);
DECLARE_WRITE8_MEMBER(stcr_w);
DECLARE_READ8_MEMBER(syscr_r);
DECLARE_WRITE8_MEMBER(syscr_w);
DECLARE_READ8_MEMBER(mdcr_r);
DECLARE_WRITE8_MEMBER(mdcr_w);
protected:
required_device<h8_intc_device> intc;
@ -76,6 +83,8 @@ protected:
required_device<h8_port_device> port7;
required_device<h8_port_device> port8;
required_device<h8_port_device> port9;
required_device<h8_timer8_channel_device> timer8_0;
required_device<h8_timer8_channel_device> timer8_1;
required_device<h8_timer16_device> timer16;
required_device<h8_timer16_channel_device> timer16_0;
required_device<h8_sci_device> sci0;

View File

@ -0,0 +1,372 @@
#include "emu.h"
#include "h8_timer8.h"
const device_type H8_TIMER8_CHANNEL = &device_creator<h8_timer8_channel_device>;
const device_type H8H_TIMER8_CHANNEL = &device_creator<h8h_timer8_channel_device>;
h8_timer8_channel_device::h8_timer8_channel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, H8_TIMER8_CHANNEL, "H8 8-bits timer channel", tag, owner, clock, "h8_8bits_timer_channel", __FILE__),
cpu(*this, "^")
{
}
h8_timer8_channel_device::h8_timer8_channel_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
cpu(*this, "^")
{
}
void h8_timer8_channel_device::set_info(const char *intc, int _irq_ca, int _irq_cb, int _irq_v, int div1, int div2, int div3, int div4, int div5, int div6)
{
intc_tag = intc;
irq_ca = _irq_ca;
irq_cb = _irq_cb;
irq_v = _irq_v;
chain_tag = NULL;
chain_type = STOPPED;
has_adte = false;
has_ice = false;
div_tab[0] = div1;
div_tab[1] = div2;
div_tab[2] = div3;
div_tab[3] = div4;
div_tab[4] = div5;
div_tab[5] = div6;
}
READ8_MEMBER(h8_timer8_channel_device::tcr_r)
{
return tcr;
}
WRITE8_MEMBER(h8_timer8_channel_device::tcr_w)
{
update_counter();
tcr = data;
update_tcr();
recalc_event();
}
void h8_timer8_channel_device::set_extra_clock_bit(bool bit)
{
update_counter();
extra_clock_bit = bit;
update_tcr();
recalc_event();
}
void h8_timer8_channel_device::update_tcr()
{
switch(tcr & TCR_CKS) {
case 0:
clock_type = STOPPED;
clock_divider = 0;
logerror("%s: clock stopped", tag());
break;
case 1: case 2: case 3:
clock_type = DIV;
clock_divider = div_tab[((tcr & TCR_CKS)-1)*2 + extra_clock_bit];
logerror("%s: clock %dHz", tag(), cpu->clock()/clock_divider);
break;
case 4:
clock_type = chain_type;
clock_divider = 0;
logerror("%s: clock chained %s", tag(), clock_type == CHAIN_A ? "tcora" : "overflow");
break;
case 5:
clock_type = INPUT_UP;
clock_divider = 0;
logerror("%s: clock external raising edge", tag());
break;
case 6:
clock_type = INPUT_DOWN;
clock_divider = 0;
logerror("%s: clock external falling edge", tag());
break;
case 7:
clock_type = INPUT_UPDOWN;
clock_divider = 0;
logerror("%s: clock external both edges", tag());
break;
}
switch(tcr & TCR_CCLR) {
case 0x00:
clear_type = CLEAR_NONE;
logerror(", no clear");
break;
case 0x08:
clear_type = CLEAR_A;
logerror(", clear on tcora");
break;
case 0x10:
clear_type = CLEAR_B;
logerror(", clear on tcorb");
break;
case 0x18:
clear_type = CLEAR_EXTERNAL;
logerror(", clear on external");
break;
}
logerror(", irq=%c%c%c\n",
tcr & TCR_CMIEB ? 'b' : '-',
tcr & TCR_CMIEA ? 'a' : '-',
tcr & TCR_OVIE ? 'o' : '-');
}
READ8_MEMBER(h8_timer8_channel_device::tcsr_r)
{
return tcsr;
}
WRITE8_MEMBER(h8_timer8_channel_device::tcsr_w)
{
update_counter();
UINT8 mask = has_adte || has_ice ? 0x1f : 0x0f;
tcsr = (tcsr & ~mask) | (data & mask);
tcsr &= data | 0x1f;
logerror("%s: tcsr_w %02x\n", tag(), tcsr);
recalc_event();
}
READ8_MEMBER(h8_timer8_channel_device::tcor_r)
{
return tcor[offset];
}
WRITE8_MEMBER(h8_timer8_channel_device::tcor_w)
{
update_counter();
tcor[offset] = data;
logerror("%s: tcor%c_w %02x\n", tag(), 'a'+offset, data);
recalc_event();
}
READ8_MEMBER(h8_timer8_channel_device::tcnt_r)
{
update_counter();
recalc_event();
return tcnt;
}
WRITE8_MEMBER(h8_timer8_channel_device::tcnt_w)
{
update_counter();
tcnt = data;
logerror("%s: tcnt_w %02x\n", tag(), data);
recalc_event();
}
void h8_timer8_channel_device::device_start()
{
intc = siblingdevice<h8_intc_device>(intc_tag);
if(chain_tag)
chained_timer = siblingdevice<h8_timer8_channel_device>(chain_tag);
else
chained_timer = NULL;
}
void h8_timer8_channel_device::device_reset()
{
tcr = 0x00;
tcsr = has_adte || has_ice ? 0x00 : 0x10;
tcor[0] = 0xff;
tcor[1] = 0xff;
tcnt = 0x00;
counter_cycle = 0x100;
clock_type = STOPPED;
clock_divider = 0;
clear_type = CLEAR_NONE;
last_clock_update = 0;
event_time = 0;
extra_clock_bit = false;
}
UINT64 h8_timer8_channel_device::internal_update(UINT64 current_time)
{
if(event_time && current_time >= event_time) {
update_counter(current_time);
if(0)
logerror("%s: Reached event time (%ld), counter=%02x, dt=%d\n", tag(), long(current_time), tcnt, int(current_time - event_time));
recalc_event(current_time);
}
return event_time;
}
void h8_timer8_channel_device::update_counter(UINT64 cur_time)
{
if(clock_type != DIV)
return;
if(!cur_time)
cur_time = cpu->get_cycle();
UINT64 base_time = (last_clock_update + clock_divider/2) / clock_divider;
UINT64 new_time = (cur_time + clock_divider/2) / clock_divider;
int ott = tcnt;
int tt = tcnt + new_time - base_time;
tcnt = tt % counter_cycle;
if(tt == tcor[0] || tcnt == tcor[0]) {
if(chained_timer)
chained_timer->chained_timer_tcora();
if(!(tcsr & TCSR_CMFA)) {
tcsr |= TCSR_CMFA;
if(tcr & TCR_CMIEA)
intc->internal_interrupt(irq_ca);
}
}
if(!(tcsr & TCSR_CMFB) && (tt == tcor[1] || tcnt == tcor[1])) {
tcsr |= TCSR_CMFB;
if(tcr & TCR_CMIEB)
intc->internal_interrupt(irq_cb);
}
if(tt >= 0x100) {
if(chained_timer)
chained_timer->chained_timer_overflow();
if(!(tcsr & TCSR_OVF)) {
tcsr |= TCSR_OVF;
if(tcr & TCR_OVIE)
intc->internal_interrupt(irq_v);
}
}
last_clock_update = cur_time;
}
void h8_timer8_channel_device::recalc_event(UINT64 cur_time)
{
bool update_cpu = cur_time == 0;
UINT64 old_event_time = event_time;
if(clock_type != DIV) {
event_time = 0;
if(old_event_time && update_cpu)
cpu->internal_update();
return;
}
if(!cur_time)
cur_time = cpu->get_cycle();
UINT32 event_delay = 0xffffffff;
if(clear_type == CLEAR_A || clear_type == CLEAR_B)
counter_cycle = tcor[clear_type - CLEAR_A];
else {
counter_cycle = 0x100;
event_delay = counter_cycle - tcnt;
if(!event_delay)
event_delay = counter_cycle;
}
for(int i=0; i<2; i++) {
UINT32 new_delay = 0xffffffff;
if(tcor[i] > tcnt) {
if(tcnt >= counter_cycle || tcor[i] <= counter_cycle)
new_delay = tcor[i] - tcnt;
} else if(tcor[i] <= counter_cycle) {
if(tcnt < counter_cycle)
new_delay = (counter_cycle - tcnt) + tcor[i];
else
new_delay = (0x100 - tcnt) + tcor[i];
}
if(event_delay > new_delay)
event_delay = new_delay;
}
if(event_delay != 0xffffffff)
event_time = ((((cur_time + clock_divider) >> clock_divider) + event_delay - 1) << clock_divider) + clock_divider/2;
else
event_time = 0;
if(old_event_time != event_time && update_cpu)
cpu->internal_update();
}
void h8_timer8_channel_device::chained_timer_overflow()
{
if(clock_type == CHAIN_OVERFLOW)
timer_tick();
}
void h8_timer8_channel_device::chained_timer_tcora()
{
if(clock_type == CHAIN_A)
timer_tick();
}
void h8_timer8_channel_device::timer_tick()
{
tcnt++;
if(tcnt == tcor[0]) {
if(chained_timer)
chained_timer->chained_timer_tcora();
if(!(tcsr & TCSR_CMFA)) {
tcsr |= TCSR_CMFA;
if(tcr & TCR_CMIEA)
intc->internal_interrupt(irq_ca);
}
}
if(!(tcsr & TCSR_CMFB) && tcnt == tcor[1]) {
tcsr |= TCSR_CMFB;
if(tcr & TCR_CMIEB)
intc->internal_interrupt(irq_cb);
}
if(tcnt == 0x00) {
if(chained_timer)
chained_timer->chained_timer_overflow();
if(!(tcsr & TCSR_OVF)) {
tcsr |= TCSR_OVF;
if(tcr & TCR_OVIE)
intc->internal_interrupt(irq_v);
}
}
}
h8h_timer8_channel_device::h8h_timer8_channel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
h8_timer8_channel_device(mconfig, H8H_TIMER8_CHANNEL, "H8H 8-bits timer channel", tag, owner, clock, "h8h_16bits_timer_channel", __FILE__)
{
}
h8h_timer8_channel_device::~h8h_timer8_channel_device()
{
}
void h8h_timer8_channel_device::set_info(const char *intc, int _irq_ca, int _irq_cb, int _irq_v, const char *_chain_tag, int _chain_type, bool _has_adte, bool _has_ice)
{
intc_tag = intc;
irq_ca = _irq_ca;
irq_cb = _irq_cb;
irq_v = _irq_v;
chain_tag = _chain_tag;
chain_type = _chain_type;
has_adte = _has_adte;
has_ice = _has_ice;
// The extra clock bit is not used for h8h+
div_tab[0] = 8;
div_tab[1] = 8;
div_tab[2] = 64;
div_tab[3] = 64;
div_tab[4] = 8192;
div_tab[5] = 8192;
}

View File

@ -0,0 +1,141 @@
/***************************************************************************
h8_timer8.h
H8 8 bits timer
****************************************************************************
Copyright Olivier Galibert
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name 'MAME' nor the names of its contributors may be
used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY OLIVIER GALIBERT ''AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL OLIVIER GALIBERT BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
#ifndef __H8_TIMER8_H__
#define __H8_TIMER8_H__
#include "h8.h"
#include "h8_intc.h"
#define MCFG_H8_TIMER8_CHANNEL_ADD( _tag, intc, irq_ca, irq_cb, irq_v, div1, div2, div3, div4, div5, div6 ) \
MCFG_DEVICE_ADD( _tag, H8_TIMER8_CHANNEL, 0 ) \
downcast<h8_timer8_channel_device *>(device)->set_info(intc, irq_ca, irq_cb, irq_v, div1, div2, div3, div4, div5, div6);
#define MCFG_H8H_TIMER8_CHANNEL_ADD( _tag, intc, irq_ca, irq_cb, irq_v, chain, chain_mode, has_adte, has_ice ) \
MCFG_DEVICE_ADD( _tag, H8H_TIMER8_CHANNEL, 0 ) \
downcast<h8h_timer8_channel_device *>(device)->set_info(intc, irq_ca, irq_cb, irq_v, chain, chain_mode, has_adte, has_ice);
class h8_timer8_channel_device : public device_t {
public:
enum {
STOPPED,
CHAIN_A,
CHAIN_OVERFLOW,
INPUT_UP,
INPUT_DOWN,
INPUT_UPDOWN,
DIV
};
h8_timer8_channel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
h8_timer8_channel_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
void set_info(const char *intc, int irq_ca, int irq_cb, int irq_v, int div1, int div2, int div3, int div4, int div5, int div6);
DECLARE_READ8_MEMBER(tcr_r);
DECLARE_WRITE8_MEMBER(tcr_w);
DECLARE_READ8_MEMBER(tcsr_r);
DECLARE_WRITE8_MEMBER(tcsr_w);
DECLARE_READ8_MEMBER(tcor_r);
DECLARE_WRITE8_MEMBER(tcor_w);
DECLARE_READ8_MEMBER(tcnt_r);
DECLARE_WRITE8_MEMBER(tcnt_w);
UINT64 internal_update(UINT64 current_time);
void set_extra_clock_bit(bool bit);
void chained_timer_overflow();
void chained_timer_tcora();
protected:
enum {
TCR_CKS = 0x07,
TCR_CCLR = 0x18,
TCR_OVIE = 0x20,
TCR_CMIEA = 0x40,
TCR_CMIEB = 0x80,
TCSR_OS = 0x0f,
TCSR_ADTE = 0x10,
TCSR_OVF = 0x20,
TCSR_CMFA = 0x40,
TCSR_CMFB = 0x80
};
enum {
CLEAR_NONE,
CLEAR_A,
CLEAR_B,
CLEAR_EXTERNAL
};
required_device<h8_device> cpu;
h8_timer8_channel_device *chained_timer;
h8_intc_device *intc;
const char *chain_tag, *intc_tag;
int irq_ca, irq_cb, irq_v, chain_type;
int div_tab[6];
UINT8 tcor[2];
UINT8 tcr, tcsr, tcnt;
bool extra_clock_bit, has_adte, has_ice;
int clock_type, clock_divider, clear_type, counter_cycle;
UINT64 last_clock_update, event_time;
virtual void device_start();
virtual void device_reset();
void update_counter(UINT64 cur_time = 0);
void recalc_event(UINT64 cur_time = 0);
void timer_tick();
void update_tcr();
};
class h8h_timer8_channel_device : public h8_timer8_channel_device {
public:
h8h_timer8_channel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~h8h_timer8_channel_device();
void set_info(const char *intc, int irq_ca, int irq_cb, int irq_v, const char *chain_tag, int chain_type, bool has_adte, bool has_ice);
};
extern const device_type H8_TIMER8_CHANNEL;
extern const device_type H8H_TIMER8_CHANNEL;
#endif

View File

@ -1,6 +1,5 @@
#include "emu.h"
#include "h8s2245.h"
#include "h8_adc.h"
const device_type H8S2241 = &device_creator<h8s2241_device>;
const device_type H8S2242 = &device_creator<h8s2242_device>;
@ -24,6 +23,8 @@ h8s2245_device::h8s2245_device(const machine_config &mconfig, device_type type,
porte(*this, "porte"),
portf(*this, "portf"),
portg(*this, "portg"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -50,6 +51,8 @@ h8s2245_device::h8s2245_device(const machine_config &mconfig, const char *tag, d
porte(*this, "porte"),
portf(*this, "portf"),
portg(*this, "portg"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -94,6 +97,8 @@ static MACHINE_CONFIG_FRAGMENT(h8s2245)
MCFG_H8_PORT_ADD("porte", h8_device::PORT_E, 0x00, 0x00)
MCFG_H8_PORT_ADD("portf", h8_device::PORT_F, 0x00, 0x00)
MCFG_H8_PORT_ADD("portg", h8_device::PORT_G, 0xe0, 0x00)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_0", "intc", 64, 65, 66, "timer8_1", h8_timer8_channel_device::CHAIN_OVERFLOW, true, false)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_1", "intc", 68, 69, 70, "timer8_0", h8_timer8_channel_device::CHAIN_A, false, false)
MCFG_H8_TIMER16_ADD("timer16", 3, 0x00)
MCFG_H8S_TIMER16_CHANNEL_ADD("timer16:0", 4, 0x60, "intc", 32,
h8_timer16_channel_device::DIV_1,
@ -204,6 +209,14 @@ DEVICE_ADDRESS_MAP_START(map, 16, h8s2245_device)
AM_RANGE(0xffff90, 0xffff97) AM_DEVREAD8( "adc", h8_adc_device, addr8_r, 0xffff)
AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("adc", h8_adc_device, adcsr_r, adcsr_w, 0xff00)
AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("adc", h8_adc_device, adcr_r, adcr_w, 0x00ff)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcr_r, tcr_w, 0xff00)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcr_r, tcr_w, 0x00ff)
AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcsr_r, tcsr_w, 0xff00)
AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcsr_r, tcsr_w, 0x00ff)
AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcor_r, tcor_w, 0xff00)
AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcor_r, tcor_w, 0x00ff)
AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcnt_r, tcnt_w, 0xff00)
AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcnt_r, tcnt_w, 0x00ff)
AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16", h8_timer16_device, tstr_r, tstr_w, 0xff00)
AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16", h8_timer16_device, tsyr_r, tsyr_w, 0x00ff)
AM_RANGE(0xffffd0, 0xffffd1) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tcr_r, tcr_w, 0xff00)

View File

@ -54,6 +54,7 @@
#include "h8_port.h"
#include "h8_intc.h"
#include "h8_sci.h"
#include "h8_timer8.h"
#include "h8_timer16.h"
class h8s2245_device : public h8s2000_device {
@ -79,6 +80,8 @@ protected:
required_device<h8_port_device> porte;
required_device<h8_port_device> portf;
required_device<h8_port_device> portg;
required_device<h8h_timer8_channel_device> timer8_0;
required_device<h8h_timer8_channel_device> timer8_1;
required_device<h8_timer16_device> timer16;
required_device<h8s_timer16_channel_device> timer16_0;
required_device<h8s_timer16_channel_device> timer16_1;

View File

@ -1,6 +1,5 @@
#include "emu.h"
#include "h8s2320.h"
#include "h8_adc.h"
const device_type H8S2320 = &device_creator<h8s2320_device>;
const device_type H8S2321 = &device_creator<h8s2321_device>;
@ -30,6 +29,8 @@ h8s2320_device::h8s2320_device(const machine_config &mconfig, device_type type,
porte(*this, "porte"),
portf(*this, "portf"),
portg(*this, "portg"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -60,6 +61,8 @@ h8s2320_device::h8s2320_device(const machine_config &mconfig, const char *tag, d
porte(*this, "porte"),
portf(*this, "portf"),
portg(*this, "portg"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -138,6 +141,8 @@ static MACHINE_CONFIG_FRAGMENT(h8s2320)
MCFG_H8_PORT_ADD("porte", h8_device::PORT_E, 0x00, 0x00)
MCFG_H8_PORT_ADD("portf", h8_device::PORT_F, 0x00, 0x00)
MCFG_H8_PORT_ADD("portg", h8_device::PORT_G, 0xe0, 0xe0)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_0", "intc", 64, 65, 66, "timer8_1", h8_timer8_channel_device::CHAIN_OVERFLOW, true, false)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_1", "intc", 68, 69, 70, "timer8_0", h8_timer8_channel_device::CHAIN_A, false, false)
MCFG_H8_TIMER16_ADD("timer16", 6, 0x00)
MCFG_H8S_TIMER16_CHANNEL_ADD("timer16:0", 4, 0x60, "intc", 32,
h8_timer16_channel_device::DIV_1,
@ -303,6 +308,15 @@ DEVICE_ADDRESS_MAP_START(map, 16, h8s2320_device)
AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("adc", h8_adc_device, adcsr_r, adcsr_w, 0xff00)
AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("adc", h8_adc_device, adcr_r, adcr_w, 0x00ff)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcr_r, tcr_w, 0xff00)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcr_r, tcr_w, 0x00ff)
AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcsr_r, tcsr_w, 0xff00)
AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcsr_r, tcsr_w, 0x00ff)
AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcor_r, tcor_w, 0xff00)
AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcor_r, tcor_w, 0x00ff)
AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcnt_r, tcnt_w, 0xff00)
AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcnt_r, tcnt_w, 0x00ff)
AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16", h8_timer16_device, tstr_r, tstr_w, 0xff00)
AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16", h8_timer16_device, tsyr_r, tsyr_w, 0x00ff)

View File

@ -59,6 +59,7 @@
#include "h8_port.h"
#include "h8_intc.h"
#include "h8_sci.h"
#include "h8_timer8.h"
#include "h8_timer16.h"
class h8s2320_device : public h8s2000_device {
@ -85,6 +86,8 @@ protected:
required_device<h8_port_device> porte;
required_device<h8_port_device> portf;
required_device<h8_port_device> portg;
required_device<h8h_timer8_channel_device> timer8_0;
required_device<h8h_timer8_channel_device> timer8_1;
required_device<h8_timer16_device> timer16;
required_device<h8s_timer16_channel_device> timer16_0;
required_device<h8s_timer16_channel_device> timer16_1;

View File

@ -1,6 +1,6 @@
#include "emu.h"
#include "h8s2357.h"
#include "h8_adc.h"
const device_type H8S2357 = &device_creator<h8s2357_device>;
const device_type H8S2352 = &device_creator<h8s2352_device>;
const device_type H8S2398 = &device_creator<h8s2398_device>;
@ -25,6 +25,8 @@ h8s2357_device::h8s2357_device(const machine_config &mconfig, device_type type,
porte(*this, "porte"),
portf(*this, "portf"),
portg(*this, "portg"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -55,6 +57,8 @@ h8s2357_device::h8s2357_device(const machine_config &mconfig, const char *tag, d
porte(*this, "porte"),
portf(*this, "portf"),
portg(*this, "portg"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -115,6 +119,8 @@ static MACHINE_CONFIG_FRAGMENT(h8s2357)
MCFG_H8_PORT_ADD("porte", h8_device::PORT_E, 0x00, 0x00)
MCFG_H8_PORT_ADD("portf", h8_device::PORT_F, 0x00, 0x00)
MCFG_H8_PORT_ADD("portg", h8_device::PORT_G, 0xe0, 0xe0)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_0", "intc", 64, 65, 66, "timer8_1", h8_timer8_channel_device::CHAIN_OVERFLOW, true, false)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_1", "intc", 68, 69, 70, "timer8_0", h8_timer8_channel_device::CHAIN_A, false, false)
MCFG_H8_TIMER16_ADD("timer16", 6, 0x00)
MCFG_H8S_TIMER16_CHANNEL_ADD("timer16:0", 4, 0x60, "intc", 32,
h8_timer16_channel_device::DIV_1,
@ -276,6 +282,14 @@ DEVICE_ADDRESS_MAP_START(map, 16, h8s2357_device)
AM_RANGE(0xffff90, 0xffff97) AM_DEVREAD8( "adc", h8_adc_device, addr8_r, 0xffff)
AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("adc", h8_adc_device, adcsr_r, adcsr_w, 0xff00)
AM_RANGE(0xffff98, 0xffff99) AM_DEVREADWRITE8("adc", h8_adc_device, adcr_r, adcr_w, 0x00ff)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcr_r, tcr_w, 0xff00)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcr_r, tcr_w, 0x00ff)
AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcsr_r, tcsr_w, 0xff00)
AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcsr_r, tcsr_w, 0x00ff)
AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcor_r, tcor_w, 0xff00)
AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcor_r, tcor_w, 0x00ff)
AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcnt_r, tcnt_w, 0xff00)
AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcnt_r, tcnt_w, 0x00ff)
AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16", h8_timer16_device, tstr_r, tstr_w, 0xff00)
AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16", h8_timer16_device, tsyr_r, tsyr_w, 0x00ff)
AM_RANGE(0xffffd0, 0xffffd1) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tcr_r, tcr_w, 0xff00)

View File

@ -56,6 +56,7 @@
#include "h8_port.h"
#include "h8_intc.h"
#include "h8_sci.h"
#include "h8_timer8.h"
#include "h8_timer16.h"
class h8s2357_device : public h8s2000_device {
@ -82,6 +83,8 @@ protected:
required_device<h8_port_device> porte;
required_device<h8_port_device> portf;
required_device<h8_port_device> portg;
required_device<h8h_timer8_channel_device> timer8_0;
required_device<h8h_timer8_channel_device> timer8_1;
required_device<h8_timer16_device> timer16;
required_device<h8s_timer16_channel_device> timer16_0;
required_device<h8s_timer16_channel_device> timer16_1;

View File

@ -1,6 +1,5 @@
#include "emu.h"
#include "h8s2655.h"
#include "h8_adc.h"
const device_type H8S2655 = &device_creator<h8s2655_device>;
const device_type H8S2653 = &device_creator<h8s2653_device>;
@ -22,6 +21,8 @@ h8s2655_device::h8s2655_device(const machine_config &mconfig, device_type type,
porte(*this, "porte"),
portf(*this, "portf"),
portg(*this, "portg"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -53,6 +54,8 @@ h8s2655_device::h8s2655_device(const machine_config &mconfig, const char *tag, d
porte(*this, "porte"),
portf(*this, "portf"),
portg(*this, "portg"),
timer8_0(*this, "timer8_0"),
timer8_1(*this, "timer8_1"),
timer16(*this, "timer16"),
timer16_0(*this, "timer16:0"),
timer16_1(*this, "timer16:1"),
@ -89,6 +92,8 @@ static MACHINE_CONFIG_FRAGMENT(h8s2655)
MCFG_H8_PORT_ADD("porte", h8_device::PORT_E, 0x00, 0x00)
MCFG_H8_PORT_ADD("portf", h8_device::PORT_F, 0x00, 0x00)
MCFG_H8_PORT_ADD("portg", h8_device::PORT_G, 0xe0, 0xe0)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_0", "intc", 64, 65, 66, "timer8_1", h8_timer8_channel_device::CHAIN_OVERFLOW, true, false)
MCFG_H8H_TIMER8_CHANNEL_ADD("timer8_1", "intc", 68, 69, 70, "timer8_0", h8_timer8_channel_device::CHAIN_A, false, false)
MCFG_H8_TIMER16_ADD("timer16", 6, 0x00)
MCFG_H8S_TIMER16_CHANNEL_ADD("timer16:0", 4, 0x60, "intc", 32,
h8_timer16_channel_device::DIV_1,
@ -251,6 +256,14 @@ DEVICE_ADDRESS_MAP_START(map, 16, h8s2655_device)
AM_RANGE(0xffff90, 0xffff9f) AM_DEVREAD( "adc", h8_adc_device, addr16_r )
AM_RANGE(0xffffa0, 0xffffa1) AM_DEVREADWRITE8("adc", h8_adc_device, adcsr_r, adcsr_w, 0xff00)
AM_RANGE(0xffffa0, 0xffffa1) AM_DEVREADWRITE8("adc", h8_adc_device, adcr_r, adcr_w, 0x00ff)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcr_r, tcr_w, 0xff00)
AM_RANGE(0xffffb0, 0xffffb1) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcr_r, tcr_w, 0x00ff)
AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcsr_r, tcsr_w, 0xff00)
AM_RANGE(0xffffb2, 0xffffb3) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcsr_r, tcsr_w, 0x00ff)
AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcor_r, tcor_w, 0xff00)
AM_RANGE(0xffffb4, 0xffffb7) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcor_r, tcor_w, 0x00ff)
AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_0", h8_timer8_channel_device, tcnt_r, tcnt_w, 0xff00)
AM_RANGE(0xffffb8, 0xffffb9) AM_DEVREADWRITE8("timer8_1", h8_timer8_channel_device, tcnt_r, tcnt_w, 0x00ff)
AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16", h8_timer16_device, tstr_r, tstr_w, 0xff00)
AM_RANGE(0xffffc0, 0xffffc1) AM_DEVREADWRITE8("timer16", h8_timer16_device, tsyr_r, tsyr_w, 0x00ff)
AM_RANGE(0xffffd0, 0xffffd1) AM_DEVREADWRITE8("timer16:0", h8_timer16_channel_device, tcr_r, tcr_w, 0xff00)

View File

@ -47,6 +47,7 @@
#include "h8_adc.h"
#include "h8_port.h"
#include "h8_intc.h"
#include "h8_timer8.h"
#include "h8_timer16.h"
#include "h8_sci.h"
@ -74,6 +75,8 @@ protected:
required_device<h8_port_device> porte;
required_device<h8_port_device> portf;
required_device<h8_port_device> portg;
required_device<h8h_timer8_channel_device> timer8_0;
required_device<h8h_timer8_channel_device> timer8_1;
required_device<h8_timer16_device> timer16;
required_device<h8s_timer16_channel_device> timer16_0;
required_device<h8s_timer16_channel_device> timer16_1;

View File

@ -3034,7 +3034,7 @@ static INPUT_PORTS_START( rapidrvr )
PORT_START("IN23")
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0xf700, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0xf7ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("SERVICE")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )