branches/alto2/src/emu/cpu/alto2/a2mouse.c
| r26384 | r26385 | |
| 98 | 98 | |
| 99 | 99 | #define MOVEX(x) ((((x) < 0) ? MY2 : ((x) > 0) ? MY1 : 0)) |
| 100 | 100 | #define MOVEY(y) ((((y) < 0) ? MX2 : ((y) > 0) ? MX1 : 0)) |
| 101 | #define SIGN(a) ((a) < 0 ? -1 : (a) > 0 ? 1 : 0) |
| 101 | 102 | |
| 102 | 103 | /** |
| 103 | 104 | * @brief return the mouse motion flags |
| r26384 | r26385 | |
| 123 | 124 | break; |
| 124 | 125 | case 1: |
| 125 | 126 | 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); |
| 134 | 129 | break; |
| 135 | 130 | case 2: |
| 136 | 131 | m_mouse.latch ^= MOVEX(m_mouse.dx - m_mouse.x); |
| r26384 | r26385 | |
| 138 | 133 | break; |
| 139 | 134 | default: |
| 140 | 135 | 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); |
| 149 | 138 | } |
| 150 | 139 | m_mouse.phase = (m_mouse.phase + 1) % 4; |
| 151 | 140 | return data; |
branches/alto2/src/emu/debug/textbuf.c
| r26384 | r26385 | |
| 46 | 46 | ***************************************************************************/ |
| 47 | 47 | |
| 48 | 48 | /*------------------------------------------------- |
| 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 |
| 51 | 51 | -------------------------------------------------*/ |
| 52 | 52 | |
| 53 | 53 | INLINE INT32 buffer_used(text_buffer *text) |
| r26384 | r26385 | |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | /*------------------------------------------------- |
| 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 |
| 65 | 65 | -------------------------------------------------*/ |
| 66 | 66 | |
| 67 | 67 | INLINE INT32 buffer_space(text_buffer *text) |
| r26384 | r26385 | |
| 81 | 81 | text_buffer_alloc - allocate a new text buffer |
| 82 | 82 | -------------------------------------------------*/ |
| 83 | 83 | |
| 84 | | text_buffer *text_buffer_alloc(UINT32 columns, UINT32 lines) |
| 84 | text_buffer *text_buffer_alloc(UINT32 length, UINT32 lines) |
| 85 | 85 | { |
| 86 | 86 | text_buffer *text; |
| 87 | 87 | |
| r26384 | r26385 | |
| 91 | 91 | return NULL; |
| 92 | 92 | |
| 93 | 93 | /* 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)); |
| 95 | 95 | if (!text->buffer) |
| 96 | 96 | { |
| 97 | 97 | osd_free(text); |
| r26384 | r26385 | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /* initialize the buffer description */ |
| 111 | | text->bufsize = columns; |
| 111 | text->bufsize = length; |
| 112 | 112 | text->linesize = lines; |
| 113 | 113 | text_buffer_clear(text); |
| 114 | 114 | |
branches/alto2/src/emu/machine/diablo_hd.c
| r26384 | r26385 | |
| 433 | 433 | { |
| 434 | 434 | size_t dst; |
| 435 | 435 | |
| 436 | if (!m_bits) |
| 437 | return NULL; |
| 436 | 438 | /* already expanded this sector? */ |
| 437 | 439 | if (m_bits[m_page]) |
| 438 | 440 | return m_bits[m_page]; |
| r26384 | r26385 | |
| 1165 | 1167 | } |
| 1166 | 1168 | |
| 1167 | 1169 | UINT32 *bits = expand_sector(); |
| 1170 | if (!bits) { |
| 1171 | LOG_DRIVE((0,"[DHD%u] no bits\n", m_unit)); |
| 1172 | return; // invalid unit |
| 1173 | } |
| 1174 | |
| 1168 | 1175 | if (-1 == m_wrfirst) |
| 1169 | 1176 | m_wrfirst = index; |
| 1170 | 1177 | |
| r26384 | r26385 | |
| 1208 | 1215 | |
| 1209 | 1216 | if (-1 == m_page) { |
| 1210 | 1217 | 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)); |
| 1211 | 1224 | return 1; // invalid page |
| 1212 | 1225 | } |
| 1213 | 1226 | |
| 1214 | | UINT32 *bits = expand_sector(); |
| 1215 | 1227 | if (-1 == m_rdfirst) |
| 1216 | 1228 | m_rdfirst = index; |
| 1217 | 1229 | |
| r26384 | r26385 | |
| 1250 | 1262 | } |
| 1251 | 1263 | |
| 1252 | 1264 | 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 | |
| 1253 | 1270 | if (-1 == m_rdfirst) |
| 1254 | 1271 | m_rdfirst = index; |
| 1255 | 1272 | |
| r26384 | r26385 | |
| 1354 | 1371 | m_cylinders = 2 * DIABLO_CYLINDERS; |
| 1355 | 1372 | m_pages = 2 * DIABLO_PAGES; |
| 1356 | 1373 | } |
| 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)); |
| 1357 | 1376 | LOG_DRIVE((0,"[DHD%u] rotation time : %.0fns\n", m_unit, m_rotation_time.as_double() * ATTOSECONDS_PER_NANOSECOND)); |
| 1358 | 1377 | LOG_DRIVE((0,"[DHD%u] sector time : %.0fns\n", m_unit, m_sector_time.as_double() * ATTOSECONDS_PER_NANOSECOND)); |
| 1359 | 1378 | LOG_DRIVE((0,"[DHD%u] sector mark 0 time : %.0fns\n", m_unit, m_sector_mark_0_time.as_double() * ATTOSECONDS_PER_NANOSECOND)); |
| r26384 | r26385 | |
| 1387 | 1406 | m_rdfirst = -1; |
| 1388 | 1407 | m_rdlast = -1; |
| 1389 | 1408 | |
| 1409 | if (!m_handle) |
| 1410 | return; |
| 1390 | 1411 | // 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(); |
| 1397 | 1416 | } |
| 1398 | 1417 | |
| 1399 | 1418 | /** |