branches/alto2/src/emu/cpu/alto2/alto2.c
| r26050 | r26051 | |
| 206 | 206 | m_icountptr = &m_icount; |
| 207 | 207 | |
| 208 | 208 | // reverse dwords and invert hardware specific bits |
| 209 | const UINT32 addrxor = 2 * (ALTO2_UCODE_PAGE_SIZE - 1); |
| 210 | UINT32* temp = auto_alloc_array(machine(), UINT32, 2 * ALTO2_UCODE_PAGE_SIZE); |
| 211 | UINT32 ucode; |
| 209 | 212 | for (UINT32 addr = 0; addr < ALTO2_UCODE_PAGE_SIZE; addr++) { |
| 210 | | UINT32 ucode = m_ucode->read_dword(4*addr); |
| 211 | | ucode ^= ALTO2_UCODE_INVERTED; |
| 212 | | m_ucode->write_dword(4*addr, ucode); |
| 213 | ucode = m_ucode->read_dword(2*addr ^ addrxor); |
| 214 | temp[addr] = ucode ^ ALTO2_UCODE_INVERTED; |
| 215 | ucode = m_ucode->read_dword(2*(ALTO2_UCODE_PAGE_SIZE+addr) ^ addrxor); |
| 216 | temp[ALTO2_UCODE_PAGE_SIZE+addr] = ucode ^ ALTO2_UCODE_INVERTED; |
| 213 | 217 | } |
| 214 | | for (UINT32 addr = ALTO2_UCODE_PAGE_SIZE; addr < 2*ALTO2_UCODE_PAGE_SIZE; addr++) { |
| 215 | | UINT32 ucode = m_ucode->read_dword(4*addr); |
| 216 | | ucode ^= ALTO2_UCODE_INVERTED; |
| 217 | | m_ucode->write_dword(4*addr, ucode); |
| 218 | for (UINT32 addr = 0; addr < 2*ALTO2_UCODE_PAGE_SIZE; addr++) { |
| 219 | m_ucode->write_dword(2*addr, temp[addr]); |
| 218 | 220 | } |
| 219 | 221 | |
| 220 | | for (UINT32 addr = 0; addr < 256; addr++) { |
| 221 | | printf("%02x: %04x\n", addr, m_const->read_word(addr)); |
| 222 | | } |
| 223 | | |
| 224 | 222 | hard_reset(); |
| 225 | 223 | } |
| 226 | 224 | |
| r26050 | r26051 | |
| 1971 | 1969 | /** @brief reset the various registers */ |
| 1972 | 1970 | void alto2_cpu_device::hard_reset() |
| 1973 | 1971 | { |
| 1974 | | static const UINT8 ctl2k_u3[256] = { |
| 1975 | | /* 0000 */ 000,000,013,016,012,016,014,016,000,001,013,016,012,016,016,016, |
| 1976 | | /* 0020 */ 010,001,013,016,012,016,015,016,010,001,013,016,012,016,017,016, |
| 1977 | | /* 0040 */ 004,001,013,017,012,017,014,017,004,001,013,017,012,017,016,017, |
| 1978 | | /* 0060 */ 014,001,013,017,012,017,015,017,014,001,013,017,012,017,017,017, |
| 1979 | | /* 0100 */ 002,001,013,016,012,016,014,016,002,001,013,016,012,016,016,016, |
| 1980 | | /* 0120 */ 012,001,013,016,012,016,015,016,012,001,013,016,012,016,017,016, |
| 1981 | | /* 0140 */ 006,001,013,017,012,017,014,017,006,013,013,017,012,017,016,017, |
| 1982 | | /* 0160 */ 017,001,013,017,012,017,015,017,017,001,013,017,012,017,017,017, |
| 1983 | | /* 0200 */ 011,001,013,016,012,016,014,016,011,016,013,016,012,016,016,016, |
| 1984 | | /* 0220 */ 001,001,013,016,012,016,015,016,001,001,013,016,012,016,017,016, |
| 1985 | | /* 0240 */ 005,001,013,017,012,017,014,017,005,013,013,017,012,017,016,017, |
| 1986 | | /* 0260 */ 015,001,013,017,012,017,015,017,015,014,013,017,012,017,017,017, |
| 1987 | | /* 0300 */ 003,001,013,016,012,016,014,016,003,001,013,016,012,016,016,016, |
| 1988 | | /* 0320 */ 013,001,013,016,012,016,015,016,013,001,013,016,012,016,017,016, |
| 1989 | | /* 0340 */ 007,001,013,017,012,017,014,017,007,001,013,017,012,017,016,017, |
| 1990 | | /* 0360 */ 016,001,013,017,012,017,015,017,016,015,013,017,012,017,017,017 |
| 1991 | | }; |
| 1992 | | memcpy(m_ctl2k_u3, ctl2k_u3, sizeof(m_ctl2k_u3)); |
| 1972 | UINT8* ctl2k = machine().root_device().memregion("2k_ctrl")->base(); |
| 1973 | m_ctl2k_u3 = ctl2k; // FIXME: region=2k_ctrl offset=00000 |
| 1974 | m_ctl2k_u76 = ctl2k + 00400; // FIXME: region=2k_ctrl offset=00400 |
| 1975 | m_cram3k_a37 = ctl2k + 01000; // FIXME: region=2k_ctrl offset=01000 |
| 1976 | m_ctl2k_u38 = ctl2k + 01400; // FIXME: region=2k_ctrl offset=01400 |
| 1977 | m_alu_a10 = ctl2k + 01440; // FIXME: region=2k_ctrl offset=01440 |
| 1993 | 1978 | |
| 1994 | | static const UINT8 ctl2k_u38[32] = { |
| 1995 | | /* 0000 */ 0367,0353,0323,0315,0265,0251,0221,0216, |
| 1996 | | /* 0010 */ 0166,0152,0122,0114,0064,0050,0020,0017, |
| 1997 | | /* 0020 */ 0000,0000,0000,0000,0000,0000,0000,0000, |
| 1998 | | /* 0030 */ 0000,0000,0000,0000,0000,0000,0000,0000 |
| 1999 | | }; |
| 2000 | | memcpy(m_ctl2k_u38, ctl2k_u38, sizeof(m_ctl2k_u38)); |
| 1979 | UINT8* memory = machine().root_device().memregion("memory")->base(); |
| 1980 | m_madr_a32 = memory; // FIXME: region=memory offset=00000 |
| 1981 | m_madr_a64 = memory + 00400; // FIXME: region=memory offset=00400 |
| 1982 | m_madr_a65 = memory + 01000; // FIXME: region=memory offset=01000 |
| 2001 | 1983 | |
| 2002 | | static const UINT8 ctl2k_u76[256] = { |
| 2003 | | /* 0000 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2004 | | /* 0020 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2005 | | /* 0040 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2006 | | /* 0060 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2007 | | /* 0100 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2008 | | /* 0120 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2009 | | /* 0140 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2010 | | /* 0160 */ 000,014,000,000,000,000,000,000,014,000,000,000,000,000,000,000, |
| 2011 | | /* 0200 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2012 | | /* 0220 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2013 | | /* 0240 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2014 | | /* 0260 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2015 | | /* 0300 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2016 | | /* 0320 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2017 | | /* 0340 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000, |
| 2018 | | /* 0360 */ 000,014,000,000,000,000,000,000,000,014,000,000,000,000,000,000 |
| 2019 | | }; |
| 2020 | | memcpy(m_ctl2k_u76, ctl2k_u76, sizeof(m_ctl2k_u76)); |
| 1984 | UINT8* displ = machine().root_device().memregion("displ")->base(); |
| 1985 | m_disp_a38 = displ; // FIXME: region=displ offset=00000 |
| 1986 | m_disp_a66 = displ + 00400; // FIXME: region=displ offset=00400 |
| 1987 | m_disp_a63 = displ + 01000; // FIXME: region=displ offset=01000 |
| 2021 | 1988 | |
| 2022 | | static const UINT8 cram3k_a37[256] = { |
| 2023 | | /* 0000 */ 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, |
| 2024 | | /* 0020 */ 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, |
| 2025 | | /* 0040 */ 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, |
| 2026 | | /* 0060 */ 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, |
| 2027 | | /* 0100 */ 014,014,014,014,014,014,014,014,014,014,014,014,014,014,014,014, |
| 2028 | | /* 0120 */ 014,014,014,016,014,014,014,004,014,014,014,010,014,014,014,015, |
| 2029 | | /* 0140 */ 015,015,015,015,015,015,015,015,015,015,015,015,015,015,015,015, |
| 2030 | | /* 0160 */ 015,015,015,017,015,015,015,005,015,015,015,011,015,015,015,014, |
| 2031 | | /* 0200 */ 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, |
| 2032 | | /* 0220 */ 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, |
| 2033 | | /* 0240 */ 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, |
| 2034 | | /* 0260 */ 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, |
| 2035 | | /* 0300 */ 014,014,014,014,014,014,014,014,014,014,014,014,014,014,014,014, |
| 2036 | | /* 0320 */ 014,014,014,016,014,014,014,014,014,014,014,014,014,014,014,015, |
| 2037 | | /* 0340 */ 015,015,015,015,015,015,015,015,015,015,015,015,015,015,015,015, |
| 2038 | | /* 0360 */ 015,015,015,017,015,015,015,015,015,015,015,015,015,015,015,014 |
| 2039 | | }; |
| 2040 | | memcpy(m_cram3k_a37, cram3k_a37, sizeof(m_cram3k_a37)); |
| 1989 | UINT8* ether = machine().root_device().memregion("ether")->base(); |
| 1990 | m_ether_a41 = ether; // FIXME: region=ether offset=00000 |
| 1991 | m_ether_a42 = ether + 00400; // FIXME: region=ether offset=00400 |
| 1992 | m_ether_a49 = ether + 01000; // FIXME: region=ether offset=01000 |
| 2041 | 1993 | |
| 2042 | | static const UINT8 madr_a64[256] = { |
| 2043 | | /* 0000 */ 004,004,004,004,004,004,004,004,004,004,004,004,004,004,004,004, |
| 2044 | | /* 0020 */ 004,004,004,004,004,004,004,004,004,004,004,004,004,004,004,004, |
| 2045 | | /* 0040 */ 004,004,004,004,004,004,004,004,004,004,004,004,004,004,004,004, |
| 2046 | | /* 0060 */ 004,004,004,004,004,004,004,004,004,004,004,004,004,004,004,004, |
| 2047 | | /* 0100 */ 004,004,004,004,004,004,004,004,004,004,004,004,004,004,004,004, |
| 2048 | | /* 0120 */ 004,004,004,004,004,004,004,004,004,004,004,004,004,004,004,004, |
| 2049 | | /* 0140 */ 004,004,004,004,004,004,004,004,004,004,004,004,004,004,004,004, |
| 2050 | | /* 0160 */ 004,004,004,004,004,004,004,004,004,004,004,004,004,004,004,004, |
| 2051 | | /* 0200 */ 004,004,004,004,004,004,000,000,004,004,004,004,004,004,004,004, |
| 2052 | | /* 0220 */ 004,004,004,004,004,004,004,004,004,004,004,004,004,004,004,004, |
| 2053 | | /* 0240 */ 004,004,004,004,004,004,000,000,004,004,004,004,004,004,004,004, |
| 2054 | | /* 0260 */ 004,004,004,004,004,004,004,014,004,004,004,004,004,005,004,004, |
| 2055 | | /* 0300 */ 004,004,004,004,004,004,000,000,004,004,004,004,004,004,004,004, |
| 2056 | | /* 0320 */ 004,004,004,004,004,004,006,006,004,004,004,004,004,004,004,004, |
| 2057 | | /* 0340 */ 004,004,004,004,004,004,000,000,004,004,004,004,004,004,004,004, |
| 2058 | | /* 0360 */ 004,004,004,004,004,004,004,004,004,004,004,004,004,005,004,004 |
| 2059 | | }; |
| 2060 | | memcpy(m_madr_a64, madr_a64, sizeof(m_madr_a64)); |
| 2061 | | |
| 2062 | | static const UINT8 madr_a65[256] = { |
| 2063 | | /* 0000 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 2064 | | /* 0020 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 2065 | | /* 0040 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 2066 | | /* 0060 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 2067 | | /* 0100 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 2068 | | /* 0120 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 2069 | | /* 0140 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 2070 | | /* 0160 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 2071 | | /* 0200 */ 007,007,007,007,007,017,007,017,007,007,007,007,007,014,007,014, |
| 2072 | | /* 0220 */ 007,007,007,007,007,015,007,015,007,007,007,007,007,013,007,016, |
| 2073 | | /* 0240 */ 007,007,007,007,007,017,007,017,007,007,007,007,007,014,007,014, |
| 2074 | | /* 0260 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,011,007,016, |
| 2075 | | /* 0300 */ 007,007,007,007,007,017,007,017,007,007,007,007,007,014,007,014, |
| 2076 | | /* 0320 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,012,007,016, |
| 2077 | | /* 0340 */ 007,007,007,007,007,017,007,017,007,007,007,007,007,014,007,014, |
| 2078 | | /* 0360 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,010,007,016 |
| 2079 | | }; |
| 2080 | | memcpy(m_madr_a65, madr_a65, sizeof(m_madr_a65)); |
| 2081 | | |
| 2082 | 1994 | /* all tasks start in ROM0 */ |
| 2083 | 1995 | m_reset_mode = 0xffff; |
| 2084 | 1996 | |
branches/alto2/src/emu/cpu/alto2/a2disp.c
| r26050 | r26051 | |
| 439 | 439 | { |
| 440 | 440 | int y; |
| 441 | 441 | |
| 442 | | UINT8 disp_a38[256] = { |
| 443 | | /* 0000 */ 003,013,015,013,015,013,017,013,015,013,017,013,015,013,017,013, |
| 444 | | /* 0020 */ 013,003,013,015,013,015,013,017,013,015,013,017,013,015,013,017, |
| 445 | | /* 0040 */ 013,015,003,013,013,017,015,013,013,017,015,013,013,017,015,013, |
| 446 | | /* 0060 */ 015,013,013,003,017,013,013,015,017,013,013,015,017,013,013,015, |
| 447 | | /* 0100 */ 013,017,015,013,003,013,015,013,013,017,015,013,015,013,017,013, |
| 448 | | /* 0120 */ 017,013,013,015,013,003,013,015,017,013,013,015,013,015,013,017, |
| 449 | | /* 0140 */ 013,015,013,017,013,015,003,013,013,015,013,017,013,017,015,013, |
| 450 | | /* 0160 */ 015,013,017,013,015,013,013,003,015,013,017,013,017,013,013,015, |
| 451 | | /* 0200 */ 013,017,015,013,015,013,017,013,003,013,015,013,015,013,017,013, |
| 452 | | /* 0220 */ 017,013,013,015,013,015,013,017,013,003,013,015,013,015,013,017, |
| 453 | | /* 0240 */ 013,015,013,017,013,017,015,013,013,015,003,013,013,017,015,013, |
| 454 | | /* 0260 */ 015,013,017,013,017,013,013,015,015,013,013,003,017,013,013,015, |
| 455 | | /* 0300 */ 013,017,015,013,013,017,015,013,013,017,015,013,003,013,015,013, |
| 456 | | /* 0320 */ 017,013,013,015,017,013,013,015,017,013,013,015,013,003,013,015, |
| 457 | | /* 0340 */ 013,015,013,017,013,015,013,017,013,015,013,017,013,015,003,013, |
| 458 | | /* 0360 */ 015,013,017,013,015,013,017,013,015,013,017,013,015,013,013,003 |
| 459 | | }; |
| 460 | | memcpy(m_disp_a38, disp_a38, sizeof(m_disp_a38)); |
| 461 | | |
| 462 | | UINT8 disp_a63[32] = { |
| 463 | | /* 0000 */ 0007,0013,0015,0021,0024,0030,0034,0040, |
| 464 | | /* 0010 */ 0044,0050,0054,0060,0064,0070,0074,0200, |
| 465 | | /* 0020 */ 0004,0010,0014,0020,0024,0030,0034,0040, |
| 466 | | /* 0030 */ 0044,0050,0054,0060,0064,0070,0175,0203 |
| 467 | | }; |
| 468 | | memcpy(m_disp_a63, disp_a63, sizeof(m_disp_a63)); |
| 469 | | |
| 470 | | UINT8 disp_a66[256] = { |
| 471 | | /* 0000 */ 013,013,013,013,013,012,012,012,012,012,012,012,012,013,013,013, |
| 472 | | /* 0020 */ 013,013,013,013,013,013,013,013,013,013,013,013,013,013,013,013, |
| 473 | | /* 0040 */ 013,013,013,013,013,013,013,013,013,013,013,013,013,013,013,013, |
| 474 | | /* 0060 */ 013,013,013,013,013,013,013,013,013,013,013,013,013,013,013,013, |
| 475 | | /* 0100 */ 013,013,013,013,017,017,017,017,017,017,017,017,017,017,017,017, |
| 476 | | /* 0120 */ 017,017,017,017,017,017,017,017,017,017,017,017,017,017,017,017, |
| 477 | | /* 0140 */ 017,017,017,017,017,017,017,017,017,017,017,017,017,017,017,017, |
| 478 | | /* 0160 */ 017,017,017,017,017,017,017,017,017,017,017,017,017,017,017,017, |
| 479 | | /* 0200 */ 017,017,017,017,017,017,017,017,017,017,017,017,017,017,017,017, |
| 480 | | /* 0220 */ 017,017,017,017,017,017,007,007,007,007,005,005,005,005,005,005, |
| 481 | | /* 0240 */ 005,005,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 482 | | /* 0260 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 483 | | /* 0300 */ 007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007, |
| 484 | | /* 0320 */ 007,007,007,007,007,007,007,007,017,017,017,017,017,017,017,017, |
| 485 | | /* 0340 */ 017,017,017,017,017,017,017,017,017,017,017,017,017,017,017,017, |
| 486 | | /* 0360 */ 017,017,017,017,017,017,017,017,017,017,017,017,017,017,017,017 |
| 487 | | }; |
| 488 | | memcpy(m_disp_a66, disp_a66, sizeof(m_disp_a66)); |
| 489 | | |
| 490 | 442 | memset(&m_dsp, 0, sizeof(m_dsp)); |
| 491 | 443 | m_dsp.hlc = ALTO2_DISPLAY_HLC_START; |
| 492 | 444 | m_dsp.raw_bitmap = (UINT16*)malloc(ALTO2_DISPLAY_HEIGHT * ALTO2_DISPLAY_SCANLINE_WORDS * sizeof(UINT16)); |