added saitek OSA module interface used in leonardo/renaissance

This commit is contained in:
hap 2021-05-14 22:00:28 +02:00
parent c89891e4aa
commit c8d53cabbd
12 changed files with 445 additions and 23 deletions

View File

@ -4442,6 +4442,22 @@ if (BUSES["RTPC_KBD"]~=null) then
}
end
---------------------------------------------------
--
--@src/devices/bus/saitek_osa/expansion.h,BUSES["SAITEK_OSA"] = true
---------------------------------------------------
if (BUSES["SAITEK_OSA"]~=null) then
files {
MAME_DIR .. "src/devices/bus/saitek_osa/expansion.cpp",
MAME_DIR .. "src/devices/bus/saitek_osa/expansion.h",
MAME_DIR .. "src/devices/bus/saitek_osa/modules.cpp",
MAME_DIR .. "src/devices/bus/saitek_osa/modules.h",
MAME_DIR .. "src/devices/bus/saitek_osa/maestroa.cpp",
MAME_DIR .. "src/devices/bus/saitek_osa/maestroa.h",
}
end
---------------------------------------------------
--
--@src/devices/bus/samcoupe/drive/drive.h,BUSES["SAMCOUPE_DRIVE_PORT"] = true

View File

@ -935,6 +935,7 @@ BUSES["QBUS"] = true
BUSES["RS232"] = true
BUSES["RTPC_KBD"] = true
BUSES["S100"] = true
BUSES["SAITEK_OSA"] = true
BUSES["SAMCOUPE_DRIVE_PORT"] = true
BUSES["SAMCOUPE_EXPANSION"] = true
BUSES["SAMCOUPE_MOUSE_PORT"] = true

View File

@ -0,0 +1,127 @@
// license:BSD-3-Clause
// copyright-holders:Dirk Best, hap
/***************************************************************************
Saitek OSA Expansion Slot
TODO:
- not sure what RTS does
***************************************************************************/
#include "emu.h"
#include "expansion.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(SAITEKOSA_EXPANSION, saitekosa_expansion_device, "saitekosa_expansion", "Saitek OSA Expansion Bus")
//**************************************************************************
// SLOT DEVICE
//**************************************************************************
//-------------------------------------------------
// saitekosa_expansion_device - constructor
//-------------------------------------------------
saitekosa_expansion_device::saitekosa_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, SAITEKOSA_EXPANSION, tag, owner, clock),
device_single_card_slot_interface<device_saitekosa_expansion_interface>(mconfig, *this),
m_stb_handler(*this),
m_rts_handler(*this),
m_module(nullptr)
{ }
//-------------------------------------------------
// saitekosa_expansion_device - destructor
//-------------------------------------------------
saitekosa_expansion_device::~saitekosa_expansion_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void saitekosa_expansion_device::device_start()
{
// get inserted module
m_module = get_card_device();
// resolve callbacks
m_stb_handler.resolve_safe();
m_rts_handler.resolve_safe();
// register for savestates
save_item(NAME(m_data));
save_item(NAME(m_nmi));
save_item(NAME(m_ack));
}
//-------------------------------------------------
// host to module interface
//-------------------------------------------------
u8 saitekosa_expansion_device::data_r()
{
if (m_module)
return m_module->data_r();
return 0xff;
}
void saitekosa_expansion_device::data_w(u8 data)
{
if (m_module)
m_module->data_w(data);
m_data = data;
}
void saitekosa_expansion_device::nmi_w(int state)
{
state = (state) ? 1 : 0;
if (m_module)
m_module->nmi_w(state);
m_nmi = state;
}
void saitekosa_expansion_device::ack_w(int state)
{
state = (state) ? 1 : 0;
if (m_module)
m_module->ack_w(state);
m_ack = state;
}
//**************************************************************************
// MODULE INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_saitekosa_expansion_interface - constructor
//-------------------------------------------------
device_saitekosa_expansion_interface::device_saitekosa_expansion_interface(const machine_config &mconfig, device_t &device) :
device_interface(device, "saitekosaexp")
{
m_expansion = dynamic_cast<saitekosa_expansion_device *>(device.owner());
}
//-------------------------------------------------
// ~device_saitekosa_expansion_interface - destructor
//-------------------------------------------------
device_saitekosa_expansion_interface::~device_saitekosa_expansion_interface()
{
}

View File

