diff options
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | src/emu/bus/bus.mak | 1 | ||||
-rw-r--r-- | src/emu/bus/scsi/pc9801_sasi.c | 26 | ||||
-rw-r--r-- | src/emu/bus/scsi/pc9801_sasi.h | 18 | ||||
-rw-r--r-- | src/emu/bus/scsi/scsi.c | 10 | ||||
-rw-r--r-- | src/mess/drivers/pc9801.c | 51 |
6 files changed, 100 insertions, 8 deletions
diff --git a/.gitattributes b/.gitattributes index e305d6f672a..e3bc8848cf7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1477,6 +1477,8 @@ src/emu/bus/scsi/cdu76s.c svneol=native#text/plain src/emu/bus/scsi/cdu76s.h svneol=native#text/plain src/emu/bus/scsi/d9060hd.c svneol=native#text/plain src/emu/bus/scsi/d9060hd.h svneol=native#text/plain +src/emu/bus/scsi/pc9801_sasi.c svneol=native#text/plain +src/emu/bus/scsi/pc9801_sasi.h svneol=native#text/plain src/emu/bus/scsi/s1410.c svneol=native#text/plain src/emu/bus/scsi/s1410.h svneol=native#text/plain src/emu/bus/scsi/sa1403d.c svneol=native#text/plain diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index aeb59ed6457..961c299051f 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -1218,6 +1218,7 @@ BUSOBJS += $(BUSOBJ)/scsi/acb4070.o BUSOBJS += $(BUSOBJ)/scsi/d9060hd.o BUSOBJS += $(BUSOBJ)/scsi/sa1403d.o BUSOBJS += $(BUSOBJ)/scsi/s1410.o +BUSOBJS += $(BUSOBJ)/scsi/pc9801_sasi.o endif #------------------------------------------------- diff --git a/src/emu/bus/scsi/pc9801_sasi.c b/src/emu/bus/scsi/pc9801_sasi.c new file mode 100644 index 00000000000..82fcbe41239 --- /dev/null +++ b/src/emu/bus/scsi/pc9801_sasi.c @@ -0,0 +1,26 @@ +#include "pc9801_sasi.h" + +#define SASI_CMD_SPECIFY 0xc2 // according to x68k_hdc.c + +const device_type PC9801_SASI = &device_creator<pc9801_sasi_device>; + +pc9801_sasi_device::pc9801_sasi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : scsihd_device(mconfig, PC9801_SASI, "PC-9801 SASI Controller", tag, owner, clock, "pc9801_sasi", __FILE__) +{ +} + +void pc9801_sasi_device::ExecCommand() +{ + switch(command[0]) + { + case SASI_CMD_SPECIFY: + m_phase = SCSI_PHASE_DATAOUT; + m_status_code = SCSI_STATUS_CODE_GOOD; + m_transfer_length = 10; + break; + + default: + scsihd_device::ExecCommand(); + break; + } +} diff --git a/src/emu/bus/scsi/pc9801_sasi.h b/src/emu/bus/scsi/pc9801_sasi.h new file mode 100644 index 00000000000..21876a6f519 --- /dev/null +++ b/src/emu/bus/scsi/pc9801_sasi.h @@ -0,0 +1,18 @@ +#ifndef PC9801_SASI_H_ +#define PC9801_SASI_H_ + +#include "scsihd.h" + +class pc9801_sasi_device : public scsihd_device +{ +public: + // construction/destruction + pc9801_sasi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual void ExecCommand(); +}; + +// device type definition +extern const device_type PC9801_SASI; + +#endif /* PC9801_SASI_H_ */ diff --git a/src/emu/bus/scsi/scsi.c b/src/emu/bus/scsi/scsi.c index 1aa25104ac3..7bf6f732064 100644 --- a/src/emu/bus/scsi/scsi.c +++ b/src/emu/bus/scsi/scsi.c @@ -122,6 +122,16 @@ void SCSI_PORT_DEVICE::device_start() m_data5_handler(0); m_data6_handler(0); m_data7_handler(0); + + m_bsy_handler(0); + m_sel_handler(0); + m_cd_handler(0); + m_io_handler(0); + m_msg_handler(0); + m_req_handler(0); + m_ack_handler(0); + m_atn_handler(0); + m_rst_handler(0); } void SCSI_PORT_DEVICE::update_bsy() diff --git a/src/mess/drivers/pc9801.c b/src/mess/drivers/pc9801.c index 9d0947e2c79..cb747193e9b 100644 --- a/src/mess/drivers/pc9801.c +++ b/src/mess/drivers/pc9801.c @@ -402,7 +402,7 @@ Keyboard TX commands: #include "machine/upd1990a.h" #include "machine/i8251.h" -#include "bus/scsi/s1410.h" +#include "bus/scsi/pc9801_sasi.h" #include "bus/scsi/scsi.h" #include "bus/scsi/scsihd.h" #include "machine/buffer.h" @@ -600,7 +600,9 @@ public: UINT32 pc9801_286_a20(bool state); DECLARE_WRITE8_MEMBER(sasi_data_w); + DECLARE_READ8_MEMBER(sasi_data_r); DECLARE_WRITE_LINE_MEMBER(write_sasi_io); + DECLARE_WRITE_LINE_MEMBER(write_sasi_req); DECLARE_READ8_MEMBER(sasi_status_r); DECLARE_WRITE8_MEMBER(sasi_ctrl_w); @@ -1730,6 +1732,15 @@ WRITE8_MEMBER(pc9801_state::pc9801_mouse_w) } } +READ8_MEMBER( pc9801_state::sasi_data_r ) +{ + UINT8 data = m_sasi_data_in->read(); + + if(m_sasi_ctrl_in->read() & 0x80) + m_sasibus->write_ack(1); + return data; +} + WRITE8_MEMBER( pc9801_state::sasi_data_w ) { m_sasi_data = data; @@ -1737,6 +1748,8 @@ WRITE8_MEMBER( pc9801_state::sasi_data_w ) if (m_sasi_data_enable) { m_sasi_data_out->write(m_sasi_data); + if(m_sasi_ctrl_in->read() & 0x80) + m_sasibus->write_ack(1); } } @@ -1754,6 +1767,25 @@ WRITE_LINE_MEMBER( pc9801_state::write_sasi_io ) { m_sasi_data_out->write(0); } + if((m_sasi_ctrl_in->read() & 0x9C) == 0x8C) + m_pic2->ir1_w(m_sasi_ctrl & 1); + else + m_pic2->ir1_w(0); +} + +WRITE_LINE_MEMBER( pc9801_state::write_sasi_req ) +{ + m_sasi_ctrl_in->write_bit7(state); + + if (!state) + m_sasibus->write_ack(0); + + if((m_sasi_ctrl_in->read() & 0x9C) == 0x8C) + m_pic2->ir1_w(m_sasi_ctrl & 1); + else + m_pic2->ir1_w(0); + + m_dmac->dreq0_w(!(state && !(m_sasi_ctrl_in->read() & 8) && (m_sasi_ctrl & 2))); } #include "debugger.h" @@ -1765,7 +1797,7 @@ READ8_MEMBER( pc9801_state::sasi_status_r ) if(m_sasi_ctrl & 0x40) // read status { /* - x--- -.-- REQ + x--- ---- REQ -x-- ---- ACK --x- ---- BSY ---x ---- MSG @@ -1782,10 +1814,9 @@ READ8_MEMBER( pc9801_state::sasi_status_r ) --xx x--- SASI-1 media type ---- -xxx SASI-2 media type */ - res |= 7 << 3; // read mediatype SASI-1 - res |= 7; // read mediatype SASI-2 + //res |= 7 << 3; // read mediatype SASI-1 + //res |= 7; // read mediatype SASI-2 } - return res; } @@ -1839,7 +1870,7 @@ static ADDRESS_MAP_START( pc9801_io, AS_IO, 16, pc9801_state ) // AM_RANGE(0x006c, 0x006f) border color / <undefined> AM_RANGE(0x0070, 0x007b) AM_READWRITE8(pc9801_70_r,pc9801_70_w,0xffff) //display registers / i8253 pit // AM_RANGE(0x0080, 0x0083) AM_READWRITE8(pc9801_sasi_r,pc9801_sasi_w,0xffff) //HDD SASI interface / <undefined> - AM_RANGE(0x0080, 0x0081) AM_DEVREAD8("sasi_data_in", input_buffer_device, read, 0x00ff) AM_WRITE8(sasi_data_w, 0x00ff) + AM_RANGE(0x0080, 0x0081) AM_READWRITE8(sasi_data_r, sasi_data_w, 0x00ff) AM_RANGE(0x0082, 0x0083) AM_READWRITE8(sasi_status_r, sasi_ctrl_w,0x00ff) AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801_fdc_2hd_r,pc9801_fdc_2hd_w,0xffff) //upd765a 2hd / cmt AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r,pc9801_a0_w,0xffff) //upd7220 bitmap ports / display registers @@ -3542,13 +3573,17 @@ static MACHINE_CONFIG_FRAGMENT( pc9801_sasi ) MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4)) MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit5)) MCFG_SCSI_ACK_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit6)) - MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit7)) + MCFG_SCSI_REQ_HANDLER(WRITELINE(pc9801_state, write_sasi_req)) - MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", S1410, SCSI_ID_0) // TODO: correct one, perhaps ttl + MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", PC9801_SASI, SCSI_ID_0) MCFG_SCSI_OUTPUT_LATCH_ADD("sasi_data_out", SASIBUS_TAG) MCFG_DEVICE_ADD("sasi_data_in", INPUT_BUFFER, 0) MCFG_DEVICE_ADD("sasi_ctrl_in", INPUT_BUFFER, 0) + + MCFG_DEVICE_MODIFY("i8237") + MCFG_I8237_IN_IOR_0_CB(READ8(pc9801_state, sasi_data_r)) + MCFG_I8237_OUT_IOW_0_CB(WRITE8(pc9801_state, sasi_data_w)) MACHINE_CONFIG_END |