Previous 199869 Revisions Next

r26127 Tuesday 12th November, 2013 at 21:17:59 UTC by Jürgen Buchmüller
Add setter for the diablo_hd_device pointers in the alto2 cpu. Fix a2disk to check for non-NULL pointers.
[/branches/alto2/src/emu/cpu/alto2]a2disk.c alto2.c alto2.h
[/branches/alto2/src/emu/imagedev]diablo.c diablo.h
[/branches/alto2/src/mess/drivers]alto2.c
[/branches/alto2/src/mess/includes]alto2.h

branches/alto2/src/emu/cpu/alto2/a2disk.c
r26126r26127
10361036   UINT8 s0, s1;
10371037
10381038   diablo_hd_device* dhd = m_drive[m_dsk.drive];
1039   if (!dhd) {
1040      // FIXME: set all signals for a not connected drive
1041      return;
1042   }
10391043   LOG((LOG_DISK,5,"   >>> KWD timing bitclk:%d datin:%d sect4:%d\n", bitclk, datin, dhd->get_sector_mark_0()));
10401044
10411045   if (0 == m_dsk.seclate) {
r26126r26127
15021506   int strobe;
15031507
15041508   diablo_hd_device* dhd = m_drive[unit];
1509   if (!dhd) {
1510      // FIXME: set all signals for a not connected drive
1511      return;
1512   }
15051513   LOG((LOG_DISK,2,"   STROBE #%d restore:%d cylinder:%d\n", unit, restore, cylinder));
15061514
15071515   /* This is really monoflop 52a generating a very short 0 pulse */
r26126r26127
15681576void alto2_cpu_device::disk_ready_mf31a(void* ptr, INT32 arg)
15691577{
15701578   diablo_hd_device* dhd = m_drive[m_dsk.drive];
1571   m_dsk.ready_mf31a = arg & dhd->get_ready_0();
1579   if (dhd)
1580      m_dsk.ready_mf31a = arg & dhd->get_ready_0();
1581   else
1582      m_dsk.ready_mf31a = arg;
15721583   /* log the not ready result with level 0, else 2 */
15731584   LOG((LOG_DISK,m_dsk.ready_mf31a ? 0 : 2,"   ready mf31a:%d\n", m_dsk.ready_mf31a));
15741585}
r26126r26127
16101621   PUT_KSTAT_SEEKFAIL(m_dsk.kstat, m_dsk.seekok ? 0 : 1);
16111622
16121623   /* KSTAT[9] latch the drive seek/read/write status */
1613   PUT_KSTAT_SEEK(m_dsk.kstat, dhd->get_seek_read_write_0());
1624   PUT_KSTAT_SEEK(m_dsk.kstat, dhd ? dhd->get_seek_read_write_0() : 1);
16141625
16151626   /* KSTAT[10] latch the latched (FF 45a at CLRSTAT) ready status */
16161627   PUT_KSTAT_NOTRDY(m_dsk.kstat, m_dsk.ff_45a & JKFF_Q ? 1 : 0);
r26126r26127
18901901   DEBUG_NAME("      RDYLAT 45a");
18911902   m_dsk.ff_45a = update_jkff(m_dsk.ff_45a,
18921903      (m_dsk.ff_45a & JKFF_CLK) |
1893      dhd->get_ready_0() |
1904      (dhd ? dhd->get_ready_0() : 1) |
18941905      JKFF_K |
18951906      JKFF_S |
18961907      0);
r26126r26127
19131924      JKFF_C);
19141925
19151926   /* set or reset monoflop 31a, depending on drive READY' */
1916   m_dsk.ready_mf31a = dhd->get_ready_0();
1927   m_dsk.ready_mf31a = dhd ? dhd->get_ready_0() : 1;
19171928
19181929   /* start monoflop 31a, which resets ready_mf31a */
19191930   if (!m_dsk.ready_timer)
r26126r26127
19811992   PUT_KADDR_HEAD(m_dsk.kaddr, head);
19821993   /* get the selected head, and select drive unit and head */
19831994   diablo_hd_device* dhd = m_drive[unit];
1984   dhd->select(unit, head);
1995   if (dhd)
1996      dhd->select(unit, head);
19851997
19861998   /* On KDAR<- bit 0 of parts #36 and #37 is reset to 0, i.e. recno = 0 */
19871999   m_dsk.krecno = 0;
r26126r26127
21092121void alto2_cpu_device::f2_swrnrdy_1()
21102122{
21112123   diablo_hd_device* dhd = m_drive[m_dsk.drive];
2112   UINT16 r = dhd->get_seek_read_write_0();
2124   UINT16 r = dhd ? dhd->get_seek_read_write_0() : 1;
21132125   UINT16 init = INIT ? 037 : 0;
21142126
21152127   LOG((LOG_DISK,1,"   SWRNRDY; %sbranch (%#o|%#o|%#o)\n", (r | init) ? "" : "no ", m_next2, r, init));
r26126r26127
21712183{
21722184   (void)ptr;
21732185   diablo_hd_device* dhd = m_drive[m_dsk.drive];
2174   int bits = dhd->bits_per_sector();
2186   int bits = dhd ? dhd->bits_per_sector() : 0;
21752187   int clk = arg & 1;
21762188   int bit = 0;
21772189
r26126r26127
21932205         /* do anything, if the transfer is off? */
21942206      } else {
21952207         LOG((LOG_DISK,7,"   BITCLK#%d bit:%d (write) @%lldns\n", arg, bit, ntime()));
2196         if (clk)
2197            dhd->wr_data(arg, bit);
2198         else
2199            dhd->wr_data(arg, 1);
2208         if (dhd) {
2209            if (clk)
2210               dhd->wr_data(arg, bit);
2211            else
2212               dhd->wr_data(arg, 1);
2213         }
22002214      }
22012215   } else if (GET_KCOM_BCLKSRC(m_dsk.kcom)) {
22022216      /* always select the crystal clock */
2203      bit = dhd->rd_data(arg);
2217      if (dhd)
2218         bit = dhd->rd_data(arg);
22042219      LOG((LOG_DISK,7,"   BITCLK#%d bit:%d (read, crystal) @%lldns\n", arg, bit, ntime()));
22052220      kwd_timing(clk, bit, 0);
22062221   } else {
r26126r26127
22082223      if (GET_KCOM_XFEROFF(m_dsk.kcom)) {
22092224         bit = 1;
22102225      } else {
2211         clk = dhd->rd_clock(arg & ~1);
2212         bit = dhd->rd_data(arg | 1);
2226         if (dhd) {
2227            clk = dhd->rd_clock(arg & ~1);
2228            bit = dhd->rd_data(arg | 1);
2229         }
22132230         LOG((LOG_DISK,7,"   BITCLK#%d bit:%d (read, driveclk) @%lldns\n", arg, bit, ntime()));
22142231      }
22152232      kwd_timing(clk, bit, 0);
r26126r26127
22172234
22182235   /* more bits to clock? */
22192236   if (++arg < bits) {
2237      assert(dhd != NULL);
22202238      m_dsk.bitclk_timer->adjust(dhd->bit_time(), arg);
22212239      m_dsk.bitclk_timer->enable();
22222240   }
r26126r26127
22362254   }
22372255
22382256   /* KSTAT[0-3] update the current sector in the kstat field */
2239   PUT_KSTAT_SECTOR(m_dsk.kstat, dhd->get_sector());
2257   PUT_KSTAT_SECTOR(m_dsk.kstat, dhd ? dhd->get_sector() : 017);
22402258
22412259   /* clear input and output shift registers (?) */
22422260   m_dsk.shiftin = 0;
r26126r26127
22572275 */
22582276void alto2_cpu_device::init_disk()
22592277{
2278//   diablo_hd_device* dhd;
2279//   for (int unit = 0; unit < 2; unit++) {
2280//      dhd = m_drive[unit];
2281//      if (!dhd)
2282//         continue;
2283//      dhd->sector_callback(&alto2_cpu_device::disk_sector_start);
2284//   }
2285
22602286   memset(&m_dsk, 0, sizeof(m_dsk));
22612287
22622288   /** @brief simulate previous sysclka */
r26126r26127
22972323   m_dsk.ok_to_run_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::disk_ok_to_run),this));
22982324   m_dsk.ok_to_run_timer->set_param(1);
22992325   m_dsk.ok_to_run_timer->adjust(attotime::from_nsec(15 * ALTO2_UCYCLE), 1);
2300
2301   /* install a callback to be called whenever a drive sector starts */
2302//   diablo_hd_device* dhd = m_drive[m_dsk.drive];
2303//   dhd->sector_callback(&alto2_cpu_device::disk_sector_start);
23042326}
23052327
branches/alto2/src/emu/cpu/alto2/alto2.c
r26126r26127
117117}
118118
119119//-------------------------------------------------
120// driver interface to RAM
121//-------------------------------------------------
122
123UINT16 alto2_cpu_device::read_ram(offs_t offset)
124{
125   return debug_read_mem(offset);
126}
127
128void alto2_cpu_device::write_ram(offs_t offset, UINT16 data)
129{
130   debug_write_mem(offset, data);
131}
132
133//-------------------------------------------------
134// driver interface to set diablo_hd_device
135//-------------------------------------------------
136
137void alto2_cpu_device::set_diablo(int unit, diablo_hd_device* ptr)
138{
139   m_drive[unit] = ptr;
140}
141
142
143//-------------------------------------------------
120144//  device_rom_region - device-specific (P)ROMs
121145//-------------------------------------------------
122146
r26126r26127
229253   return NULL;
230254}
231255
232UINT16 alto2_cpu_device::read_ram(offs_t offset)
233{
234   return debug_read_mem(offset);
235}
236
237void alto2_cpu_device::write_ram(offs_t offset, UINT16 data)
238{
239   debug_write_mem(offset, data);
240}
241
242256/**
243257 * @brief list of microcode PROM loading options
244258 */
branches/alto2/src/emu/cpu/alto2/alto2.h
r26126r26127
213213   UINT16 read_ram(offs_t offset);
214214   void write_ram(offs_t offset, UINT16 data);
215215
216   //! driver interface to set diablo_hd_device
217   void set_diablo(int unit, diablo_hd_device* ptr);
218
216219protected:
217220   //! device-level override for start
218221   virtual void device_start();
r26126r26127
13231326   void mouse_button(int b);                  //!< register a mouse button change
13241327   void mouse_init();                        //!< initialize the mouse context to useful values
13251328
1326   // ************************************************
1327   // diablo31 drive stuff
1328   // ************************************************
1329   diablo_hd_device* m_drive[2];               //!< two diablo drives
1330   void init_drive();                        //!< initialize the disk drives context
13311329
13321330   // ************************************************
13331331   // disk controller stuff
13341332   // ************************************************
1333   diablo_hd_device* m_drive[2];      //!< two diablo_hd_device drives
13351334
13361335   //! disk controller context
13371336   struct {
branches/alto2/src/emu/imagedev/diablo.h
r26126r26127
1/*********************************************************************
1/**********************************************************
2 *   DIABLO drive image to hard disk interface
3 *
4 *   Copyright: Juergen Buchmueller <pullmoll@t-online.de>
5 *
6 *   Licenses: MAME, GPLv2
7 **********************************************************/
28
3   diablo.h
9#ifndef _IMAGEDEV_DIABLO_H_
10#define _IMAGEDEV_DIABLO_H_
411
5   Interface to the CHD code
6
7*********************************************************************/
8
9#ifndef DIABLO_H
10#define DIABLO_H
11
1212#include "harddisk.h"
1313
1414#define   DIABLO_TAG(_id) "diablo:"#_id
r26126r26127
8888#define MCFG_DIABLO_CONFIG_ADD(_tag,_config) \
8989   MCFG_DEVICE_ADD(_tag, DIABLO, 0) \
9090   MCFG_DEVICE_CONFIG(_config)
91#endif /* DIABLO_H */
91#endif /* _IMAGEDEV_DIABLO_H_ */
branches/alto2/src/emu/imagedev/diablo.c
r26126r26127
11/**********************************************************
2 *   Portable DIABLO drive image to hard disk interface
2 *   DIABLO drive image to hard disk interface
33 *
44 *   Copyright: Juergen Buchmueller <pullmoll@t-online.de>
55 *
branches/alto2/src/mess/drivers/alto2.c
r26126r26127
266266{
267267   // make a copy for the front end, i.e. the driver view on the micro code
268268   memcpy(memregion("maincpu"), memregion("maincpu:ucode"), sizeof(UINT32)*ALTO2_UCODE_SIZE);
269
270   // make the diablo drives known to the CPU core
271   alto2_cpu_device* cpu = downcast<alto2_cpu_device *>(m_maincpu.target());
272   cpu->set_diablo(0, m_diablo0);
273   cpu->set_diablo(1, m_diablo1);
269274}
270275
271276/* Game Drivers */
branches/alto2/src/mess/includes/alto2.h
r26126r26127
99
1010#include "emu.h"
1111#include "cpu/alto2/alto2.h"
12#include "imagedev/diablo.h"
12#include "machine/diablo_hd.h"
1313
1414class alto2_state : public driver_device
1515{
r26126r26127
1717   alto2_state(const machine_config &mconfig, device_type type, const char *tag)
1818      : driver_device(mconfig, type, tag),
1919      m_maincpu(*this, "maincpu"),
20      m_diablo0(*this, DIABLO_TAG(0)),
21      m_diablo1(*this, DIABLO_TAG(1)),
20      m_diablo0(*this, DIABLO_HD_0),
21      m_diablo1(*this, DIABLO_HD_1),
2222      m_io_row0(*this, "ROW0"),
2323      m_io_row1(*this, "ROW1"),
2424      m_io_row2(*this, "ROW2"),
r26126r26127
4444
4545protected:
4646   required_device<cpu_device> m_maincpu;
47   optional_device<diablo_image_device> m_diablo0;
48   optional_device<diablo_image_device> m_diablo1;
47   optional_device<diablo_hd_device> m_diablo0;      // should become required_device() once the devices work right
48   optional_device<diablo_hd_device> m_diablo1;
4949   required_ioport m_io_row0;
5050   required_ioport m_io_row1;
5151   required_ioport m_io_row2;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team