Frontend Tech + >> HBMAME
Previous thread Previous  View all threads Index   Next thread Next   Flat Mode Flat  

Visionizer
MAME Fan
Reged: 02/16/13
Posts: 1
Send PM
DK2 Misfitmame Driver source code to work with Mame 0.97
02/16/13 08:08 AM


I was wondering how to use this source code and incorporate it into an older version of mame 0.97 so that I can compile it to work on the psp. I've been trying to do this for about a month now but the code has changed so much from the code below to mame 0.97 dkong driver. The code below is from Haze and originally from Robert who are geniuses in my opinion. Thank you for your time and help!

const eeprom_interface eeprom_interface_d2k =
{
7, // address bits 7
8, // data bits 8
"*110", // read 1 10 aaaaaa
"*101", // write 1 01 aaaaaa dddddddddddddddd
"*111", // erase 1 11 aaaaaa
"*10000xxxx", // lock 1 00 00xxxx
"*10011xxxx", // unlock 1 00 11xxxx
1,
};

static NVRAM_HANDLER( d2k )
{
if (read_or_write)
eeprom_save(file);
else
{
eeprom_init(&eeprom_interface_d2k);
if (file) eeprom_load(file);
}
}

static READ8_HANDLER( d2k_eeprom_r )
{
return eeprom_read_bit();
}

static WRITE8_HANDLER( d2k_eeprom_w )
{
eeprom_write_bit(data & 1);
eeprom_set_clock_line( (data & 2) ? ASSERT_LINE : CLEAR_LINE );
eeprom_set_cs_line( (data & 4) ? CLEAR_LINE : ASSERT_LINE );
}

static WRITE8_HANDLER( d2k_bank_w )
{
memory_set_bank(1, data & 1 );
memory_set_bank(2, data & 1 );
}

static ADDRESS_MAP_START( d2k_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x5fff) AM_READWRITE(SMH_BANK1, 0)
AM_RANGE(0x6000, 0x6bff) AM_RAM
AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE_MEMBER(dkong_state, sprite_ram)
AM_SIZE_MEMBER(dkong_state, sprite_ram_size) /* sprite set 1 */
AM_RANGE(0x7400, 0x77ff) AM_RAM_WRITE(dkong_videoram_w)
AM_BASE_MEMBER(dkong_state, video_ram)
AM_RANGE(0x7800, 0x780f) AM_DEVREADWRITE(DMA8257, "dma8257", dma8257_r, dma8257_w) /* P8257 control registers */
AM_RANGE(0x7c00, 0x7c00) AM_READ_PORT("IN0") AM_LATCH8_WRITE("ls175.3d") /* IN0, sound CPU intf */
AM_RANGE(0x7c80, 0x7c80) AM_READ_PORT("IN1") AM_WRITE(radarscp_grid_color_w) /* IN1 */

AM_RANGE(0x7d00, 0x7d00) AM_READ(dkong_in2_r) /* IN2 */
AM_RANGE(0x7d00, 0x7d07) AM_DEVWRITE(LATCH8, "ls259.6h", latch8_bit0_w) /* Sound signals */

AM_RANGE(0x7d80, 0x7d80) AM_READ_PORT("DSW0") AM_WRITE(dkong_audio_irq_w) /* DSW0 */
AM_RANGE(0x7d81, 0x7d81) AM_WRITE(radarscp_grid_enable_w)
AM_RANGE(0x7d82, 0x7d82) AM_WRITE(dkong_flipscreen_w)
AM_RANGE(0x7d83, 0x7d83) AM_WRITE(dkong_spritebank_w) /* 2 PSL Signal */
AM_RANGE(0x7d84, 0x7d84) AM_WRITE(interrupt_enable_w)
AM_RANGE(0x7d85, 0x7d85) AM_DEVWRITE(DMA8257, "dma8257", p8257_drq_w) /* P8257 ==> /DRQ0 /DRQ1 */
AM_RANGE(0x7d86, 0x7d87) AM_WRITE(dkong_palettebank_w)

