diff --git a/src/mame/drivers/dkmb.cpp b/src/mame/drivers/dkmb.cpp index 53d42cca80d..6534feed830 100644 --- a/src/mame/drivers/dkmb.cpp +++ b/src/mame/drivers/dkmb.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders: +// copyright-holders:David Haywood /* Donkey Kong / Donkey Kong Jr / Mario Bros @@ -36,16 +36,21 @@ class dkmb_state : public driver_device public: dkmb_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") + m_maincpu(*this, "maincpu"), + m_framebuffer(*this, "framebuffer") { } void dkmb(machine_config &config); + DECLARE_READ64_MEMBER(unk_2060000_r); + DECLARE_READ64_MEMBER(unk_20c0010_r); + protected: virtual void machine_start() override; private: required_device m_maincpu; + required_shared_ptr m_framebuffer; uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -59,12 +64,53 @@ void dkmb_state::machine_start() uint32_t dkmb_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { + int count = 0; + for (int y = 0; y < 256; y++) + { + uint32_t* dst = &bitmap.pix32(y); + + for (int x = 0; x < 1024 / 2; x++) + { + uint64_t val = m_framebuffer[count]; + + dst[(x * 2) + 0] = (val >> 32) & 0x00ffffff; + dst[(x * 2) + 1] = (val >> 0) & 0x00ffffff; + + count++; + } + } + return 0; } + +READ64_MEMBER(dkmb_state::unk_2060000_r) +{ + return ((u64)machine().rand()) << 56; +} + +READ64_MEMBER(dkmb_state::unk_20c0010_r) +{ + return ((u64)machine().rand()) << 56; +} + void dkmb_state::main_map(address_map &map) { - map(0x00ff0000, 0x00ffffff).ram(); + map(0x00000000, 0x000fffff).ram(); // copies code to RAM and runs it from here + map(0x00100000, 0x001fffff).ram().share("framebuffer"); // seems to be a 1024x256 ARGB bitmap, with 320 entries used for each line and 224 lines, so framebuffer? (but then gets overwritten with data not of that format?) + + map(0x00e00000, 0x00ffffff).ram(); // size uncertain + + map(0x02080000, 0x02080007).ram(); // write + map(0x02060000, 0x02060007).r(FUNC(dkmb_state::unk_2060000_r)); // read + map(0x020c0000, 0x020c0007).ram(); // write + map(0x020c0010, 0x020c0017).r(FUNC(dkmb_state::unk_20c0010_r)); // read + + map(0x04090000, 0x0409ffff).ram(); // size uncertain + + // map(0xff000000, 0xff0fffff) // looks like flash ROM access, mirror of main ROM or just checking if extra exist? + // map(0xff800000, 0xff8fffff) // looks like flash ROM access, mirror of main ROM or just checking if extra exist? + map(0xffe00000, 0xffffffff).rom().region("maincpu", 0); } @@ -83,8 +129,8 @@ MACHINE_CONFIG_START(dkmb_state::dkmb) MCFG_SCREEN_ADD("screen", RASTER) // wrong MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_UPDATE_DRIVER(dkmb_state, screen_update) - MCFG_SCREEN_SIZE(640, 480) - MCFG_SCREEN_VISIBLE_AREA(0, 256, 0, 240) + MCFG_SCREEN_SIZE(1024, 256) + MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 256-1) MCFG_PALETTE_ADD("palette", 65536) @@ -95,10 +141,18 @@ MACHINE_CONFIG_END ROM_START( dkmb ) ROM_REGION64_BE(0x200000, "maincpu", 0) - ROM_LOAD("donkeykong.u14", 0x00000, 0x200000, CRC(7895fe2d) SHA1(134174c02ce3c5d28a890ca57dc36677873b1dc8) ) + ROM_LOAD("donkeykong.u14", 0x00000, 0x200000, CRC(7895fe2d) SHA1(134174c02ce3c5d28a890ca57dc36677873b1dc8) ) // what type of ROM is this? ROM_REGION( 0x1000, "pic", 0 ) - ROM_LOAD("12c508.u12", 0x000, 0x09db, CRC(3adb3e33) SHA1(36a96886d83b64633eea83e57bdfa8a20c6d4f6a) ) + /* + Intel HEX format dump. When converted to binary using + "srec_cat.exe 12c508.u12 -intel -o 12c508.bin -binary" + this contains only the string + "Copyright 2001 Core Technologies why are you looking in here?" + in the first 0x80 bytes, which is the unprotected area of the PIC. + the rest is blank, therefore protected and a bad dump + */ + ROM_LOAD("12c508.u12", 0x000, 0x09db, BAD_DUMP CRC(3adb3e33) SHA1(36a96886d83b64633eea83e57bdfa8a20c6d4f6a) ) ROM_END GAME( 2003, dkmb, 0, dkmb, dkmb, dkmb_state, empty_init, ROT270, "Namco / Nintendo / Cosmodog", "Donkey Kong / Donkey Kong Jr / Mario Bros", MACHINE_IS_SKELETON )