Skip to content

Commit

Permalink
Re-add the subcomponents to the swx00 and tweak the adc
Browse files Browse the repository at this point in the history
  • Loading branch information
galibert committed Mar 5, 2024
1 parent 190f332 commit 84f5fb0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 27 deletions.
20 changes: 5 additions & 15 deletions src/devices/cpu/h8/swx00.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ DEFINE_DEVICE_TYPE(SWX00, swx00_device, "swx00", "Yamaha SWX00")
swx00_device::swx00_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, u8 mode) :
h8s2000_device(mconfig, SWX00, tag, owner, clock, address_map_constructor(FUNC(swx00_device::map), this)),
m_intc(*this, "intc"),
#if 0
m_adc(*this, "adc"),
m_dma(*this, "dma"),
m_dma0(*this, "dma:0"),
Expand Down Expand Up @@ -36,7 +35,6 @@ swx00_device::swx00_device(const machine_config &mconfig, const char *tag, devic
m_timer16_4(*this, "timer16:4"),
m_timer16_5(*this, "timer16:5"),
m_watchdog(*this, "watchdog"),
#endif
m_data_config(mode & MODE_DUAL ? "s" : "c", ENDIANNESS_BIG, 16, mode & MODE_DUAL ? 24 : 22),
m_mode(mode),
m_syscr(0)
Expand All @@ -46,8 +44,7 @@ swx00_device::swx00_device(const machine_config &mconfig, const char *tag, devic

void swx00_device::map(address_map &map)
{
map(0xffec00, 0xfffbff).ram();
#if 0
map(0xffe100, 0xfffbff).ram();
map(0xfffe80, 0xfffe80).rw(m_timer16_3, FUNC(h8_timer16_channel_device::tcr_r), FUNC(h8_timer16_channel_device::tcr_w));
map(0xfffe81, 0xfffe81).rw(m_timer16_3, FUNC(h8_timer16_channel_device::tmdr_r), FUNC(h8_timer16_channel_device::tmdr_w));
map(0xfffe82, 0xfffe83).rw(m_timer16_3, FUNC(h8_timer16_channel_device::tior_r), FUNC(h8_timer16_channel_device::tior_w));
Expand Down Expand Up @@ -163,9 +160,9 @@ void swx00_device::map(address_map &map)
map(0xffff8c, 0xffff8c).rw(m_sci[2], FUNC(h8_sci_device::ssr_r), FUNC(h8_sci_device::ssr_w));
map(0xffff8d, 0xffff8d).r(m_sci[2], FUNC(h8_sci_device::rdr_r));
map(0xffff8e, 0xffff8e).rw(m_sci[2], FUNC(h8_sci_device::scmr_r), FUNC(h8_sci_device::scmr_w));
map(0xffff90, 0xffff9f).r(m_adc, FUNC(h8_adc_device::addr16_r));
map(0xffffa0, 0xffffa0).rw(m_adc, FUNC(h8_adc_device::adcsr_r), FUNC(h8_adc_device::adcsr_w));
map(0xffffa1, 0xffffa1).rw(m_adc, FUNC(h8_adc_device::adcr_r), FUNC(h8_adc_device::adcr_w));
map(0xffff90, 0xffff97).r(m_adc, FUNC(h8_adc_device::addr8_r));
map(0xffff98, 0xffff98).rw(m_adc, FUNC(h8_adc_device::adcsr_r), FUNC(h8_adc_device::adcsr_w));
map(0xffff99, 0xffff99).rw(m_adc, FUNC(h8_adc_device::adcr_r), FUNC(h8_adc_device::adcr_w));
map(0xffffb0, 0xffffb0).rw(m_timer8_0, FUNC(h8_timer8_channel_device::tcr_r), FUNC(h8_timer8_channel_device::tcr_w));
map(0xffffb1, 0xffffb1).rw(m_timer8_1, FUNC(h8_timer8_channel_device::tcr_r), FUNC(h8_timer8_channel_device::tcr_w));
map(0xffffb2, 0xffffb2).rw(m_timer8_0, FUNC(h8_timer8_channel_device::tcsr_r), FUNC(h8_timer8_channel_device::tcsr_w));
Expand Down Expand Up @@ -199,14 +196,12 @@ void swx00_device::map(address_map &map)
map(0xfffff5, 0xfffff5).rw(m_timer16_2, FUNC(h8_timer16_channel_device::tsr_r), FUNC(h8_timer16_channel_device::tsr_w));
map(0xfffff6, 0xfffff7).rw(m_timer16_2, FUNC(h8_timer16_channel_device::tcnt_r), FUNC(h8_timer16_channel_device::tcnt_w));
map(0xfffff8, 0xfffffb).rw(m_timer16_2, FUNC(h8_timer16_channel_device::tgr_r), FUNC(h8_timer16_channel_device::tgr_w));
#endif
}

void swx00_device::device_add_mconfig(machine_config &config)
{
H8S_INTC(config, m_intc, *this);
#if 0
H8_ADC_2655(config, m_adc, *this, m_intc, 28);
H8_ADC_2357(config, m_adc, *this, m_intc, 28);
H8S_DMA(config, m_dma, *this);
H8S_DMA_CHANNEL(config, m_dma0, *this, m_dma, m_intc);
H8S_DMA_CHANNEL(config, m_dma1, *this, m_dma, m_intc);
Expand Down Expand Up @@ -282,7 +277,6 @@ void swx00_device::device_add_mconfig(machine_config &config)
h8_timer16_channel_device::INPUT_D);
H8_SCI(config, m_sci[2], 2, *this, m_intc, 88, 89, 90, 91);
H8_WATCHDOG(config, m_watchdog, *this, m_intc, 25, h8_watchdog_device::S);
#endif
H8_SCI(config, m_sci[0], 0, *this, m_intc, 80, 81, 82, 83);
H8_SCI(config, m_sci[1], 1, *this, m_intc, 84, 85, 86, 87);
}
Expand Down Expand Up @@ -393,7 +387,6 @@ void swx00_device::interrupt_taken()
void swx00_device::internal_update(u64 current_time)
{
u64 event_time = 0;
#if 0
add_event(event_time, m_adc->internal_update(current_time));
add_event(event_time, m_sci[0]->internal_update(current_time));
add_event(event_time, m_sci[1]->internal_update(current_time));
Expand All @@ -407,14 +400,12 @@ void swx00_device::internal_update(u64 current_time)
add_event(event_time, m_timer16_4->internal_update(current_time));
add_event(event_time, m_timer16_5->internal_update(current_time));
add_event(event_time, m_watchdog->internal_update(current_time));
#endif

recompute_bcount(event_time);
}

void swx00_device::notify_standby(int state)
{
#if 0
m_adc->notify_standby(state);
m_sci[0]->notify_standby(state);
m_sci[1]->notify_standby(state);
Expand All @@ -428,7 +419,6 @@ void swx00_device::notify_standby(int state)
m_timer16_4->notify_standby(state);
m_timer16_5->notify_standby(state);
m_watchdog->notify_standby(state);
#endif
}

void swx00_device::device_start()
Expand Down
4 changes: 0 additions & 4 deletions src/devices/cpu/h8/swx00.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class swx00_device : public h8s2000_device {
int s_bus_id() const { return m_mode & MODE_DUAL ? AS_DATA : AS_PROGRAM; }
int c_bus_id() const { return m_mode & MODE_DUAL ? AS_PROGRAM : AS_DATA; }

#if 0
auto read_port1() { return m_read_port [PORT_1].bind(); }
auto write_port1() { return m_write_port[PORT_1].bind(); }
auto read_port2() { return m_read_port [PORT_2].bind(); }
Expand All @@ -76,14 +75,12 @@ class swx00_device : public h8s2000_device {
auto write_portf() { return m_write_port[PORT_F].bind(); }
auto read_portg() { return m_read_port [PORT_G].bind(); }
auto write_portg() { return m_write_port[PORT_G].bind(); }
#endif

u8 syscr_r();
void syscr_w(u8 data);

protected:
required_device<h8s_intc_device> m_intc;
#if 0
required_device<h8_adc_device> m_adc;
required_device<h8s_dma_device> m_dma;
required_device<h8s_dma_channel_device> m_dma0;
Expand Down Expand Up @@ -111,7 +108,6 @@ class swx00_device : public h8s2000_device {
required_device<h8s_timer16_channel_device> m_timer16_4;
required_device<h8s_timer16_channel_device> m_timer16_5;
required_device<h8_watchdog_device> m_watchdog;
#endif

address_space_config m_data_config;

Expand Down
2 changes: 1 addition & 1 deletion src/devices/cpu/sh/sh_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void sh_port32_device::device_reset()

u32 sh_port32_device::dr_r()
{
if(~m_io & ~m_mask)
if((~m_io) & (~m_mask))
return (m_dr & m_io) | (m_cpu->do_read_port32(m_index) & ~m_io);
return m_dr;
}
Expand Down
9 changes: 6 additions & 3 deletions src/mame/yamaha/ymmu15.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class mu15_state : public driver_device
, m_maincpu(*this, "maincpu")
// , m_nvram(*this, "ram")
, m_lcd(*this, "lcd")
, m_ram(*this, "ram")
, m_ram1(*this, "ram1")
, m_ram2(*this, "ram2")
{ }

void mu15(machine_config &config);
Expand All @@ -46,7 +47,8 @@ class mu15_state : public driver_device
// required_device<nvram_device> m_nvram;
// required_device<swp00_device> m_swp00;
required_device<mu5lcd_device> m_lcd;
required_shared_ptr<u16> m_ram;
required_shared_ptr<u16> m_ram1;
required_shared_ptr<u16> m_ram2;

void c_map(address_map &map);
void s_map(address_map &map);
Expand All @@ -66,7 +68,8 @@ void mu15_state::machine_reset()
void mu15_state::s_map(address_map &map)
{
map(0x000000, 0x3fffff).rom().region("swx00", 0);
map(0x400000, 0x40ffff).ram().share(m_ram);
map(0x400000, 0x40ffff).ram().share(m_ram1);
map(0xc00000, 0xc03fff).ram().share(m_ram2);
// map(0x400000, 0x4007ff).m(m_swp00, FUNC(swp00_device::map));
}

Expand Down
5 changes: 1 addition & 4 deletions src/mame/yamaha/ympsr340.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ void psr340_state::psr340(machine_config &config)
SWX00(config, m_maincpu, 8.4672_MHz_XTAL*2, 1);
m_maincpu->set_addrmap(m_maincpu->c_bus_id(), &psr340_state::c_map);
m_maincpu->set_addrmap(m_maincpu->s_bus_id(), &psr340_state::s_map);
m_maincpu->read_adc<0>().set_constant(0x3ff); // Battery level

// SCI0 is externally clocked at the 31250 Hz MIDI rate by the mks3
m_maincpu->sci_set_external_clock_period(0, attotime::from_hz(31250 * 16));
Expand Down Expand Up @@ -303,10 +304,6 @@ ROM_START( psr340 )
ROM_REGION(0x200000, "maincpu", 0)
ROM_LOAD16_WORD_SWAP("xv89710.bin", 0x000000, 0x200000, CRC(271ccb8a) SHA1(ec6abbdb82a5e851b77338c79ecabfd8040f023d))

// patch out battery check for now (SWX00B customized H8S reads ADC *value* at FFFF90)
ROM_FILL(0x20e6, 1, 0x54)
ROM_FILL(0x20e7, 1, 0x70)

ROM_REGION16_BE(0x200000, "wave", 0)
ROM_LOAD("xv89810.bin", 0x000000, 0x200000, CRC(10e68363) SHA1(5edee814bf07c49088da44474fdd5c817e7c5af0))

Expand Down

0 comments on commit 84f5fb0

Please sign in to comment.