diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/video/huc6272.cpp | 84 | ||||
-rw-r--r-- | src/devices/video/huc6272.h | 22 | ||||
-rw-r--r-- | src/mame/drivers/pcfx.cpp | 11 |
3 files changed, 101 insertions, 16 deletions
diff --git a/src/devices/video/huc6272.cpp b/src/devices/video/huc6272.cpp index 72116d1883b..079fab06301 100644 --- a/src/devices/video/huc6272.cpp +++ b/src/devices/video/huc6272.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Wilbert Pol +// copyright-holders:Wilbert Pol, Angelo Salese /*************************************************************************** Hudson/NEC HuC6272 "King" device @@ -7,6 +7,7 @@ ***************************************************************************/ #include "emu.h" + #include "video/huc6272.h" @@ -23,8 +24,8 @@ static ADDRESS_MAP_START( microprg_map, AS_PROGRAM, 16, huc6272_device ) ADDRESS_MAP_END static ADDRESS_MAP_START( kram_map, AS_DATA, 32, huc6272_device ) - AM_RANGE(0x000000, 0x0fffff) AM_RAM - AM_RANGE(0x100000, 0x1fffff) AM_RAM + AM_RANGE(0x000000, 0x0fffff) AM_RAM AM_SHARE("kram_page0") + AM_RANGE(0x100000, 0x1fffff) AM_RAM AM_SHARE("kram_page1") ADDRESS_MAP_END @@ -41,7 +42,14 @@ huc6272_device::huc6272_device(const machine_config &mconfig, const char *tag, d device_memory_interface(mconfig, *this), m_program_space_config("microprg", ENDIANNESS_LITTLE, 16, 4, 0, nullptr, *ADDRESS_MAP_NAME(microprg_map)), m_data_space_config("kram", ENDIANNESS_LITTLE, 32, 21, 0, nullptr, *ADDRESS_MAP_NAME(kram_map)), - m_microprg_ram(*this, "microprg_ram") + m_microprg_ram(*this, "microprg_ram"), + m_kram_page0(*this, "kram_page0"), + m_kram_page1(*this, "kram_page1"), + m_scsibus(*this, "scsi"), + m_scsi_data_in(*this, "scsi_data_in"), + m_scsi_data_out(*this, "scsi_data_out"), + m_scsi_ctrl_in(*this, "scsi_ctrl_in"), + m_irq_changed_cb(*this) { } @@ -62,6 +70,8 @@ void huc6272_device::device_validity_check(validity_checker &valid) const void huc6272_device::device_start() { + m_irq_changed_cb.resolve_safe(); + } @@ -143,12 +153,22 @@ READ32_MEMBER( huc6272_device::read ) ---- ---- ---- ---- ---- ---- -xxx xxxx register read-back */ res = m_register & 0x7f; - res |= (0) << 16; + res |= (m_scsi_ctrl_in->read() & 0xff) << 16; } else { switch(m_register) { + case 0x00: // SCSI data in + res = m_scsi_data_in->read() & 0xff; + break; + + case 0x05: // SCSI bus status + res = m_scsi_ctrl_in->read() & 0xff; + res|= (m_scsi_data_in->read() << 8); + break; + + /* x--- ---- ---- ---- ---- */ @@ -180,14 +200,34 @@ WRITE32_MEMBER( huc6272_device::write ) if((offset & 1) == 0) m_register = data & 0x7f; else - { + { switch(m_register) { - case 0x00: // SCSI data + case 0x00: // SCSI data out + m_scsi_data_out->write(data & 0xff); + break; case 0x01: // SCSI command + //m_scsibus->write_bsy(BIT(data, 0)); // bus? + m_scsibus->write_atn(BIT(data, 1)); + m_scsibus->write_sel(BIT(data, 2)); + m_scsibus->write_ack(BIT(data, 4)); + m_scsibus->write_rst(BIT(data, 7)); + break; + case 0x02: // SCSI mode + break; + case 0x03: // SCSI target command + m_scsibus->write_io(BIT(data, 0)); + m_scsibus->write_cd(BIT(data, 1)); + m_scsibus->write_msg(BIT(data, 2)); + break; + case 0x05: // SCSI bus status + // bits 7-0: SCSI DMA trigger? + m_scsi_data_out->write((data >> 8) & 0xff); + break; + case 0x06: // SCSI input data case 0x07: // SCSI DMA trigger case 0x08: // SCSI subcode @@ -273,6 +313,7 @@ WRITE32_MEMBER( huc6272_device::write ) case 0x15: m_micro_prg.ctrl = data & 1; + break; // case 0x16: wrap-around enable @@ -328,3 +369,32 @@ WRITE32_MEMBER( huc6272_device::write ) } } } + +static MACHINE_CONFIG_FRAGMENT( king_scsi_intf ) + MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0) + MCFG_SCSI_RST_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit7)) + MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit6)) + MCFG_SCSI_REQ_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit5)) + MCFG_SCSI_MSG_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit4)) + MCFG_SCSI_CD_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit3)) + MCFG_SCSI_IO_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit2)) + MCFG_SCSI_SEL_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit1)) + + MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") + + MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", "scsi") + MCFG_DEVICE_ADD("scsi_ctrl_in", INPUT_BUFFER, 0) + MCFG_DEVICE_ADD("scsi_data_in", INPUT_BUFFER, 0) + + MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "cdrom", SCSICD, SCSI_ID_1) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor huc6272_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( king_scsi_intf ); +} diff --git a/src/devices/video/huc6272.h b/src/devices/video/huc6272.h index d17282d2f60..8f34c6e4e5e 100644 --- a/src/devices/video/huc6272.h +++ b/src/devices/video/huc6272.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Wilbert Pol +// copyright-holders:Wilbert Pol, Angelo Salese /*************************************************************************** Hudson/NEC HuC6272 "King" device @@ -11,6 +11,8 @@ #ifndef __huc6272DEV_H__ #define __huc6272DEV_H__ +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsicd.h" //************************************************************************** @@ -20,6 +22,9 @@ #define MCFG_HUC6272_ADD(_tag,_freq) \ MCFG_DEVICE_ADD(_tag, huc6272, _freq) +#define MCFG_HUC6272_IRQ_CHANGED_CB(_devcb) \ + devcb = &huc6272_device::set_irq_changed_callback(*device, DEVCB_##_devcb); + //************************************************************************** // TYPE DEFINITIONS @@ -34,16 +39,18 @@ public: // construction/destruction huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template<class _Object> static devcb_base &set_irq_changed_callback(device_t &device, _Object object) { return downcast<huc6272_device &>(device).m_irq_changed_cb.set_callback(object); } + // I/O operations DECLARE_WRITE32_MEMBER( write ); DECLARE_READ32_MEMBER( read ); - protected: // device-level overrides virtual void device_validity_check(validity_checker &valid) const override; virtual void device_start() override; virtual void device_reset() override; + virtual machine_config_constructor device_mconfig_additions() const override; virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const override; private: @@ -80,7 +87,16 @@ private: const address_space_config m_program_space_config; const address_space_config m_data_space_config; required_shared_ptr<uint16_t> m_microprg_ram; - + required_shared_ptr<uint32_t> m_kram_page0; + required_shared_ptr<uint32_t> m_kram_page1; + required_device<SCSI_PORT_DEVICE> m_scsibus; + required_device<input_buffer_device> m_scsi_data_in; + required_device<output_latch_device> m_scsi_data_out; + required_device<input_buffer_device> m_scsi_ctrl_in; + + /* Callback for when the irq line may have changed (mandatory) */ + devcb_write_line m_irq_changed_cb; + uint32_t read_dword(offs_t address); void write_dword(offs_t address, uint32_t data); void write_microprg_data(offs_t address, uint16_t data); diff --git a/src/mame/drivers/pcfx.cpp b/src/mame/drivers/pcfx.cpp index fb092729304..f7788bff328 100644 --- a/src/mame/drivers/pcfx.cpp +++ b/src/mame/drivers/pcfx.cpp @@ -94,7 +94,7 @@ static ADDRESS_MAP_START( pcfx_mem, AS_PROGRAM, 32, pcfx_state ) AM_RANGE( 0xE0000000, 0xE7FFFFFF ) AM_NOP /* BackUp RAM */ AM_RANGE( 0xE8000000, 0xE9FFFFFF ) AM_NOP /* Extended BackUp RAM */ AM_RANGE( 0xF8000000, 0xF8000007 ) AM_NOP /* PIO */ - AM_RANGE( 0xFFF00000, 0xFFFFFFFF ) AM_ROMBANK("bank1") /* ROM */ + AM_RANGE( 0xFFF00000, 0xFFFFFFFF ) AM_ROM AM_REGION("ipl", 0) /* ROM */ ADDRESS_MAP_END READ16_MEMBER( pcfx_state::pad_r ) @@ -395,8 +395,6 @@ WRITE_LINE_MEMBER( pcfx_state::irq15_w ) void pcfx_state::machine_reset() { - membank( "bank1" )->set_base( memregion("user1")->base() ); - m_irq_mask = 0xFF; m_irq_pending = 0; } @@ -431,13 +429,14 @@ static MACHINE_CONFIG_START( pcfx, pcfx_state ) MCFG_HUC6261_VDC2("huc6270_b") MCFG_HUC6272_ADD( "huc6272", XTAL_21_4772MHz ) - + MCFG_HUC6272_IRQ_CHANGED_CB(WRITELINE(pcfx_state, irq13_w)) + MCFG_HUC6271_ADD( "huc6271", XTAL_21_4772MHz ) MACHINE_CONFIG_END ROM_START( pcfx ) - ROM_REGION( 0x100000, "user1", 0 ) + ROM_REGION( 0x100000, "ipl", 0 ) ROM_SYSTEM_BIOS( 0, "v100", "BIOS v1.00 - 2 Sep 1994" ) ROMX_LOAD( "pcfxbios.bin", 0x000000, 0x100000, CRC(76ffb97a) SHA1(1a77fd83e337f906aecab27a1604db064cf10074), ROM_BIOS(1) ) ROM_SYSTEM_BIOS( 1, "v101", "BIOS v1.01 - 5 Dec 1994" ) @@ -449,7 +448,7 @@ ROM_END ROM_START( pcfxga ) - ROM_REGION( 0x100000, "user1", 0 ) + ROM_REGION( 0x100000, "ipl", 0 ) ROM_LOAD( "pcfxga.rom", 0x000000, 0x100000, CRC(41c3776b) SHA1(a9372202a5db302064c994fcda9b24d29bb1b41c) ) ROM_REGION( 0x80000, "scsi_rom", ROMREGION_ERASEFF ) |