AM_RANGE(0xc800, 0xc800) AM_READWRITE(d2k_eeprom_r, d2k_eeprom_w) // what if it wants to read rom at c800?
AM_RANGE(0xe000, 0xe000) AM_WRITE(d2k_bank_w)
// seems to be a mirror of the rom below, but if I try to use SMH_BANK1 mirrored it doesn't boot? weird
AM_RANGE(0x8000, 0xffff) AM_READWRITE(SMH_BANK2, 0)
ADDRESS_MAP_END

static MACHINE_DRIVER_START( d2k )
MDRV_IMPORT_FROM(dkong2b)
MDRV_CPU_MODIFY("main")
MDRV_CPU_PROGRAM_MAP(d2k_map,0)

MDRV_NVRAM_HANDLER(d2k)
MACHINE_DRIVER_END

static DRIVER_INIT( d2k )
{
UINT8 *ROM = memory_region(machine, "main");
UINT8* buf = malloc(0x10000);
int i, j;

/* data bitswap */
for( i = 0x00000; i < 0x10000; i++ )
ROM = BITSWAP8( ROM, 1, 4, 5, 7, 6, 0, 3, 2 );

/* address scramble */
for (i = 0; i < 0x10000; i++)
{
j = BITSWAP16( i, 15, 10, 8, 9, 13, 14, 12, 11,7,6,5,4,3,2,1,0 );
buf = ROM[j];
}

memcpy(ROM, buf, 0x10000);
free(buf);

memory_configure_bank(1, 0, 2, &ROM[0], 0x8000);
memory_configure_bank(2, 0, 2, &ROM[0], 0x8000);
memory_set_bank(1, 0);
memory_set_bank(2, 0);
}

ROM_START( d2k )
ROM_REGION( 0x10000, "main", ROMREGION_ERASE00 )
/* original roms present but not used */
ROM_LOAD( "d2k12.bin", 0x00000, 0x10000, CRC(6e95ca0d) SHA1(c058add0f146d577e3df0ba60828fe1734e78d01) )

ROM_REGION( 0x1800, "sound", 0 ) /* sound */
ROM_LOAD( "s_3i_b.bin", 0x0000, 0x0800, CRC(45a4ed06) SHA1(144d24464c1f9f01894eb12f846952290e6e32ef) )
ROM_RELOAD( 0x0800, 0x0800 )
ROM_LOAD( "s_3j_b.bin", 0x1000, 0x0800, CRC(4743fe92) SHA1(6c82b57637c0212a580591397e6a5a1718f19fd2) )

ROM_REGION( 0x1000, "gfx1", ROMREGION_DISPOSE )
ROM_LOAD( "v_5h_b.bin", 0x0000, 0x0800, CRC(12c8c95d) SHA1(a57ff5a231c45252a63b354137c920a1379b70a3) )
ROM_LOAD( "v_3pt.bin", 0x0800, 0x0800, CRC(15e9c5e9) SHA1(976eb1e18c74018193a35aa86cff482ebfc5cc4e) )

ROM_REGION( 0x2000, "gfx2", ROMREGION_DISPOSE )
ROM_LOAD( "l_4m_b.bin", 0x0000, 0x0800, CRC(59f8054d) SHA1(793dba9bf5a5fe76328acdfb90815c243d2a65f1) )
ROM_LOAD( "l_4n_b.bin", 0x0800, 0x0800, CRC(672e4714) SHA1(92e5d379f4838ac1fa44d448ce7d142dae42102f) )
ROM_LOAD( "l_4r_b.bin", 0x1000, 0x0800, CRC(feaa59ee) SHA1(ecf95db5a20098804fc8bd59232c66e2e0ed3db4) )
ROM_LOAD( "l_4s_b.bin", 0x1800, 0x0800, CRC(20f2ef7e) SHA1(3bc482a38bf579033f50082748ee95205b0f673d) )

