Previous 199869 Revisions Next

r26385 Saturday 23rd November, 2013 at 21:00:44 UTC by Jürgen Buchmüller
Fix crashes when running without a CHD, e.g. without "-hard1 games-diablo.chd"
[/branches/alto2/src/emu/cpu/alto2]a2disk.c a2disp.c a2mouse.c alto2cpu.c
[/branches/alto2/src/emu/debug]debugvw.c textbuf.c textbuf.h
[/branches/alto2/src/emu/machine]diablo_hd.c

branches/alto2/src/emu/cpu/alto2/a2mouse.c
r26384r26385
9898
9999#define   MOVEX(x) ((((x) < 0) ? MY2 : ((x) > 0) ? MY1 : 0))
100100#define   MOVEY(y) ((((y) < 0) ? MX2 : ((y) > 0) ? MX1 : 0))
101#define   SIGN(a) ((a) < 0 ? -1 : (a) > 0 ? 1 : 0)
101102
102103/**
103104 * @brief return the mouse motion flags
r26384r26385
123124      break;
124125   case 1:
125126      m_mouse.latch |= MACTIVE;
126      if (m_mouse.x < m_mouse.dx)
127         m_mouse.x++;
128      if (m_mouse.x > m_mouse.dx)
129         m_mouse.x--;
130      if (m_mouse.y < m_mouse.dy)
131         m_mouse.y++;
132      if (m_mouse.y > m_mouse.dy)
133         m_mouse.y--;
127      m_mouse.x -= SIGN(m_mouse.x - m_mouse.dx);
128      m_mouse.y -= SIGN(m_mouse.y - m_mouse.dy);
134129      break;
135130   case 2:
136131      m_mouse.latch ^= MOVEX(m_mouse.dx - m_mouse.x);
r26384r26385
138133      break;
139134   default:
140135      m_mouse.latch &= ~MACTIVE;
141      if (m_mouse.x < m_mouse.dx)
142         m_mouse.x++;
143      if (m_mouse.x > m_mouse.dx)
144         m_mouse.x--;
145      if (m_mouse.y < m_mouse.dy)
146         m_mouse.y++;
147      if (m_mouse.y > m_mouse.dy)
148         m_mouse.y--;
136      m_mouse.x -= SIGN(m_mouse.x - m_mouse.dx);
137      m_mouse.y -= SIGN(m_mouse.y - m_mouse.dy);
149138   }
150139   m_mouse.phase = (m_mouse.phase + 1) % 4;
151140   return data;
branches/alto2/src/emu/cpu/alto2/a2disk.c
r26384r26385
17021702   m_dsk.kaddr = 0;
17031703   m_dsk.kadr = 0;
17041704   m_dsk.kstat = 0;
1705   m_dsk.kcom = 0;
1705   m_dsk.kcom = 066000;
17061706   m_dsk.krecno = 0;
17071707   m_dsk.egate = 1;
17081708   m_dsk.wrgate = 1;
r26384r26385
17231723#if   USE_BITCLK_TIMER
17241724   m_dsk.bitclk_timer->reset();
17251725#else
1726   m_dsk.bitclk_time[0] = static_cast<int>(attotime::from_nsec(300).as_attoseconds() / 1000000);
1727   m_dsk.bitclk_time[1] = static_cast<int>(attotime::from_nsec(300).as_attoseconds() / 1000000);
1726   m_dsk.bitclk_time[0] = static_cast<int>(attotime::from_nsec(300).as_attoseconds() / 1000000);
1727   m_dsk.bitclk_time[1] = static_cast<int>(attotime::from_nsec(300).as_attoseconds() / 1000000);
17281728#endif
17291729   m_dsk.datin = 0;
17301730   m_dsk.bitcount = 0;
branches/alto2/src/emu/cpu/alto2/a2disp.c
r26384r26385
353353   if (A63_HLCGATE(a63)) {
354354      // reset or count horizontal line counters
355355      m_dsp.hlc += 1;
356      if (m_dsp.hlc == ALTO2_DISPLAY_HLC_END + 1)
356      if (m_dsp.hlc == ALTO2_DISPLAY_HLC_END - 1)
357357         m_dsp.hlc = ALTO2_DISPLAY_HLC_START;
358358      /* start the refresh task _twice_ on each scanline */
359359      m_task_wakeup |= 1 << task_mrt;
branches/alto2/src/emu/cpu/alto2/alto2cpu.c
r26384r26385
252252
253253void alto2_cpu_device::set_diablo(int unit, diablo_hd_device* ptr)
254254{
255   logerror("%s: unit=%d diablo_hd_device=%p\n", __FUNCTION__, unit, ptr);
255256   m_drive[unit] = ptr;
256257}
257258
branches/alto2/src/emu/debug/debugvw.c
r26384r26385
22// copyright-holders:Aaron Giles
33/*********************************************************************
44
5    debugvw.c
5   debugvw.c
66
7    Debugger view engine.
7   Debugger view engine.
88
99***************************************************************************/
1010
branches/alto2/src/emu/debug/textbuf.c
r26384r26385
4646***************************************************************************/
4747
4848/*-------------------------------------------------
49   buffer_used - return the number of bytes
50   currently held in the buffer
49   buffer_used - return the number of
50   unicode_chars currently held in the buffer
5151-------------------------------------------------*/
5252
5353INLINE INT32 buffer_used(text_buffer *text)
r26384r26385
6060
6161
6262/*-------------------------------------------------
63   buffer_space - return the number of bytes
64   available in the buffer
63   buffer_space - return the number of
64   unicode_chars available in the buffer
6565-------------------------------------------------*/
6666
6767INLINE INT32 buffer_space(text_buffer *text)
r26384r26385
8181   text_buffer_alloc - allocate a new text buffer
8282-------------------------------------------------*/
8383
84text_buffer *text_buffer_alloc(UINT32 columns, UINT32 lines)
84text_buffer *text_buffer_alloc(UINT32 length, UINT32 lines)
8585{
8686   text_buffer *text;
8787
r26384r26385
9191      return NULL;
9292
9393   /* allocate memory for the buffer itself */
94   text->buffer = (unicode_char *)osd_malloc_array(sizeof(unicode_char) * columns);
94   text->buffer = (unicode_char *)osd_malloc_array((length + 1) * sizeof(unicode_char));
9595   if (!text->buffer)
9696   {
9797      osd_free(text);
r26384r26385
108108   }
109109
110110   /* initialize the buffer description */
111   text->bufsize = columns;
111   text->bufsize = length;
112112   text->linesize = lines;
113113   text_buffer_clear(text);
114114
branches/alto2/src/emu/debug/textbuf.h
r26384r26385
2727***************************************************************************/
2828
2929/* allocate a new text buffer */
30text_buffer *text_buffer_alloc(UINT32 columns, UINT32 lines);
30text_buffer *text_buffer_alloc(UINT32 length, UINT32 lines);
3131
3232/* free a text buffer */
3333void text_buffer_free(text_buffer *text);
branches/alto2/src/emu/machine/diablo_hd.c
r26384r26385
433433{
434434   size_t dst;
435435
436   if (!m_bits)
437      return NULL;
436438   /* already expanded this sector? */
437439   if (m_bits[m_page])
438440      return m_bits[m_page];
r26384r26385
11651167   }
11661168
11671169   UINT32 *bits = expand_sector();
1170   if (!bits) {
1171      LOG_DRIVE((0,"[DHD%u]   no bits\n", m_unit));
1172      return;   // invalid unit
1173   }
1174
11681175   if (-1 == m_wrfirst)
11691176      m_wrfirst = index;
11701177
r26384r26385
12081215
12091216   if (-1 == m_page) {
12101217      LOG_DRIVE((0,"[DHD%u]   invalid page\n", m_unit));
1218      return 1;   // invalid unit
1219   }
1220
1221   UINT32 *bits = expand_sector();
1222   if (!bits) {
1223      LOG_DRIVE((0,"[DHD%u]   no bits\n", m_unit));
12111224      return 1;   // invalid page
12121225   }
12131226
1214   UINT32 *bits = expand_sector();
12151227   if (-1 == m_rdfirst)
12161228      m_rdfirst = index;
12171229
r26384r26385
12501262   }
12511263
12521264   UINT32 *bits = expand_sector();
1265   if (!bits) {
1266      LOG_DRIVE((0,"[DHD%u]   no bits\n", m_unit));
1267      return 1;   // invalid unit
1268   }
1269
12531270   if (-1 == m_rdfirst)
12541271      m_rdfirst = index;
12551272
r26384r26385
13541371      m_cylinders = 2 * DIABLO_CYLINDERS;
13551372      m_pages = 2 * DIABLO_PAGES;
13561373   }
1374   LOG_DRIVE((0,"[DHD%u]   m_handle            : %p\n", m_unit, m_handle));
1375   LOG_DRIVE((0,"[DHD%u]   m_disk              : %p\n", m_unit, m_disk));
13571376   LOG_DRIVE((0,"[DHD%u]   rotation time       : %.0fns\n", m_unit, m_rotation_time.as_double() * ATTOSECONDS_PER_NANOSECOND));
13581377   LOG_DRIVE((0,"[DHD%u]   sector time         : %.0fns\n", m_unit, m_sector_time.as_double() * ATTOSECONDS_PER_NANOSECOND));
13591378   LOG_DRIVE((0,"[DHD%u]   sector mark 0 time  : %.0fns\n", m_unit, m_sector_mark_0_time.as_double() * ATTOSECONDS_PER_NANOSECOND));
r26384r26385
13871406   m_rdfirst = -1;
13881407   m_rdlast = -1;
13891408
1409   if (!m_handle)
1410      return;
13901411   // for units with a CHD assigned to them start the timer
1391   if (m_handle) {
1392      timer_set(m_sector_time - m_sector_mark_0_time, 1, 0);
1393      m_cache = auto_alloc_array_clear(machine(), UINT8*, m_pages);
1394      m_bits = auto_alloc_array_clear(machine(), UINT32*, m_pages);
1395      read_sector();
1396   }
1412   m_cache = auto_alloc_array_clear(machine(), UINT8*, m_pages);
1413   m_bits = auto_alloc_array_clear(machine(), UINT32*, m_pages);
1414   timer_set(m_sector_time - m_sector_mark_0_time, 1, 0);
1415   read_sector();
13971416}
13981417
13991418/**

Previous 199869 Revisions Next


© 1997-2024 The MAME Team