Previous 199869 Revisions Next

r41675 Tuesday 10th November, 2015 at 05:35:02 UTC by Barry Rodewald
amstad: Transtape WIP support. [Barry Rodewald]
[scripts/src]bus.lua
[src/devices/bus/cpc]doubler.cpp transtape.cpp* transtape.h*
[src/mame/drivers]amstrad.cpp
[src/mame/includes]amstrad.h

trunk/scripts/src/bus.lua
r250186r250187
22052205      MAME_DIR .. "src/devices/bus/cpc/magicsound.h",
22062206      MAME_DIR .. "src/devices/bus/cpc/doubler.cpp",
22072207      MAME_DIR .. "src/devices/bus/cpc/doubler.h",
2208      MAME_DIR .. "src/devices/bus/cpc/transtape.cpp",
2209      MAME_DIR .. "src/devices/bus/cpc/transtape.h",
22082210   }
22092211end
22102212
trunk/src/devices/bus/cpc/doubler.cpp
r250186r250187
66 *
77 */
88
9   #include "doubler.h"
10   #include "includes/amstrad.h"
9#include "doubler.h"
10#include "includes/amstrad.h"
1111
12   //**************************************************************************
12//**************************************************************************
1313//  DEVICE DEFINITIONS
1414//**************************************************************************
1515
trunk/src/devices/bus/cpc/transtape.cpp
r0r250187
1// license:BSD-3-Clause
2// copyright-holders:Barry Rodewald
3/*
4 * transtape.c  --  Hard Micro SA Transtape
5 *
6 * Spanish hacking device
7 *
8 * Further info at - http://cpcwiki.eu/index.php/Transtape
9 */
10
11#include "transtape.h"
12#include "includes/amstrad.h"
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type CPC_TRANSTAPE = &device_creator<cpc_transtape_device>;
19
20ROM_START( cpc_transtape )
21   ROM_REGION( 0x4000, "tt_rom", 0 )
22   ROM_LOAD( "tta.rom",   0x0000, 0x4000, CRC(c568da76) SHA1(cc509d21216bf11d40f9a3e0791ef7f4ada03790) )
23ROM_END
24
25const rom_entry *cpc_transtape_device::device_rom_region() const
26{
27   return ROM_NAME( cpc_transtape );
28}
29
30static INPUT_PORTS_START(cpc_transtape)
31   PORT_START("transtape")
32   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)
33   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)
34INPUT_PORTS_END
35
36ioport_constructor cpc_transtape_device::device_input_ports() const
37{
38   return INPUT_PORTS_NAME( cpc_transtape );
39}
40
41//**************************************************************************
42//  LIVE DEVICE
43//**************************************************************************
44
45cpc_transtape_device::cpc_transtape_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
46   device_t(mconfig, CPC_TRANSTAPE, "HM Transtape", tag, owner, clock, "cpc_transtape", __FILE__),
47   device_cpc_expansion_card_interface(mconfig, *this),
48   m_rom_active(false),
49   m_romen(true),
50   m_output(0)
51{
52}
53
54//-------------------------------------------------
55//  device_start - device-specific startup
56//-------------------------------------------------
57
58void cpc_transtape_device::device_start()
59{
60   m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
61   m_cpu = static_cast<cpu_device*>(machine().device("maincpu"));
62   m_space = &m_cpu->space(AS_IO);
63
64   m_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000);
65
66   m_space->install_write_handler(0xfbf0,0xfbf0,0,0,write8_delegate(FUNC(cpc_transtape_device::output_w),this));
67   m_space->install_read_handler(0xfbff,0xfbff,0,0,read8_delegate(FUNC(cpc_transtape_device::input_r),this));
68}
69
70//-------------------------------------------------
71//  device_reset - device-specific reset
72//-------------------------------------------------
73
74void cpc_transtape_device::device_reset()
75{
76   // TODO
77   m_rom_active = false;
78   m_output = 0;
79}
80
81void cpc_transtape_device::map_enable()
82{
83   UINT8* ROM = memregion("tt_rom")->base();
84   if(m_output & 0x02)  // ROM enable
85   {
86      membank(":bank1")->set_base(ROM);
87      membank(":bank2")->set_base(ROM+0x2000);
88   }
89   if(m_output & 0x01)  // RAM enable
90   {
91      membank(":bank7")->set_base(m_ram);
92      membank(":bank15")->set_base(m_ram);
93      membank(":bank8")->set_base(m_ram);  // repeats in second 8kB
94      membank(":bank16")->set_base(m_ram);
95   }
96}
97
98INPUT_CHANGED_MEMBER(cpc_transtape_device::button_red_w)
99{
100   // enables device ROM at 0x0000, RAM at 0xc000, generates NMI
101   if(newval & 0x01)
102   {
103      m_output |= 0x1f;
104      map_enable();
105      m_cpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE);
106   }
107}
108
109INPUT_CHANGED_MEMBER(cpc_transtape_device::button_black_w)
110{
111   // enables device ROM at 0x0000, RAM at 0xc000(?), force execution to start at 0x0000
112   if(newval & 0x01)
113   {
114      m_output |= 0x1f;
115      map_enable();
116      m_cpu->set_pc(0);
117   }
118}
119
120READ8_MEMBER(cpc_transtape_device::input_r)
121{
122   // TODO
123   return 0x80;
124}
125
126WRITE8_MEMBER(cpc_transtape_device::output_w)
127{
128   // TODO
129   m_output = data;
130   m_slot->rom_select(space,0,get_rom_bank());  // trigger rethink
131}
132
133void cpc_transtape_device::set_mapping(UINT8 type)
134{
135   if(type != MAP_OTHER)
136      return;
137   map_enable();
138}
139
140
trunk/src/devices/bus/cpc/transtape.h
r0r250187
1// license:BSD-3-Clause
2// copyright-holders:Barry Rodewald
3/*
4 * transtape.c  --  Hard Micro SA Transtape
5 *
6 * Spanish hacking device
7 *
8 */
9
10#ifndef TRANSTAPE_H_
11#define TRANSTAPE_H_
12
13#include "emu.h"
14#include "cpcexp.h"
15
16class cpc_transtape_device  : public device_t,
17                  public device_cpc_expansion_card_interface
18{
19public:
20   // construction/destruction
21   cpc_transtape_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
22
23   // optional information overrides
24   virtual const rom_entry *device_rom_region() const;
25   virtual ioport_constructor device_input_ports() const;
26   
27   virtual void set_mapping(UINT8 type);
28   virtual WRITE_LINE_MEMBER( romen_w ) { m_romen = state; }
29   
30   DECLARE_READ8_MEMBER(input_r);
31   DECLARE_WRITE8_MEMBER(output_w);
32   DECLARE_INPUT_CHANGED_MEMBER(button_red_w);
33   DECLARE_INPUT_CHANGED_MEMBER(button_black_w);
34
35protected:
36   // device-level overrides
37   virtual void device_start();
38   virtual void device_reset();
39
40private:
41   cpc_expansion_slot_device *m_slot;
42   cpu_device* m_cpu;
43   address_space* m_space;
44   UINT8* m_ram;  // 8kB internal RAM
45   bool m_rom_active;
46   bool m_romen;
47   UINT8 m_output;
48   
49   void map_enable();
50};
51
52// device type definition
53extern const device_type CPC_TRANSTAPE;
54
55#endif /* TRANSTAPE_H_ */
trunk/src/mame/drivers/amstrad.cpp
r250186r250187
816816   SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4)
817817   SLOT_INTERFACE("hd20", CPC_HD20)
818818   SLOT_INTERFACE("doubler", CPC_DOUBLER)
819   SLOT_INTERFACE("transtape", CPC_TRANSTAPE)
819820SLOT_INTERFACE_END
820821
821822SLOT_INTERFACE_START(cpc_exp_cards)
r250186r250187
833834   SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4)
834835   SLOT_INTERFACE("hd20", CPC_HD20)
835836   SLOT_INTERFACE("doubler", CPC_DOUBLER)
837   SLOT_INTERFACE("transtape", CPC_TRANSTAPE)
836838SLOT_INTERFACE_END
837839
838840SLOT_INTERFACE_START(cpcplus_exp_cards)
r250186r250187
848850   SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH)
849851   SLOT_INTERFACE("hd20", CPC_HD20)
850852   SLOT_INTERFACE("doubler", CPC_DOUBLER)
853   SLOT_INTERFACE("transtape", CPC_TRANSTAPE)  // Plus compatible?
851854SLOT_INTERFACE_END
852855
853856SLOT_INTERFACE_START(aleste_exp_cards)
r250186r250187
865868   SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4)
866869   SLOT_INTERFACE("hd20", CPC_HD20)
867870   SLOT_INTERFACE("doubler", CPC_DOUBLER)
871   SLOT_INTERFACE("transtape", CPC_TRANSTAPE)
868872   SLOT_INTERFACE("magicsound", AL_MAGICSOUND)
869873SLOT_INTERFACE_END
870874
trunk/src/mame/includes/amstrad.h
r250186r250187
3131#include "bus/cpc/hd20.h"
3232#include "bus/cpc/magicsound.h"
3333#include "bus/cpc/doubler.h"
34#include "bus/cpc/transtape.h"
3435#include "machine/ram.h"
3536#include "imagedev/cassette.h"
3637#include "bus/centronics/ctronics.h"


Previous 199869 Revisions Next


© 1997-2024 The MAME Team