mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
(MESS) apollo: made SC499 cartridge tape device a but more
consistent with our other image devices. loading from softlist does not work yet (probably a stupid mistake on my side). nw. (MESS) softlist: added apollo_ctape softlist [Riley110]
This commit is contained in:
parent
83e0defeee
commit
8da4de0b61
50
hash/apollo_ctape.xml
Normal file
50
hash/apollo_ctape.xml
Normal file
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
|
||||
|
||||
<!-- Domain/OS Known Undumped Versions (from http://www.hpmuseum.net/exhibit.php?swc=24)
|
||||
|
||||
Domain/OS SR10.3 (1990) Product Number 018847 + 018848
|
||||
Domain/OS Quarterly PSK Q3-91 SR10.3 (1991) Product Number 19437 + 19439
|
||||
|
||||
-->
|
||||
|
||||
<softwarelist name="apollo_ctape" description="Apollo cartridge tapes">
|
||||
|
||||
<software name="domainos">
|
||||
<description>Domain/OS SR10.4</description>
|
||||
<year>1992</year>
|
||||
<publisher>Apollo</publisher>
|
||||
|
||||
<part name="cass1" interface="sc499_cass">
|
||||
<feature name="part_id" value="Tape 1 (CRTG_STD_SFW_BOOT_1)"/>
|
||||
<dataarea name="ctape" size="53678592">
|
||||
<rom name="019593-001.crtg_std_sfw_boot_1.ct" size="53678592" crc="cf1b4813" sha1="4b7e64153b3046da25cef0e2115553611d57929e" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
<part name="cass2" interface="sc499_cass">
|
||||
<feature name="part_id" value="Tape 2 (CRTG_STD_SFW_1)"/>
|
||||
<dataarea name="ctape" size="58403328">
|
||||
<rom name="019594-001.crtg_std_sfw_1.ct" size="58403328" crc="3335f0c9" sha1="94ce5ea3f9d075df7952793254ef067b92df79a6" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
<part name="cass3" interface="sc499_cass">
|
||||
<feature name="part_id" value="Tape 3 (CRTG_STD_SFW_2)"/>
|
||||
<dataarea name="ctape" size="61564928">
|
||||
<rom name="019594-002.crtg_std_sfw_2.ct" size="61564928" crc="39d0647a" sha1="6cde13fae598574b4f5ad0fc4dbb33ea1902ff6e" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
<part name="cass4" interface="sc499_cass">
|
||||
<feature name="part_id" value="Tape 4 (CRTG_STD_SFW_3)"/>
|
||||
<dataarea name="ctape" size="56568320">
|
||||
<rom name="019594-003.crtg_std_sfw_3.ct" size="56568320" crc="e9e76b3f" sha1="24fe96a22c975e9c7fcbbf0daad89277a467fae3" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
<part name="cass5" interface="sc499_cass">
|
||||
<feature name="part_id" value="Tape 5 (CRTG_STD_SFW_4)"/>
|
||||
<dataarea name="ctape" size="57844224">
|
||||
<rom name="019594-004.crtg_std_sfw_4.ct" size="57844224" crc="88d4a0eb" sha1="a3b4eb922182302e350f475b8e5c39a79503c4e3" offset="0" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
</softwarelist>
|
@ -318,7 +318,8 @@ sc499_device::sc499_device(const machine_config &mconfig, const char *tag, devic
|
||||
: device_t(mconfig, SC499, "Archive SC-499", tag, owner, clock, "sc499", __FILE__),
|
||||
device_isa8_card_interface(mconfig, *this),
|
||||
m_iobase(*this, "IO_BASE"),
|
||||
m_irqdrq(*this, "IRQ_DRQ")
|
||||
m_irqdrq(*this, "IRQ_DRQ"),
|
||||
m_image(*this, SC499_CTAPE_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
@ -342,16 +343,13 @@ void sc499_device::device_start()
|
||||
|
||||
m_installed = false;
|
||||
|
||||
device_t *ctape_device = subdevice(SC499_CTAPE_TAG);
|
||||
m_image = dynamic_cast<device_image_interface *> (ctape_device);
|
||||
|
||||
if (m_image->image_core_file() == NULL)
|
||||
{
|
||||
LOG2(("start sc499: no cartridge tape"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG2(("start sc499: cartridge tape image is %s",m_image->filename()));
|
||||
LOG2(("start sc499: cartridge tape image is %s", m_image->filename()));
|
||||
}
|
||||
|
||||
m_ctape_block_buffer.resize(SC499_CTAPE_BLOCK_SIZE);
|
||||
@ -465,11 +463,11 @@ void sc499_device::check_tape()
|
||||
tape_status_set(SC499_ST0_WP);
|
||||
}
|
||||
|
||||
if (m_image_length != m_image->length())
|
||||
if (m_image_length != m_image->tapelen())
|
||||
{
|
||||
// tape has changed, get new size
|
||||
m_image_length = m_image->length();
|
||||
m_ctape_block_count = (UINT32)((m_image_length+SC499_CTAPE_BLOCK_SIZE-1) / SC499_CTAPE_BLOCK_SIZE);
|
||||
m_image_length = m_image->tapelen();
|
||||
m_ctape_block_count = (UINT32)((m_image_length + SC499_CTAPE_BLOCK_SIZE - 1) / SC499_CTAPE_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
LOG1(("check_tape: tape image is %s with %d blocks", m_image->filename(), m_ctape_block_count));
|
||||
@ -1167,16 +1165,19 @@ void sc499_device::log_block(const char *text)
|
||||
|
||||
void sc499_device::read_block()
|
||||
{
|
||||
UINT8 *tape;
|
||||
|
||||
if (m_tape_pos == 0)
|
||||
{
|
||||
// check if tape has been replaced or removed
|
||||
check_tape();
|
||||
}
|
||||
|
||||
m_image->fseek((UINT64) m_tape_pos * SC499_CTAPE_BLOCK_SIZE, SEEK_SET);
|
||||
tape = m_image->read_block(m_tape_pos);
|
||||
|
||||
if (m_image->image_feof())
|
||||
if (tape == NULL)
|
||||
{
|
||||
// either there is no tape or m_tape_pos goes beyond end-of-tape
|
||||
m_status &= ~SC499_STAT_EXC;
|
||||
m_status &= ~SC499_STAT_DIR;
|
||||
m_status &= ~SC499_STAT_DON;
|
||||
@ -1185,7 +1186,7 @@ void sc499_device::read_block()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_image->fread(m_ctape_block_buffer, SC499_CTAPE_BLOCK_SIZE);
|
||||
memcpy(m_ctape_block_buffer, tape, SC499_CTAPE_BLOCK_SIZE);
|
||||
|
||||
// if (verbose > 1 || m_tape_pos % 100 == 0)
|
||||
{
|
||||
@ -1236,8 +1237,7 @@ void sc499_device::write_block()
|
||||
check_tape();
|
||||
}
|
||||
|
||||
m_image->fseek((UINT64) m_tape_pos * SC499_CTAPE_BLOCK_SIZE, SEEK_SET);
|
||||
m_image->fwrite(m_ctape_block_buffer, SC499_CTAPE_BLOCK_SIZE);
|
||||
m_image->write_block(m_tape_pos, m_ctape_block_buffer);
|
||||
m_ctape_block_count = m_tape_pos;
|
||||
m_ctape_block_index = 0;
|
||||
m_tape_pos++;
|
||||
@ -1268,38 +1268,13 @@ int sc499_device::block_is_filemark()
|
||||
void sc499_device::block_set_filemark()
|
||||
{
|
||||
static const UINT8 fm_pattern[] = {0xDE, 0xAF, 0xFA, 0xED};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SC499_CTAPE_BLOCK_SIZE; i += 4)
|
||||
for (int i = 0; i < SC499_CTAPE_BLOCK_SIZE; i += 4)
|
||||
{
|
||||
memcpy(m_ctape_block_buffer + i, fm_pattern, 4);
|
||||
}
|
||||
}
|
||||
|
||||
//##########################################################################
|
||||
class sc499_ctape_image_device : public device_t,
|
||||
public device_image_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
sc499_ctape_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_MAGTAPE; }
|
||||
|
||||
virtual bool is_readable() const { return 1; }
|
||||
virtual bool is_writeable() const { return 1; }
|
||||
virtual bool is_creatable() const { return 1; }
|
||||
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 "act"; }
|
||||
virtual const option_guide *create_option_guide() const { return NULL; }
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start() { };
|
||||
};
|
||||
|
||||
const device_type SC499_CTAPE = &device_creator<sc499_ctape_image_device>;
|
||||
|
||||
@ -1313,3 +1288,46 @@ void sc499_ctape_image_device::device_config_complete()
|
||||
{
|
||||
update_names(SC499_CTAPE, "ctape", "ct");
|
||||
};
|
||||
|
||||
|
||||
UINT8 *sc499_ctape_image_device::read_block(int block_num)
|
||||
{
|
||||
// access beyond end of tape cart
|
||||
if (m_ctape_data.bytes() <= (block_num + 1) * SC499_CTAPE_BLOCK_SIZE)
|
||||
return NULL;
|
||||
else
|
||||
return m_ctape_data + (block_num * SC499_CTAPE_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
void sc499_ctape_image_device::write_block(int block_num, UINT8 *ptr)
|
||||
{
|
||||
if (!(m_ctape_data.bytes() <= (block_num + 1) * SC499_CTAPE_BLOCK_SIZE))
|
||||
memcpy(m_ctape_data + (block_num * SC499_CTAPE_BLOCK_SIZE), ptr, SC499_CTAPE_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
bool sc499_ctape_image_device::call_load()
|
||||
{
|
||||
if (software_entry() == NULL)
|
||||
{
|
||||
m_ctape_data.resize(length());
|
||||
fread(m_ctape_data, length());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ctape_data.resize(get_software_region_length("ctape"));
|
||||
memcpy(m_ctape_data, get_software_region("ctape"), get_software_region_length("ctape"));
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
void sc499_ctape_image_device::call_unload()
|
||||
{
|
||||
m_ctape_data.resize(0);
|
||||
// TODO: add save tape on exit?
|
||||
//if (software_entry() == NULL)
|
||||
//{
|
||||
// fseek(0, SEEK_SET);
|
||||
// fwrite(m_ctape_data, m_ctape_data.size);
|
||||
//}
|
||||
}
|
||||
|
@ -21,6 +21,42 @@
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> sc499_ctape_image_device
|
||||
|
||||
class sc499_ctape_image_device : public device_t, public device_image_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
sc499_ctape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// image-level overrides
|
||||
virtual bool call_load();
|
||||
// virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); }
|
||||
virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { printf("%s\n", swname); return load_software(swlist, swname, start_entry); }
|
||||
virtual void call_unload();
|
||||
virtual iodevice_t image_type() const { return IO_MAGTAPE; }
|
||||
|
||||
virtual bool is_readable() const { return 1; }
|
||||
virtual bool is_writeable() const { return 1; }
|
||||
virtual bool is_creatable() const { return 1; }
|
||||
virtual bool must_be_loaded() const { return 0; }
|
||||
virtual bool is_reset_on_load() const { return 0; }
|
||||
virtual const char *image_interface() const { return "sc499_cass"; }
|
||||
virtual const char *file_extensions() const { return "act,ct"; }
|
||||
virtual const option_guide *create_option_guide() const { return NULL; }
|
||||
|
||||
UINT8 *read_block(int block_num);
|
||||
void write_block(int block_num, UINT8 *ptr);
|
||||
UINT64 tapelen() { return m_ctape_data.bytes(); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start() { };
|
||||
|
||||
dynamic_buffer m_ctape_data;
|
||||
};
|
||||
|
||||
// ======================> sc499_device
|
||||
|
||||
class sc499_device: public device_t, public device_isa8_card_interface
|
||||
@ -105,8 +141,7 @@ private:
|
||||
UINT64 m_image_length;
|
||||
|
||||
dynamic_buffer m_ctape_block_buffer;
|
||||
|
||||
device_image_interface *m_image;
|
||||
required_device<sc499_ctape_image_device> m_image;
|
||||
|
||||
enum line_state irq_state;
|
||||
enum line_state dma_drq_state;
|
||||
@ -119,6 +154,7 @@ private:
|
||||
bool m_installed;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
extern const device_type ISA8_SC499;
|
||||
|
||||
|
@ -949,6 +949,8 @@ MACHINE_CONFIG_FRAGMENT( common )
|
||||
MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa5", apollo_isa_cards, NULL, false)
|
||||
MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa6", apollo_isa_cards, NULL, false)
|
||||
MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa7", apollo_isa_cards, NULL, false)
|
||||
|
||||
MCFG_SOFTWARE_LIST_ADD("ctape_list", "apollo_ctape")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
// for machines with the keyboard and a graphics head
|
||||
|
Loading…
Reference in New Issue
Block a user