mirror of
https://github.com/holub/mame
synced 2025-05-28 16:43:04 +03:00
(MESS) Mac: added "image" card which allows direct read/write access to any vMac/BasiliskII compatible image under 256 MB, including HD floppies. Not bootable, and do NOT try to swap the disk. [Rob Braun, R. Belmont]
This commit is contained in:
parent
a0dbae3208
commit
51c1cbd056
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -7131,6 +7131,8 @@ src/mess/machine/nubus.c svneol=native#text/plain
|
||||
src/mess/machine/nubus.h svneol=native#text/plain
|
||||
src/mess/machine/nubus_asntmc3b.c svneol=native#text/plain
|
||||
src/mess/machine/nubus_asntmc3b.h svneol=native#text/plain
|
||||
src/mess/machine/nubus_image.c svneol=native#text/plain
|
||||
src/mess/machine/nubus_image.h svneol=native#text/plain
|
||||
src/mess/machine/null_modem.c svneol=native#text/plain
|
||||
src/mess/machine/null_modem.h svneol=native#text/plain
|
||||
src/mess/machine/odyssey2.c svneol=native#text/plain
|
||||
|
@ -68,6 +68,7 @@
|
||||
#include "video/nubus_radiustpd.h"
|
||||
#include "video/nubus_wsportrait.h"
|
||||
#include "machine/nubus_asntmc3b.h"
|
||||
#include "machine/nubus_image.h"
|
||||
#include "video/nubus_m2video.h"
|
||||
#include "video/pds30_cb264.h"
|
||||
#include "video/pds30_procolor816.h"
|
||||
@ -853,6 +854,7 @@ static SLOT_INTERFACE_START(mac_nubus_cards)
|
||||
SLOT_INTERFACE("824gc", NUBUS_824GC) /* Apple 8*24 Graphics Card */
|
||||
SLOT_INTERFACE("cb264", NUBUS_CB264) /* RasterOps ColorBoard 264 */
|
||||
SLOT_INTERFACE("vikbw", NUBUS_VIKBW) /* Moniterm Viking board */
|
||||
SLOT_INTERFACE("image", NUBUS_IMAGE) /* Disk Image Pseudo-Card */
|
||||
SLOT_INTERFACE("specpdq", NUBUS_SPECPDQ) /* SuperMac Spectrum PDQ */
|
||||
SLOT_INTERFACE("m2hires", NUBUS_M2HIRES) /* Apple Macintosh II Hi-Resolution Card */
|
||||
SLOT_INTERFACE("spec8s3", NUBUS_SPEC8S3) /* SuperMac Spectrum/8 Series III */
|
||||
@ -871,6 +873,9 @@ static SLOT_INTERFACE_START(mac_pds030_cards)
|
||||
SLOT_INTERFACE("mc30", PDS030_XCEEDMC30) // Micron/XCEED Technology MacroColor 30
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
static SLOT_INTERFACE_START(mac_lcpds_cards)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
/***************************************************************************
|
||||
MACHINE DRIVERS
|
||||
***************************************************************************/
|
||||
@ -1149,6 +1154,9 @@ static MACHINE_CONFIG_DERIVED( maclc, macii )
|
||||
MCFG_NUBUS_SLOT_REMOVE("nbe")
|
||||
MCFG_NUBUS_BUS_REMOVE("nubus")
|
||||
|
||||
MCFG_NUBUS_BUS_ADD("pds", "maincpu", nubus_intf)
|
||||
MCFG_NUBUS_SLOT_ADD("pds","lcpds", mac_lcpds_cards, NULL, NULL)
|
||||
|
||||
MCFG_ASC_REPLACE("asc", C15M, ASC_TYPE_V8, mac_asc_irq)
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
||||
|
254
src/mess/machine/nubus_image.c
Normal file
254
src/mess/machine/nubus_image.c
Normal file
@ -0,0 +1,254 @@
|
||||
/***************************************************************************
|
||||
|
||||
nubus_image.c - synthetic NuBus card to allow reading/writing "raw"
|
||||
HFS images, including floppy images (DD and HD) and vMac/Basilisk HDD
|
||||
volumes up to 256 MB in size.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/nubus_image.h"
|
||||
|
||||
#define IMAGE_ROM_REGION "image_rom"
|
||||
#define IMAGE_DISK0_TAG "nb_disk"
|
||||
|
||||
#define MESSIMG_DISK_SECTOR_SIZE (512)
|
||||
|
||||
// messimg_disk_image_device
|
||||
|
||||
class messimg_disk_image_device : public device_t,
|
||||
public device_image_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
messimg_disk_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// image-level overrides
|
||||
virtual iodevice_t image_type() const { return IO_QUICKLOAD; }
|
||||
|
||||
virtual bool is_readable() const { return 1; }
|
||||
virtual bool is_writeable() const { return 1; }
|
||||
virtual bool is_creatable() const { return 0; }
|
||||
virtual bool must_be_loaded() const { return 0; }
|
||||
virtual bool is_reset_on_load() const { return 0; }
|
||||
virtual const char *image_interface() const { return NULL; }
|
||||
virtual const char *file_extensions() const { return "img"; }
|
||||
virtual const option_guide *create_option_guide() const { return NULL; }
|
||||
|
||||
virtual bool call_load();
|
||||
virtual void call_unload();
|
||||
|
||||
disk_data *token() { return &m_token; }
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
disk_data m_token;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type MESSIMG_DISK;
|
||||
|
||||
const device_type MESSIMG_DISK = &device_creator<messimg_disk_image_device>;
|
||||
|
||||
messimg_disk_image_device::messimg_disk_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, MESSIMG_DISK, "Mac image", tag, owner, clock),
|
||||
device_image_interface(mconfig, *this)
|
||||
{
|
||||
}
|
||||
|
||||
void messimg_disk_image_device::device_config_complete()
|
||||
{
|
||||
update_names(MESSIMG_DISK, "disk", "disk");
|
||||
};
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
get_safe_disk_token - makes sure that the passed in device is a messimg disk
|
||||
***************************************************************************/
|
||||
|
||||
INLINE disk_data *get_safe_disk_token(device_t *device) {
|
||||
assert(device != NULL);
|
||||
assert(device->type() == MESSIMG_DISK);
|
||||
return (disk_data *) downcast<messimg_disk_image_device *>(device)->token();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
device start callback
|
||||
-------------------------------------------------*/
|
||||
|
||||
void messimg_disk_image_device::device_start()
|
||||
{
|
||||
disk_data *disk = get_safe_disk_token(this);
|
||||
|
||||
disk->device = this;
|
||||
disk->image = this;
|
||||
disk->data = (UINT8 *)NULL;
|
||||
|
||||
if (exists() && fseek(0, SEEK_END) == 0)
|
||||
{
|
||||
disk->size = (UINT32)ftell();
|
||||
}
|
||||
}
|
||||
|
||||
bool messimg_disk_image_device::call_load()
|
||||
{
|
||||
disk_data *disk = get_safe_disk_token(this);
|
||||
|
||||
// we're not ejectable for the time being
|
||||
if (disk->data)
|
||||
{
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
if (disk->size > (256*1024*1024))
|
||||
{
|
||||
printf("Mac image too large: must be 256MB or less!\n");
|
||||
disk->size = 0;
|
||||
return IMAGE_INIT_FAIL;
|
||||
}
|
||||
|
||||
disk->data = (UINT8 *)auto_alloc_array_clear(machine(), UINT32, disk->size/sizeof(UINT32));
|
||||
fseek(0, SEEK_SET);
|
||||
fread(disk->data, disk->size);
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
void messimg_disk_image_device::call_unload()
|
||||
{
|
||||
disk_data *disk = get_safe_disk_token(this);
|
||||
|
||||
// TODO: track dirty sectors and only write those
|
||||
fseek(0, SEEK_SET);
|
||||
fwrite(disk->data, disk->size);
|
||||
// disk->size = 0;
|
||||
// free(disk->data);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
device reset callback
|
||||
-------------------------------------------------*/
|
||||
|
||||
void messimg_disk_image_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
MACHINE_CONFIG_FRAGMENT( image )
|
||||
MCFG_DEVICE_ADD(IMAGE_DISK0_TAG, MESSIMG_DISK, 0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
ROM_START( image )
|
||||
ROM_REGION(0x2000, IMAGE_ROM_REGION, 0)
|
||||
ROM_LOAD( "nb_fake.bin", 0x000000, 0x002000, CRC(b6c46215) SHA1(5dc805658c1731d189e2cb289c611539680b87f4) )
|
||||
ROM_END
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
const device_type NUBUS_IMAGE = &device_creator<nubus_image_device>;
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// machine_config_additions - device-specific
|
||||
// machine configurations
|
||||
//-------------------------------------------------
|
||||
|
||||
machine_config_constructor nubus_image_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( image );
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// rom_region - device-specific ROM region
|
||||
//-------------------------------------------------
|
||||
|
||||
const rom_entry *nubus_image_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME( image );
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// nubus_image_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
nubus_image_device::nubus_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, NUBUS_IMAGE, "Disk Image Pseudo-Card", tag, owner, clock),
|
||||
device_nubus_card_interface(mconfig, *this)
|
||||
{
|
||||
m_shortname = "nb_image";
|
||||
}
|
||||
|
||||
nubus_image_device::nubus_image_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, type, name, tag, owner, clock),
|
||||
device_nubus_card_interface(mconfig, *this)
|
||||
{
|
||||
m_shortname = "nb_image";
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void nubus_image_device::device_start()
|
||||
{
|
||||
UINT32 slotspace;
|
||||
UINT32 superslotspace;
|
||||
|
||||
// set_nubus_device makes m_slot valid
|
||||
set_nubus_device();
|
||||
install_declaration_rom(this, IMAGE_ROM_REGION);
|
||||
|
||||
slotspace = get_slotspace();
|
||||
superslotspace = get_super_slotspace();
|
||||
|
||||
// printf("[image %p] slotspace = %x, super = %x\n", this, slotspace, superslotspace);
|
||||
|
||||
m_nubus->install_device(slotspace, slotspace+3, read32_delegate(FUNC(nubus_image_device::image_r), this), write32_delegate(FUNC(nubus_image_device::image_w), this));
|
||||
m_nubus->install_device(superslotspace, superslotspace+((256*1024*1024)-1), read32_delegate(FUNC(nubus_image_device::image_super_r), this), write32_delegate(FUNC(nubus_image_device::image_super_w), this));
|
||||
|
||||
device_t *device0 = subdevice(IMAGE_DISK0_TAG);
|
||||
m_image = (disk_data *) downcast<messimg_disk_image_device *>(device0)->token();
|
||||
image_mapping = (UINT32 *)NULL;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void nubus_image_device::device_reset()
|
||||
{
|
||||
image_length = m_image->size;
|
||||
image_mapping = (UINT32 *)m_image->data;
|
||||
}
|
||||
|
||||
WRITE32_MEMBER( nubus_image_device::image_w )
|
||||
{
|
||||
}
|
||||
|
||||
READ32_MEMBER( nubus_image_device::image_r )
|
||||
{
|
||||
return image_length;
|
||||
}
|
||||
|
||||
WRITE32_MEMBER( nubus_image_device::image_super_w )
|
||||
{
|
||||
data = ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24);
|
||||
mem_mask = ((mem_mask & 0xff) << 24) | ((mem_mask & 0xff00) << 8) | ((mem_mask & 0xff0000) >> 8) | ((mem_mask & 0xff000000) >> 24);
|
||||
|
||||
COMBINE_DATA(&image_mapping[offset]);
|
||||
}
|
||||
|
||||
READ32_MEMBER( nubus_image_device::image_super_r )
|
||||
{
|
||||
UINT32 data = image_mapping[offset];
|
||||
return ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24);
|
||||
}
|
||||
|
58
src/mess/machine/nubus_image.h
Normal file
58
src/mess/machine/nubus_image.h
Normal file
@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __NUBUS_IMAGE_H__
|
||||
#define __NUBUS_IMAGE_H__
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/nubus.h"
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
struct disk_data
|
||||
{
|
||||
device_t *device;
|
||||
UINT32 size;
|
||||
UINT8 *data;
|
||||
|
||||
device_image_interface *image;
|
||||
};
|
||||
|
||||
// ======================> nubus_image_device
|
||||
|
||||
class nubus_image_device :
|
||||
public device_t,
|
||||
public device_nubus_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
nubus_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
nubus_image_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// optional information overrides
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
virtual const rom_entry *device_rom_region() const;
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
DECLARE_READ32_MEMBER(image_r);
|
||||
DECLARE_WRITE32_MEMBER(image_w);
|
||||
DECLARE_READ32_MEMBER(image_super_r);
|
||||
DECLARE_WRITE32_MEMBER(image_super_w);
|
||||
|
||||
public:
|
||||
UINT32 image_length;
|
||||
UINT32 *image_mapping;
|
||||
disk_data *m_image;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
extern const device_type NUBUS_IMAGE;
|
||||
|
||||
#endif /* __NUBUS_IMAGE_H__ */
|
||||
|
@ -715,6 +715,7 @@ $(MESSOBJ)/apple.a: \
|
||||
$(MESS_VIDEO)/nubus_radiustpd.o \
|
||||
$(MESS_VIDEO)/nubus_m2video.o \
|
||||
$(MESS_MACHINE)/nubus_asntmc3b.o \
|
||||
$(MESS_MACHINE)/nubus_image.o \
|
||||
$(MESS_VIDEO)/nubus_wsportrait.o \
|
||||
$(MESS_VIDEO)/pds30_cb264.o \
|
||||
$(MESS_VIDEO)/pds30_procolor816.o \
|
||||
|
Loading…
Reference in New Issue
Block a user