diff options
Diffstat (limited to 'src/devices/bus')
-rw-r--r-- | src/devices/bus/cbus/pc9801_26.cpp | 65 | ||||
-rw-r--r-- | src/devices/bus/cbus/pc9801_26.h | 2 | ||||
-rw-r--r-- | src/devices/bus/snes/event.cpp | 12 | ||||
-rw-r--r-- | src/devices/bus/snes/upd.cpp | 68 | ||||
-rw-r--r-- | src/devices/bus/ti99/peb/cc_fdc.cpp | 13 |
5 files changed, 101 insertions, 59 deletions
diff --git a/src/devices/bus/cbus/pc9801_26.cpp b/src/devices/bus/cbus/pc9801_26.cpp index d767b0eeace..e86a276c619 100644 --- a/src/devices/bus/cbus/pc9801_26.cpp +++ b/src/devices/bus/cbus/pc9801_26.cpp @@ -32,6 +32,7 @@ pc9801_26_device::pc9801_26_device(const machine_config &mconfig, const char *ta , m_bus(*this, DEVICE_SELF_OWNER) , m_opn(*this, "opn") , m_joy(*this, "joy_p%u", 1U) + , m_irq_jp(*this, "JP6A1_JP6A3") { } @@ -39,15 +40,41 @@ void pc9801_26_device::device_add_mconfig(machine_config &config) { SPEAKER(config, "mono").front_center(); YM2203(config, m_opn, 15.9744_MHz_XTAL / 4); // divider not verified - m_opn->irq_handler().set([this] (int state) { m_bus->int_w<5>(state); }); + m_opn->irq_handler().set([this] (int state) { + switch(m_int_level & 3) + { + case 0: m_bus->int_w<0>(state); break; + case 1: m_bus->int_w<4>(state); break; + case 2: m_bus->int_w<6>(state); break; + case 3: m_bus->int_w<5>(state); break; + } + }); + /* + * xx-- ---- IRSTx interrupt status 0/1 + * --xx ---- TRIGx Trigger 1/2 + * ---- xxxx <directions> + */ m_opn->port_a_read_callback().set([this] () { - if(BIT(m_joy_sel, 7)) - return m_joy[BIT(m_joy_sel, 6)]->read(); - - return (u8)0xff; + u8 res = (BIT(m_joy_sel, 7)) ? m_joy[BIT(m_joy_sel, 6)]->read() : 0x3f; + res |= m_int_level << 6; + return (u8)res; }); + /* + * x--- ---- OUTE Output Enable (DDR?) + * -x-- ---- INSL Input Select + * --21 2211 OUTxy x = port / y (2-1) = number (1-3) + */ m_opn->port_b_write_callback().set([this] (u8 data) { m_joy_sel = data; + // TODO: guesswork, verify + if (BIT(data, 7)) + return; + m_joy[0]->pin_6_w(BIT(~data, 0)); + m_joy[0]->pin_7_w(BIT(~data, 1)); + m_joy[1]->pin_6_w(BIT(~data, 2)); + m_joy[1]->pin_7_w(BIT(~data, 3)); + m_joy[0]->pin_8_w(BIT(~data, 4)); + m_joy[1]->pin_8_w(BIT(~data, 5)); }); // TODO: verify mixing on HW @@ -86,15 +113,14 @@ const tiny_rom_entry *pc9801_26_device::device_rom_region() const static INPUT_PORTS_START( pc9801_26 ) // On-board jumpers - // TODO: any way to actually read these from HW? - PORT_START("OPN_JP6A1_JP6A3") - PORT_CONFNAME( 0x03, 0x02, "PC-9801-26: Interrupt level") - PORT_CONFSETTING( 0x00, "IRQ 0" ) // 2-3, 2-3 - PORT_CONFSETTING( 0x01, "IRQ 4" ) // 2-3, 1-2 - PORT_CONFSETTING( 0x02, "IRQ 5" ) // 1-2, 1-2 - PORT_CONFSETTING( 0x03, "IRQ 6" ) // 1-2, 2-3 - - PORT_START("OPN_JP6A2") + PORT_START("JP6A1_JP6A3") + PORT_CONFNAME( 0x03, 0x03, "PC-9801-26: Interrupt level") + PORT_CONFSETTING( 0x00, "INT0 (IRQ3)" ) // 2-3, 2-3 + PORT_CONFSETTING( 0x02, "INT41 (IRQ10)" ) // 2-3, 1-2 + PORT_CONFSETTING( 0x03, "INT5 (IRQ12)" ) // 1-2, 1-2 + PORT_CONFSETTING( 0x01, "INT6 (IRQ13)" ) // 1-2, 2-3 + + PORT_START("JP6A2") PORT_CONFNAME( 0x07, 0x01, "PC-9801-26: Sound ROM address") PORT_CONFSETTING( 0x00, "0xc8000" ) // 1-10 PORT_CONFSETTING( 0x01, "0xcc000" ) // 2-9 @@ -102,7 +128,7 @@ static INPUT_PORTS_START( pc9801_26 ) PORT_CONFSETTING( 0x03, "0xd4000" ) // 4-7 PORT_CONFSETTING( 0x04, "Disable ROM") // 5-6 - PORT_START("OPN_JP6A4") + PORT_START("JP6A4") PORT_CONFNAME( 0x01, 0x01, "PC-9801-26: Port Base" ) PORT_CONFSETTING( 0x00, "0x088" ) // 1-4 PORT_CONFSETTING( 0x01, "0x188" ) // 2-3 @@ -115,7 +141,7 @@ ioport_constructor pc9801_26_device::device_input_ports() const u16 pc9801_26_device::read_io_base() { - return ((ioport("OPN_JP6A4")->read() & 1) << 8) + 0x0088; + return ((ioport("JP6A4")->read() & 1) << 8) + 0x0088; } void pc9801_26_device::device_start() @@ -129,7 +155,7 @@ void pc9801_26_device::device_start() void pc9801_26_device::device_reset() { // install the ROM to the physical program space - u8 rom_setting = ioport("OPN_JP6A2")->read() & 7; + u8 rom_setting = ioport("JP6A2")->read() & 7; static const u32 rom_addresses[8] = { 0xc8000, 0xcc000, 0xd0000, 0xd4000, 0, 0, 0, 0 }; u32 current_rom = rom_addresses[rom_setting & 7]; memory_region *rom_region = memregion(this->subtag("sound_bios").c_str()); @@ -167,9 +193,8 @@ void pc9801_26_device::device_reset() ); m_io_base = current_io; - // install IRQ line -// static const u8 irq_levels[4] = {0, 4, 5, 6}; -// m_irq_level = irq_levels[ioport("OPN_JP6A1_JP6A3")->read() & 3]; + // read INT line + m_int_level = m_irq_jp->read() & 3; } void pc9801_26_device::device_validity_check(validity_checker &valid) const diff --git a/src/devices/bus/cbus/pc9801_26.h b/src/devices/bus/cbus/pc9801_26.h index 2b6bc9e98e7..c3576e67286 100644 --- a/src/devices/bus/cbus/pc9801_26.h +++ b/src/devices/bus/cbus/pc9801_26.h @@ -46,10 +46,12 @@ private: required_device<pc9801_slot_device> m_bus; required_device<ym2203_device> m_opn; required_device_array<msx_general_purpose_port_device, 2U> m_joy; + required_ioport m_irq_jp; u32 m_rom_base; u16 m_io_base; u8 m_joy_sel; + u8 m_int_level; }; diff --git a/src/devices/bus/snes/event.cpp b/src/devices/bus/snes/event.cpp index 5ce5bbca97c..fe9a367e54d 100644 --- a/src/devices/bus/snes/event.cpp +++ b/src/devices/bus/snes/event.cpp @@ -113,8 +113,10 @@ uint8_t sns_pfest94_device::chip_read(offs_t offset) else { // DSP access - offset &= 0x1fff; - return m_upd7725->snesdsp_read(offset < 0x1000); + if (BIT(offset, 12)) + return m_upd7725->status_r(); + else + return m_upd7725->data_r(); } } @@ -151,8 +153,10 @@ void sns_pfest94_device::chip_write(offs_t offset, uint8_t data) else { // DSP access - offset &= 0x1fff; - m_upd7725->snesdsp_write(offset < 0x1000, data); + if (BIT(~offset, 12)) + m_upd7725->data_w(data); + else + logerror("%s: Writing DSP status to %02x, ignored", machine().describe_context(), data); } } diff --git a/src/devices/bus/snes/upd.cpp b/src/devices/bus/snes/upd.cpp index 476a1b42544..aa64a656d0d 100644 --- a/src/devices/bus/snes/upd.cpp +++ b/src/devices/bus/snes/upd.cpp @@ -13,13 +13,13 @@ // helpers -inline uint32_t get_prg(uint8_t *CPU, uint32_t addr) +inline uint32_t get_prg(uint8_t const *CPU, uint32_t addr) { - return ((CPU[addr * 4] << 24) | (CPU[addr * 4 + 1] << 16) | (CPU[addr * 4 + 2] << 8) | 0x00); + return (CPU[addr * 4] << 24) | (CPU[addr * 4 + 1] << 16) | (CPU[addr * 4 + 2] << 8) | 0x00; } -inline uint16_t get_data(uint8_t *CPU, uint32_t addr) +inline uint16_t get_data(uint8_t const *CPU, uint32_t addr) { - return ((CPU[addr * 2] << 8) | CPU[addr * 2 + 1]); + return (CPU[addr * 2] << 8) | CPU[addr * 2 + 1]; } //------------------------------------------------- @@ -141,15 +141,19 @@ void sns_rom20_necdsp_device::device_add_mconfig(machine_config &config) uint8_t sns_rom20_necdsp_device::chip_read(offs_t offset) { - offset &= 0x7fff; - return m_upd7725->snesdsp_read(offset < 0x4000); + if (BIT(offset, 14)) + return m_upd7725->status_r(); + else + return m_upd7725->data_r(); } void sns_rom20_necdsp_device::chip_write(offs_t offset, uint8_t data) { - offset &= 0x7fff; - m_upd7725->snesdsp_write(offset < 0x4000, data); + if (BIT(~offset, 14)) + m_upd7725->data_w(data); + else + logerror("%s: Writing DSP status to %02x, ignored", machine().describe_context(), data); } @@ -199,15 +203,19 @@ void sns_rom21_necdsp_device::device_add_mconfig(machine_config &config) uint8_t sns_rom21_necdsp_device::chip_read(offs_t offset) { - offset &= 0x1fff; - return m_upd7725->snesdsp_read(offset < 0x1000); + if (BIT(offset, 12)) + return m_upd7725->status_r(); + else + return m_upd7725->data_r(); } void sns_rom21_necdsp_device::chip_write(offs_t offset, uint8_t data) { - offset &= 0x1fff; - m_upd7725->snesdsp_write(offset < 0x1000, data); + if (BIT(~offset, 12)) + m_upd7725->data_w(data); + else + logerror("%s: Writing DSP status to %02x, ignored", machine().describe_context(), data); } @@ -220,13 +228,18 @@ void sns_rom21_necdsp_device::chip_write(offs_t offset, uint8_t data) uint8_t sns_rom_setadsp_device::chip_read(offs_t offset) { if (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000) - m_upd96050->snesdsp_read((offset & 0x01) ? false : true); + { + if (BIT(offset, 0)) + return m_upd96050->status_r(); + else + return m_upd96050->data_r(); + } if (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000) { - uint16_t address = offset & 0xffff; - uint16_t temp = m_upd96050->dataram_r(address/2); - if (offset & 1) + uint16_t const address = offset & 0xffff; + uint16_t const temp = m_upd96050->dataram_r(address >> 1); + if (BIT(offset, 0)) return temp >> 8; else return temp & 0xff; @@ -240,27 +253,18 @@ void sns_rom_setadsp_device::chip_write(offs_t offset, uint8_t data) { if (offset >= 0x600000 && offset < 0x680000 && (offset & 0xffff) < 0x4000) { - m_upd96050->snesdsp_write((offset & 0x01) ? false : true, data); + if (BIT(~offset, 0)) + m_upd96050->data_w(data); + else + logerror("%s: Writing DSP status to %02x, ignored", machine().describe_context(), data); return; } if (offset >= 0x680000 && offset < 0x700000 && (offset & 0xffff) < 0x8000) { - uint16_t address = offset & 0xffff; - uint16_t temp = m_upd96050->dataram_r(address/2); - - if (offset & 1) - { - temp &= 0xff; - temp |= data << 8; - } - else - { - temp &= 0xff00; - temp |= data; - } - - m_upd96050->dataram_w(address/2, temp); + uint16_t const address = (offset & 0xffff) >> 1; + uint8_t const shift = BIT(offset, 0) << 3; + m_upd96050->dataram_w(address, (uint16_t(data) << 8) | data, uint16_t(0xff) << shift); return; } } diff --git a/src/devices/bus/ti99/peb/cc_fdc.cpp b/src/devices/bus/ti99/peb/cc_fdc.cpp index 88fa46d2aa3..7663abe04d8 100644 --- a/src/devices/bus/ti99/peb/cc_fdc.cpp +++ b/src/devices/bus/ti99/peb/cc_fdc.cpp @@ -367,8 +367,10 @@ void corcomp_fdc_device::select_dsk(int state) if (m_floppy[m_selected_drive-1]->get_device() != nullptr) { m_wdc->set_floppy(m_floppy[m_selected_drive-1]->get_device()); - m_floppy[m_selected_drive-1]->get_device()->ss_w(m_tms9901->read_bit(tms9901_device::INT15_P7)); + side_select(m_tms9901->read_bit(tms9901_device::INT15_P7)); } + else + LOGMASKED(LOG_WARN, "No drive connected as DSK%d\n", m_selected_drive); } } @@ -377,8 +379,13 @@ void corcomp_fdc_device::side_select(int state) // Select side of disk (bit 7) if (m_selected_drive != 0) { - LOGMASKED(LOG_DRIVE, "Set side (bit 7) = %d on DSK%d\n", state, m_selected_drive); - m_floppy[m_selected_drive-1]->get_device()->ss_w(state); + if (m_floppy[m_selected_drive-1]->get_device() != nullptr) + { + LOGMASKED(LOG_DRIVE, "Set side (bit 7) = %d on DSK%d\n", state, m_selected_drive); + m_floppy[m_selected_drive-1]->get_device()->ss_w(state); + } + else + LOGMASKED(LOG_WARN, "No drive connected as DSK%d\n", m_selected_drive); } } |