mirror of
https://github.com/holub/mame
synced 2025-04-18 22:49:58 +03:00
bus/bbc/userport: Added SD Card, and SD Turbo interfaces (not working).
This commit is contained in:
parent
3a49ac4301
commit
e0b3f53210
@ -774,6 +774,8 @@ if (BUSES["BBC_USERPORT"]~=null) then
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/palext.h",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/pointer.cpp",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/pointer.h",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/sdcard.cpp",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/sdcard.h",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/usersplit.cpp",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/usersplit.h",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/voicebox.cpp",
|
||||
|
155
src/devices/bus/bbc/userport/sdcard.cpp
Normal file
155
src/devices/bus/bbc/userport/sdcard.cpp
Normal file
@ -0,0 +1,155 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Nigel Barnes
|
||||
/**********************************************************************
|
||||
|
||||
BBC Micro SD Card
|
||||
|
||||
Original Interface Hardware
|
||||
===========================
|
||||
|
||||
This is the original interface design, as conceived by Martin Mather
|
||||
in 2006.
|
||||
|
||||
User Port SD Card
|
||||
(Master) (Slave)
|
||||
========= =======
|
||||
CB1/PB1 ==> S_CLK (Clock)
|
||||
CB2 <== S_MISO (Dout)
|
||||
PB0 ==> S_MOSI (Din)
|
||||
0V ==> S_SEL (Select)
|
||||
|
||||
TurboMMC Interface Hardware
|
||||
===========================
|
||||
|
||||
The TurboMMC hardware is a more complicated, as it uses PB[4:2] to
|
||||
control three buffers, providing two different operating modes.
|
||||
|
||||
When PB[4:2] are 010, then the hardware is configured as above, and
|
||||
the interface is compatible with the original hardware.
|
||||
|
||||
When PB[4:2] are 101, then the hardware is re-configured as:
|
||||
|
||||
User Port SD Card
|
||||
(Master) (Slave)
|
||||
========= =======
|
||||
CB1/PB1 ==> S_CLK (Clock)
|
||||
n/c <== S_MISO (Dout)
|
||||
CB2 ==> S_MOSI (Din)
|
||||
0V ==> S_SEL (Select)
|
||||
|
||||
TODO:
|
||||
- implement SR Mode 0 in via6522_device.
|
||||
- implement SPI Mode 0 in spi_sdcard_device.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "sdcard.h"
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(BBC_SDCARD, bbc_sdcard_device, "bbc_sdcard", "BBC Micro SD Card")
|
||||
DEFINE_DEVICE_TYPE(BBC_SDCARDT, bbc_sdcardt_device, "bbc_sdcardt", "BBC Micro Turbo SD Card")
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_add_mconfig - add device configuration
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_sdcard_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
SPI_SDCARD(config, m_sdcard, 0);
|
||||
m_sdcard->spi_miso_callback().set([this](int state) { m_slot->cb2_w(state); });
|
||||
}
|
||||
|
||||
void bbc_sdcardt_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
SPI_SDCARD(config, m_sdcard, 0);
|
||||
m_sdcard->spi_miso_callback().set([this](int state) { if (!m_turbo) m_slot->cb2_w(state); });
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// bbc_sdcard_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
bbc_sdcard_device::bbc_sdcard_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, type, tag, owner, clock)
|
||||
, device_bbc_userport_interface(mconfig, *this)
|
||||
, m_sdcard(*this, "sdcard")
|
||||
{
|
||||
}
|
||||
|
||||
bbc_sdcard_device::bbc_sdcard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: bbc_sdcard_device(mconfig, BBC_SDCARD, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
bbc_sdcardt_device::bbc_sdcardt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: bbc_sdcard_device(mconfig, BBC_SDCARDT, tag, owner, clock)
|
||||
, m_turbo(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_sdcard_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
void bbc_sdcardt_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_turbo));
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
void bbc_sdcard_device::write_cb1(int state)
|
||||
{
|
||||
m_sdcard->spi_ss_w(1);
|
||||
m_sdcard->spi_clock_w(!state);
|
||||
}
|
||||
|
||||
void bbc_sdcard_device::pb_w(uint8_t data)
|
||||
{
|
||||
m_sdcard->spi_ss_w(1);
|
||||
m_sdcard->spi_mosi_w(BIT(data, 0));
|
||||
m_sdcard->spi_clock_w(!BIT(data, 1));
|
||||
}
|
||||
|
||||
|
||||
void bbc_sdcardt_device::write_cb1(int state)
|
||||
{
|
||||
m_sdcard->spi_ss_w(1);
|
||||
m_sdcard->spi_clock_w(!state);
|
||||
}
|
||||
|
||||
void bbc_sdcardt_device::write_cb2(int state)
|
||||
{
|
||||
if (m_turbo)
|
||||
{
|
||||
m_sdcard->spi_ss_w(1);
|
||||
m_sdcard->spi_mosi_w(state);
|
||||
}
|
||||
}
|
||||
|
||||
void bbc_sdcardt_device::pb_w(uint8_t data)
|
||||
{
|
||||
m_turbo = (data & 0x1c) == 0x14;
|
||||
|
||||
m_sdcard->spi_ss_w(1);
|
||||
m_sdcard->spi_clock_w(!BIT(data, 1));
|
||||
}
|
77
src/devices/bus/bbc/userport/sdcard.h
Normal file
77
src/devices/bus/bbc/userport/sdcard.h
Normal file
@ -0,0 +1,77 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Nigel Barnes
|
||||
/**********************************************************************
|
||||
|
||||
BBC Micro SD Card
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
#ifndef MAME_BUS_BBC_USERPORT_SDCARD_H
|
||||
#define MAME_BUS_BBC_USERPORT_SDCARD_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "userport.h"
|
||||
#include "machine/spi_sdcard.h"
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> bbc_sdcard_device
|
||||
|
||||
class bbc_sdcard_device : public device_t, public device_bbc_userport_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
bbc_sdcard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
static constexpr feature_type unemulated_features() { return feature::MEDIA; }
|
||||
|
||||
protected:
|
||||
bbc_sdcard_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
virtual void pb_w(uint8_t data) override;
|
||||
virtual void write_cb1(int state) override;
|
||||
|
||||
required_device<spi_sdcard_device> m_sdcard;
|
||||
};
|
||||
|
||||
|
||||
// ======================> bbc_sdcardt_device
|
||||
|
||||
class bbc_sdcardt_device : public bbc_sdcard_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
bbc_sdcardt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
virtual void pb_w(uint8_t data) override;
|
||||
virtual void write_cb1(int state) override;
|
||||
virtual void write_cb2(int state) override;
|
||||
|
||||
private:
|
||||
bool m_turbo;;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(BBC_SDCARD, bbc_sdcard_device)
|
||||
DECLARE_DEVICE_TYPE(BBC_SDCARDT, bbc_sdcardt_device)
|
||||
|
||||
|
||||
#endif // MAME_BUS_BBC_USERPORT_SDCARD_H
|
@ -135,6 +135,7 @@ void bbc_userport_slot_device::write_cb2(int state)
|
||||
#include "m4000.h"
|
||||
#include "palext.h"
|
||||
#include "pointer.h"
|
||||
#include "sdcard.h"
|
||||
#include "usersplit.h"
|
||||
//#include "vci.h"
|
||||
#include "voicebox.h"
|
||||
@ -154,6 +155,8 @@ void bbc_userport_devices(device_slot_interface &device)
|
||||
device.option_add("lcd", BBC_LCD); /* Sprow LCD Display */
|
||||
device.option_add("m4000", BBC_M4000); /* Hybrid Music 4000 Keyboard */
|
||||
device.option_add("m512mouse", BBC_M512MOUSE); /* Acorn Mouse (provided with Master 512) */
|
||||
device.option_add("sdcard", BBC_SDCARD); /* SD Card */
|
||||
device.option_add("sdcardt", BBC_SDCARDT); /* Turbo SD Card */
|
||||
device.option_add("tracker", BBC_TRACKER); /* Marconi RB2 Tracker Ball / Acorn Tracker Ball */
|
||||
device.option_add("usersplit", BBC_USERSPLIT); /*User Port Splitter (Watford Electronics) */
|
||||
//device.option_add("vci", BBC_VCI); /* Video Camera Interface (Data Harvest) */
|
||||
|
Loading…
Reference in New Issue
Block a user