nec: Converted PC-6001, PC-8801 and PC88VA controller ports to slots.

* nec/pc6001.cpp: Converted joystick ports to slots.
* nec/pc8801.cpp, nec/pc88va.cpp: Converted mouse port to a slot.  Mouse
  works beautifully in Ishido now, no jumpy movement.
This commit is contained in:
Vas Crabb 2022-12-23 04:10:02 +11:00
parent 9283c76fef
commit 95cd620d66
8 changed files with 73 additions and 244 deletions

View File

@ -17056,8 +17056,7 @@ Not extensively tested
</part>
</software>
<!-- Mouse pointer is jumpy -->
<software name="ishido" supported="partial">
<software name="ishido">
<description>Ishido - The Way of Stones</description>
<year>1990</year>
<publisher>アスキー (ASCII)</publisher>

View File

@ -1078,27 +1078,6 @@ static INPUT_PORTS_START( pc6001 )
PORT_DIPSETTING( 0x04, "Green/Pink" )
//5-6-7 is presumably invalid
/* TODO: these two are unchecked */
PORT_START("P1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("P2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("key1") //0x00-0x1f
PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null
PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x01 soh
@ -1404,7 +1383,7 @@ uint8_t pc6001_state::check_keyboard_press()
uint8_t pc6001_state::check_joy_press()
{
// TODO: this may really just rearrange keyboard key presses in a joystick like fashion, somehow akin to Sharp X1 mode
uint8_t p1_key = m_io_p1->read() ^ 0xff;
uint8_t p1_key = m_joy[0]->read() ^ 0xff;
uint8_t shift_key = m_io_key_modifiers->read() & 0x02;
uint8_t space_key = m_io_keys[1]->read() & 0x01;
uint8_t joy_press;
@ -1485,7 +1464,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(pc6001_state::keyboard_callback)
uint32_t key2 = m_io_keys[1]->read();
uint32_t key3 = m_io_keys[2]->read();
u8 key_fn = m_io_fn_keys->read();
// uint8_t p1_key = m_io_p1->read();
// uint8_t p1_key = m_joy[0]->read();
if(m_cas_switch == 0)
{
@ -1715,6 +1694,10 @@ void pc6001_state::pc6001(machine_config &config)
/* uart */
I8251(config, "uart", 0);
// TODO: these are unchecked
MSX_GENERAL_PURPOSE_PORT(config, m_joy[0], msx_general_purpose_port_devices, "joystick");
MSX_GENERAL_PURPOSE_PORT(config, m_joy[1], msx_general_purpose_port_devices, "joystick");
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "pc6001_cart");
SOFTWARE_LIST(config, "cart_list_pc6001").set_original("pc6001_cart");
@ -1726,11 +1709,11 @@ void pc6001_state::pc6001(machine_config &config)
SPEAKER(config, "mono").front_center();
AY8910(config, m_ay, PC6001_MAIN_CLOCK/4);
m_ay->port_a_read_callback().set_ioport("P1");
m_ay->port_b_read_callback().set_ioport("P2");
m_ay->port_a_read_callback().set(m_joy[0], FUNC(msx_general_purpose_port_device::read));
m_ay->port_b_read_callback().set(m_joy[1], FUNC(msx_general_purpose_port_device::read));
m_ay->add_route(ALL_OUTPUTS, "mono", 1.00);
/* TODO: accurate timing on this */
// TODO: accurate timing on this
TIMER(config, "keyboard_timer").configure_periodic(FUNC(pc6001_state::keyboard_callback), attotime::from_hz(250));
TIMER(config, "cassette_timer").configure_periodic(FUNC(pc6001_state::cassette_callback), attotime::from_hz(1200/12));
}
@ -1821,8 +1804,8 @@ void pc6001mk2sr_state::pc6001mk2sr(machine_config &config)
config.device_remove("aysnd");
YM2203(config, m_ym, PC6001_MAIN_CLOCK/4);
m_ym->port_a_read_callback().set_ioport("P1");
m_ym->port_b_read_callback().set_ioport("P2");
m_ym->port_a_read_callback().set(m_joy[0], FUNC(msx_general_purpose_port_device::read));
m_ym->port_b_read_callback().set(m_joy[1], FUNC(msx_general_purpose_port_device::read));
m_ym->add_route(ALL_OUTPUTS, "mono", 1.00);
// TODO: 1D 3'5" floppy drive

View File

@ -1,20 +1,18 @@
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
#ifndef MAME_INCLUDES_PC6001_H
#define MAME_INCLUDES_PC6001_H
#ifndef MAME_NEC_PC6001_H
#define MAME_NEC_PC6001_H
#pragma once
#include "pc80s31k.h"
#include "cpu/z80/z80.h"
#include "formats/dsk_dsk.h"
#include "formats/msx_dsk.h"
#include "imagedev/cassette.h"
#include "imagedev/floppy.h"
#include "machine/bankdev.h"
#include "machine/i8251.h"
#include "machine/i8255.h"
#include "pc80s31k.h"
#include "machine/timer.h"
#include "machine/upd765.h"
#include "sound/ay8910.h"
@ -24,13 +22,17 @@
#include "bus/generic/slot.h"
#include "bus/generic/carts.h"
#include "bus/msx/ctrl/ctrl.h"
#include "emupal.h"
#include "speaker.h"
#include "screen.h"
#include "formats/dsk_dsk.h"
#include "formats/msx_dsk.h"
#include "formats/p6001_cas.h"
class pc6001_state : public driver_device
{
public:
@ -40,6 +42,7 @@ public:
, m_ram(*this, "ram")
, m_maincpu(*this, "maincpu")
, m_screen(*this, "screen")
, m_joy(*this, "joy%u", 1U)
, m_cassette(*this, "cassette")
, m_cas_hack(*this, "cas_hack")
, m_cart(*this, "cartslot")
@ -47,8 +50,6 @@ public:
, m_region_maincpu(*this, "maincpu")
, m_region_gfx1(*this, "gfx1")
, m_io_mode4_dsw(*this, "MODE4_DSW")
, m_io_p1(*this, "P1")
, m_io_p2(*this, "P2")
, m_io_keys(*this, "key%u", 1U)
, m_io_fn_keys(*this, "key_fn")
, m_io_key_modifiers(*this, "key_modifiers")
@ -83,6 +84,7 @@ protected:
optional_shared_ptr<uint8_t> m_ram;
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
required_device_array<msx_general_purpose_port_device, 2> m_joy;
optional_device<cassette_image_device> m_cassette;
optional_device<generic_slot_device> m_cas_hack;
required_device<generic_slot_device> m_cart;
@ -90,8 +92,6 @@ protected:
optional_memory_region m_region_maincpu;
required_memory_region m_region_gfx1;
required_ioport m_io_mode4_dsw;
required_ioport m_io_p1;
required_ioport m_io_p2;
required_ioport_array<3> m_io_keys;
required_ioport m_io_fn_keys;
required_ioport m_io_key_modifiers;
@ -369,4 +369,4 @@ private:
virtual u8 hw_rev_r() override;
};
#endif
#endif // MAME_NEC_PC6001_H

View File

@ -1,23 +1,24 @@
// license:BSD-3-Clause
// copyright-holders:Curt Coder, Angelo Salese
#ifndef MAME_NEC_PC8001_H
#define MAME_NEC_PC8001_H
#pragma once
#ifndef MAME_INCLUDES_PC8001_H
#define MAME_INCLUDES_PC8001_H
#include "pc80s31k.h"
#include "bus/centronics/ctronics.h"
#include "cpu/z80/z80.h"
#include "imagedev/cassette.h"
#include "machine/buffer.h"
#include "bus/centronics/ctronics.h"
#include "machine/i8257.h"
#include "machine/i8255.h"
#include "machine/i8251.h"
#include "machine/i8255.h"
#include "machine/i8257.h"
#include "machine/ram.h"
#include "machine/upd1990a.h"
#include "pc80s31k.h"
#include "sound/beep.h"
#include "video/upd3301.h"
#include "emupal.h"
#include "screen.h"
@ -169,4 +170,4 @@ private:
u8 m_n80sr_bank = 0;
};
#endif
#endif // MAME_NEC_PC8001_H