@ -0,0 +1,117 @@
// license:BSD-3-Clause
// copyright-holders:Dirk Best, hap
/***************************************************************************
Saitek OSA Expansion Slot
15-pin slot "PIO"
STB-P <
D0 <>
D1 <>
D2 <>
D3 <>
D4 <>
D5 <>
D6 <>
D7 <>
ACK-P >
RTS-P <
PW >
GND >
NMI-P >
V+ >
***************************************************************************/
#ifndef MAME_BUS_SAITEKOSA_EXPANSION_H
#define MAME_BUS_SAITEKOSA_EXPANSION_H
#pragma once
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class device_saitekosa_expansion_interface;
// ======================> saitekosa_expansion_device
class saitekosa_expansion_device : public device_t, public device_single_card_slot_interface<device_saitekosa_expansion_interface>
{
public:
// construction/destruction
template <typename T>
saitekosa_expansion_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts) :
saitekosa_expansion_device(mconfig, tag, owner, u32(0))
{
option_reset();
opts(*this);
set_default_option(nullptr);
set_fixed(false);
}
saitekosa_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual ~saitekosa_expansion_device();
// callbacks
auto stb_handler() { return m_stb_handler.bind(); }
auto rts_handler() { return m_rts_handler.bind(); }
// called from module device
void stb_w(int state) { m_stb_handler(state); }
void rts_w(int state) { m_rts_handler(state); }
u8 data_state() { return m_data; }
int nmi_state() { return m_nmi; }
int ack_state() { return m_ack; }
// called from host
u8 data_r();
void data_w(u8 data);
void nmi_w(int state);
void ack_w(int state);
protected:
// device-level overrides
virtual void device_start() override;
private:
devcb_write_line m_stb_handler;
devcb_write_line m_rts_handler;
// input pins state
u8 m_data = 0;
int m_nmi = 0;
int m_ack = 0;
device_saitekosa_expansion_interface *m_module;
};
// ======================> device_saitekosa_expansion_interface
class device_saitekosa_expansion_interface : public device_interface
{
public:
// construction/destruction
virtual ~device_saitekosa_expansion_interface();
virtual u8 data_r() { return 0xff; }
virtual void data_w(u8 data) { }
virtual void nmi_w(int state) { }
virtual void ack_w(int state) { }
protected:
device_saitekosa_expansion_interface(const machine_config &mconfig, device_t &device);
saitekosa_expansion_device *m_expansion;
};
// device type definition
DECLARE_DEVICE_TYPE(SAITEKOSA_EXPANSION, saitekosa_expansion_device)
// include here so drivers don't need to
#include "modules.h"
#endif // MAME_BUS_SAITEKOSA_EXPANSION_H

View File

