Previous 199869 Revisions Next

r30798 Tuesday 3rd June, 2014 at 08:28:53 UTC by Curt Coder
(MESS) ql: Added ROM cartridge slot interface. (nw)
[src/emu/bus]bus.mak
[src/emu/bus/ql]rom.c* rom.h* std.c* std.h*
[src/mess/drivers]ql.c
[src/mess/includes]ql.h

trunk/src/emu/bus/bus.mak
r30797r30798
11481148BUSOBJS += $(BUSOBJ)/ql/sandy_superdisk.o
11491149BUSOBJS += $(BUSOBJ)/ql/sandy_superqboard.o
11501150BUSOBJS += $(BUSOBJ)/ql/trumpcard.o
1151BUSOBJS += $(BUSOBJ)/ql/rom.o
1152BUSOBJS += $(BUSOBJ)/ql/std.o
11511153endif
trunk/src/emu/bus/ql/rom.c
r0r30798
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Sinclair QL ROM cartridge port emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#include "rom.h"
13
14
15
16//**************************************************************************
17//  DEVICE DEFINITIONS
18//**************************************************************************
19
20const device_type QL_ROM_CARTRIDGE_SLOT = &device_creator<ql_rom_cartridge_slot_t>;
21
22
23
24//**************************************************************************
25//  CARD INTERFACE
26//**************************************************************************
27
28//-------------------------------------------------
29//  device_ql_rom_cartridge_card_interface - constructor
30//-------------------------------------------------
31
32device_ql_rom_cartridge_card_interface::device_ql_rom_cartridge_card_interface(const machine_config &mconfig, device_t &device) :
33   device_slot_card_interface(mconfig, device),
34   m_rom(*this, "rom"),
35   m_romoeh(1)
36{
37   m_slot = dynamic_cast<ql_rom_cartridge_slot_t *>(device.owner());
38}
39
40
41//-------------------------------------------------
42//  ~device_ql_rom_cartridge_card_interface - destructor
43//-------------------------------------------------
44
45device_ql_rom_cartridge_card_interface::~device_ql_rom_cartridge_card_interface()
46{
47}
48
49
50
51//**************************************************************************
52//  LIVE DEVICE
53//**************************************************************************
54
55//-------------------------------------------------
56//  ql_rom_cartridge_slot_t - constructor
57//-------------------------------------------------
58
59ql_rom_cartridge_slot_t::ql_rom_cartridge_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
60   device_t(mconfig, QL_ROM_CARTRIDGE_SLOT, "QL ROM cartridge slot", tag, owner, clock, "ql_rom_cartridge_slot", __FILE__),
61   device_slot_interface(mconfig, *this),
62   device_image_interface(mconfig, *this)
63{
64}
65
66
67//-------------------------------------------------
68//  device_start - device-specific startup
69//-------------------------------------------------
70
71void ql_rom_cartridge_slot_t::device_start()
72{
73   m_card = dynamic_cast<device_ql_rom_cartridge_card_interface *>(get_card_device());
74}
75
76
77//-------------------------------------------------
78//  call_load -
79//-------------------------------------------------
80
81bool ql_rom_cartridge_slot_t::call_load()
82{
83   if (m_card)
84   {
85      size_t size = 0;
86
87      if (software_entry() == NULL)
88      {
89         size = length();
90
91         m_card->m_rom.allocate(size);
92         fread(m_card->m_rom, size);
93      }
94      else
95      {
96         load_software_region("rom", m_card->m_rom);
97      }
98   }
99
100   return IMAGE_INIT_PASS;
101}
102
103
104//-------------------------------------------------
105//  call_softlist_load -
106//-------------------------------------------------
107
108bool ql_rom_cartridge_slot_t::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
109{
110   load_software_part_region(*this, swlist, swname, start_entry);
111
112   return true;
113}
114
115
116//-------------------------------------------------
117//  get_default_card_software -
118//-------------------------------------------------
119
120void ql_rom_cartridge_slot_t::get_default_card_software(astring &result)
121{
122   software_get_default_slot(result, "standard");
123}
124
125
126//-------------------------------------------------
127//  SLOT_INTERFACE( ql_rom_cartridge_cards )
128//-------------------------------------------------
129
130// slot devices
131#include "std.h"
132
133SLOT_INTERFACE_START( ql_rom_cartridge_cards )
134   // the following need ROMs from the software list
135   SLOT_INTERFACE_INTERNAL("standard", QL_STANDARD_ROM_CARTRIDGE)
136SLOT_INTERFACE_END
Property changes on: trunk/src/emu/bus/ql/rom.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/emu/bus/ql/std.h
r0r30798
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Sinclair QL standard ROM cartridge emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#pragma once
13
14#ifndef __QL_STANDARD_ROM_CARTRIDGE__
15#define __QL_STANDARD_ROM_CARTRIDGE__
16
17#include "rom.h"
18
19
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25// ======================> ql_standard_rom_cartridge_t
26
27class ql_standard_rom_cartridge_t : public device_t,
28                           public device_ql_rom_cartridge_card_interface
29{
30public:
31   // construction/destruction
32   ql_standard_rom_cartridge_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
33
34protected:
35   // device-level overrides
36   virtual void device_start();
37
38   // device_ql_rom_cartridge_card_interface overrides
39   virtual UINT8 read(address_space &space, offs_t offset, UINT8 data);
40};
41
42
43// device type definition
44extern const device_type QL_STANDARD_ROM_CARTRIDGE;
45
46
47#endif
Property changes on: trunk/src/emu/bus/ql/std.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/ql/rom.h
r0r30798
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Sinclair QL ROM cartridge port emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************
11
12                              A     B
13                              *  1  *   VDD
14                        A12   *  2  *   A14
15                         A7   *  3  *   A13
16                         A6   *  4  *   A8
17                         A5   *  5  *   A9
18                       SLOT      6      SLOT
19                         A4   *  7  *   A11
20                         A3   *  8  *   ROMOEH
21                         A2   *  9  *   A10
22                         A1   * 10  *   A15
23                         A0   * 11  *   D7
24                         D0   * 12  *   D6
25                         D1   * 13  *   D5
26                         D2   * 14  *   D4
27                        GND   * 15  *   D3
28
29**********************************************************************/
30
31#pragma once
32
33#ifndef __QL_ROM_CARTRIDGE_SLOT__
34#define __QL_ROM_CARTRIDGE_SLOT__
35
36#include "emu.h"
37
38
39
40//**************************************************************************
41//  INTERFACE CONFIGURATION MACROS
42//**************************************************************************
43
44#define MCFG_QL_ROM_CARTRIDGE_SLOT_ADD(_tag, _slot_intf, _def_slot) \
45   MCFG_DEVICE_ADD(_tag, QL_ROM_CARTRIDGE_SLOT, 0) \
46   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
47
48
49
50//**************************************************************************
51//  TYPE DEFINITIONS
52//**************************************************************************
53
54// ======================> device_ql_rom_cartridge_card_interface
55
56class ql_rom_cartridge_slot_t;
57
58class device_ql_rom_cartridge_card_interface : public device_slot_card_interface
59{
60   friend class ql_rom_cartridge_slot_t;
61
62public:
63   // construction/destruction
64   device_ql_rom_cartridge_card_interface(const machine_config &mconfig, device_t &device);
65   virtual ~device_ql_rom_cartridge_card_interface();
66
67    virtual void romoeh_w(int state) { m_romoeh = state; }
68    virtual UINT8 read(address_space &space, offs_t offset, UINT8 data) { return data; }
69    virtual void write(address_space &space, offs_t offset, UINT8 data) { }
70
71protected:
72   ql_rom_cartridge_slot_t *m_slot;
73
74   optional_shared_ptr<UINT8> m_rom;
75
76    int m_romoeh;
77};
78
79
80// ======================> ql_rom_cartridge_slot_t
81
82class ql_rom_cartridge_slot_t : public device_t,
83                        public device_slot_interface,
84                        public device_image_interface
85{
86public:
87   // construction/destruction
88   ql_rom_cartridge_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
89
90   // computer interface
91   UINT8 read(address_space &space, offs_t offset, UINT8 data) { if (m_card) data = m_card->read(space, offset, data); return data; }
92   void write(address_space &space, offs_t offset, UINT8 data) { if (m_card) m_card->write(space, offset, data); }
93   DECLARE_WRITE_LINE_MEMBER( romoeh_w ) { if (m_card) m_card->romoeh_w(state); }
94
95protected:
96   // device-level overrides
97   virtual void device_config_complete() { update_names(); }
98   virtual void device_start();
99
100   // image-level overrides
101   virtual bool call_load();
102   virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry);
103
104   virtual iodevice_t image_type() const { return IO_CARTSLOT; }
105
106   virtual bool is_readable()  const { return 1; }
107   virtual bool is_writeable() const { return 0; }
108   virtual bool is_creatable() const { return 0; }
109   virtual bool must_be_loaded() const { return 0; }
110   virtual bool is_reset_on_load() const { return 1; }
111   virtual const char *image_interface() const { return "ql_cart"; }
112   virtual const char *file_extensions() const { return "rom,bin"; }
113   virtual const option_guide *create_option_guide() const { return NULL; }
114
115   // slot interface overrides
116   virtual void get_default_card_software(astring &result);
117
118   device_ql_rom_cartridge_card_interface *m_card;
119};
120
121
122// device type definition
123extern const device_type QL_ROM_CARTRIDGE_SLOT;
124
125SLOT_INTERFACE_EXTERN( ql_rom_cartridge_cards );
126
127
128
129#endif
Property changes on: trunk/src/emu/bus/ql/rom.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/ql/std.c
r0r30798
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Sinclair QL standard ROM cartridge emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#include "std.h"
13
14
15
16//**************************************************************************
17//  DEVICE DEFINITIONS
18//**************************************************************************
19
20const device_type QL_STANDARD_ROM_CARTRIDGE = &device_creator<ql_standard_rom_cartridge_t>;
21
22
23
24//**************************************************************************
25//  LIVE DEVICE
26//**************************************************************************
27
28//-------------------------------------------------
29//  ql_standard_rom_cartridge_t - constructor
30//-------------------------------------------------
31
32ql_standard_rom_cartridge_t::ql_standard_rom_cartridge_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
33   device_t(mconfig, QL_STANDARD_ROM_CARTRIDGE, "QL standard ROM cartridge", tag, owner, clock, "ql_standard", __FILE__),
34   device_ql_rom_cartridge_card_interface(mconfig, *this)
35{
36}
37
38
39//-------------------------------------------------
40//  device_start - device-specific startup
41//-------------------------------------------------
42
43void ql_standard_rom_cartridge_t::device_start()
44{
45}
46
47
48//-------------------------------------------------
49//  read - cartridge data read
50//-------------------------------------------------
51
52UINT8 ql_standard_rom_cartridge_t::read(address_space &space, offs_t offset, UINT8 data)
53{
54   if (m_romoeh && m_rom.bytes())
55   {
56      data = m_rom[offset & m_rom.mask()];
57   }
58
59   return data;
60}
Property changes on: trunk/src/emu/bus/ql/std.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/drivers/ql.c
r30797r30798
11191119   //MCFG_QL_EXPANSION_SLOT_BERRL_CALLBACK()
11201120   MCFG_QL_EXPANSION_SLOT_EXTINTL_CALLBACK(DEVWRITELINE(ZX8302_TAG, zx8302_device, extint_w))
11211121
1122   MCFG_QL_ROM_CARTRIDGE_SLOT_ADD("rom", ql_rom_cartridge_cards, NULL)
1123
11221124   // cartridge
11231125   MCFG_CARTSLOT_ADD("cart")
11241126   MCFG_CARTSLOT_EXTENSION_LIST("bin,rom")
trunk/src/mess/includes/ql.h
r30797r30798
88#include "emu.h"
99#include "bus/centronics/ctronics.h"
1010#include "bus/ql/exp.h"
11#include "bus/ql/rom.h"
1112#include "bus/rs232/rs232.h"
1213#include "cpu/m68000/m68000.h"
1314#include "cpu/mcs48/mcs48.h"

Previous 199869 Revisions Next


© 1997-2024 The MAME Team