mirror of
https://github.com/holub/mame
synced 2025-04-18 22:49:58 +03:00
amstad: Transtape WIP support. [Barry Rodewald]
This commit is contained in:
parent
f7cf715b6b
commit
6f3d1ec8f4
@ -2205,6 +2205,8 @@ if (BUSES["CPC"]~=null) then
|
||||
MAME_DIR .. "src/devices/bus/cpc/magicsound.h",
|
||||
MAME_DIR .. "src/devices/bus/cpc/doubler.cpp",
|
||||
MAME_DIR .. "src/devices/bus/cpc/doubler.h",
|
||||
MAME_DIR .. "src/devices/bus/cpc/transtape.cpp",
|
||||
MAME_DIR .. "src/devices/bus/cpc/transtape.h",
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -6,10 +6,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "doubler.h"
|
||||
#include "includes/amstrad.h"
|
||||
#include "doubler.h"
|
||||
#include "includes/amstrad.h"
|
||||
|
||||
//**************************************************************************
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
|
140
src/devices/bus/cpc/transtape.cpp
Normal file
140
src/devices/bus/cpc/transtape.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Barry Rodewald
|
||||
/*
|
||||
* transtape.c -- Hard Micro SA Transtape
|
||||
*
|
||||
* Spanish hacking device
|
||||
*
|
||||
* Further info at - http://cpcwiki.eu/index.php/Transtape
|
||||
*/
|
||||
|
||||
#include "transtape.h"
|
||||
#include "includes/amstrad.h"
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
const device_type CPC_TRANSTAPE = &device_creator<cpc_transtape_device>;
|
||||
|
||||
ROM_START( cpc_transtape )
|
||||
ROM_REGION( 0x4000, "tt_rom", 0 )
|
||||
ROM_LOAD( "tta.rom", 0x0000, 0x4000, CRC(c568da76) SHA1(cc509d21216bf11d40f9a3e0791ef7f4ada03790) )
|
||||
ROM_END
|
||||
|
||||
const rom_entry *cpc_transtape_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME( cpc_transtape );
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START(cpc_transtape)
|
||||
PORT_START("transtape")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Red Button") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF,cpc_transtape_device,button_red_w,1)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Black Button") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF,cpc_transtape_device,button_black_w,1)
|
||||
INPUT_PORTS_END
|
||||
|
||||
ioport_constructor cpc_transtape_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME( cpc_transtape );
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
cpc_transtape_device::cpc_transtape_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, CPC_TRANSTAPE, "HM Transtape", tag, owner, clock, "cpc_transtape", __FILE__),
|
||||
device_cpc_expansion_card_interface(mconfig, *this),
|
||||
m_rom_active(false),
|
||||
m_romen(true),
|
||||
m_output(0)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void cpc_transtape_device::device_start()
|
||||
{
|
||||
m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
|
||||
m_cpu = static_cast<cpu_device*>(machine().device("maincpu"));
|
||||
m_space = &m_cpu->space(AS_IO);
|
||||
|
||||
m_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000);
|
||||
|
||||
m_space->install_write_handler(0xfbf0,0xfbf0,0,0,write8_delegate(FUNC(cpc_transtape_device::output_w),this));
|
||||
m_space->install_read_handler(0xfbff,0xfbff,0,0,read8_delegate(FUNC(cpc_transtape_device::input_r),this));
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void cpc_transtape_device::device_reset()
|
||||
{
|
||||
// TODO
|
||||
m_rom_active = false;
|
||||
m_output = 0;
|
||||
}
|
||||
|
||||
void cpc_transtape_device::map_enable()
|
||||
{
|
||||
UINT8* ROM = memregion("tt_rom")->base();
|
||||
if(m_output & 0x02) // ROM enable
|
||||
{
|
||||
membank(":bank1")->set_base(ROM);
|
||||
membank(":bank2")->set_base(ROM+0x2000);
|
||||
}
|
||||
if(m_output & 0x01) // RAM enable
|
||||
{
|
||||
membank(":bank7")->set_base(m_ram);
|
||||
membank(":bank15")->set_base(m_ram);
|
||||
membank(":bank8")->set_base(m_ram); // repeats in second 8kB
|
||||
membank(":bank16")->set_base(m_ram);
|
||||
}
|
||||
}
|
||||
|
||||
INPUT_CHANGED_MEMBER(cpc_transtape_device::button_red_w)
|
||||
{
|
||||
// enables device ROM at 0x0000, RAM at 0xc000, generates NMI
|
||||
if(newval & 0x01)
|
||||
{
|
||||
m_output |= 0x1f;
|
||||
map_enable();
|
||||
m_cpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
INPUT_CHANGED_MEMBER(cpc_transtape_device::button_black_w)
|
||||
{
|
||||
// enables device ROM at 0x0000, RAM at 0xc000(?), force execution to start at 0x0000
|
||||
if(newval & 0x01)
|
||||
{
|
||||
m_output |= 0x1f;
|
||||
map_enable();
|
||||
m_cpu->set_pc(0);
|
||||
}
|
||||
}
|
||||
|
||||
READ8_MEMBER(cpc_transtape_device::input_r)
|
||||
{
|
||||
// TODO
|
||||
return 0x80;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(cpc_transtape_device::output_w)
|
||||
{
|
||||
// TODO
|
||||
m_output = data;
|
||||
m_slot->rom_select(space,0,get_rom_bank()); // trigger rethink
|
||||
}
|
||||
|
||||
void cpc_transtape_device::set_mapping(UINT8 type)
|
||||
{
|
||||
if(type != MAP_OTHER)
|
||||
return;
|
||||
map_enable();
|
||||
}
|
||||
|
||||
|
55
src/devices/bus/cpc/transtape.h
Normal file
55
src/devices/bus/cpc/transtape.h
Normal file
@ -0,0 +1,55 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Barry Rodewald
|
||||
/*
|
||||
* transtape.c -- Hard Micro SA Transtape
|
||||
*
|
||||
* Spanish hacking device
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRANSTAPE_H_
|
||||
#define TRANSTAPE_H_
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpcexp.h"
|
||||
|
||||
class cpc_transtape_device : public device_t,
|
||||
public device_cpc_expansion_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
cpc_transtape_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// optional information overrides
|
||||
virtual const rom_entry *device_rom_region() const;
|
||||
virtual ioport_constructor device_input_ports() const;
|
||||
|
||||
virtual void set_mapping(UINT8 type);
|
||||
virtual WRITE_LINE_MEMBER( romen_w ) { m_romen = state; }
|
||||
|
||||
DECLARE_READ8_MEMBER(input_r);
|
||||
DECLARE_WRITE8_MEMBER(output_w);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(button_red_w);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(button_black_w);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
private:
|
||||
cpc_expansion_slot_device *m_slot;
|
||||
cpu_device* m_cpu;
|
||||
address_space* m_space;
|
||||
UINT8* m_ram; // 8kB internal RAM
|
||||
bool m_rom_active;
|
||||
bool m_romen;
|
||||
UINT8 m_output;
|
||||
|
||||
void map_enable();
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type CPC_TRANSTAPE;
|
||||
|
||||
#endif /* TRANSTAPE_H_ */
|
@ -816,6 +816,7 @@ SLOT_INTERFACE_START(cpc464_exp_cards)
|
||||
SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4)
|
||||
SLOT_INTERFACE("hd20", CPC_HD20)
|
||||
SLOT_INTERFACE("doubler", CPC_DOUBLER)
|
||||
SLOT_INTERFACE("transtape", CPC_TRANSTAPE)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
SLOT_INTERFACE_START(cpc_exp_cards)
|
||||
@ -833,6 +834,7 @@ SLOT_INTERFACE_START(cpc_exp_cards)
|
||||
SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4)
|
||||
SLOT_INTERFACE("hd20", CPC_HD20)
|
||||
SLOT_INTERFACE("doubler", CPC_DOUBLER)
|
||||
SLOT_INTERFACE("transtape", CPC_TRANSTAPE)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
SLOT_INTERFACE_START(cpcplus_exp_cards)
|
||||
@ -848,6 +850,7 @@ SLOT_INTERFACE_START(cpcplus_exp_cards)
|
||||
SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH)
|
||||
SLOT_INTERFACE("hd20", CPC_HD20)
|
||||
SLOT_INTERFACE("doubler", CPC_DOUBLER)
|
||||
SLOT_INTERFACE("transtape", CPC_TRANSTAPE) // Plus compatible?
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
SLOT_INTERFACE_START(aleste_exp_cards)
|
||||
@ -865,6 +868,7 @@ SLOT_INTERFACE_START(aleste_exp_cards)
|
||||
SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4)
|
||||
SLOT_INTERFACE("hd20", CPC_HD20)
|
||||
SLOT_INTERFACE("doubler", CPC_DOUBLER)
|
||||
SLOT_INTERFACE("transtape", CPC_TRANSTAPE)
|
||||
SLOT_INTERFACE("magicsound", AL_MAGICSOUND)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "bus/cpc/hd20.h"
|
||||
#include "bus/cpc/magicsound.h"
|
||||
#include "bus/cpc/doubler.h"
|
||||
#include "bus/cpc/transtape.h"
|
||||
#include "machine/ram.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "bus/centronics/ctronics.h"
|
||||
|
Loading…
Reference in New Issue
Block a user