Previous 199869 Revisions Next

r33599 Sunday 30th November, 2014 at 17:30:01 UTC by Fabio Priuli
(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]
[hash]apollo_ctape.xml*
[src/emu/bus/isa]sc499.c sc499.h
[src/mess/machine]apollo.c

trunk/hash/apollo_ctape.xml
r0r242111
1<?xml version="1.0"?>
2<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
3
4<!-- Domain/OS Known Undumped Versions (from http://www.hpmuseum.net/exhibit.php?swc=24)
5
6       Domain/OS SR10.3 (1990) Product Number 018847 + 018848
7       Domain/OS Quarterly PSK Q3-91 SR10.3 (1991) Product Number 19437 + 19439
8
9-->
10
11<softwarelist name="apollo_ctape" description="Apollo cartridge tapes">
12
13   <software name="domainos">
14      <description>Domain/OS SR10.4</description>
15      <year>1992</year>
16      <publisher>Apollo</publisher>
17
18      <part name="cass1" interface="sc499_cass">
19         <feature name="part_id" value="Tape 1 (CRTG_STD_SFW_BOOT_1)"/>
20         <dataarea name="ctape" size="53678592">
21            <rom name="019593-001.crtg_std_sfw_boot_1.ct" size="53678592" crc="cf1b4813" sha1="4b7e64153b3046da25cef0e2115553611d57929e" offset="0" />
22         </dataarea>
23      </part>
24      <part name="cass2" interface="sc499_cass">
25         <feature name="part_id" value="Tape 2 (CRTG_STD_SFW_1)"/>
26         <dataarea name="ctape" size="58403328">
27            <rom name="019594-001.crtg_std_sfw_1.ct" size="58403328" crc="3335f0c9" sha1="94ce5ea3f9d075df7952793254ef067b92df79a6" offset="0" />
28         </dataarea>
29      </part>
30      <part name="cass3" interface="sc499_cass">
31         <feature name="part_id" value="Tape 3 (CRTG_STD_SFW_2)"/>
32         <dataarea name="ctape" size="61564928">
33            <rom name="019594-002.crtg_std_sfw_2.ct" size="61564928" crc="39d0647a" sha1="6cde13fae598574b4f5ad0fc4dbb33ea1902ff6e" offset="0" />
34         </dataarea>
35      </part>
36      <part name="cass4" interface="sc499_cass">
37         <feature name="part_id" value="Tape 4 (CRTG_STD_SFW_3)"/>
38         <dataarea name="ctape" size="56568320">
39            <rom name="019594-003.crtg_std_sfw_3.ct" size="56568320" crc="e9e76b3f" sha1="24fe96a22c975e9c7fcbbf0daad89277a467fae3" offset="0" />
40         </dataarea>
41      </part>
42      <part name="cass5" interface="sc499_cass">
43         <feature name="part_id" value="Tape 5 (CRTG_STD_SFW_4)"/>
44         <dataarea name="ctape" size="57844224">
45            <rom name="019594-004.crtg_std_sfw_4.ct" size="57844224" crc="88d4a0eb" sha1="a3b4eb922182302e350f475b8e5c39a79503c4e3" offset="0" />
46         </dataarea>
47      </part>
48   </software>
49
50</softwarelist>
trunk/src/emu/bus/isa/sc499.c
r242110r242111
318318   : device_t(mconfig, SC499, "Archive SC-499", tag, owner, clock, "sc499", __FILE__),
319319   device_isa8_card_interface(mconfig, *this),
320320   m_iobase(*this, "IO_BASE"),
321   m_irqdrq(*this, "IRQ_DRQ")
321   m_irqdrq(*this, "IRQ_DRQ"),
322   m_image(*this, SC499_CTAPE_TAG)
322323{
323324}
324325
r242110r242111
342343
343344   m_installed = false;
344345
345   device_t *ctape_device = subdevice(SC499_CTAPE_TAG);
346   m_image = dynamic_cast<device_image_interface *> (ctape_device);
347
348346   if (m_image->image_core_file() == NULL)
349347   {
350348      LOG2(("start sc499: no cartridge tape"));
351349   }
352350   else
353351   {
354      LOG2(("start sc499: cartridge tape image is %s",m_image->filename()));
352      LOG2(("start sc499: cartridge tape image is %s", m_image->filename()));
355353   }
356354
357355   m_ctape_block_buffer.resize(SC499_CTAPE_BLOCK_SIZE);
r242110r242111
465463         tape_status_set(SC499_ST0_WP);
466464      }
467465
468      if (m_image_length != m_image->length())
466      if (m_image_length != m_image->tapelen())
469467      {
470468         // tape has changed, get new size
471         m_image_length = m_image->length();
472         m_ctape_block_count = (UINT32)((m_image_length+SC499_CTAPE_BLOCK_SIZE-1) / SC499_CTAPE_BLOCK_SIZE);
469         m_image_length = m_image->tapelen();
470         m_ctape_block_count = (UINT32)((m_image_length + SC499_CTAPE_BLOCK_SIZE - 1) / SC499_CTAPE_BLOCK_SIZE);
473471      }
474472
475473      LOG1(("check_tape: tape image is %s with %d blocks", m_image->filename(), m_ctape_block_count));
r242110r242111
11671165
11681166void sc499_device::read_block()
11691167{
1168   UINT8 *tape;
1169
11701170   if (m_tape_pos == 0)
11711171   {
11721172      // check if tape has been replaced or removed
11731173      check_tape();
11741174   }
11751175
1176   m_image->fseek((UINT64) m_tape_pos * SC499_CTAPE_BLOCK_SIZE, SEEK_SET);
1176   tape = m_image->read_block(m_tape_pos);
11771177
1178   if (m_image->image_feof())
1178   if (tape == NULL)
11791179   {
1180      // either there is no tape or m_tape_pos goes beyond end-of-tape
11801181      m_status &= ~SC499_STAT_EXC;
11811182      m_status &= ~SC499_STAT_DIR;
11821183      m_status &= ~SC499_STAT_DON;
r242110r242111
11851186   }
11861187   else
11871188   {
1188      m_image->fread(m_ctape_block_buffer, SC499_CTAPE_BLOCK_SIZE);
1189      memcpy(m_ctape_block_buffer, tape, SC499_CTAPE_BLOCK_SIZE);
11891190
11901191      //  if (verbose > 1 || m_tape_pos % 100 == 0)
11911192      {
r242110r242111
12361237      check_tape();
12371238   }
12381239
1239   m_image->fseek((UINT64) m_tape_pos * SC499_CTAPE_BLOCK_SIZE, SEEK_SET);
1240   m_image->fwrite(m_ctape_block_buffer, SC499_CTAPE_BLOCK_SIZE);
1240   m_image->write_block(m_tape_pos, m_ctape_block_buffer);
12411241   m_ctape_block_count = m_tape_pos;
12421242   m_ctape_block_index = 0;
12431243   m_tape_pos++;
r242110r242111
12681268void sc499_device::block_set_filemark()
12691269{
12701270   static const UINT8 fm_pattern[] = {0xDE, 0xAF, 0xFA, 0xED};
1271   int i;
1272
1273   for (i = 0; i < SC499_CTAPE_BLOCK_SIZE; i += 4)
1271   for (int i = 0; i < SC499_CTAPE_BLOCK_SIZE; i += 4)
12741272   {
12751273      memcpy(m_ctape_block_buffer + i, fm_pattern, 4);
12761274   }
12771275}
12781276
12791277//##########################################################################
1280class sc499_ctape_image_device :    public device_t,
1281                           public device_image_interface
1282{
1283public:
1284   // construction/destruction
1285   sc499_ctape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
12861278
1287   // image-level overrides
1288   virtual iodevice_t image_type() const { return IO_MAGTAPE; }
1289
1290   virtual bool is_readable()  const { return 1; }
1291   virtual bool is_writeable() const { return 1; }
1292   virtual bool is_creatable() const { return 1; }
1293   virtual bool must_be_loaded() const { return 0; }
1294   virtual bool is_reset_on_load() const { return 0; }
1295   virtual const char *image_interface() const { return NULL; }
1296   virtual const char *file_extensions() const { return "act"; }
1297   virtual const option_guide *create_option_guide() const { return NULL; }
1298protected:
1299   // device-level overrides
1300   virtual void device_config_complete();
1301   virtual void device_start() { };
1302};
1303
13041279const device_type SC499_CTAPE = &device_creator<sc499_ctape_image_device>;
13051280
13061281sc499_ctape_image_device::sc499_ctape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
r242110r242111
13131288{
13141289   update_names(SC499_CTAPE, "ctape", "ct");
13151290};
1291
1292
1293UINT8 *sc499_ctape_image_device::read_block(int block_num)
1294{
1295   // access beyond end of tape cart
1296   if (m_ctape_data.bytes() <= (block_num + 1) * SC499_CTAPE_BLOCK_SIZE)
1297      return NULL;
1298   else
1299      return m_ctape_data + (block_num * SC499_CTAPE_BLOCK_SIZE);
1300}
1301
1302void sc499_ctape_image_device::write_block(int block_num, UINT8 *ptr)
1303{
1304   if (!(m_ctape_data.bytes() <= (block_num + 1) * SC499_CTAPE_BLOCK_SIZE))
1305      memcpy(m_ctape_data + (block_num * SC499_CTAPE_BLOCK_SIZE), ptr, SC499_CTAPE_BLOCK_SIZE);
1306}
1307
1308bool sc499_ctape_image_device::call_load()
1309{
1310   if (software_entry() == NULL)
1311   {
1312      m_ctape_data.resize(length());
1313      fread(m_ctape_data, length());
1314   }
1315   else
1316   {
1317      m_ctape_data.resize(get_software_region_length("ctape"));
1318      memcpy(m_ctape_data, get_software_region("ctape"), get_software_region_length("ctape"));
1319   }
1320
1321   return IMAGE_INIT_PASS;
1322}
1323
1324void sc499_ctape_image_device::call_unload()
1325{
1326   m_ctape_data.resize(0);
1327   // TODO: add save tape on exit?
1328   //if (software_entry() == NULL)
1329   //{
1330   //    fseek(0, SEEK_SET);
1331   //    fwrite(m_ctape_data, m_ctape_data.size);
1332   //}
1333}
trunk/src/emu/bus/isa/sc499.h
r242110r242111
2121//  TYPE DEFINITIONS
2222//**************************************************************************
2323
24// ======================> sc499_ctape_image_device
25
26class sc499_ctape_image_device : public device_t, public device_image_interface
27{
28public:
29   // construction/destruction
30   sc499_ctape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31   
32   // image-level overrides
33   virtual bool call_load();
34//   virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); }
35   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); }
36   virtual void call_unload();
37   virtual iodevice_t image_type() const { return IO_MAGTAPE; }
38   
39   virtual bool is_readable()  const { return 1; }
40   virtual bool is_writeable() const { return 1; }
41   virtual bool is_creatable() const { return 1; }
42   virtual bool must_be_loaded() const { return 0; }
43   virtual bool is_reset_on_load() const { return 0; }
44   virtual const char *image_interface() const { return "sc499_cass"; }
45   virtual const char *file_extensions() const { return "act,ct"; }
46   virtual const option_guide *create_option_guide() const { return NULL; }
47
48   UINT8 *read_block(int block_num);
49   void write_block(int block_num, UINT8 *ptr);
50   UINT64 tapelen() { return m_ctape_data.bytes(); }
51
52protected:
53   // device-level overrides
54   virtual void device_config_complete();
55   virtual void device_start() { };
56
57   dynamic_buffer m_ctape_data;
58};
59
2460// ======================> sc499_device
2561
2662class sc499_device: public device_t, public device_isa8_card_interface
r242110r242111
105141   UINT64 m_image_length;
106142
107143   dynamic_buffer m_ctape_block_buffer;
144   required_device<sc499_ctape_image_device> m_image;
108145
109   device_image_interface *m_image;
110
111146   enum line_state irq_state;
112147   enum line_state dma_drq_state;
113148
r242110r242111
119154   bool m_installed;
120155};
121156
157
122158// device type definition
123159extern const device_type ISA8_SC499;
124160
trunk/src/mess/machine/apollo.c
r242110r242111
949949   MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa5", apollo_isa_cards, NULL, false)
950950   MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa6", apollo_isa_cards, NULL, false)
951951   MCFG_ISA16_SLOT_ADD(APOLLO_ISA_TAG, "isa7", apollo_isa_cards, NULL, false)
952
953   MCFG_SOFTWARE_LIST_ADD("ctape_list", "apollo_ctape")
952954MACHINE_CONFIG_END
953955
954956// for machines with the keyboard and a graphics head


Previous 199869 Revisions Next


© 1997-2024 The MAME Team