Previous 199869 Revisions Next

r21329 Friday 22nd February, 2013 at 19:43:35 UTC by Curt Coder
(MESS) cbm8096: Emulated the 64KB memory expansion card, and promoted driver to working. [Curt Coder]
[src/mess/drivers]pet.c
[src/mess/machine]pet_64k.c pet_64k.h petexp.c petexp.h superpet.c superpet.h

trunk/src/mess/drivers/pet.c
r21328r21329
213213   int norom = m_exp->norom_r(space, offset, sel);
214214   UINT8 data = 0;
215215
216   data = m_exp->read(space, offset, data, sel);
217
216218   switch (sel)
217219   {
218220   case SEL0: case SEL1: case SEL2: case SEL3: case SEL4: case SEL5: case SEL6: case SEL7:
r21328r21329
260262      break;
261263   }
262264
263   return m_exp->read(space, offset, data, sel);
265   return data;
264266}
265267
266268
r21328r21329
272274{
273275   int sel = offset >> 12;
274276
277   m_exp->write(space, offset, data, sel);
278
275279   switch (sel)
276280   {
277281   case SEL0: case SEL1: case SEL2: case SEL3: case SEL4: case SEL5: case SEL6: case SEL7:
r21328r21329
314318      }
315319      break;
316320   }
317
318   m_exp->write(space, offset, data, sel);
319321}
320322
321323
trunk/src/mess/machine/superpet.h
r21328r21329
5252
5353   // device_pet_expansion_card_interface overrides
5454   virtual int pet_norom_r(address_space &space, offs_t offset, int sel);
55   virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel);
56   virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel);
55   virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel);
56   virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel);
5757   virtual int pet_diag_r();
5858   virtual void pet_irq_w(int state);
5959
trunk/src/mess/machine/petexp.c
r21328r21329
114114//  read - buffered data read
115115//-------------------------------------------------
116116
117UINT8 pet_expansion_slot_device::read(address_space &space, offs_t offset, UINT8 data, int sel)
117UINT8 pet_expansion_slot_device::read(address_space &space, offs_t offset, UINT8 data, int &sel)
118118{
119119   if (m_card != NULL)
120120   {
r21328r21329
129129//  write - buffered data write
130130//-------------------------------------------------
131131
132void pet_expansion_slot_device::write(address_space &space, offs_t offset, UINT8 data, int sel)
132void pet_expansion_slot_device::write(address_space &space, offs_t offset, UINT8 data, int &sel)
133133{
134134   if (m_card != NULL)
135135   {
trunk/src/mess/machine/petexp.h
r21328r21329
6363
6464   // computer interface
6565   int norom_r(address_space &space, offs_t offset, int sel);
66   UINT8 read(address_space &space, offs_t offset, UINT8 data, int sel);
67   void write(address_space &space, offs_t offset, UINT8 data, int sel);
66   UINT8 read(address_space &space, offs_t offset, UINT8 data, int &sel);
67   void write(address_space &space, offs_t offset, UINT8 data, int &sel);
6868   DECLARE_READ_LINE_MEMBER( diag_r );
6969   DECLARE_WRITE_LINE_MEMBER( irq_w );
7070
r21328r21329
7575   
7676   enum
7777   {
78      SEL_NONE = -1,
7879      SEL0 = 0,
7980      SEL1,
8081      SEL2,
r21328r21329
119120protected:
120121   // runtime
121122   virtual int pet_norom_r(address_space &space, offs_t offset, int sel) { return 1; }
122   virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel) { return data; };
123   virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel) { };
123   virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel) { return data; };
124   virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel) { };
124125   virtual int pet_diag_r() { return 1; }
125126   virtual void pet_irq_w(int state) { }
126127
trunk/src/mess/machine/pet_64k.c
r21328r21329
123123//  pet_bd_r - buffered data read
124124//-------------------------------------------------
125125
126UINT8 pet_64k_expansion_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel)
126UINT8 pet_64k_expansion_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel)
127127{
128128   if (BIT(m_ctrl, 7))
129129   {
r21328r21329
133133         if (!BIT(m_ctrl, 5))
134134         {
135135            data = read_ram(offset);
136            sel = pet_expansion_slot_device::SEL_NONE;
136137         }
137138         break;
138139
r21328r21329
140141         if (!BIT(m_ctrl, 6) || !BIT(offset, 11))
141142         {
142143            data = read_ram(offset);
144            sel = pet_expansion_slot_device::SEL_NONE;
143145         }
144146         break;
145147
r21328r21329
162164//  pet_bd_w - buffered data write
163165//-------------------------------------------------
164166
165void pet_64k_expansion_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel)
167void pet_64k_expansion_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel)
166168{
167169   if (BIT(m_ctrl, 7))
168170   {
r21328r21329
172174         if (!BIT(m_ctrl, 5))
173175         {
174176            write_ram(offset, data);
177            sel = pet_expansion_slot_device::SEL_NONE;
175178         }
176179         break;
177180
r21328r21329
179182         if (!BIT(m_ctrl, 6) || !BIT(offset, 11))
180183         {
181184            write_ram(offset, data);   
185            sel = pet_expansion_slot_device::SEL_NONE;
182186         }
183187         break;
184188
r21328r21329
195199
196200   if (offset == 0xfff0)
197201   {
198      printf("CTRL %02x\n", data);
199202      m_ctrl = data;
200203   }
201204}
trunk/src/mess/machine/pet_64k.h
r21328r21329
3838
3939   // device_pet_expansion_card_interface overrides
4040   virtual int pet_norom_r(address_space &space, offs_t offset, int sel);
41   virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel);
42   virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel);
41   virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel);
42   virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel);
4343
4444private:
4545   inline UINT8 read_ram(offs_t offset);
trunk/src/mess/machine/superpet.c
r21328r21329
250250//  pet_bd_r - buffered data read
251251//-------------------------------------------------
252252
253UINT8 superpet_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel)
253UINT8 superpet_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel)
254254{
255255   int norom = pet_norom_r(space, offset, sel);
256256
r21328r21329
311311//  pet_bd_w - buffered data write
312312//-------------------------------------------------
313313
314void superpet_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel)
314void superpet_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel)
315315{
316316   switch (sel)
317317   {

Previous 199869 Revisions Next


© 1997-2024 The MAME Team