diff --git a/src/emu/machine/ataflash.c b/src/emu/machine/ataflash.c index 8335902ca48..e5d1d0f1b39 100644 --- a/src/emu/machine/ataflash.c +++ b/src/emu/machine/ataflash.c @@ -3,51 +3,33 @@ const device_type ATA_FLASH_PCCARD = &device_creator; ata_flash_pccard_device::ata_flash_pccard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, ATA_FLASH_PCCARD, "ATA Flash PCCARD", tag, owner, clock, "ataflash", __FILE__), - device_slot_card_interface(mconfig, *this), - m_card(*this,"card") + ide_hdd_device(mconfig, ATA_FLASH_PCCARD, "ATA Flash PCCARD", tag, owner, clock, "ataflash", __FILE__) { } -static MACHINE_CONFIG_FRAGMENT( ata_flash_pccard_device ) - MCFG_IDE_CONTROLLER_ADD( "card", ide_devices, "hdd", NULL, true) -MACHINE_CONFIG_END - -machine_config_constructor ata_flash_pccard_device::device_mconfig_additions() const +void ata_flash_pccard_device::device_reset() { - return MACHINE_CONFIG_NAME( ata_flash_pccard_device ); -} + ide_hdd_device::device_reset(); -void ata_flash_pccard_device::device_start() -{ UINT32 metalength; memset(m_cis, 0xff, 512); - astring drive_tag; - subtag(drive_tag, "card:0:hdd"); + if (m_handle != NULL) + m_handle->read_metadata(PCMCIA_CIS_METADATA_TAG, 0, m_cis, 512, metalength); - m_chd_file = get_disk_handle(machine(), drive_tag); - if(m_chd_file != NULL) - { - m_chd_file->read_metadata(PCMCIA_CIS_METADATA_TAG, 0, m_cis, 512, metalength); - } -} - -void ata_flash_pccard_device::device_reset_after_children() -{ m_locked = 0x1ff; - m_card->ide_set_gnet_readlock(0, 1); + m_gnetreadlock = 1; } READ16_MEMBER( ata_flash_pccard_device::read_memory ) { if(offset <= 7) { - return m_card->read_cs0(space, offset, mem_mask); + return read_cs0(space, offset, mem_mask); } else if(offset <= 15) { - return m_card->read_cs1(space, offset & 7, mem_mask); + return read_cs1(space, offset & 7, mem_mask); } else { @@ -59,11 +41,11 @@ WRITE16_MEMBER( ata_flash_pccard_device::write_memory ) { if(offset <= 7) { - m_card->write_cs0(space, offset, data, mem_mask); + write_cs0(space, offset, data, mem_mask); } else if( offset <= 15) { - m_card->write_cs1(space, offset & 7, data, mem_mask); + write_cs1(space, offset & 7, data, mem_mask); } } @@ -93,10 +75,10 @@ READ16_MEMBER( ata_flash_pccard_device::read_reg ) WRITE16_MEMBER( ata_flash_pccard_device::write_reg ) { - if(offset >= 0x280 && offset <= 0x288 && m_chd_file != NULL) + if(offset >= 0x280 && offset <= 0x288 && m_handle != NULL) { - dynamic_buffer key(m_chd_file->hunk_bytes()); - m_chd_file->read_metadata(HARD_DISK_KEY_METADATA_TAG, 0, key); + dynamic_buffer key(m_handle->hunk_bytes()); + m_handle->read_metadata(HARD_DISK_KEY_METADATA_TAG, 0, key); UINT8 v = data; int pos = offset - 0x280; @@ -113,7 +95,7 @@ WRITE16_MEMBER( ata_flash_pccard_device::write_reg ) if (!m_locked) { - m_card->ide_set_gnet_readlock(0, 0); + m_gnetreadlock = 0; } } } diff --git a/src/emu/machine/ataflash.h b/src/emu/machine/ataflash.h index b533b7527bb..842e0624de7 100644 --- a/src/emu/machine/ataflash.h +++ b/src/emu/machine/ataflash.h @@ -8,9 +8,8 @@ extern const device_type ATA_FLASH_PCCARD; -class ata_flash_pccard_device : public device_t, - public pccard_interface, - public device_slot_card_interface +class ata_flash_pccard_device : public ide_hdd_device, + public pccard_interface { public: ata_flash_pccard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); @@ -22,15 +21,11 @@ public: protected: // device-level overrides - virtual void device_start(); - virtual void device_reset_after_children(); - virtual machine_config_constructor device_mconfig_additions() const; + virtual void device_reset(); private: - chd_file *m_chd_file; unsigned char m_cis[512]; int m_locked; - required_device m_card; }; #endif diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c index dc33d3842af..11e4b858177 100644 --- a/src/emu/machine/idectrl.c +++ b/src/emu/machine/idectrl.c @@ -85,11 +85,6 @@ UINT8 *ide_controller_device::ide_get_features(int _drive) return m_slot[_drive]->dev()->get_features(); } -void ide_controller_device::ide_set_gnet_readlock(int _drive, const UINT8 onoff) -{ - m_slot[_drive]->dev()->m_gnetreadlock = onoff; -} - void ide_controller_device::ide_set_master_password(int _drive, const UINT8 *password) { m_slot[_drive]->dev()->m_master_password = password; diff --git a/src/emu/machine/idectrl.h b/src/emu/machine/idectrl.h index d145e41f76f..282cac4a1fb 100644 --- a/src/emu/machine/idectrl.h +++ b/src/emu/machine/idectrl.h @@ -88,7 +88,6 @@ public: template static devcb2_base &set_dmarq_handler(device_t &device, _Object object) { return downcast(device).m_dmarq_handler.set_callback(object); } UINT8 *ide_get_features(int drive); - void ide_set_gnet_readlock(int drive, const UINT8 onoff); void ide_set_master_password(int drive, const UINT8 *password); void ide_set_user_password(int drive, const UINT8 *password); diff --git a/src/emu/machine/idehd.c b/src/emu/machine/idehd.c index 8ab6bc71e31..1d5e107aaca 100644 --- a/src/emu/machine/idehd.c +++ b/src/emu/machine/idehd.c @@ -77,12 +77,13 @@ enum // ide_device_interface - constructor //------------------------------------------------- -ide_device_interface::ide_device_interface(const machine_config &mconfig, device_t &device) - : device_slot_card_interface(mconfig, device), +ide_device_interface::ide_device_interface(const machine_config &mconfig, device_t &device) : m_master_password(NULL), m_user_password(NULL), - m_irq_handler(*this), - m_dmarq_handler(*this) + m_csel(0), + m_dasp(0), + m_irq_handler(device), + m_dmarq_handler(device) { } @@ -104,7 +105,8 @@ void ide_device_interface::set_dmarq(int state) ide_mass_storage_device::ide_mass_storage_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock,const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - ide_device_interface(mconfig, *this) + ide_device_interface(mconfig, *this), + device_slot_card_interface(mconfig, *this) { } @@ -1318,8 +1320,8 @@ ide_hdd_device::ide_hdd_device(const machine_config &mconfig, const char *tag, d { } -ide_hdd_device::ide_hdd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : - ide_mass_storage_device(mconfig, type, name, tag, owner, clock, shortname, source) +ide_hdd_device::ide_hdd_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : ide_mass_storage_device(mconfig, type, name, tag, owner, clock, shortname, source) { } diff --git a/src/emu/machine/idehd.h b/src/emu/machine/idehd.h index 2697d480866..518b6261eb3 100644 --- a/src/emu/machine/idehd.h +++ b/src/emu/machine/idehd.h @@ -19,7 +19,7 @@ // ======================> ide_device_interface -class ide_device_interface : public device_slot_card_interface +class ide_device_interface { public: ide_device_interface(const machine_config &mconfig, device_t &device); @@ -63,7 +63,8 @@ protected: }; class ide_mass_storage_device : public device_t, - public ide_device_interface + public ide_device_interface, + public device_slot_card_interface { public: ide_mass_storage_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock,const char *shortname = "", const char *source = __FILE__); diff --git a/src/mame/drivers/taitogn.c b/src/mame/drivers/taitogn.c index bdd02e2c396..685584f068c 100644 --- a/src/mame/drivers/taitogn.c +++ b/src/mame/drivers/taitogn.c @@ -795,7 +795,7 @@ ROM_END ROM_START(raycris) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "raycris", 0, SHA1(015cb0e6c4421cc38809de28c4793b4491386aee)) ROM_END @@ -803,28 +803,28 @@ ROM_END ROM_START(gobyrc) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "gobyrc", 0, SHA1(0bee1f495fc8b033fd56aad9260ae94abb35eb58)) ROM_END ROM_START(rcdego) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "rcdego", 0, SHA1(9e177f2a3954cfea0c8c5a288e116324d10f5dd1)) ROM_END ROM_START(chaoshea) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "chaosheat", 0, SHA1(c13b7d7025eee05f1f696d108801c7bafb3f1356)) ROM_END ROM_START(chaosheaj) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "chaosheatj", 0, SHA1(2f211ac08675ea8ec33c7659a13951db94eaa627)) ROM_END @@ -832,7 +832,7 @@ ROM_END ROM_START(flipmaze) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "flipmaze", 0, SHA1(423b6c06f4f2d9a608ce20b61a3ac11687d22c40) ) ROM_END @@ -840,42 +840,42 @@ ROM_END ROM_START(spuzbobl) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "spuzbobl", 0, SHA1(1b1c72fb7e5656021485fefaef8f2ba48e2b4ea8)) ROM_END ROM_START(spuzboblj) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "spuzbobj", 0, SHA1(dac433cf88543d2499bf797d7406b82ae4338726)) ROM_END ROM_START(soutenry) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "soutenry", 0, SHA1(9204d0be833d29f37b8cd3fbdf09da69b622254b)) ROM_END ROM_START(shanghss) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "shanghss", 0, SHA1(7964f71ec5c81d2120d83b63a82f97fbad5a8e6d)) ROM_END ROM_START(sianniv) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "sianniv", 0, SHA1(1e08b813190a9e1baf29bc16884172d6c8da7ae3)) ROM_END ROM_START(kollon) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "kollon", 0, SHA1(d8ea5b5b0ee99004b16ef89883e23de6c7ddd7ce)) ROM_END @@ -883,14 +883,14 @@ ROM_START(kollonc) TAITOGNET_BIOS ROM_DEFAULT_BIOS( "v2" ) - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "kollonc", 0, SHA1(ce62181659701cfb8f7c564870ab902be4d8e060)) /* Original Taito Compact Flash version */ ROM_END ROM_START(shikigam) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "shikigam", 0, SHA1(fa49a0bc47f5cb7c30d7e49e2c3696b21bafb840)) ROM_END @@ -900,7 +900,7 @@ ROM_END ROM_START(otenamih) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "otenamih", 0, SHA1(b3babe3a1876c43745616ee1e7d87276ce7dad0b) ) ROM_END @@ -908,28 +908,28 @@ ROM_END ROM_START(psyvaria) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "psyvaria", 0, SHA1(b981a42a10069322b77f7a268beae1d409b4156d)) ROM_END ROM_START(psyvarrv) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "psyvarrv", 0, SHA1(277c4f52502bcd7acc1889840962ec80d56465f3)) ROM_END ROM_START(zooo) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "zooo", 0, SHA1(e275b3141b2bc49142990e6b497a5394a314a30b)) ROM_END ROM_START(zokuoten) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "zokuoten", 0, SHA1(5ce13db00518f96af64935176c71ec68d2a51938)) ROM_END @@ -937,7 +937,7 @@ ROM_START(otenamhf) TAITOGNET_BIOS ROM_DEFAULT_BIOS( "v2" ) - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "otenamhf", 0, SHA1(5b15c33bf401e5546d78e905f538513d6ffcf562)) /* Original Taito Compact Flash version */ ROM_END @@ -949,14 +949,14 @@ ROM_END ROM_START(nightrai) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "nightrai", 0, SHA1(74d0458f851cbcf10453c5cc4c47bb4388244cdf)) ROM_END ROM_START(otenki) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "otenki", 0, SHA1(7e745ca4c4570215f452fd09cdd56a42c39caeba)) ROM_END @@ -965,21 +965,21 @@ ROM_END ROM_START(usagi) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "usagi", 0, SHA1(edf9dd271957f6cb06feed238ae21100514bef8e)) ROM_END ROM_START(mahjngoh) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "mahjngoh", 0, SHA1(3ef1110d15582d7c0187438d7ad61765dd121cff)) ROM_END ROM_START(shangtou) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "shanghaito", 0, SHA1(9901db5a9aae77e3af4157aa2c601eaab5b7ca85) ) ROM_END @@ -989,7 +989,7 @@ ROM_END ROM_START(xiistag) TAITOGNET_BIOS - DISK_REGION( "pccard:ataflash:card:0:hdd" ) + DISK_REGION( "pccard:ataflash" ) DISK_IMAGE( "xiistag", 0, SHA1(586e37c8d926293b2bd928e5f0d693910cfb05a2)) ROM_END