From 4318236bce2984c11f9b8c85a9dda618a483accc Mon Sep 17 00:00:00 2001 From: mamehaze <140764005+mamehaze@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:29:34 +0000 Subject: igs/igs_fear.cpp: Dumped IGS027A internal ROM and GG ROMs for Icescape. (#12942) * igs/igs_fear.cpp: Dumped IGS027A internal ROM and GG ROMs for Icescape. [TeamEurope, Peter Wilhelmsen, XingXing] * cpu/xa: Implemented unsigned 16*16 multiply, and branch if positive. * cpu/xa: Fixed flags for unsigned 32/16 divide. * igs/pgmcrypt.cpp: Removed obsolete XOR table for Icescape. --- src/devices/cpu/xa/xa_ops.cpp | 39 ++++++++++++++++++++++++++++++++++++--- src/mame/igs/igs_fear.cpp | 14 ++++++++------ src/mame/igs/pgmcrypt.cpp | 22 ---------------------- 3 files changed, 44 insertions(+), 31 deletions(-) diff --git a/src/devices/cpu/xa/xa_ops.cpp b/src/devices/cpu/xa/xa_ops.cpp index c66277ba6c4..07c8494f994 100644 --- a/src/devices/cpu/xa/xa_ops.cpp +++ b/src/devices/cpu/xa/xa_ops.cpp @@ -1527,7 +1527,7 @@ void xa_cpu::bnv_rel8(u8 rel8) { fatalerror("BNV %04x\n", expand_rel8(rel8)); } // BOV rel8 Branch if overflow flag is set 2 6t/3nt 1111 0101 rrrr rrrr void xa_cpu::bov_rel8(u8 rel8) { fatalerror("BOV %04x\n", expand_rel8(rel8)); } // BPL rel8 Branch if the negative flag is clear 2 6t/3nt 1111 0110 rrrr rrrr -void xa_cpu::bpl_rel8(u8 rel8) { fatalerror("BPL %04x\n", expand_rel8(rel8)); } +void xa_cpu::bpl_rel8(u8 rel8) { if (!get_n_flag()) { set_pc_in_current_page(expand_rel8(rel8)); cy(6); } else { cy(3); } } // BMI rel8 Branch if the negative flag is set 2 6t/3nt 1111 0111 rrrr rrrr void xa_cpu::bmi_rel8(u8 rel8) { fatalerror("BMI %04x\n", expand_rel8(rel8)); } // BG rel8 Branch if greater than (unsigned) 2 6t/3nt 1111 1000 rrrr rrrr @@ -1593,7 +1593,39 @@ void xa_cpu::mulu_byte_rd_rs(u8 rd, u8 rs) { fatalerror( "MULU.b %s, %s", m_regn //DIVU.b Rd, Rs void xa_cpu::divu_byte_rd_rs(u8 rd, u8 rs) { fatalerror( "DIVU.b %s, %s", m_regnames8[rd], m_regnames8[rs]); } //MULU.w Rd, Rs -void xa_cpu::mulu_word_rd_rs(u8 rd, u8 rs) { fatalerror( "MULU.w %s, %s", m_regnames16[rd], m_regnames16[rs]); } +void xa_cpu::mulu_word_rd_rs(u8 rd, u8 rs) +{ + if (rd & 1) + fatalerror("mulu_word_rd_rs with low rd bit set\n"); + + u16 fullval = gr16(rd); + u16 rsval = gr16(rs); + + u32 result = (u32)fullval * rsval; + + if (result & 0xffff0000) + set_v_flag(); + else + clear_v_flag(); + + if (result == 0x0000) + set_z_flag(); + else + clear_z_flag(); + + if (result & 0x8000) + set_n_flag(); + else + clear_n_flag(); + + // TODO: verify these are writing to the correct registers + sr16(rd, result & 0xffff); + sr16(rd + 1, result >> 16); + + clear_c_flag(); + + cy(12); +} //DIVU.w Rd, Rs void xa_cpu::divu_word_rd_rs(u8 rd, u8 rs) { fatalerror( "DIVU.w %s, %s", m_regnames16[rd], m_regnames16[rs]); } // MUL.w Rd, Rs @@ -1641,13 +1673,14 @@ void xa_cpu::divu_dword_rd_rs(u8 rd, u8 rs) if (result == 0x0000) set_z_flag(); else - clear_n_flag(); + clear_z_flag(); if (result & 0x8000) set_n_flag(); else clear_n_flag(); + // TODO: verify these are writing to the correct registers sr16(rd, result); sr16(rd + 1, remainder); } diff --git a/src/mame/igs/igs_fear.cpp b/src/mame/igs/igs_fear.cpp index b1834546d73..e648222bed5 100644 --- a/src/mame/igs/igs_fear.cpp +++ b/src/mame/igs/igs_fear.cpp @@ -526,19 +526,21 @@ ROM_END ROM_START( icescape ) // IGS PCB-0433-16-GK (same PCB as Fearless Pinocchio) - Has IGS027A, MX10EXAQC, 2x Actel A54SX32A, ICS2115, 2x 8-DIP banks ROM_REGION( 0x04000, "maincpu", 0 ) // Internal ROM of IGS027A ARM based MCU - ROM_LOAD( "a7.bin", 0x00000, 0x4000, NO_DUMP ) // sticker marked 'A7', unreadable location + ROM_LOAD( "igs027_a7.bin", 0x00000, 0x4000, CRC(16285c0f) SHA1(7e70a890d7793982f54ff70641566b4810d4a1d8) ) // sticker marked 'A7', unreadable location ROM_REGION32_LE( 0x80000, "user1", 0 ) // external ARM data / prg ROM_LOAD( "icescape_v-104fa.u37", 0x000000, 0x80000, CRC(e3552726) SHA1(bac34ac4fce1519c1bc8020064090e77b5c2a629) ) // TMS27C240 ROM_REGION( 0x10000, "xa:mcu", 0 ) // MX10EXAQC (80C51 XA based MCU) marked O7 + // while the XA is marked O7 like fearless, it is not confirmed to be the same (IGS labels are not unique) + // it can currently be booted with the superkds XA (fearless XA requires some additional XA ops to be implemented) ROM_LOAD( "o7.u33", 0x00000, 0x10000, NO_DUMP ) ROM_REGION( 0x2000000, "gfx1", 0 ) // FIXED BITS (0xxxxxxx) (graphics are 7bpp) - ROM_LOAD32_WORD( "icescape_fa_cg_u7.u7", 0x0000000, 0x800000, NO_DUMP ) - ROM_LOAD32_WORD( "icescape_fa_cg_u6.u6", 0x0000002, 0x800000, NO_DUMP ) - ROM_LOAD32_WORD( "icescape_fa_cg_u14.u14", 0x1000000, 0x800000, NO_DUMP ) - ROM_LOAD32_WORD( "icescape_fa_cg_u13.u13", 0x1000002, 0x800000, NO_DUMP ) + ROM_LOAD32_WORD( "icescape_fa_cg_u7.u7", 0x0000000, 0x800000, CRC(cd534afb) SHA1(ba9a265d45f7a1a0ca1ac248789609b24b19441d) ) + ROM_LOAD32_WORD( "icescape_fa_cg_u6.u6", 0x0000002, 0x800000, CRC(4c9781fe) SHA1(bc2ac914ecaf1c10800b3634d457006aee29e248) ) + ROM_LOAD32_WORD( "icescape_fa_cg_u14.u14", 0x1000000, 0x800000, CRC(ec1eef24) SHA1(0668ea7c7475599c8d2e93580b8e81c104e7b0a0) ) + ROM_LOAD32_WORD( "icescape_fa_cg_u13.u13", 0x1000002, 0x800000, CRC(18477258) SHA1(e19fbcabfbfe9e37b94cef1054b4d65b49ad38db) ) // u17 and u18 not populated ROM_REGION( 0x400000, "xa:ics", 0 ) @@ -565,4 +567,4 @@ void igs_fear_state::init_igs_icescape() GAME( 2005, superkds, 0, igs_fear_xor, superkds, igs_fear_state, init_igs_superkds, ROT0, "IGS (Golden Dragon Amusement license)", "Super Kids / Jiu Nan Xiao Yingxiong (S019CN)", MACHINE_NODEVICE_LAN ) GAME( 2006, fearless, 0, igs_fear_xor, fear, igs_fear_state, init_igs_fear, ROT0, "IGS (American Alpha license)", "Fearless Pinocchio (V101US)", 0 ) -GAME( 2006, icescape, 0, igs_fear, fear, igs_fear_state, init_igs_icescape, ROT0, "IGS", "Icescape (V104FA)", MACHINE_IS_SKELETON ) // IGS FOR V104FA 2006-11-02 +GAME( 2006, icescape, 0, igs_fear_xor, fear, igs_fear_state, init_igs_icescape, ROT0, "IGS", "Icescape (V104FA)", MACHINE_IS_SKELETON ) // IGS FOR V104FA 2006-11-02 diff --git a/src/mame/igs/pgmcrypt.cpp b/src/mame/igs/pgmcrypt.cpp index 148cdedec62..5d2d870f265 100644 --- a/src/mame/igs/pgmcrypt.cpp +++ b/src/mame/igs/pgmcrypt.cpp @@ -1686,26 +1686,6 @@ void crzybugs_decrypt(running_machine &machine) } } - -static const uint8_t icescape_tab[0x100] = { - 0x49, 0x47, 0x53, 0x30, 0x32, 0x32, 0x31, 0x52, 0x44, 0x34, 0x30, 0x35, 0x30, 0x38, 0x33, 0x30, // IGS0221RD4050830 - 0x5b, 0x35, 0xae, 0x6a, 0x98, 0x65, 0x89, 0xce, 0x06, 0x64, 0xe3, 0x19, 0x6c, 0x84, 0xb3, 0xbd, - 0x41, 0xb4, 0xcd, 0xa7, 0xd0, 0x4a, 0x16, 0xad, 0x8d, 0x12, 0x07, 0x32, 0xb2, 0x97, 0x65, 0x1b, - 0x1d, 0xb1, 0x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43, 0xde, 0xd0, 0x5e, 0xe8, 0x13, 0xab, - 0xc8, 0x98, 0xc0, 0xfd, 0xf7, 0xef, 0x13, 0xb6, 0x62, 0xed, 0x7f, 0xc9, 0x74, 0x43, 0x71, 0x18 -}; - void icescape_decrypt(running_machine &machine) { memory_region *const region = machine.root_device().memregion("user1"); @@ -1725,8 +1705,6 @@ void icescape_decrypt(running_machine &machine) IGS27_CRYPT7_ALT IGS27_CRYPT8 - x ^= icescape_tab[(i>> 1) & 0xff] << 8; - src[i] ^= x; } } -- cgit v1.2.3