branches/alto2/src/emu/cpu/alto2/alto2.c
| r26198 | r26199 | |
| 32 | 32 | |
| 33 | 33 | DEVICE_ADDRESS_MAP_START( iomem_map, 16, alto2_cpu_device ) |
| 34 | 34 | AM_RANGE(0, ALTO2_IO_PAGE_BASE - 1) AM_READWRITE( ioram_r, ioram_w ) |
| 35 | | AM_RANGE(ALTO2_IO_PAGE_BASE, 0177777) AM_NOP |
| 36 | | AM_RANGE(0177016, 0177016) AM_READWRITE( utilout_r, utilout_w ) |
| 37 | | AM_RANGE(0177020, 0177023) AM_READWRITE( xbus_r, xbus_w ) |
| 38 | | AM_RANGE(0177024, 0177024) AM_READ ( mear_r ) |
| 39 | | AM_RANGE(0177025, 0177025) AM_READWRITE( mesr_r, mesr_w ) |
| 40 | | AM_RANGE(0177026, 0177026) AM_READWRITE( mecr_r, mecr_w ) |
| 41 | | AM_RANGE(0177030, 0177033) AM_READ ( utilin_r ) |
| 42 | | AM_RANGE(0177034, 0177037) AM_READ ( kbd_ad_r ) |
| 43 | | AM_RANGE(0177040, 0177057) AM_READWRITE( bank_reg_r, bank_reg_w ) |
| 35 | // page 0376 |
| 36 | AM_RANGE(0177000, 0177015) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 37 | AM_RANGE(0177016, 0177016) AM_READWRITE( utilout_r, utilout_w ) // UTILOUT register |
| 38 | AM_RANGE(0177017, 0177017) AM_READWRITE( noop_r, noop_w ) // unused range |
| 39 | AM_RANGE(0177020, 0177023) AM_READWRITE( xbus_r, xbus_w ) // XBUS[0-3] registers |
| 40 | AM_RANGE(0177024, 0177024) AM_READ ( mear_r ) // MEAR (memory error address register) |
| 41 | AM_RANGE(0177025, 0177025) AM_READWRITE( mesr_r, mesr_w ) // MESR (memory error status register) |
| 42 | AM_RANGE(0177026, 0177026) AM_READWRITE( mecr_r, mecr_w ) // MECR (memory error control register) |
| 43 | AM_RANGE(0177027, 0177027) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 44 | AM_RANGE(0177030, 0177033) AM_READ ( utilin_r ) // UTILIN register |
| 45 | AM_RANGE(0177034, 0177037) AM_READ ( kbd_ad_r ) // KBD_AD[0-3] matrix |
| 46 | AM_RANGE(0177040, 0177057) AM_READWRITE( bank_reg_r, bank_reg_w ) // BANK[0-17] registers (4 bit) |
| 47 | AM_RANGE(0177060, 0177077) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 48 | AM_RANGE(0177100, 0177101) AM_READWRITE( noop_r, noop_w ) // { Summagraphics tablet X, Y } |
| 49 | AM_RANGE(0177102, 0177137) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 50 | AM_RANGE(0177140, 0177157) AM_READWRITE( noop_r, noop_w ) // { Organ keyboard } |
| 51 | AM_RANGE(0177160, 0177177) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 52 | AM_RANGE(0177200, 0177204) AM_READWRITE( noop_r, noop_w ) // { PROM programmer } |
| 53 | AM_RANGE(0177205, 0177233) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 54 | AM_RANGE(0177234, 0177237) AM_READWRITE( noop_r, noop_w ) // { Experimental cursor control } |
| 55 | AM_RANGE(0177240, 0177257) AM_READWRITE( noop_r, noop_w ) // { Alto-II debugger } |
| 56 | // AM_RANGE(0177244, 0177247) AM_READWRITE( noop_r, noop_w ) // { Graphics keyboard } |
| 57 | AM_RANGE(0177260, 0177377) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 58 | // page 0377 |
| 59 | // AM_RANGE(0177400, 0177405) AM_READWRITE( noop_r, noop_w ) // { Maxc2 maintenance interface } |
| 60 | AM_RANGE(0177400, 0177400) AM_READWRITE( noop_r, noop_w ) // { Alto DLS input } |
| 61 | AM_RANGE(0177401, 0177417) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 62 | AM_RANGE(0177420, 0177420) AM_READWRITE( noop_r, noop_w ) // { "" } |
| 63 | AM_RANGE(0177421, 0177437) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 64 | AM_RANGE(0177440, 0177440) AM_READWRITE( noop_r, noop_w ) // { "" } |
| 65 | AM_RANGE(0177441, 0177457) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 66 | AM_RANGE(0177460, 0177460) AM_READWRITE( noop_r, noop_w ) // { "" } |
| 67 | AM_RANGE(0177461, 0177577) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 68 | AM_RANGE(0177600, 0177677) AM_READWRITE( noop_r, noop_w ) // { Alto DLS output } |
| 69 | AM_RANGE(0177700, 0177700) AM_READWRITE( noop_r, noop_w ) // { EIA interface output bit } |
| 70 | AM_RANGE(0177701, 0177701) AM_READWRITE( noop_r, noop_w ) // { EIA interface input bit } |
| 71 | AM_RANGE(0177702, 0177717) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 72 | AM_RANGE(0177720, 0177737) AM_READWRITE( noop_r, noop_w ) // { TV camera interface } |
| 73 | AM_RANGE(0177740, 0177763) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 74 | AM_RANGE(0177764, 0177773) AM_READWRITE( noop_r, noop_w ) // { Redactron tape drive } |
| 75 | AM_RANGE(0177774, 0177775) AM_READWRITE( noop_r, noop_w ) // UNUSED RANGE |
| 76 | AM_RANGE(0177776, 0177776) AM_READWRITE( noop_r, noop_w ) // { Digital-Analog Converter, Joystick } |
| 77 | AM_RANGE(0177777, 0177777) AM_READWRITE( noop_r, noop_w ) // { Digital-Analog Converter, Joystick } |
| 78 | |
| 44 | 79 | AM_RANGE(0200000, 0377777) AM_READWRITE( ioram_r, ioram_w ) |
| 45 | 80 | ADDRESS_MAP_END |
| 46 | 81 | |
| r26198 | r26199 | |
| 1499 | 1534 | task_name(m_task), m_mpc, f2_name(MIR_F2(m_mir))); |
| 1500 | 1535 | } |
| 1501 | 1536 | |
| 1537 | #if ALTO2_DEBUG |
| 1538 | typedef struct { |
| 1539 | UINT16 first, last; |
| 1540 | const char* name; |
| 1541 | } memory_range_name_t; |
| 1542 | |
| 1543 | memory_range_name_t memory_range_name_table[] = { |
| 1544 | {0177016, 0177017, "UTILOUT Printer output (Std. Hardware)"}, |
| 1545 | {0177020, 0177023, "XBUS Utility input bus (Alto II Std. Hardware)"}, |
| 1546 | {0177024, 0177024, "MEAR Memory Error Address Register (Alto II Std. Hardware)"}, |
| 1547 | {0177025, 0177025, "MESR Memory error status register (Alto II Std. Hardware)"}, |
| 1548 | {0177026, 0177026, "MECR Memory error control register (Alto II Std. Hardware)"}, |
| 1549 | {0177030, 0177033, "UTILIN Printer status, mouse, keyset (all 4 locations return same thing)"}, |
| 1550 | {0177034, 0177037, "KBDAD Undecoded keyboard (Std. Hardware)"}, |
| 1551 | {0177740, 0177757, "BANKREGS Extended memory option bank registers"}, |
| 1552 | {0177100, 0177100, "- Sumagraphics tablet X"}, |
| 1553 | {0177101, 0177101, "- Sumagraphics tablet Y"}, |
| 1554 | {0177140, 0177157, "- Organ keyboard"}, |
| 1555 | {0177200, 0177204, "- PROM programmer"}, |
| 1556 | {0177234, 0177237, "- Experimental ursor control"}, |
| 1557 | {0177240, 0177257, "- Alto II debugger"}, |
| 1558 | {0177244, 0177247, "- Graphics keyboard"}, |
| 1559 | {0177400, 0177405, "- Maxc2 maintenance interface"}, |
| 1560 | {0177400, 0177400, "- Alto DLS input (0)"}, |
| 1561 | {0177420, 0177420, "- Alto DLS input (1)"}, |
| 1562 | {0177440, 0177440, "- Alto DLS input (2)"}, |
| 1563 | {0177460, 0177460, "- Alto DLS input (3)"}, |
| 1564 | {0177600, 0177677, "- Alto DLS output"}, |
| 1565 | {0177700, 0177700, "- EIA interface output bit"}, |
| 1566 | {0177701, 0177701, "EIALOC EIA interface input bit"}, |
| 1567 | {0177720, 0177737, "- TV Camera Interface"}, |
| 1568 | {0177764, 0177773, "- Redactron tape drive"}, |
| 1569 | {0177776, 0177776, "- Digital-Analog Converter, Joystick"}, |
| 1570 | {0177777, 0177777, "- Digital-Analog Converter, Joystick"} |
| 1571 | }; |
| 1572 | |
| 1573 | static const char* memory_range_name(offs_t offset) |
| 1574 | { |
| 1575 | int _min = 0; |
| 1576 | int _max = sizeof(memory_range_name_table) / sizeof(memory_range_name_table[0]) - 1; |
| 1577 | int _mid; |
| 1578 | |
| 1579 | offset %= ALTO2_IO_PAGE_SIZE; |
| 1580 | offset += ALTO2_IO_PAGE_BASE; |
| 1581 | |
| 1582 | /* binary search in table of unicode ranges */ |
| 1583 | while (_max >= _min) |
| 1584 | { |
| 1585 | _mid = (_min + _max) / 2; |
| 1586 | if (memory_range_name_table[_mid].last < offset) |
| 1587 | _min = _mid + 1; |
| 1588 | else if (memory_range_name_table[_mid].first > offset) |
| 1589 | _max = _mid - 1; |
| 1590 | else if (memory_range_name_table[_mid].first <= offset && |
| 1591 | memory_range_name_table[_mid].last >= offset) |
| 1592 | return memory_range_name_table[_mid].name; |
| 1593 | } |
| 1594 | return "- UNUSED"; |
| 1595 | } |
| 1596 | |
| 1597 | #endif |
| 1598 | |
| 1502 | 1599 | /** |
| 1600 | * @brief read the open bus for unused MMIO range |
| 1601 | */ |
| 1602 | READ16_MEMBER( alto2_cpu_device::noop_r ) |
| 1603 | { |
| 1604 | LOG((LOG_CPU,0," MMIO rd %s\n", memory_range_name(offset))); |
| 1605 | return 0177777; |
| 1606 | } |
| 1607 | |
| 1608 | /** |
| 1609 | * @brief write nowhere for unused MMIO range |
| 1610 | */ |
| 1611 | WRITE16_MEMBER( alto2_cpu_device::noop_w ) |
| 1612 | { |
| 1613 | LOG((LOG_CPU,0," MMIO wr %s\n", memory_range_name(offset))); |
| 1614 | } |
| 1615 | |
| 1616 | /** |
| 1503 | 1617 | * @brief read bank register in memory mapped I/O range |
| 1504 | 1618 | * |
| 1505 | 1619 | * The bank registers are stored in a 16x4-bit RAM 74S189. |
branches/alto2/src/emu/cpu/alto2/a2hw.c
| r26198 | r26199 | |
| 23 | 23 | |
| 24 | 24 | data = m_hw.utilin; |
| 25 | 25 | |
| 26 | | LOG((LOG_HW,2," read UTILIN %#o (%#o)\n", offset, data)); |
| 26 | if (!space.debugger_access()) { |
| 27 | LOG((LOG_HW,2," UTILIN rd %#o (%#o)\n", offset, data)); |
| 28 | } |
| 27 | 29 | return data; |
| 28 | 30 | } |
| 29 | 31 | |
| r26198 | r26199 | |
| 37 | 39 | { |
| 38 | 40 | UINT16 data = m_hw.xbus[offset & 3]; |
| 39 | 41 | |
| 40 | | LOG((LOG_HW,2," read XBUS[%d] %#o (%#o)\n", offset & 3, offset, data)); |
| 42 | if (!space.debugger_access()) { |
| 43 | LOG((LOG_HW,2," XBUS[%d] rd %#o (%#o)\n", offset & 3, offset, data)); |
| 44 | } |
| 41 | 45 | return data; |
| 42 | 46 | } |
| 43 | 47 | |
| r26198 | r26199 | |
| 51 | 55 | */ |
| 52 | 56 | WRITE16_MEMBER( alto2_cpu_device::xbus_w ) |
| 53 | 57 | { |
| 54 | | LOG((LOG_HW,2," write XBUS[%d] %#o (%#o)\n", offset & 3, offset, data)); |
| 58 | if (!space.debugger_access()) { |
| 59 | LOG((LOG_HW,2," XBUS[%d] wr %#o (%#o)\n", offset & 3, offset, data)); |
| 60 | } |
| 55 | 61 | m_hw.xbus[offset&3] = data; |
| 56 | 62 | } |
| 57 | 63 | |
| r26198 | r26199 | |
| 64 | 70 | READ16_MEMBER( alto2_cpu_device::utilout_r ) |
| 65 | 71 | { |
| 66 | 72 | UINT16 data = m_hw.utilout ^ 0177777; |
| 67 | | LOG((0,2," read UTILOUT %#o (%#o)\n", offset, data)); |
| 73 | if (!space.debugger_access()) { |
| 74 | LOG((0,2," UTILOUT rd %#o (%#o)\n", offset, data)); |
| 75 | } |
| 68 | 76 | return data; |
| 69 | 77 | } |
| 70 | 78 | |
| r26198 | r26199 | |
| 78 | 86 | */ |
| 79 | 87 | WRITE16_MEMBER( alto2_cpu_device::utilout_w ) |
| 80 | 88 | { |
| 81 | | LOG((LOG_HW,2," write UTILOUT %#o (%#o)\n", offset, data)); |
| 89 | if (!space.debugger_access()) { |
| 90 | LOG((LOG_HW,2," UTILOUT wr %#o (%#o)\n", offset, data)); |
| 91 | } |
| 82 | 92 | m_hw.utilout = data ^ 0177777; |
| 83 | 93 | |
| 84 | 94 | // FIXME: write printer data |
branches/alto2/src/emu/cpu/alto2/a2mem.c
| r26198 | r26199 | |
| 494 | 494 | READ16_MEMBER( alto2_cpu_device::mear_r ) |
| 495 | 495 | { |
| 496 | 496 | int data = m_mem.error ? m_mem.mear : m_mem.mar; |
| 497 | | LOG((LOG_MEM,2," MEAR read %07o\n", data)); |
| 497 | if (!space.debugger_access()) { |
| 498 | LOG((LOG_MEM,2," MEAR read %07o\n", data)); |
| 499 | } |
| 498 | 500 | return data; |
| 499 | 501 | } |
| 500 | 502 | |
| r26198 | r26199 | |
| 517 | 519 | READ16_MEMBER( alto2_cpu_device::mesr_r ) |
| 518 | 520 | { |
| 519 | 521 | UINT16 data = m_mem.mesr ^ 0177777; |
| 520 | | LOG((LOG_MEM,2," MESR read %07o\n", data)); |
| 521 | | LOG((LOG_MEM,6," Hamming code read : %#o\n", GET_MESR_HAMMING(data))); |
| 522 | | LOG((LOG_MEM,6," Parity error : %o\n", GET_MESR_PERR(data))); |
| 523 | | LOG((LOG_MEM,6," Memory parity bit : %o\n", GET_MESR_PARITY(data))); |
| 522 | if (!space.debugger_access()) { |
| 523 | LOG((LOG_MEM,2," MESR read %07o\n", data)); |
| 524 | LOG((LOG_MEM,6," Hamming code read : %#o\n", GET_MESR_HAMMING(data))); |
| 525 | LOG((LOG_MEM,6," Parity error : %o\n", GET_MESR_PERR(data))); |
| 526 | LOG((LOG_MEM,6," Memory parity bit : %o\n", GET_MESR_PARITY(data))); |
| 524 | 527 | #if ALTO2_HAMMING_CHECK |
| 525 | | LOG((LOG_MEM,6," Hamming syndrome : %#o (bit #%d)\n", GET_MESR_SYNDROME(data), hamming_lut[GET_MESR_SYNDROME(data)])); |
| 528 | LOG((LOG_MEM,6," Hamming syndrome : %#o (bit #%d)\n", GET_MESR_SYNDROME(data), hamming_lut[GET_MESR_SYNDROME(data)])); |
| 526 | 529 | #else |
| 527 | | LOG((LOG_MEM,6," Hamming syndrome : %#o\n", GET_MESR_SYNDROME(data))); |
| 530 | LOG((LOG_MEM,6," Hamming syndrome : %#o\n", GET_MESR_SYNDROME(data))); |
| 528 | 531 | #endif |
| 529 | | LOG((LOG_MEM,6," Memory bank : %#o\n", GET_MESR_BANK(data))); |
| 532 | LOG((LOG_MEM,6," Memory bank : %#o\n", GET_MESR_BANK(data))); |
| 533 | } |
| 530 | 534 | return data; |
| 531 | 535 | } |
| 532 | 536 | |
| 533 | 537 | WRITE16_MEMBER( alto2_cpu_device::mesr_w ) |
| 534 | 538 | { |
| 535 | | LOG((LOG_MEM,2," MESR write %07o (clear MESR; was %07o)\n", data, m_mem.mesr)); |
| 539 | if (!space.debugger_access()) { |
| 540 | LOG((LOG_MEM,2," MESR write %07o (clear MESR; was %07o)\n", data, m_mem.mesr)); |
| 541 | } |
| 536 | 542 | m_mem.mesr = 0; // set all bits to 0 |
| 537 | 543 | m_mem.error = 0; // reset the error flag |
| 538 | 544 | m_task_wakeup &= ~(1 << task_part); // clear the task wakeup for the parity error task |
| r26198 | r26199 | |
| 564 | 570 | m_mem.mecr = data ^ 0177777; |
| 565 | 571 | A2_PUT16(m_mem.mecr,16, 0, 3,0); |
| 566 | 572 | A2_PUT16(m_mem.mecr,16,15,15,0); |
| 567 | | LOG((LOG_MEM,2," MECR write %07o\n", data)); |
| 568 | | LOG((LOG_MEM,6," Test Hamming code : %#o\n", GET_MECR_TEST_CODE(m_mem.mecr))); |
| 569 | | LOG((LOG_MEM,6," Test mode : %s\n", GET_MECR_TEST_MODE(m_mem.mecr) ? "on" : "off")); |
| 570 | | LOG((LOG_MEM,6," INT on single-bit err: %s\n", GET_MECR_INT_SBERR(m_mem.mecr) ? "on" : "off")); |
| 571 | | LOG((LOG_MEM,6," INT on double-bit err: %s\n", GET_MECR_INT_DBERR(m_mem.mecr) ? "on" : "off")); |
| 572 | | LOG((LOG_MEM,6," Error correction : %s\n", GET_MECR_ERRCORR(m_mem.mecr) ? "off" : "on")); |
| 573 | if (!space.debugger_access()) { |
| 574 | LOG((LOG_MEM,2," MECR write %07o\n", data)); |
| 575 | LOG((LOG_MEM,6," Test Hamming code : %#o\n", GET_MECR_TEST_CODE(m_mem.mecr))); |
| 576 | LOG((LOG_MEM,6," Test mode : %s\n", GET_MECR_TEST_MODE(m_mem.mecr) ? "on" : "off")); |
| 577 | LOG((LOG_MEM,6," INT on single-bit err: %s\n", GET_MECR_INT_SBERR(m_mem.mecr) ? "on" : "off")); |
| 578 | LOG((LOG_MEM,6," INT on double-bit err: %s\n", GET_MECR_INT_DBERR(m_mem.mecr) ? "on" : "off")); |
| 579 | LOG((LOG_MEM,6," Error correction : %s\n", GET_MECR_ERRCORR(m_mem.mecr) ? "off" : "on")); |
| 580 | } |
| 573 | 581 | } |
| 574 | 582 | |
| 575 | 583 | /** |
| r26198 | r26199 | |
| 579 | 587 | { |
| 580 | 588 | UINT16 data = m_mem.mecr ^ 0177777; |
| 581 | 589 | /* set all spare bits */ |
| 582 | | LOG((LOG_MEM,2," MECR read %07o\n", data)); |
| 583 | | LOG((LOG_MEM,6," Test Hamming code : %#o\n", GET_MECR_TEST_CODE(data))); |
| 584 | | LOG((LOG_MEM,6," Test mode : %s\n", GET_MECR_TEST_MODE(data) ? "on" : "off")); |
| 585 | | LOG((LOG_MEM,6," INT on single-bit err: %s\n", GET_MECR_INT_SBERR(data) ? "on" : "off")); |
| 586 | | LOG((LOG_MEM,6," INT on double-bit err: %s\n", GET_MECR_INT_DBERR(data) ? "on" : "off")); |
| 587 | | LOG((LOG_MEM,6," Error correction : %s\n", GET_MECR_ERRCORR(data) ? "off" : "on")); |
| 590 | if (!space.debugger_access()) { |
| 591 | LOG((LOG_MEM,2," MECR read %07o\n", data)); |
| 592 | LOG((LOG_MEM,6," Test Hamming code : %#o\n", GET_MECR_TEST_CODE(data))); |
| 593 | LOG((LOG_MEM,6," Test mode : %s\n", GET_MECR_TEST_MODE(data) ? "on" : "off")); |
| 594 | LOG((LOG_MEM,6," INT on single-bit err: %s\n", GET_MECR_INT_SBERR(data) ? "on" : "off")); |
| 595 | LOG((LOG_MEM,6," INT on double-bit err: %s\n", GET_MECR_INT_DBERR(data) ? "on" : "off")); |
| 596 | LOG((LOG_MEM,6," Error correction : %s\n", GET_MECR_ERRCORR(data) ? "off" : "on")); |
| 597 | } |
| 588 | 598 | return data; |
| 589 | 599 | } |
| 590 | 600 | |