Previous 199869 Revisions Next

r32270 Monday 22nd September, 2014 at 01:35:01 UTC by R. Belmont
(MESS) itt3030: additional FDC hookup, now tries and fails to boot. [R. Belmont]
[src/mess/drivers]itt3030.c

trunk/src/mess/drivers/itt3030.c
r32269r32270
198198#include "sound/beep.h"
199199#include "cpu/mcs48/mcs48.h"        //Keyboard MCU ... talks to the 8278 on the keyboard circuit
200200
201
202201#define MAIN_CLOCK XTAL_4.194MHz
203202
204203class itt3030_state : public driver_device
r32269r32270
265264public:
266265
267266   DECLARE_READ8_MEMBER(vsync_r);
268   DECLARE_READ8_MEMBER(unk2_r);
267   DECLARE_READ8_MEMBER(i8078_r);
268   DECLARE_WRITE8_MEMBER(i8078_w);
269269   DECLARE_WRITE8_MEMBER( beep_w );
270270   DECLARE_WRITE8_MEMBER(bank_w);
271271   DECLARE_READ8_MEMBER(bankl_r);
r32269r32270
275275   DECLARE_READ8_MEMBER(kbd_fifo_r);
276276   DECLARE_READ8_MEMBER(kbd_matrix_r);
277277   DECLARE_WRITE8_MEMBER(kbd_matrix_w);
278   DECLARE_READ8_MEMBER(fdc_stat_r);
279   DECLARE_WRITE8_MEMBER(fdc_cmd_w);
278280   DECLARE_FLOPPY_FORMATS(itt3030_floppy_formats);
281
282   DECLARE_WRITE_LINE_MEMBER(fdcirq_w);
283   DECLARE_WRITE_LINE_MEMBER(fdcdrq_w);
284   DECLARE_WRITE_LINE_MEMBER(fdchld_w);
285
279286private:
280287   UINT8 m_unk;
281288   UINT8 m_bank;
282289   UINT8 m_kbdrow, m_kbdcol, m_kbdclk, m_kbdread;
283290   required_device<gfxdecode_device> m_gfxdecode;
284291   required_device<palette_device> m_palette;
292   floppy_image_device *m_curfloppy;
293   bool m_fdc_irq, m_fdc_drq, m_fdc_hld;
294   floppy_connector *m_con1, *m_con2, *m_con3;
295   bool m_keyskip;
285296};
286297
287298void itt3030_state::video_start()
r32269r32270
306317   return ret;
307318}
308319
309READ8_MEMBER(itt3030_state::unk2_r)
320// TODO: make this a correct device once we figure out how everything goes together in this system
321READ8_MEMBER(itt3030_state::i8078_r)
310322{
311   return 0x40;
323   if (offset)
324   {
325//      printf("Read 8078 status\n");
326      if (!m_keyskip)
327      {
328         return 0x10;
329      }
330   }
331   else
332   {
333//      printf("Read 8078 data\n");
334      if (!m_keyskip)
335      {
336         m_keyskip = true;   // don't keep reporting the 'b' key, just the once to trick the boot ROM
337         return 0x0c;
338      }
339   }
340
341   return 0;
312342}
313343
344WRITE8_MEMBER(itt3030_state::i8078_w)
345{
346   #if 0
347   if (offset)
348   {
349      printf("%02x to 8078 command\n", data);
350   }
351   else
352   {
353      printf("%02x to 8078 data\n", data);
354   }
355   #endif
356}
357
314358WRITE8_MEMBER( itt3030_state::beep_w )
315359{
316360   m_beep->set_state(data&0x32);
r32269r32270
369413   return 0;
370414}
371415
416WRITE_LINE_MEMBER(itt3030_state::fdcirq_w)
417{
418   m_fdc_irq = state;
419}
372420
421WRITE_LINE_MEMBER(itt3030_state::fdcdrq_w)
422{
423   m_fdc_drq = state;
424}
425
426WRITE_LINE_MEMBER(itt3030_state::fdchld_w)
427{
428   m_fdc_hld = state;
429}
430
431/*
432   7 Data Request (IRQ - inverted 1791-Signal)
433   6 Interrupt Request (INTRQ - 1791-Signal)
434   5 Head Load (HLD - inverted 1791-Signal)
435   4 Ready 3 (Drive 3 ready)
436   3 Ready 2 (Drive 2 ready)
437   2 Ready l (Drive 1 ready)
438   1 Write protect (the disk in the selected drive is write protected)
439   0 HLT (Halt signal during head load and track change)
440*/
441READ8_MEMBER(itt3030_state::fdc_stat_r)
442{
443   UINT8 res = 0;
444   floppy_image_device *floppy1 = m_con1 ? m_con1->get_device() : 0;
445   floppy_image_device *floppy2 = m_con2 ? m_con2->get_device() : 0;
446   floppy_image_device *floppy3 = m_con3 ? m_con3->get_device() : 0;
447
448   res = m_fdc_drq ? 0x00 : 0x80;
449   res = m_fdc_irq ? 0x40 : 0x00;
450   res = m_fdc_hld ? 0x00 : 0x20;
451   if (floppy3) res |= floppy3->ready_r() ? 0x10 : 0;
452   if (floppy2) res |= floppy2->ready_r() ? 0x08 : 0;
453   if (floppy1) res |= floppy1->ready_r() ? 0x04 : 0;
454   if (m_curfloppy) res |= m_curfloppy->wpt_r() ? 0x02 : 0;
455
456   return res;
457}
458
459/*
460   7 SEL1 - Select drive 1
461   6 SEL2 - Select drive 2
462   5 SEL3 - Select drive 3
463   4 MOTOR - Motor on
464   3 DOOR - Drive door lock drives 1 + 2 (not possible with all drives)
465   2 SIDESEL - Select disk side
466   1 KOMP - write comp on/off
467   0 RG J - Change separator stage to read
468*/
469WRITE8_MEMBER(itt3030_state::fdc_cmd_w)
470{
471   floppy_image_device *floppy = NULL;
472
473   logerror("%02x to fdc_cmd_w: motor %d side %d\n", data, (data & 0x10)>>4, (data & 4)>>2);
474
475   // select drive
476   if (data & 0x80)
477   {
478      floppy = m_con1 ? m_con1->get_device() : 0;
479   }
480   else if (data & 0x40)
481   {
482      floppy = m_con2 ? m_con2->get_device() : 0;
483   }
484   else if (data & 0x20)
485   {
486      floppy = m_con3 ? m_con3->get_device() : 0;
487   }
488
489   // selecting a new drive?
490   if (floppy != m_curfloppy)
491   {
492      m_fdc->set_floppy(floppy);
493      m_curfloppy = floppy;
494   }
495
496   if (floppy != NULL)
497   {
498      // side select
499      floppy->ss_w((data & 4) ? 1 : 0);
500
501      // motor control (active low)
502      floppy->mon_w((data & 0x10) ? 0 : 1);
503   }
504}
505
373506// The lower 48K is switchable among the first 48K of each of 8 64K banks numbered 0-7 or "bank 8" which is the internal ROM and VRAM
374507// The upper 16K is always the top 16K of the selected bank 0-7, which allows bank/bank copies and such
375508// Port F6 bits 7-5 select banks 0-7, bit 4 enables bank 8
r32269r32270
390523static ADDRESS_MAP_START( itt3030_io, AS_IO, 8, itt3030_state )
391524   ADDRESS_MAP_GLOBAL_MASK(0xff)
392525   AM_RANGE(0x20, 0x26) AM_DEVREADWRITE("crt5027", crt5027_device, read, write)
393   AM_RANGE(0x31, 0x31) AM_READ(unk2_r)
526   AM_RANGE(0x30, 0x31) AM_READWRITE(i8078_r, i8078_w)
394527   AM_RANGE(0x32, 0x32) AM_WRITE(beep_w)
395528   AM_RANGE(0x35, 0x35) AM_READ(vsync_r)
396529   AM_RANGE(0x40, 0x40) AM_READ(kbd_fifo_r)
397   AM_RANGE(0x50, 0x55) AM_DEVREADWRITE("fdc", fd1791_t, read, write)
530   AM_RANGE(0x50, 0x53) AM_DEVREADWRITE("fdc", fd1791_t, read, write)
531   AM_RANGE(0x54, 0x54) AM_READWRITE(fdc_stat_r, fdc_cmd_w)
398532   AM_RANGE(0xf6, 0xf6) AM_WRITE(bank_w)
399533ADDRESS_MAP_END
400534
r32269r32270
577711   m_kbdread = 1;
578712   m_kbdrow = m_kbdcol = 0;
579713   m_kbdclk = 1;
714   m_fdc_irq = m_fdc_drq = m_fdc_hld = 0;
715   m_curfloppy = NULL;
716   m_keyskip = false;
717
718   // look up floppies in advance
719   m_con1 = machine().device<floppy_connector>("fdc:0");
720   m_con2 = machine().device<floppy_connector>("fdc:1");
721   m_con3 = machine().device<floppy_connector>("fdc:2");
580722}
581723
582724FLOPPY_FORMATS_MEMBER( itt3030_state::itt3030_floppy_formats )
r32269r32270
619761   MCFG_TMS9927_CHAR_WIDTH(16)
620762
621763   MCFG_FD1791x_ADD("fdc", XTAL_20MHz / 20)
622   MCFG_WD_FDC_FORCE_READY
764   MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(itt3030_state, fdcirq_w))
765   MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(itt3030_state, fdcdrq_w))
766   MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(itt3030_state, fdchld_w))
623767   MCFG_FLOPPY_DRIVE_ADD("fdc:0", itt3030_floppies, "525dd", itt3030_state::itt3030_floppy_formats)
624768   MCFG_FLOPPY_DRIVE_ADD("fdc:1", itt3030_floppies, "525dd", itt3030_state::itt3030_floppy_formats)
769   MCFG_FLOPPY_DRIVE_ADD("fdc:2", itt3030_floppies, "525dd", itt3030_state::itt3030_floppy_formats)
625770
626771   MCFG_GFXDECODE_ADD("gfxdecode", "palette", itt3030)
627772

Previous 199869 Revisions Next


© 1997-2024 The MAME Team