@ -0,0 +1,54 @@
// license:BSD-3-Clause
// copyright-holders:hap
/***************************************************************************
***************************************************************************/
#include "emu.h"
#include "maestroa.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(OSA_MAESTROA, saitekosa_maestroa_device, "osa_maestroa", "Maestro A")
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void saitekosa_maestroa_device::device_add_mconfig(machine_config &config)
{
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// saitekosa_maestroa_device - constructor
//-------------------------------------------------
saitekosa_maestroa_device::saitekosa_maestroa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, OSA_MAESTROA, tag, owner, clock),
device_saitekosa_expansion_interface(mconfig, *this)
{ }
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void saitekosa_maestroa_device::device_start()
{
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
void saitekosa_maestroa_device::nmi_w(int state)
{
}

View File

@ -0,0 +1,40 @@
// license:BSD-3-Clause
// copyright-holders:hap
/***************************************************************************
Saitek OSA Maestro A
***************************************************************************/
#ifndef MAME_BUS_SAITEKOSA_MAESTROA_H
#define MAME_BUS_SAITEKOSA_MAESTROA_H
#pragma once
#include "expansion.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> saitekosa_maestroa_device
class saitekosa_maestroa_device : public device_t, public device_saitekosa_expansion_interface
{
public:
// construction/destruction
saitekosa_maestroa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// from host
virtual void nmi_w(int state) override;
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
};
// device type definition
DECLARE_DEVICE_TYPE(OSA_MAESTROA, saitekosa_maestroa_device)
#endif // MAME_BUS_SAITEKOSA_MAESTROA_H

View File

@ -0,0 +1,17 @@
// license:BSD-3-Clause
// copyright-holders:hap
/***************************************************************************
Saitek OSA Expansion Slot modules
***************************************************************************/
#include "emu.h"
#include "modules.h"
#include "maestroa.h"
void saitekosa_expansion_modules(device_slot_interface &device)
{
device.option_add("maestroa", OSA_MAESTROA);
}

View File

@ -0,0 +1,16 @@
// license:BSD-3-Clause
// copyright-holders:hap
/***************************************************************************
Saitek OSA Expansion Slot modules
***************************************************************************/
#ifndef MAME_BUS_SAITEKOSA_MODULES_H
#define MAME_BUS_SAITEKOSA_MODULES_H
#pragma once
void saitekosa_expansion_modules(device_slot_interface &device);
#endif // MAME_BUS_SAITEKOSA_MODULES_H

View File

@ -90,14 +90,14 @@ void samcoupe_expansion_device::iorq_w(offs_t offset, uint8_t data)
WRITE_LINE_MEMBER( samcoupe_expansion_device::xmem_w )
{
if (m_module)
m_module->xmem_w(state);
if (m_module)
m_module->xmem_w(state);
}
WRITE_LINE_MEMBER( samcoupe_expansion_device::print_w )
{
if (m_module)
m_module->print_w(state);
if (m_module)
m_module->print_w(state);
}

View File

@ -66,6 +66,10 @@ There are no other known external port peripherals.
The Brikett was also used in the 1983 Mephisto Excalibur, but the hardware
is completely different, based on a 68000.
BTANB:
- bad bug in mephistoj opening library: e4 e6 / d4 d5 / Nd2 c5 / exd5 Qd1xd5,
in other words: computer makes an illegal move with the WHITE queen
******************************************************************************/
#include "emu.h"

View File

@ -42,7 +42,6 @@ Expansion modules released:
- Sparc (SPARClite, Spracklen's)
TODO:
- OSA module support (softwarelist, devices/bus)
- OSA PC link (probably uses MCU serial interface)
- add nvram
- finish internal artwork
@ -51,9 +50,10 @@ TODO:
#include "emu.h"
#include "bus/saitek_osa/expansion.h"
#include "cpu/m6800/m6801.h"
#include "machine/sensorboard.h"
#include "sound/dac.h"
#include "sound/spkrdev.h"
#include "video/pwm.h"
#include "speaker.h"
@ -70,6 +70,7 @@ public:
leo_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_expansion(*this, "exp"),
m_board(*this, "board"),
m_display(*this, "display"),
m_dac(*this, "dac"),
@ -85,9 +86,10 @@ protected:
private:
// devices/pointers
required_device<hd6303y_cpu_device> m_maincpu;
required_device<saitekosa_expansion_device> m_expansion;
required_device<sensorboard_device> m_board;
required_device<pwm_display_device> m_display;
optional_device<dac_bit_interface> m_dac;
optional_device<speaker_sound_device> m_dac;
required_ioport_array<9> m_inputs;
void main_map(address_map &map);
@ -97,6 +99,7 @@ private:
void leds_w(u8 data);
u8 unk_r();
void unk_w(u8 data);
void exp_stb_w(int state);
u8 p2_r();
void p2_w(u8 data);
@ -107,12 +110,14 @@ private:
u8 m_inp_mux = 0;
u8 m_led_data[2] = { 0, 0 };
bool m_stb_enable = false;
};
void leo_state::machine_start()
{
save_item(NAME(m_inp_mux));
save_item(NAME(m_led_data));
save_item(NAME(m_stb_enable));
}
@ -138,7 +143,7 @@ void leo_state::mux_w(u8 data)
update_display();
// d4: speaker out
m_dac->write(BIT(data, 4));
m_dac->level_w(BIT(data, 4));
}
void leo_state::leds_w(u8 data)
@ -159,6 +164,12 @@ void leo_state::unk_w(u8 data)
// ?
}
void leo_state::exp_stb_w(int state)
{
// STB-P to P5 IS
m_maincpu->set_input_line(M6801_IS_LINE, (state && m_stb_enable) ? CLEAR_LINE : ASSERT_LINE);
}
// MCU ports
@ -186,29 +197,38 @@ void leo_state::p2_w(u8 data)
u8 leo_state::p5_r()
{
// ?
// d1: N/C, d4: IS strobe (handled with inputline)
return 0xff ^ 0x10;
}
void leo_state::p5_w(u8 data)
{
// d2: expansion NMI-P
m_expansion->nmi_w(BIT(data, 2));
// d3: enable expansion STB signal
m_stb_enable = bool(BIT(data, 3));
// d5: expansion ACK-P
m_expansion->ack_w(BIT(data, 5));
// d6,d7: chessboard led row data
m_led_data[0] = (m_led_data[0] & 3) | (~data >> 4 & 0xc);
update_display();
// d0: power-off
// other: ?
}
u8 leo_state::p6_r()
{
// read chessboard sensors
return ~m_board->read_file(m_inp_mux & 0xf);
// read chessboard sensors and module data
return ~m_board->read_file(m_inp_mux & 0xf) & m_expansion->data_r();
}
void leo_state::p6_w(u8 data)
{
// module data
m_expansion->data_w(data);
}
@ -291,7 +311,7 @@ INPUT_PORTS_END
void leo_state::leo(machine_config &config)
{
/* basic machine hardware */
// basic machine hardware
HD6303Y(config, m_maincpu, 12_MHz_XTAL);
m_maincpu->set_addrmap(AS_PROGRAM, &leo_state::main_map);
m_maincpu->in_p2_cb().set(FUNC(leo_state::p2_r));
@ -305,13 +325,17 @@ void leo_state::leo(machine_config &config)
m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess));
m_board->set_delay(attotime::from_msec(150));
/* video hardware */
// video hardware
PWM_DISPLAY(config, m_display).set_size(8+2, 8+2);
config.set_default_layout(layout_saitek_leonardo);
/* sound hardware */
// sound hardware
SPEAKER(config, "speaker").front_center();
DAC_1BIT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25);
SPEAKER_SOUND(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25);
// expansion module
SAITEKOSA_EXPANSION(config, m_expansion, saitekosa_expansion_modules);
m_expansion->stb_handler().set(FUNC(leo_state::exp_stb_w));
}
void leo_state::leoa(machine_config &config)