View File

@ -647,16 +647,6 @@ uint8_t pc8801_state::port40_r()
return data;
}
inline attotime pc8801_state::mouse_limit_hz()
{
return attotime::from_hz(900);
}
inline attotime pc8801fh_state::mouse_limit_hz()
{
return attotime::from_hz(m_clock_setting ? 900 : 1800);
}
/*
* I/O Port $40 writes "Strobe Port"
* N88-BASIC buffer port $e6c1
@ -687,35 +677,7 @@ void pc8801_state::port40_w(uint8_t data)
if(((m_device_ctrl_data & 0x20) == 0x20) && ((data & 0x20) == 0x00))
m_beeper->set_state(0);
// TODO: send to joyport DE-9 implementation
if((m_device_ctrl_data & 0x40) != (data & 0x40))
{
attotime new_time = machine().time();
if(data & 0x40 && (new_time - m_mouse.time) > mouse_limit_hz())
{
m_mouse.phase = 0;
}
else
{
m_mouse.phase ++;
m_mouse.phase &= 3;
}
if(m_mouse.phase == 0)
{
const u8 mouse_x = ioport("MOUSEX")->read();
const u8 mouse_y = ioport("MOUSEY")->read();
m_mouse.lx = (mouse_x - m_mouse.prev_dx) & 0xff;
m_mouse.ly = (mouse_y - m_mouse.prev_dy) & 0xff;
m_mouse.prev_dx = mouse_x;
m_mouse.prev_dy = mouse_y;
}
m_mouse.time = machine().time();
}
m_mouse_port->pin_8_w(BIT(data, 6));
// TODO: is SING a buzzer mask? bastard leaves beeper to ON state otherwise
if(m_device_ctrl_data & 0x80)
@ -1358,27 +1320,6 @@ static INPUT_PORTS_START( pc8801 )
PORT_DIPSETTING( 0x00, "Slow" )
PORT_DIPSETTING( 0x40, DEF_STR( High ) )
PORT_START("OPN_PA")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("OPN_PB")
// TODO: yojukiko and grobda maps Joystick buttons in reverse than expected?
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Mouse Button 1") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Mouse Button 2") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02)
PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("MOUSEX")
PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_REVERSE PORT_SENSITIVITY(20) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02)
PORT_START("MOUSEY")
PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_REVERSE PORT_SENSITIVITY(20) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02)
PORT_START("MEM")
PORT_CONFNAME( 0x0f, 0x0a, "Extension memory" )
PORT_CONFSETTING( 0x00, DEF_STR( None ) )
@ -1401,9 +1342,6 @@ static INPUT_PORTS_START( pc8801 )
// PORT_CONFNAME( 0x01, 0x01, "Sound Board" )
// PORT_CONFSETTING( 0x00, "OPN (YM2203)" )
// PORT_CONFSETTING( 0x01, "OPNA (YM2608)" )
PORT_CONFNAME( 0x02, 0x00, "Port 1 Connection" )
PORT_CONFSETTING( 0x00, "Joystick" )
PORT_CONFSETTING( 0x02, "Mouse" )
INPUT_PORTS_END
static INPUT_PORTS_START( pc8801fh )
@ -1468,13 +1406,6 @@ void pc8801_state::machine_start()
save_pointer(NAME(m_hi_work_ram), 0x1000);
save_pointer(NAME(m_ext_work_ram), 0x8000*0x100);
save_pointer(NAME(m_gvram), 0xc000);
save_item(STRUCT_MEMBER(m_mouse, phase));
save_item(STRUCT_MEMBER(m_mouse, prev_dx));
save_item(STRUCT_MEMBER(m_mouse, prev_dy));
save_item(STRUCT_MEMBER(m_mouse, lx));
save_item(STRUCT_MEMBER(m_mouse, ly));
// save_item(STRUCT_MEMBER(m_mouse, time));
save_item(NAME(m_mouse.time));
save_item(NAME(m_gfx_ctrl));
save_item(NAME(m_ext_rom_bank));
save_item(NAME(m_vram_sel));
@ -1516,15 +1447,9 @@ void pc8801_state::machine_reset()
m_bitmap_layer_mask = 0;
m_vram_sel = 3;
m_mouse.phase = 0;
// initialize ALU
{
int i;
for(i = 0; i < 3; i++)
m_alu_reg[i] = 0x00;
}
for(int i = 0; i < 3; i++)
m_alu_reg[i] = 0x00;
m_beeper->set_state(0);
@ -1604,25 +1529,18 @@ void pc8801mc_state::machine_reset()
m_cdrom_bank = true;
}
// TODO: to joyport DE-9 option slot
// DE-9 mouse port on front panel (labelled "マウス") - MSX-compatible
uint8_t pc8801mk2sr_state::opn_porta_r()
{
if(ioport("BOARD_CONFIG")->read() & 2)
{
uint8_t shift, res;
shift = (m_mouse.phase & 1) ? 0 : 4;
res = (m_mouse.phase & 2) ? m_mouse.ly : m_mouse.lx;
// logerror("%d\n",m_mouse.phase);
return ((res >> shift) & 0x0f) | 0xf0;
}
return ioport("OPN_PA")->read();
return BIT(m_mouse_port->read(), 0, 4) | 0xf0;
}
/* Cassette Configuration */
uint8_t pc8801mk2sr_state::opn_portb_r()
{
return BIT(m_mouse_port->read(), 4, 2) | 0xfc;
}
// Cassette Configuration
WRITE_LINE_MEMBER( pc8801_state::txdata_callback )
{
//m_cassette->output( (state) ? 1.0 : -1.0);
@ -1806,6 +1724,8 @@ void pc8801_state::pc8801(machine_config &config)
m_beeper->add_route(ALL_OUTPUTS, speaker, 0.10);
}
MSX_GENERAL_PURPOSE_PORT(config, m_mouse_port, msx_general_purpose_port_devices, "mouse");
PC8801_EXP_SLOT(config, m_exp, pc8801_exp_devices, nullptr);
m_exp->set_iospace(m_maincpu, AS_IO);
m_exp->int3_callback().set([this] (bool state) { m_pic->r_w(7 ^ INT3_IRQ_LEVEL, !state); });
@ -1820,7 +1740,7 @@ void pc8801mk2sr_state::pc8801mk2sr(machine_config &config)
YM2203(config, m_opn, MASTER_CLOCK);
m_opn->irq_handler().set(FUNC(pc8801mk2sr_state::int4_irq_w));
m_opn->port_a_read_callback().set(FUNC(pc8801mk2sr_state::opn_porta_r));
m_opn->port_b_read_callback().set_ioport("OPN_PB");
m_opn->port_b_read_callback().set(FUNC(pc8801mk2sr_state::opn_portb_r));
for (auto &speaker : { m_lspeaker, m_rspeaker })
{
@ -1848,7 +1768,8 @@ void pc8801fh_state::pc8801fh(machine_config &config)
m_opna->set_addrmap(0, &pc8801fh_state::opna_map);
m_opna->irq_handler().set(FUNC(pc8801fh_state::int4_irq_w));
m_opna->port_a_read_callback().set(FUNC(pc8801fh_state::opn_porta_r));
m_opna->port_b_read_callback().set_ioport("OPN_PB");
m_opna->port_b_read_callback().set(FUNC(pc8801fh_state::opn_portb_r));
// TODO: per-channel mixing is unconfirmed
m_opna->add_route(0, m_lspeaker, 0.25);
m_opna->add_route(0, m_rspeaker, 0.25);

View File

@ -6,12 +6,17 @@
********************************************************************************************/
#ifndef MAME_INCLUDES_PC8801_H
#define MAME_INCLUDES_PC8801_H
#ifndef MAME_NEC_PC8801_H
#define MAME_NEC_PC8801_H
#pragma once
#include "pc8001.h"
#include "bus/centronics/ctronics.h"
#include "bus/msx/ctrl/ctrl.h"
#include "bus/pc8801/pc8801_31.h"
#include "bus/pc8801/pc8801_exp.h"
#include "cpu/z80/z80.h"
#include "imagedev/cassette.h"
#include "imagedev/floppy.h"
@ -23,14 +28,13 @@
#include "pc80s31k.h"
#include "sound/beep.h"
#include "sound/ymopn.h"
#include "bus/centronics/ctronics.h"
#include "bus/pc8801/pc8801_31.h"
#include "bus/pc8801/pc8801_exp.h"
#include "emupal.h"
#include "screen.h"
#include "softlist.h"
#include "speaker.h"
#define I8214_TAG "i8214"
class pc8801_state : public pc8001_base_state
@ -53,6 +57,7 @@ public:
// , m_cg_rom(*this, "cgrom")
, m_kanji_rom(*this, "kanji")
, m_kanji_lv2_rom(*this, "kanji_lv2")
, m_mouse_port(*this, "mouseport") // labelled "マウス" (mouse) - can't use "mouse" because of core -mouse option
, m_exp(*this, "exp")
{
}
@ -71,8 +76,6 @@ protected:
virtual uint8_t dma_mem_r(offs_t offset) override;
virtual attotime mouse_limit_hz();
virtual uint8_t dictionary_rom_r(offs_t offset);
virtual bool dictionary_rom_enable();
@ -96,19 +99,11 @@ protected:
// required_region_ptr<u8> m_cg_rom;
required_region_ptr<u8> m_kanji_rom;
required_region_ptr<u8> m_kanji_lv2_rom;
required_device<msx_general_purpose_port_device> m_mouse_port;
required_device<pc8801_exp_slot_device> m_exp;
DECLARE_WRITE_LINE_MEMBER(int4_irq_w);
struct mouse_t {
uint8_t phase = 0;
int8_t prev_dx = 0, prev_dy = 0;
uint8_t lx = 0, ly = 0;
attotime time = attotime::never;
};
mouse_t m_mouse;
uint8_t m_gfx_ctrl = 0;
private:
@ -236,6 +231,7 @@ protected:
virtual void main_io(address_map &map) override;
uint8_t opn_porta_r();
uint8_t opn_portb_r();
private:
optional_device<ym2203_device> m_opn;
@ -257,8 +253,6 @@ protected:
virtual void machine_reset() override;
virtual void main_io(address_map &map) override;
virtual attotime mouse_limit_hz() override;
private:
required_device<ym2608_device> m_opna;
void opna_map(address_map &map);
@ -326,4 +320,4 @@ private:
bool m_cdrom_bank = true;
};
#endif // MAME_INCLUDES_PC8801_H
#endif // MAME_NEC_PC8801_H

