Previous 199869 Revisions Next

r33975 Saturday 20th December, 2014 at 01:49:12 UTC by Barry Rodewald
(MESS) ngen: put 386-based systems in a separate driver_device class for now, so that they don't crash.
[src/mess/drivers]ngen.c

trunk/src/mess/drivers/ngen.c
r242486r242487
126126   virtual void machine_reset();
127127
128128private:
129   required_device<cpu_device> m_maincpu;
129   required_device<i80186_cpu_device> m_maincpu;
130130   required_device<mc6845_device> m_crtc;
131131   required_device<i8251_device> m_viduart;
132132   required_device<upd7201_device> m_iouart;
r242486r242487
151151   UINT16 m_control;
152152};
153153
154class ngen386_state : public driver_device
155{
156public:
157   ngen386_state(const machine_config &mconfig, device_type type, const char *tag)
158      : driver_device(mconfig, type, tag),
159      m_maincpu(*this,"maincpu"),
160      m_pic(*this,"pic")
161      {}
162private:
163   required_device<i386_device> m_maincpu;
164   required_device<pic8259_device> m_pic;
165};
166
154167WRITE_LINE_MEMBER(ngen_state::pit_out0_w)
155168{
156169   m_pic->ir3_w(state);  // Timer interrupt
r242486r242487
168181{
169182   m_iouart->rxca_w(state);
170183   m_iouart->txca_w(state);
171   //logerror("PIT Timer 2 state %i\n",state);
184   popmessage("PIT Timer 2 state %i\n",state);
172185}
173186
174187WRITE_LINE_MEMBER(ngen_state::cpu_timer_w)
r242486r242487
254267         m_pic->write(space,1,data & 0xff);
255268      break;
256269   case 0x110:
257      if(mem_mask & 0x00ff)
258         m_pit->write(space,0,data & 0x0ff);
259      break;
260270   case 0x111:
261      if(mem_mask & 0x00ff)
262         m_pit->write(space,1,data & 0x0ff);
263      break;
264271   case 0x112:
265      if(mem_mask & 0x00ff)
266         m_pit->write(space,2,data & 0x0ff);
267      break;
268272   case 0x113:
269273      if(mem_mask & 0x00ff)
270         m_pit->write(space,3,data & 0x0ff);
274         m_pit->write(space,offset-0x110,data & 0xff);
271275      break;
272276   case 0x141:
273277      // bit 1 enables speaker?
r242486r242487
329333      if(mem_mask & 0x00ff)
330334         ret = m_dma_offset[offset-0x80] & 0xff;
331335      break;
332   case 0x110:
336   case 0x10c:
333337      if(mem_mask & 0x00ff)
334         ret = m_pit->read(space,0);
338         ret = m_pic->read(space,0);
335339      break;
336   case 0x111:
340   case 0x10d:
337341      if(mem_mask & 0x00ff)
338         ret = m_pit->read(space,1);
342         ret = m_pic->read(space,1);
339343      break;
344   case 0x110:
345   case 0x111:
340346   case 0x112:
341      if(mem_mask & 0x00ff)
342         ret = m_pit->read(space,2);
343      break;
344347   case 0x113:
345348      if(mem_mask & 0x00ff)
346         ret = m_pit->read(space,3);
349         ret = m_pit->read(space,offset-0x110);
347350      break;
348351   case 0x141:
349352      ret = m_periph141;
r242486r242487
368371   case 0x1a0:  // I/O control register?
369372      ret = m_control;  // end of DMA transfer? (maybe a per-channel EOP?) Bit 6 is set during a transfer?
370373      break;
371   case 0x1b1:
372      ret = 0;
373      ret |= 0x02;  // also checked after DMA transfer ends
374      break;
375374   default:
376375      logerror("(PC=%06x) Unknown 80186 peripheral read offset %04x mask %04x returning %04x\n",m_maincpu->device_t::safe_pc(),offset,mem_mask,ret);
377376   }
r242486r242487
516515   AM_RANGE(0x0000, 0x0001) AM_READWRITE(port00_r,port00_w)
517516   AM_RANGE(0x0100, 0x0107) AM_DEVREADWRITE8("fdc",wd2797_t,read,write,0x00ff)  // a guess for now
518517   AM_RANGE(0x0108, 0x0109) AM_WRITE8(fdc_control_w,0x00ff)
518   AM_RANGE(0x0110, 0x0117) AM_DEVREADWRITE8("fdc_timer",pit8253_device,read,write,0x00ff)
519519ADDRESS_MAP_END
520520
521521static ADDRESS_MAP_START( ngen386_mem, AS_PROGRAM, 32, ngen_state )
r242486r242487
634634   MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu",i80186_cpu_device,drq1_w))
635635   MCFG_WD_FDC_FORCE_READY
636636   MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0)
637   MCFG_PIT8253_CLK0(XTAL_20MHz / 20)
638   MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w))
639   MCFG_PIT8253_CLK1(XTAL_20MHz / 20)
640   MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w))
641   MCFG_PIT8253_CLK2(XTAL_20MHz / 20)
642   MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w))
637643   // TODO: WD1010 HDC (not implemented)
638644   MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0)
639645   MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats)
640646
641647MACHINE_CONFIG_END
642648
643static MACHINE_CONFIG_DERIVED( ngen386, ngen )
644   MCFG_CPU_REPLACE("maincpu", I386, XTAL_50MHz / 2)
649static MACHINE_CONFIG_START( ngen386, ngen386_state )
650   MCFG_CPU_ADD("maincpu", I386, XTAL_50MHz / 2)
645651   MCFG_CPU_PROGRAM_MAP(ngen386_mem)
646652   MCFG_CPU_IO_MAP(ngen386_io)
647   MCFG_DEVICE_REMOVE("pic")
648653   MCFG_PIC8259_ADD( "pic", INPUTLINE("maincpu", 0), VCC, NULL )
649654MACHINE_CONFIG_END
650655


Previous 199869 Revisions Next


© 1997-2024 The MAME Team