Previous 15994 Revisions Next

r10601 Sunday 27th February, 2011 at 01:01:11 UTC by Barry Rodewald
[FMTOWNS] Implemented CPU wait port, fixing HD access on faster systems (like the SJ). Added extra I/O port for the FMSCSI device, used to detect the ability to do word-size transfers.
[src/mess/drivers]fmtowns.c
[src/mess/includes]fmtowns.h
[src/mess/machine]fm_scsi.c fm_scsi.h

src/mess/machine/fm_scsi.c
r10600r10601
453453
454454READ8_MEMBER( fmscsi_device::fmscsi_r )
455455{
456   switch(offset & 0x01)
456   switch(offset & 0x03)
457457   {
458458   case 0x00:
459459      return fmscsi_data_r();
460460   case 0x01:
461461      return fmscsi_status_r();
462   case 0x02:
463      return 0x80;  // Linux uses this port to detect the ability to do word transfers.  We'll tell it that it doesn't for now.
464   default:
465      logerror("FMSCSI: Unknown read at offset %i\n",offset);
462466   }
463467   return 0;
464468}
465469
466470WRITE8_MEMBER( fmscsi_device::fmscsi_w )
467471{
468   switch(offset & 0x01)
472   switch(offset & 0x03)
469473   {
470474   case 0x00:
471475      fmscsi_data_w(data);
r10600r10601
473477   case 0x01:
474478      fmscsi_control_w(data);
475479      break;
480   default:
481      logerror("FMSCSI: Unknown write 0x%02x at offset %i\n",data,offset);
476482   }
477483}
src/mess/machine/fm_scsi.h
r10600r10601
1616#define FMSCSI_LINE_MSG   0x20
1717#define FMSCSI_LINE_CD    0x10
1818#define FMSCSI_LINE_BSY   0x08
19#define FMSCSI_LINE_EX    0x04
1920#define FMSCSI_LINE_INT   0x02
2021#define FMSCSI_LINE_PERR  0x01
2122
2223// SCSI output lines (to target)
2324#define FMSCSI_LINE_WEN   0x80
2425#define FMSCSI_LINE_IMSK  0x40
26#define FMSCSI_LINE_RMSK  0x20
2527#define FMSCSI_LINE_ATN   0x10
28#define FMSCSI_LINE_WRD   0x08
2629#define FMSCSI_LINE_SEL   0x04
2730#define FMSCSI_LINE_DMAE  0x02
2831#define FMSCSI_LINE_RST   0x01
src/mess/includes/fmtowns.h
r10600r10601
124124   UINT8 towns_volume_select;
125125   UINT8 towns_scsi_control;
126126   UINT8 towns_scsi_status;
127   emu_timer* towns_wait_timer;
127128   struct towns_cdrom_controller towns_cd;
128129   struct towns_video_controller video;
129130   required_shared_ptr<UINT8>   m_nvram;
src/mess/drivers/fmtowns.c
r10600r10601
305305   }
306306}
307307
308static TIMER_CALLBACK(towns_wait_end)
309{
310   towns_state* state = machine->driver_data<towns_state>();
311   cpu_set_input_line(state->maincpu,INPUT_LINE_HALT,CLEAR_LINE);
312}
313
308314static READ8_HANDLER(towns_sys6c_r)
309315{
310316   logerror("SYS: (0x6c) Timer? read\n");
r10600r10601
316322   towns_state* state = space->machine->driver_data<towns_state>();
317323//  logerror("SYS: (0x6c) write to timer (0x%02x)\n",data);
318324   state->ftimer -= 0x54;
325   // halts the CPU for a period of time (exact length unknown)
326   cpu_set_input_line(state->maincpu,INPUT_LINE_HALT,ASSERT_LINE);
327   state->towns_wait_timer->adjust(attotime::from_usec(1),0,attotime::zero);
319328}
320329
321330static READ8_HANDLER(towns_dma1_r)
r10600r10601
20622071  // Keyboard (8042 MCU)
20632072  AM_RANGE(0x0600,0x0607) AM_READWRITE8(towns_keyboard_r, towns_keyboard_w,0x00ff00ff)
20642073  // SCSI controller
2065  AM_RANGE(0x0c30,0x0c33) AM_DEVREADWRITE8_MODERN("scsi",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff00ff)
2074  AM_RANGE(0x0c30,0x0c37) AM_DEVREADWRITE8_MODERN("scsi",fmscsi_device,fmscsi_r,fmscsi_w,0x00ff00ff)
20662075  // CMOS
20672076  AM_RANGE(0x3000,0x3fff) AM_READWRITE8(towns_cmos8_r, towns_cmos8_w,0x00ff00ff)
20682077  // Something (MS-DOS wants this 0x41ff to be 1)
r10600r10601
23002309   state->towns_rtc_timer = machine->scheduler().timer_alloc(FUNC(rtc_second));
23012310   state->towns_kb_timer = machine->scheduler().timer_alloc(FUNC(poll_keyboard));
23022311   state->towns_mouse_timer = machine->scheduler().timer_alloc(FUNC(towns_mouse_timeout));
2312   state->towns_wait_timer = machine->scheduler().timer_alloc(FUNC(towns_wait_end));
23032313
23042314   // CD-ROM init
23052315   state->towns_cd.read_timer = machine->scheduler().timer_alloc(FUNC(towns_cdrom_read_byte), (void*)machine->device("dma_1"));

Previous 15994 Revisions Next


© 1998-2018 The MESS Team