View File

@ -137,59 +137,21 @@ void pc88va_state::port40_w(offs_t offset, u8 data)
m_rtc->stb_w((data & 2) >> 1);
m_rtc->clk_w((data & 4) >> 2);
if((m_device_ctrl_data & 0x40) != (data & 0x40))
{
attotime new_time = machine().time();
if(data & 0x40 && (new_time - m_mouse.time) > mouse_limit_hz())
{
m_mouse.phase = 0;
}
else
{
m_mouse.phase ++;
m_mouse.phase &= 3;
}
if(m_mouse.phase == 0)
{
const u8 mouse_x = ioport("MOUSEX")->read();
const u8 mouse_y = ioport("MOUSEY")->read();
m_mouse.lx = (mouse_x - m_mouse.prev_dx) & 0xff;
m_mouse.ly = (mouse_y - m_mouse.prev_dy) & 0xff;
m_mouse.prev_dx = mouse_x;
m_mouse.prev_dy = mouse_y;
}
m_mouse.time = machine().time();
}
m_mouse_port->pin_8_w(BIT(data, 6));
m_device_ctrl_data = data;
}
inline attotime pc88va_state::mouse_limit_hz()
// DE-9 mouse port (labelled "マウス") - MSX-compatible
uint8_t pc88va_state::opn_porta_r()
{
return attotime::from_hz(1800);
return BIT(m_mouse_port->read(), 0, 4) | 0xf0;
}
u8 pc88va_state::opn_porta_r()
uint8_t pc88va_state::opn_portb_r()
{
if(ioport("BOARD_CONFIG")->read() & 2)
{
u8 shift, res;
shift = (m_mouse.phase & 1) ? 0 : 4;
res = (m_mouse.phase & 2) ? m_mouse.ly : m_mouse.lx;
// logerror("%d\n",m_mouse.phase);
return ((res >> shift) & 0x0f) | 0xf0;
}
return ioport("OPN_PA")->read();
return BIT(m_mouse_port->read(), 4, 2) | 0xfc;
}
void pc88va_state::rtc_w(offs_t offset, u8 data)
@ -933,31 +895,6 @@ static INPUT_PORTS_START( pc88va )
PORT_DIPSETTING( 0x01, "N88 V2 Mode" )
PORT_DIPSETTING( 0x02, "N88 V1 Mode" )
// PORT_DIPSETTING( 0x03, "???" )
PORT_START("OPN_PA")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("OPN_PB")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x00)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Mouse Button 1") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Mouse Button 2") PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02)
PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("MOUSEX")
PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_REVERSE PORT_SENSITIVITY(20) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02)
PORT_START("MOUSEY")
PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_REVERSE PORT_SENSITIVITY(20) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02)
PORT_START("BOARD_CONFIG")
PORT_CONFNAME( 0x02, 0x00, "Port 1 Connection" )
PORT_CONFSETTING( 0x00, "Joystick" )
PORT_CONFSETTING( 0x02, "Mouse" )
INPUT_PORTS_END
static const gfx_layout pc88va_chars_8x8 =
@ -1237,6 +1174,8 @@ void pc88va_state::pc88va(machine_config &config)
ADDRESS_MAP_BANK(config, "sysbank").set_map(&pc88va_state::sysbank_map).set_options(ENDIANNESS_LITTLE, 16, 22, 0x40000);
MSX_GENERAL_PURPOSE_PORT(config, m_mouse_port, msx_general_purpose_port_devices, "mouse");
SPEAKER(config, m_lspeaker).front_left();
SPEAKER(config, m_rspeaker).front_right();
@ -1244,9 +1183,8 @@ void pc88va_state::pc88va(machine_config &config)
YM2608(config, m_opna, FM_CLOCK);
m_opna->set_addrmap(0, &pc88va_state::opna_map);
m_opna->irq_handler().set(FUNC(pc88va_state::int4_irq_w));
// TODO: DE-9
m_opna->port_a_read_callback().set(FUNC(pc88va_state::opn_porta_r));
m_opna->port_b_read_callback().set_ioport("OPN_PB");
m_opna->port_b_read_callback().set(FUNC(pc88va_state::opn_portb_r));
// TODO: per-channel mixing is unconfirmed
m_opna->add_route(0, m_lspeaker, 0.25);
m_opna->add_route(0, m_rspeaker, 0.25);

