trunk/src/mame/machine/pgmprot_igs027a_type1.c
| r24687 | r24688 | |
| 1863 | 1863 | m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x400000, 0x400005, read16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_r),this), write16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_w),this)); |
| 1864 | 1864 | } |
| 1865 | 1865 | |
| 1866 | | DRIVER_INIT_MEMBER(pgm_arm_type1_state,puzzli2) |
| 1867 | | { |
| 1868 | | pgm_basic_init(); |
| 1869 | | pgm_puzzli2_decrypt(machine()); |
| 1870 | | arm_sim_handler = &pgm_arm_type1_state::command_handler_puzzli2; |
| 1871 | | m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x500000, 0x500005, read16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_r),this), write16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_w),this)); |
| 1872 | | m_maincpu->space(AS_PROGRAM).install_read_handler(0x4f0000, 0x4f003f, read16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_protram_r),this)); |
| 1873 | | m_irq4_disabled = 1; // // doesn't like this irq?? |
| 1874 | 1866 | |
| 1875 | | //#define PUZZLI2_LEVEL_STRUCTURE_LOG |
| 1876 | | #ifdef PUZZLI2_LEVEL_STRUCTURE_LOG |
| 1877 | | UINT8 *src2 = (UINT8 *) (machine().root_device().memregion("maincpu")->base()); |
| 1878 | | UINT8 new_puzzli2_level_decode[256]; |
| 1879 | 1867 | |
| 1880 | | for (int i=0;i<256;i++) |
| 1881 | | new_puzzli2_level_decode[i] = puzzli2_level_decode[i]; |
| 1882 | 1868 | |
| 1883 | | int offset; |
| 1884 | | int limit; |
| 1885 | | UINT8 coverage[256]; // coverage is how much of the table we've managed to verify using known facts about the table structure |
| 1886 | | for (int i=0;i<256;i++) |
| 1887 | | coverage[i] = 0; |
| 1888 | | |
| 1889 | | if (!strcmp(machine().system().name,"puzzli2")) |
| 1869 | int pgm_arm_type1_state::puzzli2_take_leveldata_value(UINT8 datvalue) |
| 1870 | { |
| 1871 | if (stage==-1) |
| 1890 | 1872 | { |
| 1891 | | offset = 0x17ab66; |
| 1892 | | limit = 476; |
| 1873 | printf("%02x <- table offset\n", datvalue); |
| 1874 | tableoffs = datvalue; |
| 1875 | tableoffs2 = 0; |
| 1876 | stage = 0; |
| 1893 | 1877 | } |
| 1894 | 1878 | else |
| 1895 | 1879 | { |
| 1896 | | offset = 0x16c3ca; |
| 1897 | | limit = 500; |
| 1898 | | } |
| 1880 | |
| 1881 | UINT8 rawvalue = datvalue; |
| 1882 | UINT8 tableloc = (tableoffs+tableoffs2)&0xff; |
| 1883 | rawvalue ^= puzzli2_level_decode[tableloc]; |
| 1899 | 1884 | |
| 1885 | tableoffs2++; |
| 1886 | tableoffs2&=0xf; |
| 1900 | 1887 | |
| 1901 | | for (int i=0;i<limit;i++) |
| 1902 | | { |
| 1903 | | UINT32 val1 = (src2[offset+1]<<24) | (src2[offset+0] << 16) | (src2[offset+3]<<8) | (src2[offset+2] << 0); |
| 1904 | | offset += 4; |
| 1905 | | UINT32 val2 = (src2[offset+1]<<24) | (src2[offset+0] << 16) | (src2[offset+3]<<8) | (src2[offset+2] << 0); |
| 1888 | if (stage==0) |
| 1889 | { |
| 1890 | stage = 1; |
| 1906 | 1891 | |
| 1907 | | int stage = 0; |
| 1892 | // this seems to be the first thing returned back when reading the level structure always seems to be 0x8 or 0x7, makes sense, levels would be too difficult otherwise ;-) (actually puzzli2 seems to have one specifying 5 unless it's a decrypt table error?!) |
| 1893 | depth = (rawvalue & 0xf0); |
| 1894 | numbercolumns = (rawvalue & 0x0f); |
| 1895 | numbercolumns++; |
| 1908 | 1896 | |
| 1909 | | printf("(%d) data range %08x %08x\n", i, val1, val2); |
| 1897 | printf("%02x <- Sizes (level depth %01x) (number of columns %01x)", rawvalue, depth>>4, numbercolumns); |
| 1910 | 1898 | |
| 1911 | | int tableoffs = 0; |
| 1912 | | int tableoffs2 = 0; |
| 1913 | | int entries_left = 0; |
| 1914 | | int currentcolumn = 0; |
| 1915 | | int num_entries = 0; |
| 1916 | | int full_entry = 0; |
| 1917 | | int prev_tablloc = 0; |
| 1918 | | int x = 0; |
| 1919 | | int numbercolumns = 0; |
| 1920 | | int depth; |
| 1921 | 1899 | |
| 1922 | | for (x=val1; x<val2;x++) |
| 1923 | | { |
| 1924 | | |
| 1925 | | if (x==val1) |
| 1926 | | { |
| 1927 | | printf("%02x <- table offset\n", src2[x^1]); |
| 1928 | | tableoffs = src2[x^1]; |
| 1929 | | tableoffs2 = 0; |
| 1930 | | } |
| 1931 | | else |
| 1932 | | { |
| 1933 | | |
| 1934 | | UINT8 rawvalue = src2[x^1]; |
| 1935 | | UINT8 tableloc = (tableoffs+tableoffs2)&0xff; |
| 1936 | | rawvalue ^= puzzli2_level_decode[tableloc]; |
| 1900 | if ((depth != 0x80) && (depth != 0x70) && (depth != 0x50)) |
| 1901 | fatalerror("depth isn't 0x5, 0x7 or 0x8"); |
| 1937 | 1902 | |
| 1938 | | tableoffs2++; |
| 1939 | | tableoffs2&=0xf; |
| 1940 | 1903 | |
| 1941 | | if (stage==0) |
| 1942 | | { |
| 1943 | | stage = 1; |
| 1944 | 1904 | |
| 1945 | | // this seems to be the first thing returned back when reading the level structure always seems to be 0x8 or 0x7, makes sense, levels would be too difficult otherwise ;-) (actually puzzli2 seems to have one specifying 5 unless it's a decrypt table error?!) |
| 1946 | | depth = (rawvalue & 0xf0); |
| 1947 | | numbercolumns = (rawvalue & 0x0f); |
| 1948 | | numbercolumns++; |
| 1905 | // it seems to use this to specify the number of columns, ie how many data structures follow, so that the ARM knows when to send back the 'finished' flag. |
| 1906 | // it also gets returned at the end with said flag |
| 1907 | if ((numbercolumns != 0x6) && (numbercolumns != 0x7) && (numbercolumns != 0x8)) |
| 1908 | fatalerror("number of columns specified isn't 6,7, or 8"); |
| 1949 | 1909 | |
| 1950 | | printf("%02x <- Sizes (level depth %01x) (number of columns %01x)", rawvalue, depth>>4, numbercolumns); |
| 1910 | printf("\n"); |
| 1951 | 1911 | |
| 1912 | } |
| 1913 | else if (stage==1) |
| 1914 | { |
| 1915 | printf("%02x <- Number of Entries for this Column (column is %d) (xor table location is %02x) ", rawvalue, currentcolumn, tableloc); |
| 1916 | stage = 2; |
| 1917 | entries_left = (rawvalue >> 4); |
| 1918 | full_entry = rawvalue; |
| 1919 | prev_tablloc = tableloc; |
| 1952 | 1920 | |
| 1953 | | if ((depth != 0x80) && (depth != 0x70) && (depth != 0x50)) |
| 1954 | | fatalerror("depth isn't 0x5, 0x7 or 0x8"); |
| 1921 | num_entries = entries_left; |
| 1955 | 1922 | |
| 1923 | if (num_entries == 0x00) |
| 1924 | { |
| 1925 | printf("0 entries for this column?"); // seems a valid condition based on the data |
| 1926 | } |
| 1956 | 1927 | |
| 1957 | 1928 | |
| 1958 | | // it seems to use this to specify the number of columns, ie how many data structures follow, so that the ARM knows when to send back the 'finished' flag. |
| 1959 | | // it also gets returned at the end with said flag |
| 1960 | | if ((numbercolumns != 0x6) && (numbercolumns != 0x7) && (numbercolumns != 0x8)) |
| 1961 | | fatalerror("number of columns specified isn't 6,7, or 8"); |
| 1962 | 1929 | |
| 1963 | | printf("\n"); |
| 1930 | printf("\n"); |
| 1964 | 1931 | |
| 1932 | |
| 1933 | } |
| 1934 | else if (stage==2) |
| 1935 | { |
| 1936 | printf("%02x <- Mask value equal to number of entries (xor table location is %02x)", rawvalue, tableloc); |
| 1937 | stage = 3; |
| 1938 | |
| 1939 | // |
| 1940 | if (entries_left == 0) |
| 1941 | { |
| 1942 | // for 0 entries skip back to state 1 instead of 3, because there is nothing following |
| 1943 | stage = 1; |
| 1944 | currentcolumn++; |
| 1945 | |
| 1946 | coverage[tableloc] = 1; |
| 1947 | if (rawvalue!=0) |
| 1948 | { |
| 1949 | printf(" invalid mask after 00 length?"); |
| 1950 | // attempt to correct the table |
| 1951 | //new_puzzli2_level_decode[tableloc] = new_puzzli2_level_decode[tableloc] ^ rawvalue; |
| 1952 | |
| 1965 | 1953 | } |
| 1966 | | else if (stage==1) |
| 1954 | coverage[prev_tablloc] = 1; |
| 1955 | if (full_entry!=0) |
| 1967 | 1956 | { |
| 1968 | | printf("%02x <- Number of Entries for this Column (column is %d) (xor table location is %02x) ", rawvalue, currentcolumn, tableloc); |
| 1969 | | stage = 2; |
| 1970 | | entries_left = (rawvalue >> 4); |
| 1971 | | full_entry = rawvalue; |
| 1972 | | prev_tablloc = tableloc; |
| 1957 | printf(" previous value wasn't 0x00"); |
| 1958 | } |
| 1973 | 1959 | |
| 1974 | | num_entries = entries_left; |
| 1960 | if (currentcolumn==numbercolumns) |
| 1961 | { |
| 1962 | return 1; |
| 1963 | } |
| 1964 | |
| 1965 | } |
| 1966 | else |
| 1967 | { |
| 1968 | if (num_entries> 0xa) |
| 1969 | { |
| 1970 | printf(" more than 10 entries?"); |
| 1971 | } |
| 1972 | else |
| 1973 | { |
| 1974 | coverage[tableloc] = 1; |
| 1975 | 1975 | |
| 1976 | | if (num_entries == 0x00) |
| 1976 | int desired_mask = 0; |
| 1977 | |
| 1978 | if (num_entries==0x00) desired_mask = 0x00; |
| 1979 | if (num_entries==0x01) desired_mask = 0x01; |
| 1980 | if (num_entries==0x02) desired_mask = 0x03; |
| 1981 | if (num_entries==0x03) desired_mask = 0x07; |
| 1982 | if (num_entries==0x04) desired_mask = 0x0f; |
| 1983 | if (num_entries==0x05) desired_mask = 0x1f; |
| 1984 | if (num_entries==0x06) desired_mask = 0x3f; |
| 1985 | if (num_entries==0x07) desired_mask = 0x7f; |
| 1986 | if (num_entries==0x08) desired_mask = 0xff; |
| 1987 | if (num_entries==0x09) desired_mask = 0xff; |
| 1988 | if (num_entries==0x0a) desired_mask = 0xff; |
| 1989 | |
| 1990 | if (rawvalue!=desired_mask) |
| 1977 | 1991 | { |
| 1978 | | printf("0 entries for this column?"); // seems a valid condition based on the data |
| 1992 | printf(" possible wrong mask?"); |
| 1979 | 1993 | } |
| 1980 | 1994 | |
| 1981 | 1995 | |
| 1982 | | |
| 1983 | | printf("\n"); |
| 1984 | | |
| 1985 | | |
| 1986 | 1996 | } |
| 1987 | | else if (stage==2) |
| 1988 | | { |
| 1989 | | printf("%02x <- Mask value equal to number of entries (xor table location is %02x)", rawvalue, tableloc); |
| 1990 | | stage = 3; |
| 1991 | 1997 | |
| 1992 | | // |
| 1993 | | if (entries_left == 0) |
| 1994 | | { |
| 1995 | | // for 0 entries skip back to state 1 instead of 3, because there is nothing following |
| 1996 | | stage = 1; |
| 1997 | | currentcolumn++; |
| 1998 | } |
| 1998 | 1999 | |
| 1999 | | coverage[tableloc] = 1; |
| 2000 | | if (rawvalue!=0) |
| 2001 | | { |
| 2002 | | printf(" invalid mask after 00 length?"); |
| 2003 | | // attempt to correct the table |
| 2004 | | //new_puzzli2_level_decode[tableloc] = new_puzzli2_level_decode[tableloc] ^ rawvalue; |
| 2000 | printf("\n"); |
| 2005 | 2001 | |
| 2006 | | } |
| 2007 | | coverage[prev_tablloc] = 1; |
| 2008 | | if (full_entry!=0) |
| 2009 | | { |
| 2010 | | printf(" previous value wasn't 0x00"); |
| 2011 | | } |
| 2002 | } |
| 2003 | else if (stage==3) |
| 2004 | { |
| 2005 | // some of these might be due to bad decrypt values in the table |
| 2006 | if (rawvalue==0x00) printf("%02x <- fish type 0\n", rawvalue); |
| 2007 | else if (rawvalue==0x01) printf("%02x <- fish type 1\n", rawvalue); |
| 2008 | else if (rawvalue==0x02) printf("%02x <- fish type 2\n", rawvalue); |
| 2009 | else if (rawvalue==0x03) printf("%02x <- fish type 3\n", rawvalue); |
| 2010 | else if (rawvalue==0x04) printf("%02x <- fish type 4\n", rawvalue); |
| 2011 | else if (rawvalue==0x05) printf("%02x <- fish type 5\n", rawvalue); |
| 2012 | else if (rawvalue==0x06) printf("%02x <- fish type 6\n", rawvalue); |
| 2013 | else if (rawvalue==0x07) printf("%02x <- fish type 7\n", rawvalue); |
| 2012 | 2014 | |
| 2013 | | } |
| 2014 | | else |
| 2015 | | { |
| 2016 | | if (num_entries> 0xa) |
| 2017 | | { |
| 2018 | | printf(" more than 10 entries?"); |
| 2019 | | } |
| 2020 | | else |
| 2021 | | { |
| 2022 | | coverage[tableloc] = 1; |
| 2015 | else if (rawvalue==0x08) printf("%02x <- ?? 08\n", rawvalue); |
| 2023 | 2016 | |
| 2024 | | int desired_mask = 0; |
| 2017 | else if (rawvalue==0x0b) printf("%02x <- ?? 0b\n", rawvalue); |
| 2018 | else if (rawvalue==0x0c) printf("%02x <- ?? 0c\n", rawvalue); |
| 2019 | else if (rawvalue==0x0d) printf("%02x <- ?? 0d\n", rawvalue); |
| 2020 | else if (rawvalue==0x0e) printf("%02x <- ?? 0e\n", rawvalue); |
| 2021 | else if (rawvalue==0x0f) printf("%02x <- ?? 0f\n", rawvalue); |
| 2022 | else if (rawvalue==0x10) printf("%02x <- ?? 10\n", rawvalue); |
| 2023 | else if (rawvalue==0x11) printf("%02x <- ?? 11\n", rawvalue); |
| 2024 | else if (rawvalue==0x12) printf("%02x <- ?? 12\n", rawvalue); |
| 2025 | else if (rawvalue==0x13) printf("%02x <- ?? 13\n", rawvalue); |
| 2026 | else if (rawvalue==0x14) printf("%02x <- ?? 14\n", rawvalue); |
| 2027 | else if (rawvalue==0x15) printf("%02x <- ?? 15\n", rawvalue); |
| 2028 | else if (rawvalue==0x16) printf("%02x <- ?? 16\n", rawvalue); |
| 2029 | else if (rawvalue==0x17) printf("%02x <- ?? 17\n", rawvalue); |
| 2030 | else if (rawvalue==0x18) printf("%02x <- ?? 18\n", rawvalue); |
| 2031 | else if (rawvalue==0x19) printf("%02x <- ?? 19\n", rawvalue); |
| 2025 | 2032 | |
| 2026 | | if (num_entries==0x00) desired_mask = 0x00; |
| 2027 | | if (num_entries==0x01) desired_mask = 0x01; |
| 2028 | | if (num_entries==0x02) desired_mask = 0x03; |
| 2029 | | if (num_entries==0x03) desired_mask = 0x07; |
| 2030 | | if (num_entries==0x04) desired_mask = 0x0f; |
| 2031 | | if (num_entries==0x05) desired_mask = 0x1f; |
| 2032 | | if (num_entries==0x06) desired_mask = 0x3f; |
| 2033 | | if (num_entries==0x07) desired_mask = 0x7f; |
| 2034 | | if (num_entries==0x08) desired_mask = 0xff; |
| 2035 | | if (num_entries==0x09) desired_mask = 0xff; |
| 2036 | | if (num_entries==0x0a) desired_mask = 0xff; |
| 2033 | else if (rawvalue==0x1e) printf("%02x <- ?? 1e\n", rawvalue); |
| 2037 | 2034 | |
| 2038 | | if (rawvalue!=desired_mask) |
| 2039 | | { |
| 2040 | | printf(" possible wrong mask?"); |
| 2041 | | } |
| 2035 | else if (rawvalue==0x21) printf("%02x <- ?? 21\n", rawvalue); // puzzli2 |
| 2036 | else if (rawvalue==0x22) printf("%02x <- ?? 22\n", rawvalue); |
| 2037 | else if (rawvalue==0x23) printf("%02x <- ?? 23\n", rawvalue); |
| 2038 | else if (rawvalue==0x24) printf("%02x <- ?? 24\n", rawvalue); |
| 2039 | else if (rawvalue==0x25) printf("%02x <- ?? 25\n", rawvalue); |
| 2040 | else if (rawvalue==0x26) printf("%02x <- ?? 26\n", rawvalue); |
| 2041 | else if (rawvalue==0x27) printf("%02x <- ?? 27\n", rawvalue); |
| 2042 | else if (rawvalue==0x28) printf("%02x <- ?? 28\n", rawvalue); |
| 2043 | else if (rawvalue==0x29) printf("%02x <- ?? 29\n", rawvalue); |
| 2044 | else if (rawvalue==0x2a) printf("%02x <- ?? 2a\n", rawvalue); |
| 2042 | 2045 | |
| 2046 | else if (rawvalue==0x32) printf("%02x <- ?? 32\n", rawvalue); // puzzli2 |
| 2047 | else if (rawvalue==0x33) printf("%02x <- ?? 33\n", rawvalue); // puzzli2 |
| 2048 | else if (rawvalue==0x35) printf("%02x <- ?? 35\n", rawvalue); |
| 2049 | else if (rawvalue==0x38) printf("%02x <- ?? 38\n", rawvalue); // puzzli2 |
| 2043 | 2050 | |
| 2044 | | } |
| 2051 | else if (rawvalue==0x41) printf("%02x <- ?? 41\n", rawvalue); // puzzli2 |
| 2052 | else if (rawvalue==0x43) printf("%02x <- ?? 43\n", rawvalue); // puzzli2 |
| 2045 | 2053 | |
| 2046 | | } |
| 2054 | else if (rawvalue==0xd0) printf("%02x <- ?? d0\n", rawvalue); |
| 2047 | 2055 | |
| 2048 | | printf("\n"); |
| 2056 | else if (rawvalue==0xe0) printf("%02x <- ?? e0\n", rawvalue); |
| 2057 | else if (rawvalue==0xe1) printf("%02x <- ?? e1\n", rawvalue); |
| 2058 | else if (rawvalue==0xe2) printf("%02x <- ?? e2\n", rawvalue); |
| 2059 | else if (rawvalue==0xe3) printf("%02x <- ?? e3\n", rawvalue); |
| 2060 | else if (rawvalue==0xe4) printf("%02x <- ?? e3\n", rawvalue); |
| 2049 | 2061 | |
| 2062 | |
| 2063 | else printf("%02x <- unknown object\n", rawvalue); |
| 2064 | |
| 2065 | entries_left--; |
| 2066 | if (entries_left == 0) |
| 2067 | { |
| 2068 | stage = 1; |
| 2069 | currentcolumn++; |
| 2070 | |
| 2071 | if (currentcolumn==numbercolumns) |
| 2072 | { |
| 2073 | return 1; |
| 2050 | 2074 | } |
| 2051 | | else if (stage==3) |
| 2052 | | { |
| 2053 | | // some of these might be due to bad decrypt values in the table |
| 2054 | | if (rawvalue==0x00) printf("%02x <- fish type 0\n", rawvalue); |
| 2055 | | else if (rawvalue==0x01) printf("%02x <- fish type 1\n", rawvalue); |
| 2056 | | else if (rawvalue==0x02) printf("%02x <- fish type 2\n", rawvalue); |
| 2057 | | else if (rawvalue==0x03) printf("%02x <- fish type 3\n", rawvalue); |
| 2058 | | else if (rawvalue==0x04) printf("%02x <- fish type 4\n", rawvalue); |
| 2059 | | else if (rawvalue==0x05) printf("%02x <- fish type 5\n", rawvalue); |
| 2060 | | else if (rawvalue==0x06) printf("%02x <- fish type 6\n", rawvalue); |
| 2061 | | else if (rawvalue==0x07) printf("%02x <- fish type 7\n", rawvalue); |
| 2075 | |
| 2076 | } |
| 2077 | } |
| 2078 | |
| 2079 | } |
| 2080 | |
| 2081 | return 0; |
| 2082 | } |
| 2062 | 2083 | |
| 2063 | | else if (rawvalue==0x08) printf("%02x <- ?? 08\n", rawvalue); |
| 2064 | 2084 | |
| 2065 | | else if (rawvalue==0x0b) printf("%02x <- ?? 0b\n", rawvalue); |
| 2066 | | else if (rawvalue==0x0c) printf("%02x <- ?? 0c\n", rawvalue); |
| 2067 | | else if (rawvalue==0x0d) printf("%02x <- ?? 0d\n", rawvalue); |
| 2068 | | else if (rawvalue==0x0e) printf("%02x <- ?? 0e\n", rawvalue); |
| 2069 | | else if (rawvalue==0x0f) printf("%02x <- ?? 0f\n", rawvalue); |
| 2070 | | else if (rawvalue==0x10) printf("%02x <- ?? 10\n", rawvalue); |
| 2071 | | else if (rawvalue==0x11) printf("%02x <- ?? 11\n", rawvalue); |
| 2072 | | else if (rawvalue==0x12) printf("%02x <- ?? 12\n", rawvalue); |
| 2073 | | else if (rawvalue==0x13) printf("%02x <- ?? 13\n", rawvalue); |
| 2074 | | else if (rawvalue==0x14) printf("%02x <- ?? 14\n", rawvalue); |
| 2075 | | else if (rawvalue==0x15) printf("%02x <- ?? 15\n", rawvalue); |
| 2076 | | else if (rawvalue==0x16) printf("%02x <- ?? 16\n", rawvalue); |
| 2077 | | else if (rawvalue==0x17) printf("%02x <- ?? 17\n", rawvalue); |
| 2078 | | else if (rawvalue==0x18) printf("%02x <- ?? 18\n", rawvalue); |
| 2079 | | else if (rawvalue==0x19) printf("%02x <- ?? 19\n", rawvalue); |
| 2080 | 2085 | |
| 2081 | | else if (rawvalue==0x1e) printf("%02x <- ?? 1e\n", rawvalue); |
| 2086 | DRIVER_INIT_MEMBER(pgm_arm_type1_state,puzzli2) |
| 2087 | { |
| 2088 | pgm_basic_init(); |
| 2089 | pgm_puzzli2_decrypt(machine()); |
| 2090 | arm_sim_handler = &pgm_arm_type1_state::command_handler_puzzli2; |
| 2091 | m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x500000, 0x500005, read16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_r),this), write16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_w),this)); |
| 2092 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x4f0000, 0x4f003f, read16_delegate(FUNC(pgm_arm_type1_state::pgm_arm7_type1_sim_protram_r),this)); |
| 2093 | m_irq4_disabled = 1; // // doesn't like this irq?? |
| 2082 | 2094 | |
| 2083 | | else if (rawvalue==0x21) printf("%02x <- ?? 21\n", rawvalue); // puzzli2 |
| 2084 | | else if (rawvalue==0x22) printf("%02x <- ?? 22\n", rawvalue); |
| 2085 | | else if (rawvalue==0x23) printf("%02x <- ?? 23\n", rawvalue); |
| 2086 | | else if (rawvalue==0x24) printf("%02x <- ?? 24\n", rawvalue); |
| 2087 | | else if (rawvalue==0x25) printf("%02x <- ?? 25\n", rawvalue); |
| 2088 | | else if (rawvalue==0x26) printf("%02x <- ?? 26\n", rawvalue); |
| 2089 | | else if (rawvalue==0x27) printf("%02x <- ?? 27\n", rawvalue); |
| 2090 | | else if (rawvalue==0x28) printf("%02x <- ?? 28\n", rawvalue); |
| 2091 | | else if (rawvalue==0x29) printf("%02x <- ?? 29\n", rawvalue); |
| 2092 | | else if (rawvalue==0x2a) printf("%02x <- ?? 2a\n", rawvalue); |
| 2095 | //#define PUZZLI2_LEVEL_STRUCTURE_LOG |
| 2096 | #ifdef PUZZLI2_LEVEL_STRUCTURE_LOG |
| 2097 | UINT8 *src2 = (UINT8 *) (machine().root_device().memregion("maincpu")->base()); |
| 2098 | // UINT8 new_puzzli2_level_decode[256]; |
| 2093 | 2099 | |
| 2094 | | else if (rawvalue==0x32) printf("%02x <- ?? 32\n", rawvalue); // puzzli2 |
| 2095 | | else if (rawvalue==0x33) printf("%02x <- ?? 33\n", rawvalue); // puzzli2 |
| 2096 | | else if (rawvalue==0x35) printf("%02x <- ?? 35\n", rawvalue); |
| 2097 | | else if (rawvalue==0x38) printf("%02x <- ?? 38\n", rawvalue); // puzzli2 |
| 2100 | // for (int i=0;i<256;i++) |
| 2101 | // new_puzzli2_level_decode[i] = puzzli2_level_decode[i]; |
| 2098 | 2102 | |
| 2099 | | else if (rawvalue==0x41) printf("%02x <- ?? 41\n", rawvalue); // puzzli2 |
| 2100 | | else if (rawvalue==0x43) printf("%02x <- ?? 43\n", rawvalue); // puzzli2 |
| 2103 | int offset; |
| 2104 | int limit; |
| 2105 | for (int i=0;i<256;i++) |
| 2106 | coverage[i] = 0; |
| 2101 | 2107 | |
| 2102 | | else if (rawvalue==0xd0) printf("%02x <- ?? d0\n", rawvalue); |
| 2108 | if (!strcmp(machine().system().name,"puzzli2")) |
| 2109 | { |
| 2110 | offset = 0x17ab66; |
| 2111 | limit = 476; |
| 2112 | } |
| 2113 | else |
| 2114 | { |
| 2115 | offset = 0x16c3ca; |
| 2116 | limit = 500; |
| 2117 | } |
| 2103 | 2118 | |
| 2104 | | else if (rawvalue==0xe0) printf("%02x <- ?? e0\n", rawvalue); |
| 2105 | | else if (rawvalue==0xe1) printf("%02x <- ?? e1\n", rawvalue); |
| 2106 | | else if (rawvalue==0xe2) printf("%02x <- ?? e2\n", rawvalue); |
| 2107 | | else if (rawvalue==0xe3) printf("%02x <- ?? e3\n", rawvalue); |
| 2108 | | else if (rawvalue==0xe4) printf("%02x <- ?? e3\n", rawvalue); |
| 2109 | 2119 | |
| 2110 | 2120 | |
| 2111 | | else printf("%02x <- unknown object\n", rawvalue); |
| 2112 | 2121 | |
| 2113 | | entries_left--; |
| 2114 | | if (entries_left == 0) |
| 2115 | | { |
| 2116 | | stage = 1; |
| 2117 | | currentcolumn++; |
| 2118 | | } |
| 2122 | for (int i=0;i<limit;i++) |
| 2123 | { |
| 2124 | UINT32 val1 = (src2[offset+1]<<24) | (src2[offset+0] << 16) | (src2[offset+3]<<8) | (src2[offset+2] << 0); |
| 2125 | offset += 4; |
| 2126 | UINT32 val2 = (src2[offset+1]<<24) | (src2[offset+0] << 16) | (src2[offset+3]<<8) | (src2[offset+2] << 0); |
| 2127 | |
| 2128 | |
| 2129 | printf("(%d) data range %08x %08x\n", i, val1, val2); |
| 2130 | |
| 2131 | int x = 0; |
| 2132 | |
| 2133 | tableoffs = 0; |
| 2134 | tableoffs2 = 0; |
| 2135 | entries_left = 0; |
| 2136 | currentcolumn = 0; |
| 2137 | num_entries = 0; |
| 2138 | full_entry = 0; |
| 2139 | prev_tablloc = 0; |
| 2140 | numbercolumns = 0; |
| 2141 | depth = 0; |
| 2142 | stage = -1; |
| 2143 | |
| 2144 | for (x=val1; x<val2;x++) |
| 2145 | { |
| 2146 | int end = puzzli2_take_leveldata_value(src2[x^1]); |
| 2147 | |
| 2148 | if (end) |
| 2149 | { |
| 2150 | printf("--- ended at %08x (val 2 was %08x)\n",x ,val2); |
| 2151 | |
| 2152 | if ( (val2-x) > 2 ) |
| 2153 | { |
| 2154 | fatalerror("ended even earlier than padding byte\n"); |
| 2119 | 2155 | } |
| 2120 | | |
| 2156 | else if ( (val2-x) == 2) |
| 2157 | { |
| 2158 | printf("ended with padding byte\n"); |
| 2159 | } |
| 2160 | else if ( (val2-x) == 1) |
| 2161 | { |
| 2162 | printf("ended normally\n"); |
| 2163 | } |
| 2164 | else // can't happen |
| 2165 | { |
| 2166 | fatalerror("ended after marker?!\n"); |
| 2167 | } |
| 2168 | |
| 2169 | x = val2; |
| 2121 | 2170 | } |
| 2122 | | } |
| 2123 | 2171 | |
| 2124 | | if (entries_left!=0) |
| 2125 | | { |
| 2126 | | printf("last column didn't terminate (sometimes this is ok, streams are padded to a word)\n"); |
| 2127 | | UINT8 lastbyte = src2[(x-1)^1]; |
| 2128 | | printf("last (pre-decrypted) byte in stream was %02x if this is 00 we're probably ok\n", lastbyte); |
| 2129 | 2172 | } |
| 2130 | 2173 | |
| 2131 | 2174 | printf("total number of valid columns was %02x\n", currentcolumn); |
| r24687 | r24688 | |
| 2137 | 2180 | fatalerror("mismatch in number of columns vs specified amount\n"); |
| 2138 | 2181 | |
| 2139 | 2182 | printf("\n"); |
| 2183 | |
| 2140 | 2184 | |
| 2141 | 2185 | } |
| 2186 | /* |
| 2142 | 2187 | int c=0; |
| 2143 | 2188 | for (int i=0;i<256;i++) |
| 2144 | 2189 | { |
| r24687 | r24688 | |
| 2165 | 2210 | c = 0; |
| 2166 | 2211 | } |
| 2167 | 2212 | } |
| 2213 | */ |
| 2168 | 2214 | |
| 2169 | 2215 | #endif |
| 2170 | 2216 | |