Previous 199869 Revisions Next

r20902 Sunday 10th February, 2013 at 16:45:56 UTC by R. Belmont
(MESS) checkpoint: AE Vulcan IDE card (nw)
[src/mess]mess.mak
[src/mess/machine]a2vulcan.c* a2vulcan.h*

trunk/src/mess/machine/a2vulcan.c
r0r20902
1/*********************************************************************
2 
3   a2vulcan.c
4
5   Applied Engineering Vulcan IDE controller
6
7   Recognized drives by IDE features parameters:
8   (# of cylinders is never checked, just heads, sectors, and the vendor specific at 0x0A)
9
10    H  S    Vendor specific #5
11    8, 33 + 0x69
12    2, 33 + 0x69
13    4, 26 + 0x69
14    5, 29 + (any)
15    7, 29 + 0x44
16    9, 29 + (any)
17    9, 36 + 0x44
18    9, 36 + 0xff
19    7, 34 + (any)
20    4, 17 + 0x55
21    4, 26 + 0x55
22    5, 17 + 0x55
23    6, 26 + 0x55
24    2, 28 + 0x36
25    4, 28 + 0x36
26    4, 28 + 0x67
27    4, 27 + 0x43
28    5, 17 + 0x26
29   15, 32 + 0x43
30   16, 38 + 0x94
31   10, 17 + (any)
32
33*********************************************************************/
34
35#include "a2vulcan.h"
36#include "includes/apple2.h"
37#include "machine/idectrl.h"
38#include "imagedev/harddriv.h"
39
40//**************************************************************************
41//  GLOBAL VARIABLES
42//**************************************************************************
43
44const device_type A2BUS_VULCAN = &device_creator<a2bus_vulcan_device>;
45
46#define VULCAN_ROM_REGION  "vulcan_rom"
47#define VULCAN_IDE_TAG     "vulcan_ide"
48
49static MACHINE_CONFIG_FRAGMENT( vulcan )
50   MCFG_IDE_CONTROLLER_ADD(VULCAN_IDE_TAG, ide_image_devices, "hdd", "hdd", false)
51MACHINE_CONFIG_END
52
53ROM_START( vulcan )
54   ROM_REGION(0x4000, VULCAN_ROM_REGION, 0)
55   ROM_LOAD( "ae vulcan rom v1.4.bin", 0x000000, 0x004000, CRC(798d5825) SHA1(1d668e856e33c6eeb10fe26975341afa8acb81f5) )
56ROM_END
57
58/***************************************************************************
59    FUNCTION PROTOTYPES
60***************************************************************************/
61
62//-------------------------------------------------
63//  machine_config_additions - device-specific
64//  machine configurations
65//-------------------------------------------------
66
67machine_config_constructor a2bus_vulcanbase_device::device_mconfig_additions() const
68{
69   return MACHINE_CONFIG_NAME( vulcan );
70}
71
72//-------------------------------------------------
73//  rom_region - device-specific ROM region
74//-------------------------------------------------
75
76const rom_entry *a2bus_vulcanbase_device::device_rom_region() const
77{
78   return ROM_NAME( vulcan );
79}
80
81//**************************************************************************
82//  LIVE DEVICE
83//**************************************************************************
84
85a2bus_vulcanbase_device::a2bus_vulcanbase_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
86   device_t(mconfig, type, name, tag, owner, clock),
87   device_a2bus_card_interface(mconfig, *this),
88   m_ide(*this, VULCAN_IDE_TAG)
89{
90}
91
92a2bus_vulcan_device::a2bus_vulcan_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
93   a2bus_vulcanbase_device(mconfig, A2BUS_VULCAN, "Applied Engineering Vulcan IDE controller", tag, owner, clock)
94{
95   m_shortname = "a2vulcan";
96}
97
98//-------------------------------------------------
99//  device_start - device-specific startup
100//-------------------------------------------------
101
102void a2bus_vulcanbase_device::device_start()
103{
104   // set_a2bus_device makes m_slot valid
105   set_a2bus_device();
106
107   astring tempstring;
108   m_rom = device().machine().root_device().memregion(this->subtag(tempstring, VULCAN_ROM_REGION))->base();
109
110   // patch partition table check failure
111//   m_rom[0x59e] = 0xea;
112//   m_rom[0x59f] = 0xea;
113
114   save_item(NAME(m_lastdata));
115   save_item(NAME(m_ram));
116   save_item(NAME(m_rombank));
117   save_item(NAME(m_rambank));
118}
119
120void a2bus_vulcanbase_device::device_reset()
121{
122   m_rombank = m_rambank = 0;
123   m_last_read_was_0 = false;
124}
125
126
127/*-------------------------------------------------
128    read_c0nx - called for reads from this card's c0nx space
129-------------------------------------------------*/
130
131UINT8 a2bus_vulcanbase_device::read_c0nx(address_space &space, UINT8 offset)
132{
133   switch (offset)
134   {
135      case 0:
136         m_lastdata = ide_controller_r(m_ide, 0x1f0+offset, 2);
137//         printf("IDE: read %04x\n", m_lastdata);
138         m_last_read_was_0 = true;
139         return m_lastdata&0xff;
140
141      case 1:
142         if (m_last_read_was_0)
143         {
144            m_last_read_was_0 = false;
145            return (m_lastdata>>8) & 0xff;
146         }
147         else
148         {
149            return ide_controller_r(m_ide, 0x1f0+offset, 1);
150         }
151         break;
152
153      case 2:
154      case 3:
155      case 4:
156      case 5:
157      case 6:
158      case 7:
159         return ide_controller_r(m_ide, 0x1f0+offset, 1);
160
161      default:
162//         printf("Read @ C0n%x\n", offset);
163         break;
164
165   }
166
167   return 0xff;
168}
169
170
171/*-------------------------------------------------
172    write_c0nx - called for writes to this card's c0nx space
173-------------------------------------------------*/
174
175void a2bus_vulcanbase_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data)
176{
177   switch (offset)
178   {
179      case 0:   
180         m_lastdata = data;
181         m_last_read_was_0 = true;
182         break;
183                       
184      case 1:
185         if (m_last_read_was_0)
186         {
187            m_last_read_was_0 = false;
188            m_lastdata &= 0x00ff;
189            m_lastdata |= (data << 8);
190//            printf("IDE: write %04x\n", m_lastdata);
191            ide_controller_w(m_ide, 0x1f0, 2, m_lastdata);
192         }
193         else
194         {
195            ide_controller_w(m_ide, 0x1f0+offset, 1, data);
196         }
197         break;
198
199      case 2:
200      case 3:
201      case 4:
202      case 5:
203      case 6:
204      case 7:
205//         printf("%02x to IDE controller @ %x\n", data, offset);
206         ide_controller_w(m_ide, 0x1f0+offset, 1, data);
207         break;
208
209      case 9:   // ROM bank
210//         printf("%x (%x) to ROM bank\n", data, (data & 0xf) * 0x400);
211         m_rombank = (data & 0xf) * 0x400;
212         break;
213
214      case 0xa: // RAM bank
215//         printf("%x to RAM bank\n", data);
216         m_rambank = (data & 7) * 0x400;
217         break;
218
219      default:
220         printf("Write %02x @ C0n%x\n", data, offset);
221         break;
222   }
223}
224
225/*-------------------------------------------------
226    read_cnxx - called for reads from this card's cnxx space
227-------------------------------------------------*/
228
229UINT8 a2bus_vulcanbase_device::read_cnxx(address_space &space, UINT8 offset)
230{
231   int slotimg = m_slot * 0x100;
232
233   // ROM contains a CnXX image for each of slots 1-7 at 0x3400
234   return m_rom[offset+slotimg+0x3400];
235}
236
237/*-------------------------------------------------
238    read_c800 - called for reads from this card's c800 space
239-------------------------------------------------*/
240
241UINT8 a2bus_vulcanbase_device::read_c800(address_space &space, UINT16 offset)
242{
243   offset &= 0x7ff;
244   if (offset < 0x400)   // c800-cbff is banked RAM window, cc00-cfff is banked ROM window
245   {
246//      printf("read RAM @ %x (bank %x)\n", offset, m_rambank);
247      return m_ram[offset + m_rambank];
248   }
249
250   return m_rom[(offset & 0x3ff)+m_rombank];
251}
252
253void a2bus_vulcanbase_device::write_c800(address_space &space, UINT16 offset, UINT8 data)
254{
255   offset &= 0x7ff;
256   if (offset < 0x400)
257   {
258//      printf("%02x to RAM @ %x (bank %x)\n", data, offset, m_rambank);
259      m_ram[offset + m_rambank] = data;
260   }
261}
Property changes on: trunk/src/mess/machine/a2vulcan.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/machine/a2vulcan.h
r0r20902
1/*********************************************************************
2
3    a2vulcan.h
4
5    Applied Engineering Vulcan IDE controller
6
7*********************************************************************/
8
9#ifndef __A2BUS_VULCAN__
10#define __A2BUS_VULCAN__
11
12#include "emu.h"
13#include "machine/a2bus.h"
14#include "machine/idectrl.h"
15
16//**************************************************************************
17//  TYPE DEFINITIONS
18//**************************************************************************
19
20class a2bus_vulcanbase_device:
21   public device_t,
22   public device_a2bus_card_interface
23{
24public:
25   // construction/destruction
26   a2bus_vulcanbase_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
27
28   // optional information overrides
29   virtual machine_config_constructor device_mconfig_additions() const;
30   virtual const rom_entry *device_rom_region() const;
31
32protected:
33   virtual void device_start();
34   virtual void device_reset();
35
36   // overrides of standard a2bus slot functions
37   virtual UINT8 read_c0nx(address_space &space, UINT8 offset);
38   virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data);
39   virtual UINT8 read_cnxx(address_space &space, UINT8 offset);
40   virtual UINT8 read_c800(address_space &space, UINT16 offset);
41   virtual void write_c800(address_space &space, UINT16 offset, UINT8 data);
42
43   required_device<ide_controller_device> m_ide;
44
45   UINT8 *m_rom;
46   UINT8 m_ram[8*1024];
47
48private:
49   UINT16 m_lastdata;
50   int m_rombank, m_rambank;
51   bool m_last_read_was_0;
52};
53
54class a2bus_vulcan_device : public a2bus_vulcanbase_device
55{
56public:
57   a2bus_vulcan_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
58
59protected:
60};
61
62// device type definition
63extern const device_type A2BUS_VULCAN;
64
65#endif /* __A2BUS_VULCAN__ */
Property changes on: trunk/src/mess/machine/a2vulcan.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/mess.mak
r20901r20902
695695   $(MESS_MACHINE)/a2echoii.o \
696696   $(MESS_MACHINE)/a2arcadebd.o \
697697   $(MESS_MACHINE)/a2midi.o \
698   $(MESS_MACHINE)/a2vulcan.o \
698699   $(MESS_MACHINE)/a2estd80col.o \
699700   $(MESS_MACHINE)/a2eext80col.o \
700701   $(MESS_MACHINE)/a2eramworks3.o \

Previous 199869 Revisions Next


© 1997-2024 The MAME Team