Previous 15994 Revisions Next

r11675 Friday 27th May, 2011 at 14:00:41 UTC by Miodrag Milanović
Added neat (cs8221) chip skeleton (no whatsnew)
[src/mess/machine]cs8221.c* cs8221.h*

src/mess/machine/cs8221.c
r0r11675
1/***************************************************************************
2
3    Chips & Technologies CS8221 chipset
4
5    a.k.a. NEW ENHANCED AT (NEAT)
6   
7   Consists of four individual chips:
8
9    * 82C211 - CPU/Bus controller
10   * 82C212 - Page/Interleave and EMS Memory controller
11    * 82C215 - Data/Address buffer
12    * 82C206 - Integrated Peripherals Controller(IPC)
13   
14***************************************************************************/
15
16#include "emu.h"
17#include "machine/ram.h"
18#include "machine/cs8221.h"
19
20
21//**************************************************************************
22//  GLOBAL VARIABLES
23//**************************************************************************
24
25#define LOG_REGISTER   1
26#define LOG_MEMORY      1
27
28const device_type CS8221 = &device_creator<cs8221_device>;
29
30
31static const char *const register_names[] =
32{
33   /* 00 */ "PROCCLK",
34   /* 01 */ "COMMAND DELAY",
35   /* 02 */ "WAIT STATES",
36   /* 03 */ "RESERVED",
37   /* 04 */ "VERSION",
38   /* 05 */ "ROM CONFIGURATION",
39   /* 06 */ "MEMORY ENABLE-1",
40   /* 07 */ "MEMORY ENABLE-2",
41   /* 08 */ "MEMORY ENABLE-3",
42   /* 09 */ "MEMORY ENABLE-4",
43   /* 0a */ "BANK 0/1 ENABLE",
44   /* 0b */ "DRAM CONFIGURATION",
45   /* 0c */ "BANK 2/3 ENABLE",
46   /* 0d */ "EMS BASE ADDRESS",
47   /* 0e */ "EMS ADDRESS EXTENSION",
48   /* 0f */ "MISCELLANEOUS"
49};
50
51//**************************************************************************
52//  LIVE DEVICE
53//**************************************************************************
54
55//-------------------------------------------------
56//  cs8221_device - constructor
57//-------------------------------------------------
58
59cs8221_device::cs8221_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
60   : device_t(mconfig, CS8221, "CS8221", tag, owner, clock),
61     m_address(0),
62     m_address_valid(false)
63{
64}
65
66void cs8221_device::static_set_cputag(device_t &device, const char *tag)
67{
68   cs8221_device &cs8221 = downcast<cs8221_device &>(device);
69   cs8221.m_cputag = tag;
70}
71
72void cs8221_device::static_set_isatag(device_t &device, const char *tag)
73{
74   cs8221_device &cs8221 = downcast<cs8221_device &>(device);
75   cs8221.m_isatag = tag;
76}
77
78void cs8221_device::static_set_biostag(device_t &device, const char *tag)
79{
80   cs8221_device &cs8221 = downcast<cs8221_device &>(device);
81   cs8221.m_biostag = tag;
82}
83
84//-------------------------------------------------
85//  device_start - device-specific startup
86//-------------------------------------------------
87
88void cs8221_device::device_start()
89{
90}
91
92//-------------------------------------------------
93//  device_reset - device-specific reset
94//-------------------------------------------------
95
96void cs8221_device::device_reset()
97{
98   // setup default values
99   memset(&m_registers, 0x00, sizeof(m_registers));
100}
101
102
103//**************************************************************************
104//  READ/WRITE HANDLERS
105//**************************************************************************
106
107WRITE8_MEMBER( cs8221_device::address_w )
108{
109   m_address = data;
110   m_address_valid = ((m_address & 0x60)== 0x60) ? true : false;
111}
112
113READ8_MEMBER( cs8221_device::data_r )
114{
115   UINT8 result = 0xff;
116
117   if (m_address_valid)
118   {
119      if (LOG_REGISTER)
120         logerror("cs8221_device: read %s = %02x\n", register_names[m_address & 0x0f], m_registers[m_address & 0x0f]);
121
122      result = m_registers[m_address & 0x0f];
123   }
124
125   // after a read the selected address needs to be reset
126   m_address_valid = false;
127
128   return result;
129}
130
131WRITE8_MEMBER( cs8221_device::data_w )
132{
133   if (m_address_valid)
134   {
135      if (LOG_REGISTER)
136         logerror("cs8221_device: write %s = %02x\n", register_names[m_address & 0x0f], data);
137
138      // update register with new data
139      m_registers[m_address & 0x0f] = data;
140
141      // execute command
142      switch (m_address)
143      {
144         case 0x60: break;
145         case 0x61: break;
146         case 0x62: break;
147         case 0x63: break;
148         case 0x64: break;
149         case 0x65: break;
150         case 0x66: break;
151         case 0x67: break;
152         case 0x68: break;
153         case 0x69: break;
154         case 0x6a: break;
155         case 0x6b: break;
156         case 0x6c: break;
157         case 0x6d: break;
158         case 0x6e: break;
159         case 0x6f: break;
160      }
161   }
162
163   // after a write the selected address needs to be reset
164   m_address_valid = false;
165}
src/mess/machine/cs8221.h
r0r11675
1/***************************************************************************
2
3    Chips & Technologies CS8221 chipset
4
5    a.k.a. NEW ENHANCED AT (NEAT)
6   
7   Consists of four individual chips:
8
9    * 82C211 - CPU/Bus controller
10   * 82C212 - Page/Interleave and EMS Memory controller
11    * 82C215 - Data/Address buffer
12    * 82C206 - Integrated Peripherals Controller(IPC)
13   
14***************************************************************************/
15
16#pragma once
17
18#ifndef __CS8221_H__
19#define __CS8221_H__
20
21#include "emu.h"
22
23
24//**************************************************************************
25//  INTERFACE CONFIGURATION MACROS
26//**************************************************************************
27
28#define MCFG_CS8221_ADD(_tag, _cputag, _isatag, _biostag) \
29    MCFG_DEVICE_ADD(_tag, CS8221, 0) \
30    cs8221_device::static_set_cputag(*device, _cputag); \
31    cs8221_device::static_set_isatag(*device, _isatag); \
32    cs8221_device::static_set_biostag(*device, _biostag);
33
34
35//**************************************************************************
36//  TYPE DEFINITIONS
37//**************************************************************************
38
39// ======================> cs8221_device
40
41class cs8221_device : public device_t
42{
43public:
44   // construction/destruction
45   cs8221_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
46
47   DECLARE_WRITE8_MEMBER( address_w );
48   DECLARE_READ8_MEMBER( data_r );
49   DECLARE_WRITE8_MEMBER( data_w );
50
51   // inline configuration
52   static void static_set_cputag(device_t &device, const char *tag);
53   static void static_set_isatag(device_t &device, const char *tag);
54   static void static_set_biostag(device_t &device, const char *tag);
55
56protected:
57   // device-level overrides
58   virtual void device_start();
59   virtual void device_reset();
60
61private:
62
63   // internal state
64   address_space *m_space;
65   UINT8 *m_isa;
66   UINT8 *m_bios;
67   UINT8 *m_ram;
68
69   // address selection
70   UINT8 m_address;
71   bool m_address_valid;
72
73   const char *m_cputag;
74   const char *m_isatag;
75   const char *m_biostag;
76
77
78   UINT8 m_registers[0x10];
79};
80
81
82// device type definition
83extern const device_type CS8221;
84
85
86#endif   /* __CS8221_H__ */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team