ROM_REGION( 0x0300, "proms", 0 )
ROM_LOAD( "c-2k.bpr", 0x0000, 0x0100, CRC(e273ede5) SHA1(b50ec9e1837c00c20fb2a4369ec7dd0358321127) ) /* palette low 4 bits (inverted) */
ROM_LOAD( "c-2j.bpr", 0x0100, 0x0100, CRC(d6412358) SHA1(f9c872da2fe8e800574ae3bf483fb3ccacc92eb3) ) /* palette high 4 bits (inverted) */
ROM_LOAD( "v-5e.bpr", 0x0200, 0x0100, CRC(b869b8f5) SHA1(c2bdccbf2654b64ea55cd589fd21323a9178a660) ) /* character color codes on a per-column basis */
ROM_END

ROM_START( d2k11 )
ROM_REGION( 0x10000, "main", ROMREGION_ERASE00 )
/* original roms not used */
ROM_LOAD( "d2k11.bin", 0x00000, 0x10000, CRC(2048fc42) SHA1(e427a09ed8e792ee8ce01cd0b07c6a0d5a7c5536) )

ROM_REGION( 0x1800, "sound", 0 ) /* sound */
ROM_LOAD( "s_3i_b.bin", 0x0000, 0x0800, CRC(45a4ed06) SHA1(144d24464c1f9f01894eb12f846952290e6e32ef) )
ROM_RELOAD( 0x0800, 0x0800 )
ROM_LOAD( "s_3j_b.bin", 0x1000, 0x0800, CRC(4743fe92) SHA1(6c82b57637c0212a580591397e6a5a1718f19fd2) )

ROM_REGION( 0x1000, "gfx1", ROMREGION_DISPOSE )
ROM_LOAD( "v_5h_b.bin", 0x0000, 0x0800, CRC(12c8c95d) SHA1(a57ff5a231c45252a63b354137c920a1379b70a3) )
ROM_LOAD( "v_3pt.bin", 0x0800, 0x0800, CRC(15e9c5e9) SHA1(976eb1e18c74018193a35aa86cff482ebfc5cc4e) )

ROM_REGION( 0x2000, "gfx2", ROMREGION_DISPOSE )
ROM_LOAD( "l_4m_b.bin", 0x0000, 0x0800, CRC(59f8054d) SHA1(793dba9bf5a5fe76328acdfb90815c243d2a65f1) )
ROM_LOAD( "l_4n_b.bin", 0x0800, 0x0800, CRC(672e4714) SHA1(92e5d379f4838ac1fa44d448ce7d142dae42102f) )
ROM_LOAD( "l_4r_b.bin", 0x1000, 0x0800, CRC(feaa59ee) SHA1(ecf95db5a20098804fc8bd59232c66e2e0ed3db4) )
ROM_LOAD( "l_4s_b.bin", 0x1800, 0x0800, CRC(20f2ef7e) SHA1(3bc482a38bf579033f50082748ee95205b0f673d) )

ROM_REGION( 0x0300, "proms", 0 )
ROM_LOAD( "c-2k.bpr", 0x0000, 0x0100, CRC(e273ede5) SHA1(b50ec9e1837c00c20fb2a4369ec7dd0358321127) ) /* palette low 4 bits (inverted) */
ROM_LOAD( "c-2j.bpr", 0x0100, 0x0100, CRC(d6412358) SHA1(f9c872da2fe8e800574ae3bf483fb3ccacc92eb3) ) /* palette high 4 bits (inverted) */
ROM_LOAD( "v-5e.bpr", 0x0200, 0x0100, CRC(b869b8f5) SHA1(c2bdccbf2654b64ea55cd589fd21323a9178a660) ) /* character color codes on a per-column basis */
ROM_END

GAME( 200?, d2k, dkong, d2k, dkong, d2k, ROT90, "Nintendo [hack, Jeff Kulczycki]", "Donkey Kong II: Jumpman Returns (v1.2) (hack of Donkey Kong)", 0 )
GAME( 200?, d2k11, dkong, d2k, dkong, d2k, ROT90, "Nintendo [hack, Jeff Kulczycki]", "Donkey Kong II: Jumpman Returns (v1.1) (hack of Donkey Kong)", 0 )







Entire thread
Subject Posted by Posted on
* DK2 Misfitmame Driver source code to work with Mame 0.97 Visionizer 02/16/13 08:08 AM

Extra information Permissions
Moderator:  Robbbert 
0 registered and 3 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2808