ctk551: minor I/O corrections (#9076)

This commit is contained in:
Devin Acker 2021-12-31 22:39:23 -05:00 committed by GitHub
parent 54504e4558
commit 21c974e676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 15 deletions

View File

@ -26,6 +26,7 @@ DEFINE_DEVICE_TYPE(GT913, gt913_device, "gt913", "Casio GT913F")
gt913_device::gt913_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
h8_device(mconfig, GT913, tag, owner, clock, address_map_constructor(FUNC(gt913_device::map), this)),
device_mixer_interface(mconfig, *this, 2),
m_rom(*this, DEVICE_SELF),
m_bank(*this, "bank"),
m_intc(*this, "intc"),
@ -80,8 +81,11 @@ void gt913_device::map(address_map &map)
map(0xfff1, 0xfff1).rw(m_port[1], FUNC(h8_port_device::ddr_r), FUNC(h8_port_device::ddr_w));
map(0xfff2, 0xfff2).rw(m_port[0], FUNC(h8_port_device::port_r), FUNC(h8_port_device::dr_w));
map(0xfff3, 0xfff3).rw(m_port[1], FUNC(h8_port_device::port_r), FUNC(h8_port_device::dr_w));
// map(0xfff4, 0xfff4).nopw(); probably not port 3 DDR - ctk551 writes 0x00 but uses port 3 for output only
map(0xfff5, 0xfff5).rw(m_port[2], FUNC(h8_port_device::port_r), FUNC(h8_port_device::dr_w));
// likely port 3 - pins are shared with input matrix, ctk551 clears this register on boot and nothing else
// (specifically, the pins are also used for key velocity detection, so port 3 is probably used by very few models, if any at all)
map(0xfff4, 0xfff4).rw(m_port[2], FUNC(h8_port_device::port_r), FUNC(h8_port_device::dr_w));
// unknown - ctk551 sets/clears a few bits on boot and before going to sleep
// map(0xfff5, 0xfff5).noprw();
}
void gt913_device::device_add_mconfig(machine_config &config)
@ -90,6 +94,8 @@ void gt913_device::device_add_mconfig(machine_config &config)
GT913_SOUND(config, m_sound, DERIVED_CLOCK(1, 1));
m_sound->set_device_rom_tag(m_rom);
m_sound->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
m_sound->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
GT913_KBD_HLE(config, m_kbd, 0);
m_kbd->irq_cb().set([this] (int val) { if (val) m_intc->internal_interrupt(5); });

View File

@ -21,7 +21,7 @@
#include "machine/gt913_kbd.h"
#include "machine/gt913_snd.h"
class gt913_device : public h8_device {
class gt913_device : public h8_device, public device_mixer_interface {
public:
gt913_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

View File

@ -115,11 +115,12 @@ INPUT_CHANGED_MEMBER(ctk551_state::switch_w)
WRITE_LINE_MEMBER(ctk551_state::apo_w)
{
logerror("apo_w: %x\n", state);
/* auto power off - disable the LCD
/* auto power off - disable the LCD and speakers
the CPU will go to sleep until the power switch triggers a NMI */
if (state)
if (!state)
m_lcdc->reset();
m_led_power = !state;
m_led_power = state;
m_maincpu->set_output_gain(ALL_OUTPUTS, state ? 1.0 : 0.0);
}
@ -143,7 +144,7 @@ void ctk551_state::ctk551_io_map(address_map &map)
{
map(h8_device::PORT_1, h8_device::PORT_1).portr("P1_R").portw("P1_W").umask16(0x00ff);
map(h8_device::PORT_2, h8_device::PORT_2).portrw("P2").umask16(0x00ff);
map(h8_device::PORT_3, h8_device::PORT_3).portrw("P3").umask16(0x00ff);
map(h8_device::PORT_3, h8_device::PORT_3).noprw(); // port 3 pins are shared w/ key matrix
map(h8_device::ADC_0, h8_device::ADC_0).portr("AN0");
map(h8_device::ADC_1, h8_device::ADC_1).portr("AN1");
}
@ -165,8 +166,8 @@ void ctk551_state::ctk551(machine_config &config)
// 30MHz oscillator, divided down internally (otherwise the test mode's OK/NG sounds play at double speed)
GT913(config, m_maincpu, 30'000'000 / 2);
m_maincpu->set_addrmap(AS_IO, &ctk551_state::ctk551_io_map);
m_maincpu->subdevice<gt913_sound_device>("gt_sound")->add_route(0, "lspeaker", 1.0);
m_maincpu->subdevice<gt913_sound_device>("gt_sound")->add_route(1, "rspeaker", 1.0);
m_maincpu->add_route(0, "lspeaker", 1.0);
m_maincpu->add_route(1, "rspeaker", 1.0);
// MIDI
auto &mdin(MIDI_PORT(config, "mdin"));
@ -335,7 +336,7 @@ INPUT_PORTS_START(ctk551)
PORT_START("P1_W")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_MEMBER(ctk551_state, led_touch_w)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) // unknown
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_MEMBER(ctk551_state, apo_w)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("lcdc", hd44780_device, e_w)
PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_MEMBER(ctk551_state, lcd_w)
@ -345,11 +346,6 @@ INPUT_PORTS_START(ctk551)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("lcdc", hd44780_device, rw_w)
PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START("P3")
PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_MEMBER(ctk551_state, apo_w)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START("AN0")
PORT_CONFNAME( 0xff, 0x00, "Power Source" )
PORT_CONFSETTING( 0x00, "AC Adapter" )