View File

@ -14,6 +14,7 @@
//#include "pc80s31k.h"
#include "pc88va_sgp.h"
#include "bus/msx/ctrl/ctrl.h"
#include "cpu/nec/v5x.h"
#include "cpu/z80/z80.h"
#include "imagedev/floppy.h"
@ -45,6 +46,7 @@ public:
, m_fdd(*this, "upd765:%u", 0U)
, m_pic2(*this, "pic8259_slave")
, m_rtc(*this, "rtc")
, m_mouse_port(*this, "mouseport") // labelled "マウス" (mouse) - can't use "mouse" because of core -mouse option
, m_opna(*this, "opna")
, m_lspeaker(*this, "lspeaker")
, m_rspeaker(*this, "rspeaker")
@ -105,6 +107,7 @@ private:
// required_device<pic8259_device> m_pic1;
required_device<pic8259_device> m_pic2;
required_device<upd4990a_device> m_rtc;
required_device<msx_general_purpose_port_device> m_mouse_port;
required_device<ym2608_device> m_opna;
required_device<speaker_device> m_lspeaker;
required_device<speaker_device> m_rspeaker;
@ -265,23 +268,13 @@ private:
void port40_w(offs_t offset, u8 data);
void rtc_w(offs_t offset, u8 data);
u8 opn_porta_r();
u8 opn_portb_r();
u8 m_device_ctrl_data = 0;
u8 m_misc_ctrl = 0x80;
bool m_sound_irq_enable = false;
bool m_sound_irq_pending = false;
DECLARE_WRITE_LINE_MEMBER(int4_irq_w);
struct mouse_t {
uint8_t phase = 0;
int8_t prev_dx = 0, prev_dy = 0;
uint8_t lx = 0, ly = 0;
attotime time = attotime::never;
};
attotime mouse_limit_hz();
mouse_t m_mouse;
};