Previous 15994 Revisions Next

r15259 Monday 21st May, 2012 at 13:51:49 UTC by Curt Coder
[BBCM] Moved Acorn FileStore E01 to a device and started implementing Econet. (nw)
[src/mess]mess.lst mess.mak
[src/mess/drivers]bbc.c e01.c
[src/mess/includes]e01.h
[src/mess/layout]e01.lay
[src/mess/machine]bbc.c e01.c* e01.h* econet.c* econet.h* mc6854.c mc6854.h thomflop.c

src/mess/machine/mc6854.c
r15258r15259
5959
6060typedef struct
6161{
62   devcb_resolved_write_line    out_irq_func;
63   devcb_resolved_read_line    in_rxd_func;
64   devcb_resolved_write_line    out_txd_func;
65   devcb_resolved_write_line    out_rts_func;
66   devcb_resolved_write_line    out_dtr_func;
6267
6368   /* interface */
6469   const mc6854_interface* iface;
r15258r15259
262267      mc6854->tones = 0;
263268
264269   /* send bits */
265   if ( mc6854->iface->out_tx )
270   if ( !mc6854->out_txd_func.isnull() )
266271   {
267272      for ( i = 0; i < len; i++, data >>= 1 )
268         mc6854->iface->out_tx( device, data & 1 );
273         mc6854->out_txd_func( data & 1 );
269274   }
270275
271276   /* schedule when to ask the MC6854 for more bits */
r15258r15259
584589
585590
586591/* MC6854 makes fields from bits */
587void mc6854_set_rx( device_t *device, int bit )
592WRITE_LINE_DEVICE_HANDLER( mc6854_set_rx )
588593{
589594   mc6854_t* mc6854 = get_safe_token( device );
590595   int fieldlen = ( mc6854->rstate < 6 ) ? 8 : RWL;
r15258r15259
592597   if ( RRESET || (mc6854->sr2 & DCD) )
593598      return;
594599
595   if ( bit )
600   if ( state )
596601   {
597602      mc6854->rones++;
598603      mc6854->rreg = (mc6854->rreg >> 1) | 0x80000000;
r15258r15259
699704
700705
701706
702void mc6854_set_cts( device_t *device, int data )
707WRITE_LINE_DEVICE_HANDLER( mc6854_set_cts )
703708{
704709   mc6854_t* mc6854 = get_safe_token( device );
705   if ( ! mc6854->cts && data )
710   if ( ! mc6854->cts && state )
706711      mc6854->sr1 |= CTS;
707   mc6854->cts = data;
712   mc6854->cts = state;
708713
709714   if ( mc6854->cts )
710715      mc6854->sr1 |= CTS;
r15258r15259
714719
715720
716721
717void mc6854_set_dcd( device_t *device, int data )
722WRITE_LINE_DEVICE_HANDLER( mc6854_set_dcd )
718723{
719724   mc6854_t* mc6854 = get_safe_token( device );
720   if ( ! mc6854->dcd && data )
725   if ( ! mc6854->dcd && state )
721726   {
722727      mc6854->sr2 |= DCD;
723728      /* partial reset */
r15258r15259
726731      mc6854->rsize = 0;
727732      mc6854->rones = 0;
728733   }
729   mc6854->dcd = data;
734   mc6854->dcd = state;
730735}
731736
732737
r15258r15259
788793      if ( mc6854->sr2 & (ERR | FV | DCD | OVRN | RABT | RIDLE | AP) )
789794         mc6854->sr1 |= IRQ;
790795   }
796
797   mc6854->out_irq_func((mc6854->sr1 & IRQ) ? ASSERT_LINE : CLEAR_LINE);
791798}
792799
793800
r15258r15259
891898         if ( TST )
892899            logerror( "$%04x mc6854 test mode not handled (CR3=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr3 );
893900
894         if ( mc6854->iface->out_dtr )
895            mc6854->iface->out_dtr( device, DTR ? 1 : 0 );
901         mc6854->out_dtr_func( DTR ? 1 : 0 );
896902
897903      }
898904      else
r15258r15259
925931               mc6854->sr1 |= CTS;
926932         }
927933
928         if ( mc6854->iface->out_rts )
929            mc6854->iface->out_rts( device, RTS ? 1 : 0 );
934         mc6854->out_rts_func( RTS ? 1 : 0 );
930935      }
931936      break;
932937
r15258r15259
966971   }
967972}
968973
974WRITE_LINE_DEVICE_HANDLER( mc6854_rxc_w )
975{
976   // TODO
977}
969978
979WRITE_LINE_DEVICE_HANDLER( mc6854_txc_w )
980{
981   // TODO
982}
970983
971984/************************ reset *****************************/
972985
r15258r15259
9951008   mc6854_t* mc6854 = get_safe_token( device );
9961009
9971010   mc6854->iface = (const mc6854_interface*)device->static_config();
1011   mc6854->out_irq_func.resolve(mc6854->iface->out_irq_func, *device);
1012   mc6854->in_rxd_func.resolve(mc6854->iface->in_rxd_func, *device);
1013   mc6854->out_txd_func.resolve(mc6854->iface->out_txd_func, *device);
1014   mc6854->out_rts_func.resolve(mc6854->iface->out_rts_func, *device);
1015   mc6854->out_dtr_func.resolve(mc6854->iface->out_dtr_func, *device);
9981016
9991017   mc6854->ttimer = device->machine().scheduler().timer_alloc(FUNC(mc6854_tfifo_cb), (void*) device );
10001018
src/mess/machine/mc6854.h
r15258r15259
3737typedef struct _mc6854_interface mc6854_interface;
3838struct _mc6854_interface
3939{
40  devcb_write_line  out_irq_func; /* interrupt request */
41
4042  /* low-level, bit-based interface */
41  void ( * out_tx  ) ( device_t *device, int state ); /* transmit bit */
43  devcb_read_line   in_rxd_func; /* receive bit */
44  devcb_write_line  out_txd_func; /* transmit bit */
4245
4346  /* high-level, frame-based interface */
4447  void ( * out_frame ) ( device_t *device, UINT8* data, int length );
4548
4649  /* control lines */
47  void ( * out_rts ) ( device_t *device, int state ); /* 1 = transmitting, 0 = idle */
48  void ( * out_dtr ) ( device_t *device, int state ); /* 1 = data transmit ready, 0 = busy */
50  devcb_write_line  out_rts_func; /* 1 = transmitting, 0 = idle */
51  devcb_write_line  out_dtr_func; /* 1 = data transmit ready, 0 = busy */
4952};
5053
5154
r15258r15259
6366extern WRITE8_DEVICE_HANDLER ( mc6854_w );
6467
6568/* low-level, bit-based interface */
66extern void mc6854_set_rx ( device_t *device, int state );
69WRITE_LINE_DEVICE_HANDLER( mc6854_set_rx );
6770
6871/* high-level, frame-based interface */
6972extern int mc6854_send_frame( device_t *device, UINT8* data, int length ); /* ret -1 if busy */
7073
7174/* control lines */
72extern void mc6854_set_cts ( device_t *device, int state ); /* 1 = clear-to-send, 0 = busy */
73extern void mc6854_set_dcd ( device_t *device, int state ); /* 1 = carrier, 0 = no carrier */
75WRITE_LINE_DEVICE_HANDLER( mc6854_set_cts ); /* 1 = clear-to-send, 0 = busy */
76WRITE_LINE_DEVICE_HANDLER( mc6854_set_dcd ); /* 1 = carrier, 0 = no carrier */
7477
78/* clock */
79WRITE_LINE_DEVICE_HANDLER( mc6854_rxc_w );
80WRITE_LINE_DEVICE_HANDLER( mc6854_txc_w );
81
7582#endif
src/mess/machine/bbc.c
r15258r15259
2020#include "machine/upd7002.h"
2121#include "machine/i8271.h"
2222#include "machine/mc146818.h"
23#include "machine/mc6854.h"
2324#include "machine/ctronics.h"
2425#include "imagedev/cassette.h"
2526
r15258r15259
558559   {
559560      via6522_device *via_0 = machine().device<via6522_device>("via6522_0");
560561      via6522_device *via_1 = machine().device<via6522_device>("via6522_1");
562      device_t *adlc = machine().device("mc6854");
561563
562564      myo=offset-0x200;
563565      if ((myo>=0x00) && (myo<=0x07)) return bbc_6845_r(space, myo-0x00);      /* Video Controller */
r15258r15259
581583      if ((myo>=0x40) && (myo<=0x5f)) return via_0->read(space,myo-0x40);
582584      if ((myo>=0x60) && (myo<=0x7f)) return via_1->read(space,myo-0x60);
583585      if ((myo>=0x80) && (myo<=0x9f)) return 0xfe;
584      if ((myo>=0xa0) && (myo<=0xbf)) return 0xfe;
586      if ((myo>=0xa0) && (myo<=0xbf)) return mc6854_r(adlc, myo & 0x03);
585587      if ((myo>=0xc0) && (myo<=0xdf)) return 0xfe;
586588      if ((myo>=0xe0) && (myo<=0xff)) return 0xfe;
587589   }
r15258r15259
597599   {
598600      via6522_device *via_0 = machine().device<via6522_device>("via6522_0");
599601      via6522_device *via_1 = machine().device<via6522_device>("via6522_1");
602      device_t *adlc = machine().device("mc6854");
600603
601604      myo=offset-0x200;
602605      if ((myo>=0x00) && (myo<=0x07)) bbc_6845_w(space, myo-0x00,data);         /* Video Controller */
r15258r15259
620623      if ((myo>=0x40) && (myo<=0x5f)) via_0->write(space,myo-0x40, data);
621624      if ((myo>=0x60) && (myo<=0x7f)) via_1->write(space,myo-0x60, data);
622625      //if ((myo>=0x80) && (myo<=0x9f))
623      //if ((myo>=0xa0) && (myo<=0xbf))
626      if ((myo>=0xa0) && (myo<=0xbf)) mc6854_w(adlc, myo & 0x03, data);
624627      //if ((myo>=0xc0) && (myo<=0xdf))
625628      //if ((myo>=0xe0) && (myo<=0xff))
626629   }
src/mess/machine/thomflop.c
r15258r15259
16871687
16881688
16891689
1690const mc6854_interface to7_network_iface = { NULL, to7_network_got_frame, NULL, NULL };
1690const mc6854_interface to7_network_iface = { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, to7_network_got_frame, DEVCB_NULL, DEVCB_NULL };
16911691
16921692
16931693
src/mess/machine/econet.c
r0r15259
1/**********************************************************************
2
3    Acorn Computers Econet local area network emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "econet.h"
11
12
13
14//**************************************************************************
15//  MACROS / CONSTANTS
16//**************************************************************************
17
18#define LOG 0
19
20
21static const char *const SIGNAL_NAME[] = { "CLK", "DATA" };
22
23
24
25//**************************************************************************
26//  DEVICE DEFINITIONS
27//**************************************************************************
28
29const device_type ECONET = &device_creator<econet_device>;
30const device_type ECONET_SLOT = &device_creator<econet_slot_device>;
31
32
33
34//**************************************************************************
35//  DEVICE INTERFACE
36//**************************************************************************
37
38//-------------------------------------------------
39//  device_econet_interface - constructor
40//-------------------------------------------------
41
42device_econet_interface::device_econet_interface(const machine_config &mconfig, device_t &device)
43   : device_slot_card_interface(mconfig, device)
44{
45}
46
47
48//-------------------------------------------------
49//  ~device_econet_interface - destructor
50//-------------------------------------------------
51
52device_econet_interface::~device_econet_interface()
53{
54}
55
56
57
58//**************************************************************************
59//  LIVE DEVICE
60//**************************************************************************
61
62//-------------------------------------------------
63//  econet_slot_device - constructor
64//-------------------------------------------------
65
66econet_slot_device::econet_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
67        device_t(mconfig, ECONET_SLOT, "Econet station", tag, owner, clock),
68      device_slot_interface(mconfig, *this)
69{
70}
71
72
73//-------------------------------------------------
74//  static_set_slot -
75//-------------------------------------------------
76
77void econet_slot_device::static_set_slot(device_t &device, int address)
78{
79   econet_slot_device &econet_card = dynamic_cast<econet_slot_device &>(device);
80   econet_card.m_address = address;
81}
82
83
84//-------------------------------------------------
85//  device_start - device-specific startup
86//-------------------------------------------------
87
88void econet_slot_device::device_start()
89{
90   m_econet = machine().device<econet_device>(ECONET_TAG);
91   device_econet_interface *dev = dynamic_cast<device_econet_interface *>(get_card_device());
92   if (dev) m_econet->add_device(get_card_device(), m_address);
93}
94
95
96
97//**************************************************************************
98//  DEVICE CONFIGURATION
99//**************************************************************************
100
101//-------------------------------------------------
102//  device_config_complete - perform any
103//  operations now that the configuration is
104//  complete
105//-------------------------------------------------
106
107void econet_device::device_config_complete()
108{
109   // inherit a copy of the static data
110   const econet_interface *intf = reinterpret_cast<const econet_interface *>(static_config());
111   if (intf != NULL)
112      *static_cast<econet_interface *>(this) = *intf;
113
114   // or initialize to defaults if none provided
115   else
116   {
117      memset(&m_out_clk_cb, 0, sizeof(m_out_clk_cb));
118      memset(&m_out_data_cb, 0, sizeof(m_out_data_cb));
119   }
120}
121
122
123
124//**************************************************************************
125//  INLINE HELPERS
126//**************************************************************************
127
128//-------------------------------------------------
129//  set_signal -
130//-------------------------------------------------
131
132inline void econet_device::set_signal(device_t *device, int signal, int state)
133{
134   bool changed = false;
135
136   if (device == this)
137   {
138      if (m_line[signal] != state)
139      {
140         if (LOG) logerror("Econet: '%s' %s %u\n", tag(), SIGNAL_NAME[signal], state);
141         m_line[signal] = state;
142         changed = true;
143      }
144   }
145   else
146   {
147      daisy_entry *entry = m_device_list.first();
148
149      while (entry)
150      {
151         if (!strcmp(entry->m_device->tag(), device->tag()))
152         {
153            if (entry->m_line[signal] != state)
154            {
155               if (LOG) logerror("Econet: '%s' %s %u\n", device->tag(), SIGNAL_NAME[signal], state);
156               entry->m_line[signal] = state;
157               changed = true;
158            }
159         }
160
161         entry = entry->next();
162      }
163   }
164
165   if (changed)
166   {
167      switch (signal)
168      {
169      case CLK:   m_out_clk_func(state);   break;
170      case DATA:   m_out_data_func(state);   break;
171      }
172
173      daisy_entry *entry = m_device_list.first();
174
175      while (entry)
176      {
177         switch (signal)
178         {
179         case CLK:
180            entry->m_interface->econet_clk(state);
181            break;
182
183         case DATA:
184            entry->m_interface->econet_data(state);
185            break;
186         }
187
188         entry = entry->next();
189      }
190
191      if (LOG) logerror("Econet: CLK %u DATA %u\n", get_signal(CLK), get_signal(DATA));
192   }
193}
194
195
196//-------------------------------------------------
197//  get_signal -
198//-------------------------------------------------
199
200inline int econet_device::get_signal(int signal)
201{
202   int state = m_line[signal];
203
204   if (state)
205   {
206      daisy_entry *entry = m_device_list.first();
207
208      while (entry)
209      {
210         if (!entry->m_line[signal])
211         {
212            state = 0;
213            break;
214         }
215
216         entry = entry->next();
217      }
218   }
219
220   return state;
221}
222
223
224
225//**************************************************************************
226//  LIVE DEVICE
227//**************************************************************************
228
229//-------------------------------------------------
230//  econet_device - constructor
231//-------------------------------------------------
232
233econet_device::econet_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
234    : device_t(mconfig, ECONET, "Econet", tag, owner, clock)
235{
236   for (int i = 0; i < SIGNAL_COUNT; i++)
237   {
238      m_line[i] = 1;
239   }
240}
241
242
243//-------------------------------------------------
244//  device_start - device-specific startup
245//-------------------------------------------------
246
247void econet_device::device_start()
248{
249   // resolve callbacks
250    m_out_clk_func.resolve(m_out_clk_cb, *this);
251    m_out_data_func.resolve(m_out_data_cb, *this);
252}
253
254
255//-------------------------------------------------
256//  device_stop - device-specific stop
257//-------------------------------------------------
258
259void econet_device::device_stop()
260{
261   m_device_list.reset();
262}
263
264
265//-------------------------------------------------
266//  add_device -
267//-------------------------------------------------
268
269void econet_device::add_device(device_t *target, int address)
270{
271   daisy_entry *entry = auto_alloc(machine(), daisy_entry(target));
272
273   entry->m_interface->m_econet = this;
274   entry->m_interface->m_address = address;
275
276   m_device_list.append(*entry);
277}
278
279
280//-------------------------------------------------
281//  daisy_entry - constructor
282//-------------------------------------------------
283
284econet_device::daisy_entry::daisy_entry(device_t *device)
285   : m_next(NULL),
286     m_device(device),
287     m_interface(NULL)
288{
289   for (int i = 0; i < SIGNAL_COUNT; i++)
290   {
291      m_line[i] = 1;
292   }
293
294   device->interface(m_interface);
295}
296
297
298//-------------------------------------------------
299//  clk_r -
300//-------------------------------------------------
301
302READ_LINE_MEMBER( econet_device::clk_r )
303{
304   return get_signal(CLK);
305}
306
307
308//-------------------------------------------------
309//  data_r -
310//-------------------------------------------------
311
312READ_LINE_MEMBER( econet_device::data_r )
313{
314   return get_signal(DATA);
315}
316
317
318//-------------------------------------------------
319//  clk_w -
320//-------------------------------------------------
321
322WRITE_LINE_MEMBER( econet_device::clk_w )
323{
324   set_signal(this, CLK, state);
325}
326
327
328//-------------------------------------------------
329//  data_w -
330//-------------------------------------------------
331
332WRITE_LINE_MEMBER( econet_device::data_w )
333{
334   set_signal(this, DATA, state);
335}
336
337
338//-------------------------------------------------
339//  clk_w -
340//-------------------------------------------------
341
342void econet_device::clk_w(device_t *device, int state)
343{
344   set_signal(device, CLK, state);
345}
346
347
348//-------------------------------------------------
349//  data_w -
350//-------------------------------------------------
351
352void econet_device::data_w(device_t *device, int state)
353{
354   set_signal(device, DATA, state);
355}
src/mess/machine/econet.h
r0r15259
1/**********************************************************************
2
3    Acorn Computers Econet local area network emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __ECONET__
13#define __ECONET__
14
15#include "emu.h"
16
17
18
19//**************************************************************************
20//  MACROS / CONSTANTS
21//**************************************************************************
22
23#define ECONET_TAG         "econet"
24
25
26
27//**************************************************************************
28//  INTERFACE CONFIGURATION MACROS
29//**************************************************************************
30
31#define MCFG_ECONET_ADD(_config) \
32    MCFG_DEVICE_ADD(ECONET_TAG, ECONET, 0) \
33    MCFG_DEVICE_CONFIG(_config)
34
35
36#define ECONET_INTERFACE(_name) \
37   const econet_interface (_name) =
38
39
40#define MCFG_ECONET_SLOT_ADD(_tag, _num, _slot_intf, _def_slot, _def_inp) \
41    MCFG_DEVICE_ADD(_tag, ECONET_SLOT, 0) \
42   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp) \
43   econet_slot_device::static_set_slot(*device, _num);
44
45
46
47//**************************************************************************
48//  TYPE DEFINITIONS
49//**************************************************************************
50
51// ======================> econet_interface
52
53struct econet_interface
54{
55   devcb_write_line   m_out_clk_cb;
56   devcb_write_line   m_out_data_cb;
57};
58
59
60// ======================> econet_device
61
62class device_econet_interface;
63
64class econet_device : public device_t,
65                 public econet_interface
66{
67public:
68   // construction/destruction
69   econet_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
70
71   void add_device(device_t *target, int address);
72
73   // reads for both host and peripherals
74   DECLARE_READ_LINE_MEMBER( clk_r );
75   DECLARE_READ_LINE_MEMBER( data_r );
76
77   // writes for host (driver_device)
78   DECLARE_WRITE_LINE_MEMBER( clk_w );
79   DECLARE_WRITE_LINE_MEMBER( data_w );
80
81   // writes for peripherals (device_t)
82   void clk_w(device_t *device, int state);
83   void data_w(device_t *device, int state);
84
85protected:
86   enum
87   {
88      CLK = 0,
89      DATA,
90      SIGNAL_COUNT
91   };
92
93   // device-level overrides
94    virtual void device_config_complete();
95    virtual void device_start();
96    virtual void device_stop();
97
98   class daisy_entry
99   {
100   public:
101      daisy_entry(device_t *device);
102      daisy_entry *next() const { return m_next; }
103
104      daisy_entry *            m_next;         // next device
105      device_t *               m_device;      // associated device
106      device_econet_interface *   m_interface;   // associated device's daisy interface
107
108      int m_line[SIGNAL_COUNT];
109   };
110
111   simple_list<daisy_entry> m_device_list;
112
113private:
114   devcb_resolved_write_line   m_out_clk_func;
115   devcb_resolved_write_line   m_out_data_func;
116
117   inline void set_signal(device_t *device, int signal, int state);
118   inline int get_signal(int signal);
119
120   int m_line[SIGNAL_COUNT];
121};
122
123
124// ======================> econet_slot_device
125
126class econet_slot_device : public device_t,
127                     public device_slot_interface
128{
129public:
130   // construction/destruction
131   econet_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
132
133   // device-level overrides
134   virtual void device_start();
135
136    // inline configuration
137    static void static_set_slot(device_t &device, int address);
138
139private:
140   // configuration
141   UINT8 m_address;
142   econet_device  *m_econet;
143};
144
145
146// ======================> device_econet_interface
147
148class device_econet_interface : public device_slot_card_interface
149{
150   friend class econet_device;
151
152public:
153   // construction/destruction
154   device_econet_interface(const machine_config &mconfig, device_t &device);
155   virtual ~device_econet_interface();
156
157   device_econet_interface *next() const { return m_next; }
158   device_econet_interface *m_next;
159
160   // optional operation overrides
161   virtual void econet_clk(int state) = 0;
162   virtual void econet_data(int state) { };
163
164   econet_device  *m_econet;
165   UINT8 m_address;
166};
167
168
169// device type definition
170extern const device_type ECONET;
171extern const device_type ECONET_SLOT;
172
173
174
175#endif
src/mess/machine/e01.c
r0r15259
1/**********************************************************************
2
3    Acorn FileStore E01/E01S network hard disk emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8    http://acorn.chriswhy.co.uk/Network/Econet.html
9    http://acorn.chriswhy.co.uk/Network/Pics/Acorn_FileStoreE01.html
10    http://acorn.chriswhy.co.uk/8bit_Upgrades/Acorn_FileStoreE01S.html
11    http://www.heyrick.co.uk/econet/fs/emulator.html
12    http://www.pdfio.com/k-1019481.html#
13
14**********************************************************************/
15
16/*
17
18    The FileStore E01 is an Econet station in its own right which acts as a fileserver when connected to a network. It is a single unit
19    which does not require a monitor or keyboard. Communication with the FileStore is done via another Econet station when the FileStore
20    is in one of two "maintenance modes"
21
22    The E01 can be seen as a slimmed-down BBC computer tailored for its function as a fileserver. It has a 6502 processor at its heart
23    along with a 6522 VIA just like the BBC. It requires a Master series Econet module to be plugged in and connects to the network via
24    an Econet port in the same way as any other station.
25
26    The FileStore E01S was Acorns second generation Filestore replacing the FileStore E01. The FileStore is a dedicated Econet fileserver,
27    it does not support a keyboard and monitor, instead you use an Econet attached station to logon and perform administrative tasks.
28
29            Hitachi HD146818P Real Time Clock
30            Rockwell R65C102P3 CPU
31            2 x TMM27256D-20 white labelled EPROMs, TMSE01 MOS on left and E01 FS on the right
32    IC20    WD2793-APL-02 floppy disc controller
33            2 x NEC D41464C-12 64k x 4bit NMOS RAM ICs giving 64K memory
34    IC21    Rockwell RC6522AP VIA behind to the right
35
36*/
37
38/*
39
40    TODO:
41
42   - memory_bank::set_entry called for bank ':econet254:e01s:bank2' with invalid bank entry 0
43   - centronics strobe
44   - econet clock speed select
45    - ADLC interrupts
46    - ECONET device
47    - artwork
48    - hard disk
49
50       E20: Rodime RO652 (-chs 306,4,17,512)
51       E40S: Rodime RO3057S (-chs 680,5,26,512)
52       E60S:
53
54*/
55
56#include "e01.h"
57
58
59
60//**************************************************************************
61//  MACROS / CONSTANTS
62//**************************************************************************
63
64#define R65C102_TAG      "r65c102"
65#define R6522_TAG      "ic21"
66#define WD2793_TAG      "ic20"
67#define MC6854_TAG      "mc6854"
68#define HD146818_TAG   "hd146818"
69#define CENTRONICS_TAG   "centronics"
70#define SCSIBUS_TAG      "scsi"
71
72
73
74//**************************************************************************
75//  DEVICE DEFINITIONS
76//**************************************************************************
77
78const device_type E01 = &device_creator<e01_device>;
79const device_type E01S = &device_creator<e01s_device>;
80
81e01s_device::e01s_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
82   :e01_device(mconfig, E01S, "Acorn FileStore E01S", tag, owner, clock) { m_variant = TYPE_E01S; }
83
84
85//-------------------------------------------------
86//  ROM( e01 )
87//-------------------------------------------------
88
89ROM_START( e01 )
90    ROM_REGION( 0x10000, R65C102_TAG, 0 )
91   //ROM_DEFAULT_BIOS("v131")
92   //ROM_SYSTEM_BIOS( 0, "v131", "V 1.31" )
93   ROM_LOAD( "0254,205-04 e01 fs",  0x0000, 0x8000, CRC(ae666c76) SHA1(0954119eb5cd09cdbadf76d60d812aa845838d5a) )
94   ROM_LOAD( "0254,205-03 e01 mos", 0x8000, 0x8000, CRC(a13e8014) SHA1(6f44a1a48108c60a64a1774cb30c1a59c4a6a199) )
95ROM_END
96
97
98//-------------------------------------------------
99//  ROM( e01s )
100//-------------------------------------------------
101
102ROM_START( e01s )
103    ROM_REGION( 0x10000, R65C102_TAG, 0 )
104   //ROM_DEFAULT_BIOS("v140")
105   //ROM_SYSTEM_BIOS( 0, "v133", "V 1.33" ) // 0282,008-02 e01s rom
106   ROM_LOAD( "e01sv133.rom",  0x0000, 0x10000, CRC(2a4a0032) SHA1(54ad68ceae44992293ccdd64ec88ad8520deec22) ) // which label?
107   //ROM_SYSTEM_BIOS( 1, "v140", "V 1.40" )
108   ROM_LOAD( "e01sv140.rom",  0x0000, 0x10000, CRC(5068fe86) SHA1(9b8740face15b5541e2375b3054988af00757931) ) // which label?
109ROM_END
110
111
112//-------------------------------------------------
113//  rom_region - device-specific ROM region
114//-------------------------------------------------
115
116const rom_entry *e01_device::device_rom_region() const
117{
118   switch (m_variant)
119   {
120   default:
121   case TYPE_E01:
122      return ROM_NAME( e01 );
123
124   case TYPE_E01S:
125      return ROM_NAME( e01s );
126   }
127}
128
129
130//-------------------------------------------------
131//  MC146818_INTERFACE( rtc_intf )
132//-------------------------------------------------
133
134WRITE_LINE_MEMBER( e01_device::rtc_irq_w )
135{
136    m_rtc_irq = state;
137
138    update_interrupts();
139}
140
141static mc146818_interface rtc_intf =
142{
143   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, e01_device, rtc_irq_w)
144};
145
146
147//-------------------------------------------------
148//  mc6854_interface adlc_intf
149//-------------------------------------------------
150
151WRITE_LINE_MEMBER( e01_device::adlc_irq_w )
152{
153    m_adlc_irq = state;
154
155    update_interrupts();
156}
157
158READ_LINE_MEMBER( e01_device::econet_data_r )
159{
160   return m_econet->data_r();
161}
162
163WRITE_LINE_MEMBER( e01_device::econet_data_w )
164{
165   m_econet->data_w(this, state);
166}
167
168static const mc6854_interface adlc_intf =
169{
170   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, e01_device, adlc_irq_w),
171   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, e01_device, econet_data_r),
172   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, e01_device, econet_data_w),
173   NULL,
174   DEVCB_NULL,
175   DEVCB_NULL
176};
177
178
179//-------------------------------------------------
180//  via6522_interface via_intf
181//-------------------------------------------------
182
183WRITE_LINE_MEMBER( e01_device::via_irq_w )
184{
185   m_via_irq = state;
186
187   update_interrupts();
188}
189
190WRITE_LINE_MEMBER( e01_device::clk_en_w )
191{
192   m_clk_en = state;
193}
194
195static const via6522_interface via_intf =
196{
197   DEVCB_NULL,
198   DEVCB_NULL,
199   DEVCB_NULL,
200   DEVCB_NULL,
201   DEVCB_NULL,
202   DEVCB_NULL,
203
204   DEVCB_DEVICE_MEMBER(CENTRONICS_TAG, centronics_device, write),
205   DEVCB_NULL,
206   DEVCB_NULL,
207   DEVCB_NULL,
208   DEVCB_NULL,
209   DEVCB_NULL,
210
211   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, e01_device, via_irq_w)
212};
213
214
215//-------------------------------------------------
216//  floppy_interface e01_floppy_interface
217//-------------------------------------------------
218
219static const floppy_interface e01_floppy_interface =
220{
221   DEVCB_NULL,
222   DEVCB_NULL,
223   DEVCB_NULL,
224   DEVCB_NULL,
225   DEVCB_NULL,
226   FLOPPY_STANDARD_3_5_DSDD, // NEC FD1036 A
227   LEGACY_FLOPPY_OPTIONS_NAME(default),
228   NULL,
229   NULL
230};
231
232
233//-------------------------------------------------
234//  wd17xx_interface fdc_intf
235//-------------------------------------------------
236
237WRITE_LINE_MEMBER( e01_device::fdc_irq_w )
238{
239   m_fdc_irq = state;
240
241   update_interrupts();
242}
243
244WRITE_LINE_MEMBER( e01_device::fdc_drq_w )
245{
246   m_fdc_drq = state;
247
248   update_interrupts();
249}
250
251static const wd17xx_interface fdc_intf =
252{
253   DEVCB_NULL,
254   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, e01_device, fdc_irq_w),
255   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, e01_device, fdc_drq_w),
256   { FLOPPY_0, FLOPPY_1, NULL, NULL }
257};
258
259
260//-------------------------------------------------
261//  SCSIBus_interface scsi_intf
262//-------------------------------------------------
263
264static const SCSIConfigTable scsi_dev_table =
265{
266   1,
267   {
268      { SCSI_ID_0, "harddisk0", SCSI_DEVICE_HARDDISK }
269   }
270};
271
272WRITE_LINE_MEMBER( e01_device::scsi_bsy_w )
273{
274   if (!state)
275   {
276      scsi_sel_w(m_scsibus, 1);
277   }
278}
279
280WRITE_LINE_MEMBER( e01_device::scsi_req_w )
281{
282   if (state)
283   {
284      scsi_ack_w(m_scsibus, 1);
285   }
286
287   m_hdc_irq = !state;
288   update_interrupts();
289}
290
291static const SCSIBus_interface scsi_intf =
292{
293    &scsi_dev_table,
294    NULL,
295   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, e01_device, scsi_bsy_w),
296   DEVCB_NULL,
297   DEVCB_NULL,
298   DEVCB_NULL,
299   DEVCB_NULL,
300   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, e01_device, scsi_req_w),
301   DEVCB_NULL
302};
303
304
305//-------------------------------------------------
306//  centronics_interface e01_centronics_intf
307//-------------------------------------------------
308
309static centronics_interface e01_centronics_intf =
310{
311   DEVCB_DEVICE_LINE_MEMBER(R6522_TAG, via6522_device, write_ca1),
312   DEVCB_NULL,
313   DEVCB_NULL
314};
315
316
317//-------------------------------------------------
318//  ADDRESS_MAP( e01_mem )
319//-------------------------------------------------
320
321static ADDRESS_MAP_START( e01_mem, AS_PROGRAM, 8, e01_device )
322   AM_RANGE(0x0000, 0xfbff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2")
323   AM_RANGE(0xfc00, 0xfc00) AM_MIRROR(0x00c3) AM_READWRITE(rtc_address_r, rtc_address_w)
324   AM_RANGE(0xfc04, 0xfc04) AM_MIRROR(0x00c3) AM_READWRITE(rtc_data_r, rtc_data_w)
325   AM_RANGE(0xfc08, 0xfc08) AM_MIRROR(0x00c0) AM_READ(ram_select_r) AM_WRITE(floppy_w)
326   AM_RANGE(0xfc0c, 0xfc0f) AM_MIRROR(0x00c0) AM_DEVREADWRITE_LEGACY(WD2793_TAG, wd17xx_r, wd17xx_w)
327   AM_RANGE(0xfc10, 0xfc1f) AM_MIRROR(0x00c0) AM_DEVREADWRITE(R6522_TAG, via6522_device, read, write)
328   AM_RANGE(0xfc20, 0xfc23) AM_MIRROR(0x00c0) AM_DEVREADWRITE_LEGACY(MC6854_TAG, mc6854_r, mc6854_w)
329   AM_RANGE(0xfc24, 0xfc24) AM_MIRROR(0x00c3) AM_READWRITE(network_irq_disable_r, network_irq_disable_w)
330   AM_RANGE(0xfc28, 0xfc28) AM_MIRROR(0x00c3) AM_READWRITE(network_irq_enable_r, network_irq_enable_w)
331   AM_RANGE(0xfc2c, 0xfc2c) AM_MIRROR(0x00c3) AM_READ_PORT("FLAP")
332   AM_RANGE(0xfc30, 0xfc30) AM_MIRROR(0x00c0) AM_READWRITE(hdc_data_r, hdc_data_w)
333   AM_RANGE(0xfc31, 0xfc31) AM_MIRROR(0x00c0) AM_READ(hdc_status_r)
334   AM_RANGE(0xfc32, 0xfc32) AM_MIRROR(0x00c0) AM_WRITE(hdc_select_w)
335   AM_RANGE(0xfc33, 0xfc33) AM_MIRROR(0x00c0) AM_WRITE(hdc_irq_enable_w)
336   AM_RANGE(0xfd00, 0xffff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank4")
337ADDRESS_MAP_END
338
339
340//-------------------------------------------------
341//  MACHINE_DRIVER( e01 )
342//-------------------------------------------------
343
344static MACHINE_CONFIG_FRAGMENT( e01 )
345    // basic machine hardware
346   MCFG_CPU_ADD(R65C102_TAG, M65C02, XTAL_8MHz/4) // Rockwell R65C102P3
347    MCFG_CPU_PROGRAM_MAP(e01_mem)
348
349   MCFG_MC146818_IRQ_ADD(HD146818_TAG, MC146818_STANDARD, rtc_intf)
350
351   // devices
352   MCFG_VIA6522_ADD(R6522_TAG, XTAL_8MHz/4, via_intf)
353   MCFG_MC6854_ADD(MC6854_TAG, adlc_intf)
354   MCFG_WD2793_ADD(WD2793_TAG, fdc_intf)
355   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(e01_floppy_interface)
356   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, e01_centronics_intf)
357
358   MCFG_SCSIBUS_ADD(SCSIBUS_TAG, scsi_intf)
359   MCFG_HARDDISK_ADD("harddisk0")
360
361   // internal ram
362   MCFG_RAM_ADD(RAM_TAG)
363   MCFG_RAM_DEFAULT_SIZE("64K")
364MACHINE_CONFIG_END
365
366
367//-------------------------------------------------
368//  machine_config_additions - device-specific
369//  machine configurations
370//-------------------------------------------------
371
372machine_config_constructor e01_device::device_mconfig_additions() const
373{
374   return MACHINE_CONFIG_NAME( e01 );
375}
376
377
378//-------------------------------------------------
379//  INPUT_PORTS( e01 )
380//-------------------------------------------------
381
382static INPUT_PORTS_START( e01 )
383   PORT_START("FLAP")
384   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
385   PORT_CONFNAME( 0x40, 0x00, "Front Flap")
386   PORT_CONFSETTING( 0x00, "Closed" )
387   PORT_CONFSETTING( 0x40, "Open" )
388   PORT_DIPNAME( 0x80, 0x00, "SW3")
389   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
390   PORT_DIPSETTING( 0x80, DEF_STR( On ) )
391INPUT_PORTS_END
392
393
394//-------------------------------------------------
395//  input_ports - device-specific input ports
396//-------------------------------------------------
397
398ioport_constructor e01_device::device_input_ports() const
399{
400   return INPUT_PORTS_NAME( e01 );
401}
402
403
404
405//**************************************************************************
406//  INLINE HELPERS
407//**************************************************************************
408
409//-------------------------------------------------
410//  update_interrupts - update interrupt state
411//-------------------------------------------------
412
413inline void e01_device::update_interrupts()
414{
415   int irq = (m_via_irq || (m_hdc_ie & m_hdc_irq) || m_rtc_irq) ? ASSERT_LINE : CLEAR_LINE;
416   int nmi = (m_fdc_irq || m_fdc_drq || (m_adlc_ie & m_adlc_irq)) ? ASSERT_LINE : CLEAR_LINE;
417
418   m_maincpu->set_input_line(INPUT_LINE_IRQ0, irq);
419   m_maincpu->set_input_line(INPUT_LINE_NMI, nmi);
420}
421
422
423//-------------------------------------------------
424//   network_irq_enable - network interrupt enable
425//-------------------------------------------------
426
427inline void e01_device::network_irq_enable(int enabled)
428{
429   m_adlc_ie = enabled;
430
431   update_interrupts();
432}
433
434
435//-------------------------------------------------
436//   hdc_irq_enable - hard disk interrupt enable
437//-------------------------------------------------
438
439inline void e01_device::hdc_irq_enable(int enabled)
440{
441   m_hdc_ie = enabled;
442
443   update_interrupts();
444}
445
446
447
448//**************************************************************************
449//  LIVE DEVICE
450//**************************************************************************
451
452//-------------------------------------------------
453//  e01_device - constructor
454//-------------------------------------------------
455
456e01_device::e01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
457    : device_t(mconfig, E01, "Acorn FileStore E01", tag, owner, clock),
458      device_econet_interface(mconfig, *this),
459     m_maincpu(*this, R65C102_TAG),
460     m_fdc(*this, WD2793_TAG),
461     m_adlc(*this, MC6854_TAG),
462     m_rtc(*this, HD146818_TAG),
463     m_ram(*this, RAM_TAG),
464     m_scsibus(*this, SCSIBUS_TAG),
465     m_adlc_ie(0),
466     m_hdc_ie(0),
467     m_rtc_irq(CLEAR_LINE),
468     m_via_irq(CLEAR_LINE),
469     m_hdc_irq(CLEAR_LINE),
470     m_fdc_irq(CLEAR_LINE),
471     m_fdc_drq(CLEAR_LINE),
472     m_adlc_irq(CLEAR_LINE),
473     m_clk_en(0)
474{
475}
476
477
478e01_device::e01_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
479    : device_t(mconfig, type, name, tag, owner, clock),
480      device_econet_interface(mconfig, *this),
481     m_maincpu(*this, R65C102_TAG),
482     m_fdc(*this, WD2793_TAG),
483     m_adlc(*this, MC6854_TAG),
484     m_rtc(*this, HD146818_TAG),
485     m_ram(*this, RAM_TAG),
486     m_scsibus(*this, SCSIBUS_TAG),
487     m_adlc_ie(0),
488     m_hdc_ie(0),
489     m_rtc_irq(CLEAR_LINE),
490     m_via_irq(CLEAR_LINE),
491     m_hdc_irq(CLEAR_LINE),
492     m_fdc_irq(CLEAR_LINE),
493     m_fdc_drq(CLEAR_LINE),
494     m_adlc_irq(CLEAR_LINE),
495     m_clk_en(0)
496{
497}
498
499
500//-------------------------------------------------
501//  device_config_complete - perform any
502//  operations now that the configuration is
503//  complete
504//-------------------------------------------------
505
506void e01_device::device_config_complete()
507{
508   switch (m_variant)
509   {
510   default:
511   case TYPE_E01:
512      m_shortname = "e01";
513      break;
514
515   case TYPE_E01S:
516      m_shortname = "e01s";
517      break;
518   }
519}
520
521
522//-------------------------------------------------
523//  device_start - device-specific startup
524//-------------------------------------------------
525
526void e01_device::device_start()
527{
528   // setup memory banking
529   UINT8 *ram = m_ram->pointer();
530   UINT8 *rom = memregion(R65C102_TAG)->base();
531
532   membank("bank1")->configure_entry(0, ram);
533   membank("bank1")->configure_entry(1, rom);
534   membank("bank1")->set_entry(1);
535
536   membank("bank2")->configure_entry(0, ram);
537//   membank("bank2")->set_entry(0);
538
539   membank("bank3")->configure_entry(0, ram + 0xfd00);
540   membank("bank3")->configure_entry(1, rom + 0xfd00);
541   membank("bank3")->set_entry(1);
542
543   membank("bank4")->configure_entry(0, ram + 0xfd00);
544   membank("bank4")->set_entry(0);
545
546   // allocate timers
547   m_clk_timer = timer_alloc();
548
549   // register for state saving
550   save_item(NAME(m_adlc_ie));
551   save_item(NAME(m_hdc_ie));
552   save_item(NAME(m_rtc_irq));
553   save_item(NAME(m_via_irq));
554   save_item(NAME(m_hdc_irq));
555   save_item(NAME(m_fdc_drq));
556   save_item(NAME(m_adlc_irq));
557}
558
559
560//-------------------------------------------------
561//  device_reset - device-specific reset
562//-------------------------------------------------
563
564void e01_device::device_reset()
565{
566   init_scsibus(m_scsibus, 512);
567
568   m_clk_timer->adjust(attotime::zero, 0, attotime::from_hz(200000));
569
570   membank("bank1")->set_entry(1);
571   membank("bank3")->set_entry(1);
572}
573
574
575//-------------------------------------------------
576//  device_timer - handler timer events
577//-------------------------------------------------
578
579void e01_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
580{
581   if (m_clk_en)
582   {
583      m_econet->clk_w(this, 1);
584      m_econet->clk_w(this, 0);
585   }
586}
587
588
589//-------------------------------------------------
590//  eprom_r - ROM/RAM select read
591//-------------------------------------------------
592
593READ8_MEMBER( e01_device::ram_select_r )
594{
595   membank("bank1")->set_entry(0);
596   membank("bank3")->set_entry(0);
597
598   return 0;
599}
600
601
602//-------------------------------------------------
603//  floppy_w - floppy control write
604//-------------------------------------------------
605
606WRITE8_MEMBER( e01_device::floppy_w )
607{
608   /*
609
610        bit     description
611
612        0       floppy 1 select
613        1       floppy 2 select
614        2       floppy side select
615        3       NVRAM select
616        4       floppy density
617        5       floppy master reset
618        6       floppy test
619        7       mode LED
620   
621   */
622   
623   // floppy 1 select
624   if (!BIT(data, 0)) wd17xx_set_drive(m_fdc, 0);
625
626   // floppy 2 select
627   if (!BIT(data, 1)) wd17xx_set_drive(m_fdc, 1);
628
629   // floppy side select
630   wd17xx_set_side(m_fdc, BIT(data, 2));
631
632   // TODO NVRAM select
633   //mc146818_stby_w(m_rtc, BIT(data, 3));
634
635   // floppy density
636   wd17xx_dden_w(m_fdc, BIT(data, 4));
637
638   // floppy master reset
639   wd17xx_mr_w(m_fdc, BIT(data, 5));
640
641   // TODO floppy test
642   //wd17xx_test_w(m_fdc, BIT(data, 6));
643
644   // mode LED
645   output_set_value("led_0", BIT(data, 7));
646}
647
648
649//-------------------------------------------------
650//  network_irq_disable_r -
651//-------------------------------------------------
652
653READ8_MEMBER( e01_device::network_irq_disable_r )
654{
655   network_irq_enable(0);
656
657   return 0;
658}
659
660
661//-------------------------------------------------
662//  network_irq_disable_w -
663//-------------------------------------------------
664
665WRITE8_MEMBER( e01_device::network_irq_disable_w )
666{
667   network_irq_enable(0);
668}
669
670
671//-------------------------------------------------
672//  network_irq_enable_r -
673//-------------------------------------------------
674
675READ8_MEMBER( e01_device::network_irq_enable_r )
676{
677   network_irq_enable(1);
678
679   return 0;
680}
681
682
683//-------------------------------------------------
684//  network_irq_enable_w -
685//-------------------------------------------------
686
687WRITE8_MEMBER( e01_device::network_irq_enable_w )
688{
689   network_irq_enable(1);
690}
691
692
693//-------------------------------------------------
694//  hdc_data_r -
695//-------------------------------------------------
696
697READ8_MEMBER( e01_device::hdc_data_r )
698{
699   UINT8 data = scsi_data_r(m_scsibus, 0);
700   
701   scsi_ack_w(m_scsibus, 0);
702
703   return data;
704}
705
706
707//-------------------------------------------------
708//  hdc_data_w -
709//-------------------------------------------------
710
711WRITE8_MEMBER( e01_device::hdc_data_w )
712{
713   scsi_data_w(m_scsibus, 0, data);
714
715   scsi_ack_w(m_scsibus, 0);
716}
717
718
719//-------------------------------------------------
720//  hdc_status_r -
721//-------------------------------------------------
722
723READ8_MEMBER( e01_device::hdc_status_r )
724{
725   /*
726   
727       bit     description
728   
729       0       MSG
730       1       BSY
731       2       0
732       3       0
733       4       NIRQ
734       5       REQ
735       6       I/O
736       7       C/D
737   
738   */
739
740   UINT8 data = 0;
741
742   // SCSI bus
743   data |= !scsi_msg_r(m_scsibus);
744   data |= !scsi_bsy_r(m_scsibus) << 1;
745   data |= !scsi_req_r(m_scsibus) << 5;
746   data |= !scsi_io_r(m_scsibus) << 6;
747   data |= !scsi_cd_r(m_scsibus) << 7;
748
749   // TODO NIRQ
750
751   return data;
752}
753
754
755//-------------------------------------------------
756//  hdc_select_w -
757//-------------------------------------------------
758
759WRITE8_MEMBER( e01_device::hdc_select_w )
760{
761   scsi_sel_w(m_scsibus, 0);
762}
763
764
765//-------------------------------------------------
766//  hdc_irq_enable_w -
767//-------------------------------------------------
768
769WRITE8_MEMBER( e01_device::hdc_irq_enable_w )
770{
771   hdc_irq_enable(BIT(data, 0));
772}
773
774
775//-------------------------------------------------
776//  rtc_address_r -
777//-------------------------------------------------
778
779READ8_MEMBER( e01_device::rtc_address_r )
780{
781   return m_rtc->read(space, 0);
782}
783
784
785//-------------------------------------------------
786//  rtc_address_w -
787//-------------------------------------------------
788
789WRITE8_MEMBER( e01_device::rtc_address_w )
790{
791   m_rtc->write(space, 0, data);
792}
793
794
795//-------------------------------------------------
796//  rtc_data_r -
797//-------------------------------------------------
798
799READ8_MEMBER( e01_device::rtc_data_r )
800{
801   return m_rtc->read(space, 1);
802}
803
804
805//-------------------------------------------------
806//  rtc_data_w -
807//-------------------------------------------------
808
809WRITE8_MEMBER( e01_device::rtc_data_w )
810{
811   m_rtc->write(space, 1, data);
812}
813
814
815//-------------------------------------------------
816//  econet_clk_w -
817//-------------------------------------------------
818
819void e01_device::econet_clk(int state)
820{
821   mc6854_rxc_w(m_adlc, state);
822   mc6854_txc_w(m_adlc, state);
823}
src/mess/machine/e01.h
r0r15259
1/**********************************************************************
2
3    Acorn FileStore E01/E01S network hard disk emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __E01__
13#define __E01__
14
15#include "emu.h"
16#include "cpu/m6502/m6502.h"
17#include "imagedev/flopdrv.h"
18#include "imagedev/harddriv.h"
19#include "machine/6522via.h"
20#include "machine/ctronics.h"
21#include "machine/econet.h"
22#include "machine/mc146818.h"
23#include "machine/mc6854.h"
24#include "machine/ram.h"
25#include "machine/scsibus.h"
26#include "machine/wd17xx.h"
27
28class e01_device : public device_t,
29               public device_econet_interface
30{
31public:
32    // construction/destruction
33   e01_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
34    e01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
35
36   enum
37   {
38      TYPE_E01 = 0,
39      TYPE_E01S
40   };
41
42   DECLARE_READ8_MEMBER( ram_select_r );
43   DECLARE_WRITE8_MEMBER( floppy_w );
44   DECLARE_READ8_MEMBER( network_irq_disable_r );
45   DECLARE_WRITE8_MEMBER( network_irq_disable_w );
46   DECLARE_READ8_MEMBER( network_irq_enable_r );
47   DECLARE_WRITE8_MEMBER( network_irq_enable_w );
48   DECLARE_READ8_MEMBER( hdc_data_r );
49   DECLARE_WRITE8_MEMBER( hdc_data_w );
50   DECLARE_READ8_MEMBER( hdc_status_r );
51   DECLARE_WRITE8_MEMBER( hdc_select_w );
52   DECLARE_WRITE8_MEMBER( hdc_irq_enable_w );
53   DECLARE_READ8_MEMBER( rtc_address_r );
54   DECLARE_WRITE8_MEMBER( rtc_address_w );
55   DECLARE_READ8_MEMBER( rtc_data_r );
56   DECLARE_WRITE8_MEMBER( rtc_data_w );
57   DECLARE_WRITE_LINE_MEMBER( rtc_irq_w );
58   DECLARE_WRITE_LINE_MEMBER( adlc_irq_w );
59   DECLARE_READ_LINE_MEMBER( econet_data_r );
60   DECLARE_WRITE_LINE_MEMBER( econet_data_w );
61   DECLARE_WRITE_LINE_MEMBER( via_irq_w );
62   DECLARE_WRITE_LINE_MEMBER( clk_en_w );
63   DECLARE_WRITE_LINE_MEMBER( fdc_irq_w );
64   DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
65   DECLARE_WRITE_LINE_MEMBER( scsi_bsy_w );
66   DECLARE_WRITE_LINE_MEMBER( scsi_req_w );
67
68protected:
69    // device-level overrides
70    virtual void device_config_complete();
71    virtual void device_start();
72    virtual void device_reset();
73   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
74
75   // optional information overrides
76   virtual const rom_entry *device_rom_region() const;
77   virtual machine_config_constructor device_mconfig_additions() const;
78   virtual ioport_constructor device_input_ports() const;
79
80   // device_econet_interface overrides
81   virtual void econet_clk(int state);
82
83   required_device<cpu_device> m_maincpu;
84   required_device<device_t> m_fdc;
85   required_device<device_t> m_adlc;
86   required_device<mc146818_device> m_rtc;
87   required_device<ram_device> m_ram;
88   required_device<device_t> m_scsibus;
89
90   inline void update_interrupts();
91   inline void network_irq_enable(int enabled);
92   inline void hdc_irq_enable(int enabled);
93
94   // interrupt state
95   int m_adlc_ie;
96   int m_hdc_ie;
97   int m_rtc_irq;
98   int m_via_irq;
99   int m_hdc_irq;
100   int m_fdc_irq;
101   int m_fdc_drq;
102   int m_adlc_irq;
103
104   int m_clk_en;
105
106   int m_variant;
107
108   // timers
109   emu_timer *m_clk_timer;
110};
111
112
113// ======================> e01s_device
114
115class e01s_device :  public e01_device
116{
117public:
118    // construction/destruction
119    e01s_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
120};
121
122
123// device type definition
124extern const device_type E01;
125extern const device_type E01S;
126
127
128
129#endif
src/mess/includes/e01.h
r15258r15259
1/**********************************************************************
2
3    Acorn FileStore E01/E20 network hard disk emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __E01__
13#define __E01__
14
15
16#include "emu.h"
17#include "cpu/m6502/m6502.h"
18#include "imagedev/flopdrv.h"
19#include "imagedev/harddriv.h"
20#include "machine/ctronics.h"
21#include "machine/6522via.h"
22#include "machine/mc146818.h"
23#include "machine/mc6854.h"
24#include "machine/ram.h"
25#include "machine/scsibus.h"
26#include "machine/wd17xx.h"
27
28#define R65C102_TAG      "r65c102"
29#define R6522_TAG      "ic21"
30#define WD2793_TAG      "ic20"
31#define MC6854_TAG      "mc6854"
32#define HD146818_TAG   "hd146818"
33#define CENTRONICS_TAG   "centronics"
34#define SCSIBUS_TAG      "scsi"
35
36class e01_state : public driver_device
37{
38public:
39   e01_state(const machine_config &mconfig, device_type type, const char *tag)
40      : driver_device(mconfig, type, tag),
41        m_maincpu(*this, R65C102_TAG),
42        m_fdc(*this, WD2793_TAG),
43        m_rtc(*this, HD146818_TAG),
44        m_ram(*this, RAM_TAG),
45        m_scsibus(*this, SCSIBUS_TAG)
46   { }
47
48   required_device<cpu_device> m_maincpu;
49   required_device<device_t> m_fdc;
50   required_device<mc146818_device> m_rtc;
51   required_device<ram_device> m_ram;
52   required_device<device_t> m_scsibus;
53
54   virtual void machine_start();
55   virtual void machine_reset();
56
57   void update_interrupts();
58   void network_irq_enable(int enabled);
59   void hdc_irq_enable(int enabled);
60   DECLARE_READ8_MEMBER( ram_select_r );
61   DECLARE_WRITE8_MEMBER( floppy_w );
62   DECLARE_READ8_MEMBER( network_irq_disable_r );
63   DECLARE_WRITE8_MEMBER( network_irq_disable_w );
64   DECLARE_READ8_MEMBER( network_irq_enable_r );
65   DECLARE_WRITE8_MEMBER( network_irq_enable_w );
66   DECLARE_READ8_MEMBER( hdc_data_r );
67   DECLARE_WRITE8_MEMBER( hdc_data_w );
68   DECLARE_READ8_MEMBER( hdc_status_r );
69   DECLARE_WRITE8_MEMBER( hdc_select_w );
70   DECLARE_WRITE8_MEMBER( hdc_irq_enable_w );
71   DECLARE_READ8_MEMBER( rtc_address_r );
72   DECLARE_WRITE8_MEMBER( rtc_address_w );
73   DECLARE_READ8_MEMBER( rtc_data_r );
74   DECLARE_WRITE8_MEMBER( rtc_data_w );
75   DECLARE_WRITE_LINE_MEMBER( rtc_irq_w );
76   DECLARE_WRITE_LINE_MEMBER( adlc_irq_w );
77   DECLARE_WRITE_LINE_MEMBER( via_irq_w );
78   DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
79   DECLARE_WRITE_LINE_MEMBER( scsi_bsy_w );
80   DECLARE_WRITE_LINE_MEMBER( scsi_req_w );
81
82   /* interrupt state */
83   int m_adlc_ie;
84   int m_hdc_ie;
85
86   int m_rtc_irq;
87   int m_via_irq;
88   int m_hdc_irq;
89   int m_fdc_drq;
90   int m_adlc_irq;
91};
92
93#endif
src/mess/mess.lst
r15258r15259
20062006z80dev
20072007pegasus
20082008pegasusm
2009e01
2010e01s
20112009pasopia
20122010pasopia7
20132011pasopia7lcd
src/mess/layout/e01.lay
r15258r15259
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="background">
4   </element>
5  <element name="red_led" defstate="0">
6    <disk state="1">
7      <color red="0.75" green="0.0" blue="0.0" />
8    </disk>
9    <disk state="0">
10      <color red="0.09375" green="0.0" blue="0.0" />
11    </disk>
12  </element>
13  <element name="green_led" defstate="0">
14    <disk state="1">
15      <color red="0.0" green="0.75" blue="0.0" />
16    </disk>
17    <disk state="0">
18      <color red="0.0" green="0.09375" blue="0.0" />
19    </disk>
20  </element>
21   <view name="Front panel">
22      <bezel element="background">
23         <bounds x="0" y="0" width="628" height="77" />
24      </bezel>
25      <bezel name="led_0" element="red_led">
26         <bounds x="474" y="34" width="6" height="6" />
27      </bezel>
28      <bezel name="led_1" element="green_led">
29         <bounds x="510" y="34" width="6" height="6" />
30      </bezel>
31   </view>
32</mamelayout>
src/mess/drivers/e01.c
r15258r15259
1/**********************************************************************
2
3    Acorn FileStore E01/E20 network hard disk emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8    http://acorn.chriswhy.co.uk/Network/Econet.html
9    http://acorn.chriswhy.co.uk/Network/Pics/Acorn_FileStoreE01.html
10    http://acorn.chriswhy.co.uk/8bit_Upgrades/Acorn_FileStoreE01S.html
11    http://www.heyrick.co.uk/econet/fs/emulator.html
12    http://www.pdfio.com/k-1019481.html#
13
14**********************************************************************/
15
16/*
17
18    The FileStore E01 is an Econet station in its own right which acts as a fileserver when connected to a network. It is a single unit
19    which does not require a monitor or keyboard. Communication with the FileStore is done via another Econet station when the FileStore
20    is in one of two "maintenance modes"
21
22    The E01 can be seen as a slimmed-down BBC computer tailored for its function as a fileserver. It has a 6502 processor at its heart
23    along with a 6522 VIA just like the BBC. It requires a Master series Econet module to be plugged in and connects to the network via
24    an Econet port in the same way as any other station.
25
26    The FileStore E01S was Acorns second generation Filestore replacing the FileStore E01. The FileStore is a dedicated Econet fileserver,
27    it does not support a keyboard and monitor, instead you use an Econet attached station to logon and perform administrative tasks.
28
29            Hitachi HD146818P Real Time Clock
30            Rockwell R65C102P3 CPU
31            2 x TMM27256D-20 white labelled EPROMs, TMSE01 MOS on left and E01 FS on the right
32    IC20    WD2793-APL-02 floppy disc controller
33            2 x NEC D41464C-12 64k x 4bit NMOS RAM ICs giving 64K memory
34    IC21    Rockwell RC6522AP VIA behind to the right
35
36*/
37
38/*
39
40    TODO:
41
42    - centronics strobe
43    - VIA CB2 -> econet rx/tx clock terminator
44    - ADLC interrupts
45    - ECONET device
46    - artwork
47    - hard disk
48
49        E20: Rodime RO652 (-chs 306,4,17,512)
50        E40S:
51        E60S:
52
53*/
54
55#include "includes/e01.h"
56#include "e01.lh"
57
58
59
60//**************************************************************************
61//  INTERRUPT HANDLING
62//**************************************************************************
63
64//-------------------------------------------------
65//  update_interrupts - update interrupt state
66//-------------------------------------------------
67
68void e01_state::update_interrupts()
69{
70   int irq = (m_via_irq || (m_hdc_ie & m_hdc_irq) || m_rtc_irq) ? ASSERT_LINE : CLEAR_LINE;
71   int nmi = (m_fdc_drq || (m_adlc_ie & m_adlc_irq)) ? ASSERT_LINE : CLEAR_LINE;
72
73   m_maincpu->set_input_line(INPUT_LINE_IRQ0, irq);
74   m_maincpu->set_input_line(INPUT_LINE_NMI, nmi);
75}
76
77
78//-------------------------------------------------
79//   network_irq_enable - network interrupt enable
80//-------------------------------------------------
81
82void e01_state::network_irq_enable(int enabled)
83{
84   m_adlc_ie = enabled;
85
86   update_interrupts();
87}
88
89
90//-------------------------------------------------
91//   hdc_irq_enable - hard disk interrupt enable
92//-------------------------------------------------
93
94void e01_state::hdc_irq_enable(int enabled)
95{
96   m_hdc_ie = enabled;
97
98   update_interrupts();
99}
100
101
102
103//**************************************************************************
104//  READ/WRITE HANDLERS
105//**************************************************************************
106
107//-------------------------------------------------
108//  eprom_r - ROM/RAM select read
109//-------------------------------------------------
110
111READ8_MEMBER( e01_state::ram_select_r )
112{
113   membank("bank1")->set_entry(0);
114   membank("bank3")->set_entry(0);
115
116   return 0;
117}
118
119
120//-------------------------------------------------
121//  floppy_w - floppy control write
122//-------------------------------------------------
123
124WRITE8_MEMBER( e01_state::floppy_w )
125{
126   /*
127
128        bit     description
129
130        0       floppy 1 select
131        1       floppy 2 select
132        2       floppy side select
133        3       NVRAM select
134        4       floppy density
135        5       floppy master reset
136        6       floppy test
137        7       mode LED
138
139    */
140
141   // floppy 1 select
142   if (!BIT(data, 0)) wd17xx_set_drive(m_fdc, 0);
143
144   // floppy 2 select
145   if (!BIT(data, 1)) wd17xx_set_drive(m_fdc, 1);
146
147   // floppy side select
148   wd17xx_set_side(m_fdc, BIT(data, 2));
149
150   // TODO NVRAM select
151   //mc146818_stby_w(m_rtc, BIT(data, 3));
152
153   // floppy density
154   wd17xx_dden_w(m_fdc, BIT(data, 4));
155
156   // floppy master reset
157   wd17xx_mr_w(m_fdc, BIT(data, 5));
158
159   // TODO floppy test
160   //wd17xx_test_w(m_fdc, BIT(data, 6));
161
162   // mode LED
163   output_set_value("led_0", BIT(data, 7));
164}
165
166
167//-------------------------------------------------
168//  network_irq_disable_r -
169//-------------------------------------------------
170
171READ8_MEMBER( e01_state::network_irq_disable_r )
172{
173   network_irq_enable(0);
174
175   return 0;
176}
177
178
179//-------------------------------------------------
180//  network_irq_disable_w -
181//-------------------------------------------------
182
183WRITE8_MEMBER( e01_state::network_irq_disable_w )
184{
185   network_irq_enable(0);
186}
187
188
189//-------------------------------------------------
190//  network_irq_enable_r -
191//-------------------------------------------------
192
193READ8_MEMBER( e01_state::network_irq_enable_r )
194{
195   network_irq_enable(1);
196
197   return 0;
198}
199
200
201//-------------------------------------------------
202//  network_irq_enable_w -
203//-------------------------------------------------
204
205WRITE8_MEMBER( e01_state::network_irq_enable_w )
206{
207   network_irq_enable(1);
208}
209
210
211//-------------------------------------------------
212//  hdc_data_r -
213//-------------------------------------------------
214
215READ8_MEMBER( e01_state::hdc_data_r )
216{
217   UINT8 data = scsi_data_r(m_scsibus, 0);
218
219   scsi_ack_w(m_scsibus, 0);
220
221   return data;
222}
223
224
225//-------------------------------------------------
226//  hdc_data_w -
227//-------------------------------------------------
228
229WRITE8_MEMBER( e01_state::hdc_data_w )
230{
231   scsi_data_w(m_scsibus, 0, data);
232
233   scsi_ack_w(m_scsibus, 0);
234}
235
236
237//-------------------------------------------------
238//  hdc_status_r -
239//-------------------------------------------------
240
241READ8_MEMBER( e01_state::hdc_status_r )
242{
243   /*
244
245        bit     description
246
247        0       MSG
248        1       BSY
249        2       0
250        3       0
251        4       NIRQ
252        5       REQ
253        6       I/O
254        7       C/D
255
256    */
257
258   UINT8 data = 0;
259
260   data |= !scsi_msg_r(m_scsibus);
261   data |= !scsi_bsy_r(m_scsibus) << 1;
262   data |= !scsi_req_r(m_scsibus) << 5;
263   data |= !scsi_io_r(m_scsibus) << 6;
264   data |= !scsi_cd_r(m_scsibus) << 7;
265
266   return data;
267}
268
269
270//-------------------------------------------------
271//  hdc_select_w -
272//-------------------------------------------------
273
274WRITE8_MEMBER( e01_state::hdc_select_w )
275{
276   scsi_sel_w(m_scsibus, 0);
277}
278
279
280//-------------------------------------------------
281//  hdc_irq_enable_w -
282//-------------------------------------------------
283
284WRITE8_MEMBER( e01_state::hdc_irq_enable_w )
285{
286   hdc_irq_enable(BIT(data, 0));
287}
288
289
290//-------------------------------------------------
291//  rtc_address_r -
292//-------------------------------------------------
293
294READ8_MEMBER( e01_state::rtc_address_r )
295{
296   return m_rtc->read(space, 0);
297}
298
299
300//-------------------------------------------------
301//  rtc_address_w -
302//-------------------------------------------------
303
304WRITE8_MEMBER( e01_state::rtc_address_w )
305{
306   m_rtc->write(space, 0, data);
307}
308
309
310//-------------------------------------------------
311//  rtc_data_r -
312//-------------------------------------------------
313
314READ8_MEMBER( e01_state::rtc_data_r )
315{
316   return m_rtc->read(space, 1);
317}
318
319
320//-------------------------------------------------
321//  rtc_data_w -
322//-------------------------------------------------
323
324WRITE8_MEMBER( e01_state::rtc_data_w )
325{
326   m_rtc->write(space, 1, data);
327}
328
329
330//**************************************************************************
331//  MEMORY MAPS
332//**************************************************************************
333
334//-------------------------------------------------
335//  ADDRESS_MAP( e01_mem )
336//-------------------------------------------------
337
338static ADDRESS_MAP_START( e01_mem, AS_PROGRAM, 8, e01_state )
339   AM_RANGE(0x0000, 0xfbff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank2")
340   AM_RANGE(0xfc00, 0xfc00) AM_MIRROR(0x00c3) AM_READWRITE(rtc_address_r, rtc_address_w)
341   AM_RANGE(0xfc04, 0xfc04) AM_MIRROR(0x00c3) AM_READWRITE(rtc_data_r, rtc_data_w)
342   AM_RANGE(0xfc08, 0xfc08) AM_MIRROR(0x00c0) AM_READ(ram_select_r) AM_WRITE(floppy_w)
343   AM_RANGE(0xfc0c, 0xfc0f) AM_MIRROR(0x00c0) AM_DEVREADWRITE_LEGACY(WD2793_TAG, wd17xx_r, wd17xx_w)
344   AM_RANGE(0xfc10, 0xfc1f) AM_MIRROR(0x00c0) AM_DEVREADWRITE(R6522_TAG, via6522_device, read, write)
345   AM_RANGE(0xfc20, 0xfc23) AM_MIRROR(0x00c0) AM_DEVREADWRITE_LEGACY(MC6854_TAG, mc6854_r, mc6854_w)
346   AM_RANGE(0xfc24, 0xfc24) AM_MIRROR(0x00c3) AM_READWRITE(network_irq_disable_r, network_irq_disable_w)
347   AM_RANGE(0xfc28, 0xfc28) AM_MIRROR(0x00c3) AM_READWRITE(network_irq_enable_r, network_irq_enable_w)
348   AM_RANGE(0xfc2c, 0xfc2c) AM_MIRROR(0x00c3) AM_READ_PORT("FLAP")
349   AM_RANGE(0xfc30, 0xfc30) AM_MIRROR(0x00c0) AM_READWRITE(hdc_data_r, hdc_data_w)
350   AM_RANGE(0xfc31, 0xfc31) AM_MIRROR(0x00c0) AM_READ(hdc_status_r)
351   AM_RANGE(0xfc32, 0xfc32) AM_MIRROR(0x00c0) AM_WRITE(hdc_select_w)
352   AM_RANGE(0xfc33, 0xfc33) AM_MIRROR(0x00c0) AM_WRITE(hdc_irq_enable_w)
353   AM_RANGE(0xfd00, 0xffff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank4")
354ADDRESS_MAP_END
355
356
357
358//**************************************************************************
359//  INPUT PORTS
360//**************************************************************************
361
362//-------------------------------------------------
363//  INPUT_PORTS( e01 )
364//-------------------------------------------------
365
366static INPUT_PORTS_START( e01 )
367   PORT_START("FLAP")
368   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
369   PORT_CONFNAME( 0x40, 0x00, "Front Flap")
370   PORT_CONFSETTING( 0x00, "Closed" )
371   PORT_CONFSETTING( 0x40, "Open" )
372   PORT_DIPNAME( 0x80, 0x00, "SW3")
373   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
374   PORT_DIPSETTING( 0x80, DEF_STR( On ) )
375INPUT_PORTS_END
376
377
378
379//**************************************************************************
380//  DEVICE CONFIGURATION
381//**************************************************************************
382
383//-------------------------------------------------
384//  MC146818_INTERFACE( rtc_intf )
385//-------------------------------------------------
386
387WRITE_LINE_MEMBER( e01_state::rtc_irq_w )
388{
389    m_rtc_irq = state;
390
391    update_interrupts();
392}
393
394static mc146818_interface rtc_intf =
395{
396   DEVCB_DRIVER_LINE_MEMBER(e01_state, rtc_irq_w)
397};
398
399
400//-------------------------------------------------
401//  mc6854_interface adlc_intf
402//-------------------------------------------------
403
404WRITE_LINE_MEMBER( e01_state::adlc_irq_w )
405{
406    m_adlc_irq = state;
407
408    update_interrupts();
409}
410
411static const mc6854_interface adlc_intf =
412{
413   NULL,
414   NULL,
415   NULL,
416   NULL
417};
418
419
420//-------------------------------------------------
421//  via6522_interface via_intf
422//-------------------------------------------------
423
424WRITE_LINE_MEMBER( e01_state::via_irq_w )
425{
426   m_via_irq = state;
427
428   update_interrupts();
429}
430
431static const via6522_interface via_intf =
432{
433   DEVCB_NULL,
434   DEVCB_NULL,
435   DEVCB_NULL,
436   DEVCB_NULL,
437   DEVCB_NULL,
438   DEVCB_NULL,
439
440   DEVCB_DEVICE_MEMBER(CENTRONICS_TAG, centronics_device, write),
441   DEVCB_NULL,
442   DEVCB_NULL,
443   DEVCB_NULL,
444   DEVCB_NULL,
445   DEVCB_NULL,
446
447   DEVCB_DRIVER_LINE_MEMBER(e01_state, via_irq_w)
448};
449
450
451//-------------------------------------------------
452//  floppy_interface e01_floppy_interface
453//-------------------------------------------------
454
455static const floppy_interface e01_floppy_interface =
456{
457   DEVCB_NULL,
458   DEVCB_NULL,
459   DEVCB_NULL,
460   DEVCB_NULL,
461   DEVCB_NULL,
462   FLOPPY_STANDARD_3_5_DSDD, // NEC FD1036 A
463   LEGACY_FLOPPY_OPTIONS_NAME(default),
464   NULL,
465   NULL
466};
467
468
469//-------------------------------------------------
470//  wd17xx_interface fdc_intf
471//-------------------------------------------------
472
473WRITE_LINE_MEMBER( e01_state::fdc_drq_w )
474{
475   m_fdc_drq = state;
476
477   update_interrupts();
478}
479
480static const wd17xx_interface fdc_intf =
481{
482   DEVCB_NULL,
483   DEVCB_NULL,
484   DEVCB_DRIVER_LINE_MEMBER(e01_state, fdc_drq_w),
485   { FLOPPY_0, FLOPPY_1, NULL, NULL }
486};
487
488
489//-------------------------------------------------
490//  SCSIBus_interface scsi_intf
491//-------------------------------------------------
492
493static const SCSIConfigTable scsi_dev_table =
494{
495   1,
496   {
497      { SCSI_ID_0, "harddisk0", SCSI_DEVICE_HARDDISK }
498   }
499};
500
501WRITE_LINE_MEMBER( e01_state::scsi_bsy_w )
502{
503   if (!state)
504   {
505      scsi_sel_w(m_scsibus, 1);
506   }
507}
508
509WRITE_LINE_MEMBER( e01_state::scsi_req_w )
510{
511   if (state)
512   {
513      scsi_ack_w(m_scsibus, 1);
514   }
515
516   m_hdc_irq = !state;
517   update_interrupts();
518}
519
520static const SCSIBus_interface scsi_intf =
521{
522    &scsi_dev_table,
523    NULL,
524   DEVCB_DRIVER_LINE_MEMBER(e01_state, scsi_bsy_w),
525   DEVCB_NULL,
526   DEVCB_NULL,
527   DEVCB_NULL,
528   DEVCB_NULL,
529   DEVCB_DRIVER_LINE_MEMBER(e01_state, scsi_req_w),
530   DEVCB_NULL
531};
532
533
534//-------------------------------------------------
535//  centronics_interface e01_centronics_intf
536//-------------------------------------------------
537
538static centronics_interface e01_centronics_intf =
539{
540   DEVCB_DEVICE_LINE_MEMBER(R6522_TAG, via6522_device, write_ca1),
541   DEVCB_NULL,
542   DEVCB_NULL
543};
544
545
546
547//**************************************************************************
548//  MACHINE INITIALIZATION
549//**************************************************************************
550
551//-------------------------------------------------
552//  MACHINE_START( e01 )
553//-------------------------------------------------
554
555void e01_state::machine_start()
556{
557   UINT8 *ram = m_ram->pointer();
558   UINT8 *rom = memregion(R65C102_TAG)->base();
559
560   // setup memory banking
561   membank("bank1")->configure_entry(0, ram);
562   membank("bank1")->configure_entry(1, rom);
563   membank("bank1")->set_entry(1);
564
565   membank("bank2")->configure_entry(0, ram);
566   membank("bank2")->set_entry(0);
567
568   membank("bank3")->configure_entry(0, ram + 0xfd00);
569   membank("bank3")->configure_entry(1, rom + 0xfd00);
570   membank("bank3")->set_entry(1);
571
572   membank("bank4")->configure_entry(0, ram + 0xfd00);
573   membank("bank4")->set_entry(0);
574
575   // register for state saving
576   save_item(NAME(m_adlc_ie));
577   save_item(NAME(m_hdc_ie));
578   save_item(NAME(m_rtc_irq));
579   save_item(NAME(m_via_irq));
580   save_item(NAME(m_hdc_irq));
581   save_item(NAME(m_fdc_drq));
582   save_item(NAME(m_adlc_irq));
583}
584
585
586//-------------------------------------------------
587//  MACHINE_RESET( e01 )
588//-------------------------------------------------
589
590void e01_state::machine_reset()
591{
592   init_scsibus(m_scsibus, 512);
593
594   membank("bank1")->set_entry(1);
595   membank("bank3")->set_entry(1);
596}
597
598
599
600//**************************************************************************
601//  MACHINE DRIVERS
602//**************************************************************************
603
604//-------------------------------------------------
605//  MACHINE_DRIVER( e01 )
606//-------------------------------------------------
607
608static MACHINE_CONFIG_START( e01, e01_state )
609    // basic machine hardware
610   MCFG_CPU_ADD(R65C102_TAG, M65C02, XTAL_8MHz/4) // Rockwell R65C102P3
611    MCFG_CPU_PROGRAM_MAP(e01_mem)
612
613   MCFG_MC146818_IRQ_ADD(HD146818_TAG, MC146818_STANDARD, rtc_intf)
614
615   // video hardware
616   MCFG_DEFAULT_LAYOUT( layout_e01 )
617
618   // devices
619   MCFG_VIA6522_ADD(R6522_TAG, XTAL_8MHz/4, via_intf)
620   MCFG_MC6854_ADD(MC6854_TAG, adlc_intf)
621   MCFG_WD2793_ADD(WD2793_TAG, fdc_intf)
622   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(e01_floppy_interface)
623   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, e01_centronics_intf)
624
625   MCFG_SCSIBUS_ADD(SCSIBUS_TAG, scsi_intf)
626   MCFG_HARDDISK_ADD("harddisk0")
627
628   // internal ram
629   MCFG_RAM_ADD(RAM_TAG)
630   MCFG_RAM_DEFAULT_SIZE("64K")
631MACHINE_CONFIG_END
632
633
634
635//**************************************************************************
636//  ROMS
637//**************************************************************************
638
639//-------------------------------------------------
640//  ROM( e01 )
641//-------------------------------------------------
642
643ROM_START( e01 )
644    ROM_REGION( 0x10000, R65C102_TAG, 0 )
645   ROM_DEFAULT_BIOS("v131")
646   ROM_SYSTEM_BIOS( 0, "v131", "V 1.31" )
647   ROMX_LOAD( "0254,205-04 e01 fs",  0x0000, 0x8000, CRC(ae666c76) SHA1(0954119eb5cd09cdbadf76d60d812aa845838d5a), ROM_BIOS(1) )
648   ROMX_LOAD( "0254,205-03 e01 mos", 0x8000, 0x8000, CRC(a13e8014) SHA1(6f44a1a48108c60a64a1774cb30c1a59c4a6a199), ROM_BIOS(1) )
649ROM_END
650
651
652//-------------------------------------------------
653//  ROM( e01s )
654//-------------------------------------------------
655
656ROM_START( e01s )
657    ROM_REGION( 0x10000, R65C102_TAG, 0 )
658   ROM_DEFAULT_BIOS("v140")
659   ROM_SYSTEM_BIOS( 0, "v133", "V 1.33" ) // 0282,008-02 e01s rom
660   ROMX_LOAD( "e01sv133.rom",  0x0000, 0x10000, CRC(2a4a0032) SHA1(54ad68ceae44992293ccdd64ec88ad8520deec22), ROM_BIOS(1) ) // which label?
661   ROM_SYSTEM_BIOS( 1, "v140", "V 1.40" )
662   ROMX_LOAD( "e01sv140.rom",  0x0000, 0x10000, CRC(5068fe86) SHA1(9b8740face15b5541e2375b3054988af00757931), ROM_BIOS(2) ) // which label?
663ROM_END
664
665
666
667//**************************************************************************
668//  SYSTEM DRIVERS
669//**************************************************************************
670
671//    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT      COMPANY   FULLNAME
672COMP( 1988, e01,  0,       0,   e01,   e01,    0,  "Acorn",   "FileStore E01",      GAME_NOT_WORKING | GAME_NO_SOUND)
673COMP( 1988, e01s, e01,       0,   e01,   e01,    0,  "Acorn",   "FileStore E01S",      GAME_NOT_WORKING | GAME_NO_SOUND)
src/mess/drivers/bbc.c
r15258r15259
1313#include "emu.h"
1414#include "cpu/m6502/m6502.h"
1515#include "machine/6522via.h"
16#include "machine/econet.h"
17#include "machine/e01.h"
1618#include "machine/mc146818.h"
19#include "machine/mc6854.h"
1720#include "machine/upd7002.h"
1821#include "machine/ctronics.h"
1922#include "imagedev/flopdrv.h"
r15258r15259
680683   /* 34000 rom 13  ADFS */
681684   /* 38000 rom 14  View */
682685   /* 3c000 rom 15  Terminal */
686
687   ROM_LOAD("anfs424.ic27", 0x20000, 0x4000, CRC(1b9f75fd) SHA1(875f71edd48f87c3a55371409d0cc2015d8b5853) ) // TODO where to load this?
683688ROM_END
684689
685690
r15258r15259
772777   bbc_draw_RGB_in,
773778};
774779
780static const mc6854_interface adlc_intf =
781{
782   DEVCB_NULL,
783   DEVCB_DEVICE_LINE_MEMBER(ECONET_TAG, econet_device, data_r),
784   DEVCB_DEVICE_LINE_MEMBER(ECONET_TAG, econet_device, data_w),
785   NULL,
786   DEVCB_NULL,
787   DEVCB_NULL
788};
789
790static WRITE_LINE_DEVICE_HANDLER( econet_clk_w )
791{
792   mc6854_rxc_w(device, state);
793   mc6854_txc_w(device, state);
794}
795
796static ECONET_INTERFACE( econet_intf )
797{
798   DEVCB_DEVICE_LINE("mc6854", econet_clk_w),
799   DEVCB_NULL
800};
801
802static SLOT_INTERFACE_START( econet_devices )
803   SLOT_INTERFACE("e01", E01)
804   SLOT_INTERFACE("e01s", E01S)
805SLOT_INTERFACE_END
806
775807static MACHINE_CONFIG_FRAGMENT( bbc_cartslot )
776808   MCFG_CARTSLOT_ADD("cart1")
777809   MCFG_CARTSLOT_EXTENSION_LIST("rom")
r15258r15259
950982   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(bbc_floppy_interface)
951983
952984   MCFG_FRAGMENT_ADD(bbc_cartslot)
985
986   MCFG_MC6854_ADD("mc6854", adlc_intf)
987   MCFG_ECONET_ADD(econet_intf)
988   MCFG_ECONET_SLOT_ADD("econet254", 254, econet_devices, NULL, NULL)
953989MACHINE_CONFIG_END
954990
955991/*     YEAR  NAME      PARENT    COMPAT MACHINE   INPUT  INIT      COMPANY  FULLNAME */
src/mess/mess.mak
r15258r15259
571571   $(MESS_MACHINE)/bbc.o      \
572572   $(MESS_DRIVERS)/bbc.o      \
573573   $(MESS_DRIVERS)/bbcbc.o      \
574   $(MESS_DRIVERS)/e01.o      \
574   $(MESS_MACHINE)/econet.o   \
575   $(MESS_MACHINE)/e01.o      \
575576   $(MESS_VIDEO)/electron.o   \
576577   $(MESS_MACHINE)/electron.o   \
577578   $(MESS_DRIVERS)/electron.o   \
r15258r15259
20632064$(MESS_DRIVERS)/c80.o:      $(MESS_LAYOUT)/c80.lh
20642065$(MESS_DRIVERS)/dectalk.o:   $(MESS_LAYOUT)/dectalk.lh
20652066$(MESS_DRIVERS)/dolphunk.o:   $(MESS_LAYOUT)/dolphunk.lh
2066$(MESS_DRIVERS)/e01.o:      $(MESS_LAYOUT)/e01.lh
20672067$(MESS_DRIVERS)/eacc.o:      $(MESS_LAYOUT)/eacc.lh
20682068$(MESS_DRIVERS)/elf.o:      $(MESS_LAYOUT)/elf2.lh
20692069$(MESS_DRIVERS)/elekscmp.o:   $(MESS_LAYOUT)/elekscmp.lh

Previous 15994 Revisions Next


© 1998-2018 The MESS Team