mirror of
https://github.com/holub/mame
synced 2025-07-02 16:49:22 +03:00
ti99: Changed busmouse to a push behaviour; the real V9938 does not regularly poll the mouse but lets it update an internal counter. Also rerouted the extra mouse button to a separate input line.
This commit is contained in:
parent
a5fb1e1839
commit
7b7292523f
@ -9,62 +9,92 @@
|
||||
|
||||
Michael Zapf, 2017-03-18
|
||||
|
||||
2019-08-14: Changed to push behavior (MZ)
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "busmouse.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE_NS(TI99_BUSMOUSE, bus::ti99::colorbus, geneve_busmouse_device, "ti99_busmouse", "Geneve Bus Mouse")
|
||||
#define LOG_BUTTON (1U<<1) // Buttons
|
||||
#define LOG_MOVEX (1U<<2) // x movement
|
||||
#define LOG_MOVEY (1U<<3) // y movement
|
||||
|
||||
#define VERBOSE ( LOG_GENERAL )
|
||||
#include "logmacro.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE_NS(V9938_BUSMOUSE, bus::ti99::colorbus, v9938_busmouse_device, "v9938_busmouse", "V9938 Bus Mouse")
|
||||
|
||||
namespace bus { namespace ti99 { namespace colorbus {
|
||||
|
||||
geneve_busmouse_device::geneve_busmouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, TI99_BUSMOUSE, tag, owner, clock), device_ti99_colorbus_interface(mconfig, *this)
|
||||
, m_buttons(*this, "MOUSEBUT"), m_xaxis(*this, "MOUSEX"), m_yaxis(*this, "MOUSEY")
|
||||
v9938_busmouse_device::v9938_busmouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, V9938_BUSMOUSE, tag, owner, clock),
|
||||
device_v9938_colorbus_interface(mconfig, *this),
|
||||
m_buttons(*this, "MOUSEBUT"),
|
||||
m_xaxis(*this, "MOUSEX"),
|
||||
m_yaxis(*this, "MOUSEY")
|
||||
{
|
||||
}
|
||||
|
||||
void geneve_busmouse_device::poll(int& delta_x, int& delta_y, int& buttons)
|
||||
void v9938_busmouse_device::device_start()
|
||||
{
|
||||
buttons = m_buttons->read();
|
||||
int const new_mx = m_xaxis->read();
|
||||
int const new_my = m_yaxis->read();
|
||||
|
||||
/* compute x delta */
|
||||
delta_x = new_mx - m_last_mx;
|
||||
m_last_mx = new_mx;
|
||||
|
||||
/* compute y delta */
|
||||
delta_y = new_my - m_last_my;
|
||||
m_last_my = new_my;
|
||||
save_item(NAME(m_last_x));
|
||||
save_item(NAME(m_last_y));
|
||||
save_item(NAME(m_bstate));
|
||||
}
|
||||
|
||||
void geneve_busmouse_device::device_start()
|
||||
void v9938_busmouse_device::device_reset()
|
||||
{
|
||||
save_item(NAME(m_last_mx));
|
||||
save_item(NAME(m_last_my));
|
||||
m_last_x = 0;
|
||||
m_last_y = 0;
|
||||
m_bstate = 0;
|
||||
}
|
||||
|
||||
void geneve_busmouse_device::device_reset()
|
||||
INPUT_CHANGED_MEMBER( v9938_busmouse_device::mouse_button_changed )
|
||||
{
|
||||
m_last_mx = 0;
|
||||
m_last_my = 0;
|
||||
LOGMASKED(LOG_BUTTON, "Button %d: %d\n", (long)param, newval);
|
||||
if (newval==1)
|
||||
m_bstate |= (long)param;
|
||||
else
|
||||
m_bstate &= ~(long)param;
|
||||
m_colorbus->buttons(m_bstate);
|
||||
}
|
||||
|
||||
INPUT_CHANGED_MEMBER( v9938_busmouse_device::mouse_pos_changed )
|
||||
{
|
||||
int16_t pos = (int16_t)newval;
|
||||
int delta;
|
||||
|
||||
if ((long)param==1)
|
||||
{
|
||||
delta = pos - m_last_x;
|
||||
LOGMASKED(LOG_MOVEX, "posx = %d, delta x = %d\n", pos, delta);
|
||||
m_last_x = pos;
|
||||
m_colorbus->movex(delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = pos - m_last_y;
|
||||
LOGMASKED(LOG_MOVEY, "posy = %d, delta y = %d\n", pos, delta);
|
||||
m_last_y = pos;
|
||||
m_colorbus->movey(delta);
|
||||
}
|
||||
}
|
||||
|
||||
INPUT_PORTS_START( busmouse )
|
||||
PORT_START("MOUSEX") /* Mouse - X AXIS */
|
||||
PORT_BIT( 0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_PLAYER(1)
|
||||
PORT_BIT( 0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, v9938_busmouse_device, mouse_pos_changed, 1)
|
||||
|
||||
PORT_START("MOUSEY") /* Mouse - Y AXIS */
|
||||
PORT_BIT( 0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_PLAYER(1)
|
||||
PORT_BIT( 0xffff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, v9938_busmouse_device, mouse_pos_changed, 2)
|
||||
|
||||
PORT_START("MOUSEBUT") /* mouse buttons */
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left mouse button")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Right mouse button")
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Middle mouse button")
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left mouse button") PORT_CHANGED_MEMBER(DEVICE_SELF, v9938_busmouse_device, mouse_button_changed, 4)
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Right mouse button") PORT_CHANGED_MEMBER(DEVICE_SELF, v9938_busmouse_device, mouse_button_changed, 1)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Middle mouse button") PORT_CHANGED_MEMBER(DEVICE_SELF, v9938_busmouse_device, mouse_button_changed, 2)
|
||||
INPUT_PORTS_END
|
||||
|
||||
ioport_constructor geneve_busmouse_device::device_input_ports() const
|
||||
ioport_constructor v9938_busmouse_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME( busmouse );
|
||||
}
|
||||
|
@ -19,24 +19,26 @@
|
||||
|
||||
namespace bus { namespace ti99 { namespace colorbus {
|
||||
|
||||
class geneve_busmouse_device : public device_t, public device_ti99_colorbus_interface
|
||||
class v9938_busmouse_device : public device_t, public device_v9938_colorbus_interface
|
||||
{
|
||||
public:
|
||||
geneve_busmouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
void poll(int& delta_x, int& delta_y, int& buttons) override;
|
||||
v9938_busmouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
DECLARE_INPUT_CHANGED_MEMBER( mouse_button_changed );
|
||||
DECLARE_INPUT_CHANGED_MEMBER( mouse_pos_changed );
|
||||
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
void device_start() override;
|
||||
void device_reset() override;
|
||||
ioport_constructor device_input_ports() const override;
|
||||
|
||||
private:
|
||||
required_ioport m_buttons, m_xaxis, m_yaxis;
|
||||
int m_last_mx;
|
||||
int m_last_my;
|
||||
int m_last_x;
|
||||
int m_last_y;
|
||||
int m_bstate;
|
||||
};
|
||||
} } } // end namespace bus::ti99::colorbus
|
||||
|
||||
DECLARE_DEVICE_TYPE_NS(TI99_BUSMOUSE, bus::ti99::colorbus, geneve_busmouse_device)
|
||||
DECLARE_DEVICE_TYPE_NS(V9938_BUSMOUSE, bus::ti99::colorbus, v9938_busmouse_device)
|
||||
|
||||
#endif // MAME_BUS_TI99_COLORBUS_BUSMOUSE_H
|
||||
|
@ -22,49 +22,49 @@
|
||||
#include "busmouse.h"
|
||||
#include "bus/ti99/ti99defs.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE_NS(TI99_COLORBUS, bus::ti99::colorbus, ti99_colorbus_device, "ti99_colorbus", "v9938 Color bus")
|
||||
DEFINE_DEVICE_TYPE_NS(V9938_COLORBUS, bus::ti99::colorbus, v9938_colorbus_device, "v9938_colorbus", "V9938 Color bus")
|
||||
|
||||
namespace bus { namespace ti99 { namespace colorbus {
|
||||
|
||||
ti99_colorbus_device::ti99_colorbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, TI99_COLORBUS, tag, owner, clock),
|
||||
v9938_colorbus_device::v9938_colorbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, V9938_COLORBUS, tag, owner, clock),
|
||||
device_slot_interface(mconfig, *this),
|
||||
m_connected(nullptr),
|
||||
m_v9938(*owner, TI_VDP_TAG),
|
||||
m_left_button_pressed(false)
|
||||
m_extra_button(*this)
|
||||
{
|
||||
}
|
||||
|
||||
void ti99_colorbus_device::poll()
|
||||
void v9938_colorbus_device::movex(int delta)
|
||||
{
|
||||
int delta_x, delta_y, buttons;
|
||||
|
||||
// only middle and right button go to V9938
|
||||
m_connected->poll(delta_x, delta_y, buttons);
|
||||
m_v9938->update_mouse_state(delta_x, delta_y, buttons & 0x03);
|
||||
m_left_button_pressed = (buttons & 0x04)!=0;
|
||||
m_v9938->colorbus_x_input(delta);
|
||||
}
|
||||
|
||||
line_state ti99_colorbus_device::left_button()
|
||||
void v9938_colorbus_device::movey(int delta)
|
||||
{
|
||||
return m_left_button_pressed? ASSERT_LINE : CLEAR_LINE;
|
||||
m_v9938->colorbus_y_input(delta);
|
||||
}
|
||||
|
||||
void ti99_colorbus_device::device_config_complete()
|
||||
void v9938_colorbus_device::buttons(int bstate)
|
||||
{
|
||||
m_connected = dynamic_cast<device_ti99_colorbus_interface*>(subdevices().first());
|
||||
m_v9938->colorbus_button_input(bstate & 1, bstate & 2);
|
||||
m_extra_button((bstate & 4)? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
void v9938_colorbus_device::device_start()
|
||||
{
|
||||
m_extra_button.resolve_safe();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void device_ti99_colorbus_interface::interface_config_complete()
|
||||
void device_v9938_colorbus_interface::interface_config_complete()
|
||||
{
|
||||
m_colorbus = dynamic_cast<ti99_colorbus_device*>(device().owner());
|
||||
m_colorbus = dynamic_cast<v9938_colorbus_device*>(device().owner());
|
||||
}
|
||||
|
||||
} } } // end namespace bus::ti99::colorbus
|
||||
|
||||
void ti99_colorbus_options(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("busmouse", TI99_BUSMOUSE);
|
||||
device.option_add("busmouse", V9938_BUSMOUSE);
|
||||
}
|
||||
|
@ -20,32 +20,29 @@
|
||||
|
||||
namespace bus { namespace ti99 { namespace colorbus {
|
||||
|
||||
class ti99_colorbus_device;
|
||||
class v9938_colorbus_device;
|
||||
|
||||
/********************************************************************
|
||||
Common parent class of all devices attached to the color bus
|
||||
********************************************************************/
|
||||
class device_ti99_colorbus_interface : public device_slot_card_interface
|
||||
class device_v9938_colorbus_interface : public device_slot_card_interface
|
||||
{
|
||||
public:
|
||||
virtual void poll(int& delta_x, int& delta_y, int& buttons) = 0;
|
||||
|
||||
protected:
|
||||
using device_slot_card_interface::device_slot_card_interface;
|
||||
|
||||
virtual void interface_config_complete() override;
|
||||
ti99_colorbus_device* m_colorbus = nullptr;
|
||||
v9938_colorbus_device* m_colorbus = nullptr;
|
||||
};
|
||||
|
||||
/********************************************************************
|
||||
Color bus port
|
||||
********************************************************************/
|
||||
class ti99_colorbus_device : public device_t, public device_slot_interface
|
||||
class v9938_colorbus_device : public device_t, public device_slot_interface
|
||||
{
|
||||
public:
|
||||
template <typename U>
|
||||
ti99_colorbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, U &&opts, const char *dflt)
|
||||
: ti99_colorbus_device(mconfig, tag, owner, clock)
|
||||
v9938_colorbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, U &&opts, const char *dflt)
|
||||
: v9938_colorbus_device(mconfig, tag, owner, clock)
|
||||
{
|
||||
option_reset();
|
||||
opts(*this);
|
||||
@ -53,23 +50,27 @@ public:
|
||||
set_fixed(false);
|
||||
}
|
||||
|
||||
ti99_colorbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
line_state left_button(); // left button is not connected to the V9938 but to a TMS9901 pin
|
||||
void poll();
|
||||
v9938_colorbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// For the extra button (V9938 only handles 2)
|
||||
auto extra_button_cb() { return m_extra_button.bind(); }
|
||||
|
||||
// Called from the device
|
||||
void movex(int delta);
|
||||
void movey(int delta);
|
||||
void buttons(int bstate);
|
||||
|
||||
protected:
|
||||
void device_start() override { }
|
||||
void device_config_complete() override;
|
||||
void device_start() override;
|
||||
|
||||
private:
|
||||
device_ti99_colorbus_interface* m_connected;
|
||||
required_device<v9938_device> m_v9938;
|
||||
bool m_left_button_pressed;
|
||||
devcb_write_line m_extra_button;
|
||||
};
|
||||
|
||||
} } } // end namespace bus::ti99::colorbus
|
||||
|
||||
DECLARE_DEVICE_TYPE_NS(TI99_COLORBUS, bus::ti99::colorbus, ti99_colorbus_device)
|
||||
DECLARE_DEVICE_TYPE_NS(V9938_COLORBUS, bus::ti99::colorbus, v9938_colorbus_device)
|
||||
|
||||
void ti99_colorbus_options(device_slot_interface &device);
|
||||
|
||||
|
@ -440,8 +440,6 @@ WRITE_LINE_MEMBER( snug_enhanced_video_device::video_interrupt_in )
|
||||
m_intlevel = state;
|
||||
if (m_console_conn != nullptr) m_console_conn->vclock_line(state);
|
||||
else m_slot->lcp_line(state);
|
||||
|
||||
if (state!=0) m_colorbus->poll();
|
||||
}
|
||||
}
|
||||
|
||||
@ -508,8 +506,8 @@ void snug_enhanced_video_device::device_add_mconfig(machine_config& config)
|
||||
soundgen.ready_cb().set(FUNC(snug_enhanced_video_device::ready_line));
|
||||
soundgen.add_route(ALL_OUTPUTS, "sound_out", 0.75);
|
||||
|
||||
// Mouse connected to the color bus of the v9938
|
||||
TI99_COLORBUS(config, m_colorbus, 0, ti99_colorbus_options, "busmouse");
|
||||
// Mouse connected to the color bus of the v9938; default: none
|
||||
V9938_COLORBUS(config, m_colorbus, 0, ti99_colorbus_options, nullptr);
|
||||
}
|
||||
|
||||
} } } // end namespace bus::ti99::peb
|
||||
|
@ -85,7 +85,7 @@ private:
|
||||
evpc_palette m_palette;
|
||||
required_device<v9938_device> m_video;
|
||||
required_device<sn76496_base_device> m_sound;
|
||||
required_device<bus::ti99::colorbus::ti99_colorbus_device> m_colorbus;
|
||||
required_device<bus::ti99::colorbus::v9938_colorbus_device> m_colorbus;
|
||||
optional_device<bus::ti99::internal::evpc_clock_connector> m_console_conn;
|
||||
};
|
||||
|
||||
|
@ -273,20 +273,35 @@ void v99x8_device::configure_pal_ntsc()
|
||||
|
||||
|
||||
/*
|
||||
Driver-specific function: update the vdp mouse state
|
||||
Colorbus inputs
|
||||
vdp will process mouse deltas only if it is in mouse mode
|
||||
Reg 8: MS LP x x x x x x
|
||||
*/
|
||||
void v99x8_device::update_mouse_state(int mx_delta, int my_delta, int button_state)
|
||||
void v99x8_device::colorbus_x_input(int mx_delta)
|
||||
{
|
||||
// save button state
|
||||
m_button_state = (button_state << 6) & 0xc0;
|
||||
|
||||
if ((m_cont_reg[8] & 0xc0) == 0x80)
|
||||
{ // vdp will process mouse deltas only if it is in mouse mode
|
||||
{
|
||||
m_mx_delta += mx_delta;
|
||||
m_my_delta += my_delta;
|
||||
if (m_mx_delta < -127) m_mx_delta = -127;
|
||||
if (m_mx_delta > 127) m_mx_delta = 127;
|
||||
}
|
||||
}
|
||||
|
||||
void v99x8_device::colorbus_y_input(int my_delta)
|
||||
{
|
||||
if ((m_cont_reg[8] & 0xc0) == 0x80)
|
||||
{
|
||||
m_my_delta += my_delta;
|
||||
if (m_my_delta < -127) m_my_delta = -127;
|
||||
if (m_my_delta > 127) m_my_delta = 127;
|
||||
}
|
||||
}
|
||||
|
||||
void v99x8_device::colorbus_button_input(bool switch1_pressed, bool switch2_pressed)
|
||||
{
|
||||
// save button state
|
||||
m_button_state = (switch2_pressed? 0x80 : 0x00) | (switch1_pressed? 0x40 : 0x00);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -49,7 +49,9 @@ public:
|
||||
}
|
||||
|
||||
bitmap_rgb32 &get_bitmap() { return m_bitmap; }
|
||||
void update_mouse_state(int mx_delta, int my_delta, int button_state);
|
||||
void colorbus_x_input(int mx_delta);
|
||||
void colorbus_y_input(int my_delta);
|
||||
void colorbus_button_input(bool button1, bool button2);
|
||||
|
||||
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
|
||||
@ -210,7 +212,7 @@ private:
|
||||
// blinking
|
||||
int m_blink, m_blink_count;
|
||||
// mouse
|
||||
uint8_t m_mx_delta, m_my_delta;
|
||||
int16_t m_mx_delta, m_my_delta;
|
||||
// mouse & lightpen
|
||||
uint8_t m_button_state;
|
||||
// render bitmap
|
||||
|
@ -218,7 +218,8 @@ public:
|
||||
m_mapper(*this, GENEVE_MAPPER_TAG),
|
||||
m_peribox(*this, TI_PERIBOX_TAG),
|
||||
m_joyport(*this, TI_JOYPORT_TAG),
|
||||
m_colorbus(*this, COLORBUS_TAG)
|
||||
m_colorbus(*this, COLORBUS_TAG),
|
||||
m_left_button(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -240,6 +241,7 @@ private:
|
||||
DECLARE_WRITE_LINE_MEMBER(joystick_select);
|
||||
DECLARE_WRITE_LINE_MEMBER(extbus_wait_states);
|
||||
DECLARE_WRITE_LINE_MEMBER(video_wait_states);
|
||||
DECLARE_WRITE_LINE_MEMBER(left_mouse_button);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(clock_out);
|
||||
|
||||
@ -255,7 +257,7 @@ private:
|
||||
required_device<bus::ti99::internal::geneve_mapper_device> m_mapper;
|
||||
required_device<bus::ti99::peb::peribox_device> m_peribox;
|
||||
required_device<bus::ti99::joyport::joyport_device> m_joyport;
|
||||
required_device<bus::ti99::colorbus::ti99_colorbus_device> m_colorbus;
|
||||
required_device<bus::ti99::colorbus::v9938_colorbus_device> m_colorbus;
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( inta );
|
||||
DECLARE_WRITE_LINE_MEMBER( intb );
|
||||
@ -276,6 +278,8 @@ private:
|
||||
int m_ready_line;
|
||||
int m_ready_line1;
|
||||
|
||||
int m_left_button;
|
||||
|
||||
void crumap(address_map &map);
|
||||
void memmap(address_map &map);
|
||||
void memmap_setaddress(address_map &map);
|
||||
@ -479,8 +483,8 @@ uint8_t geneve_state::psi_input(offs_t offset)
|
||||
|
||||
// Left mouse button
|
||||
case tms9901_device::INT10_P12:
|
||||
LOG("Mouse button = %d\n", m_colorbus->left_button());
|
||||
return (m_colorbus->left_button()==CLEAR_LINE)? 1 : 0;
|
||||
LOGMASKED(LOG_CRU, "Mouse button = %d\n", m_left_button);
|
||||
return (m_left_button==CLEAR_LINE)? 1 : 0;
|
||||
|
||||
// TODO: Real time clock interrupt
|
||||
case tms9901_device::INT11_P11:
|
||||
@ -491,65 +495,17 @@ uint8_t geneve_state::psi_input(offs_t offset)
|
||||
return (m_intb==CLEAR_LINE)? 1 : 0;
|
||||
|
||||
default:
|
||||
LOG("Unknown pin %d\n", offset);
|
||||
// Pin 9 seems to be queried although there is no connection, maybe
|
||||
// by CRU multi-bit operation (STCR)
|
||||
// LOGMASKED(LOG_WARN, "Unknown pin %d\n", offset);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
switch (offset & 0x03)
|
||||
{
|
||||
case tms9901_device::CB_INT7:
|
||||
//
|
||||
// Read pins INT3*-INT7* of Geneve's 9901.
|
||||
// bit 1: INTA status
|
||||
// bit 2: INT2 status
|
||||
// bit 3-7: joystick status
|
||||
//
|
||||
// |K|K|K|K|K|I2|I1|C|
|
||||
// negative logic
|
||||
if (m_inta==CLEAR_LINE) answer |= 0x02;
|
||||
if (m_int2==CLEAR_LINE) answer |= 0x04;
|
||||
answer |= m_joyport->read_port()<<3;
|
||||
break;
|
||||
|
||||
case tms9901_device::INT8_INT15:
|
||||
// Read pins int8_t*-INT15* of Geneve 9901.
|
||||
//
|
||||
// bit 0: keyboard interrupt
|
||||
// bit 1: unused
|
||||
// bit 2: mouse left button
|
||||
// (bit 3: clock interrupt)
|
||||
// bit 4: INTB from PE-bus
|
||||
// bit 5 & 7: used as output
|
||||
// bit 6: unused
|
||||
if (m_keyint==CLEAR_LINE) answer |= 0x01;
|
||||
if (m_colorbus->left_button()==CLEAR_LINE) answer |= 0x04;
|
||||
// TODO: add clock interrupt
|
||||
if (m_intb==CLEAR_LINE) answer |= 0x10;
|
||||
if (m_video_wait==ASSERT_LINE) answer |= 0x20;
|
||||
// TODO: PAL pin 5
|
||||
LOGMASKED(LOG_LINES, "INT15-8 = %02x\n", answer);
|
||||
break;
|
||||
|
||||
case tms9901_device::P0_P7:
|
||||
// Read pins P0-P7 of TMS9901. All pins are configured as outputs, so nothing here.
|
||||
break;
|
||||
|
||||
case tms9901_device::P8_P15:
|
||||
// Read pins P8-P15 of TMS 9901.
|
||||
// bit 4: mouse left button
|
||||
// video wait is an output; no input possible here
|
||||
if (m_intb==CLEAR_LINE) answer |= 0x04; // mirror from above
|
||||
// TODO: 0x08 = real-time clock int
|
||||
if (m_colorbus->left_button()==CLEAR_LINE) answer |= 0x10; // mirror from above
|
||||
if (m_keyint==CLEAR_LINE) answer |= 0x40;
|
||||
|
||||
// Joystick up (mirror of bit 7)
|
||||
if ((m_joyport->read_port() & 0x10)==0) answer |= 0x80;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
WRITE_LINE_MEMBER( geneve_state::left_mouse_button )
|
||||
{
|
||||
m_left_button = state;
|
||||
}
|
||||
|
||||
/*
|
||||
Write PE bus reset line
|
||||
@ -654,10 +610,6 @@ WRITE_LINE_MEMBER(geneve_state::set_tms9901_INT2_from_v9938)
|
||||
{
|
||||
m_int2 = (state!=0)? ASSERT_LINE : CLEAR_LINE;
|
||||
m_tms9901->set_int_line(2, state);
|
||||
if (state!=0)
|
||||
{
|
||||
m_colorbus->poll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -699,6 +651,7 @@ void geneve_state::machine_start()
|
||||
save_item(NAME(m_video_wait)); // reflects the line to the mapper for CRU query
|
||||
save_item(NAME(m_ready_line));
|
||||
save_item(NAME(m_ready_line1));
|
||||
save_item(NAME(m_left_button));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -804,7 +757,8 @@ void geneve_state::geneve_common(machine_config &config)
|
||||
// User interface devices
|
||||
GENEVE_KEYBOARD(config, m_keyboard, 0).int_cb().set(FUNC(geneve_state::keyboard_interrupt));
|
||||
TI99_JOYPORT(config, m_joyport, 0, ti99_joyport_options_plain, "twinjoy");
|
||||
TI99_COLORBUS(config, m_colorbus, 0, ti99_colorbus_options, "busmouse");
|
||||
V9938_COLORBUS(config, m_colorbus, 0, ti99_colorbus_options, nullptr);
|
||||
m_colorbus->extra_button_cb().set(FUNC(geneve_state::left_mouse_button));
|
||||
|
||||
// PFM expansion
|
||||
AT29C040(config, GENEVE_PFM512_TAG);
|
||||
|
Loading…
Reference in New Issue
Block a user