View File

@ -31,9 +31,10 @@ TODO:
#include "emu.h"
#include "bus/saitek_osa/expansion.h"
#include "cpu/m6800/m6801.h"
#include "machine/sensorboard.h"
#include "sound/dac.h"
#include "sound/spkrdev.h"
#include "video/pwm.h"
#include "video/sed1500.h"
@ -52,6 +53,7 @@ public:
ren_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_expansion(*this, "exp"),
m_board(*this, "board"),
m_display(*this, "display"),
m_lcd_pwm(*this, "lcd_pwm"),
@ -70,11 +72,12 @@ protected:
private:
// devices/pointers
required_device<hd6303y_cpu_device> m_maincpu;
required_device<saitekosa_expansion_device> m_expansion;
required_device<sensorboard_device> m_board;
required_device<pwm_display_device> m_display;
required_device<pwm_display_device> m_lcd_pwm;
required_device<sed1502_device> m_lcd;
optional_device<dac_bit_interface> m_dac;
optional_device<speaker_sound_device> m_dac;
required_ioport_array<8+1> m_inputs;
output_finder<16, 34> m_out_lcd;
@ -156,7 +159,7 @@ void ren_state::leds_w(u8 data)
void ren_state::control_w(u8 data)
{
// d1: speaker out
m_dac->write(BIT(data, 1));
m_dac->level_w(BIT(data, 1));
// d2,d3: comm/module leds?
m_led_data[1] = (m_led_data[1] & ~0xc) | (~data & 0xc);
@ -301,7 +304,7 @@ INPUT_PORTS_END
void ren_state::ren(machine_config &config)
{
/* basic machine hardware */
// basic machine hardware
HD6303Y(config, m_maincpu, 10_MHz_XTAL);
m_maincpu->set_addrmap(AS_PROGRAM, &ren_state::main_map);
m_maincpu->in_p2_cb().set(FUNC(ren_state::p2_r));
@ -315,7 +318,7 @@ void ren_state::ren(machine_config &config)
m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess));
m_board->set_delay(attotime::from_msec(150));
/* video hardware */
// video hardware
SED1502(config, m_lcd, 32768).write_segs().set(FUNC(ren_state::lcd_output_w));
PWM_DISPLAY(config, m_lcd_pwm).set_size(16, 34);
m_lcd_pwm->set_refresh(attotime::from_hz(30));
@ -329,9 +332,12 @@ void ren_state::ren(machine_config &config)
PWM_DISPLAY(config, m_display).set_size(9+1, 9);
config.set_default_layout(layout_saitek_renaissance);
/* sound hardware */
// sound hardware
SPEAKER(config, "speaker").front_center();
DAC_1BIT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25);
SPEAKER_SOUND(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25);
// expansion module
SAITEKOSA_EXPANSION(config, m_expansion, saitekosa_expansion_modules);
}