From fcf7dd71a9777123faf43dd263602841a7138582 Mon Sep 17 00:00:00 2001 From: Zsolt Vasvari Date: Sat, 19 Jan 2008 02:03:20 +0000 Subject: [PATCH] Changes the dynamic installation of MRA8_RAM to banks --- src/mame/drivers/chqflag.c | 29 +++++++++++++---------------- src/mame/drivers/crimfght.c | 17 ++++++++--------- src/mame/drivers/vendetta.c | 13 +++++-------- src/mame/drivers/wardner.c | 14 +++++++++----- src/mame/video/simpsons.c | 19 +++++-------------- 5 files changed, 40 insertions(+), 52 deletions(-) diff --git a/src/mame/drivers/chqflag.c b/src/mame/drivers/chqflag.c index 90aada4cda9..92fabbad20b 100644 --- a/src/mame/drivers/chqflag.c +++ b/src/mame/drivers/chqflag.c @@ -48,23 +48,20 @@ static WRITE8_HANDLER( chqflag_bankswitch_w ) memory_set_bankptr(4,&RAM[bankaddress]); /* bit 5 = memory bank select */ - if (data & 0x20){ - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, MRA8_RAM); /* palette */ - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, paletteram_xBBBBBGGGGGRRRRR_be_w); /* palette */ - if (K051316_readroms){ - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, K051316_rom_0_r); /* 051316 #1 (ROM test) */ - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, K051316_0_w); /* 051316 #1 */ - } - else{ - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, K051316_0_r); /* 051316 #1 */ - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, K051316_0_w); /* 051316 #1 */ - } + if (data & 0x20) + { + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, MRA8_BANK5, paletteram_xBBBBBGGGGGRRRRR_be_w); + memory_set_bankptr(5, paletteram); + + if (K051316_readroms) + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, K051316_rom_0_r, K051316_0_w); /* 051316 #1 (ROM test) */ + else + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, K051316_0_r, K051316_0_w); /* 051316 #1 */ } - else{ - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, MRA8_BANK1); /* RAM */ - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, MWA8_BANK1); /* RAM */ - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, MRA8_BANK2); /* RAM */ - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, MWA8_BANK2); /* RAM */ + else + { + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, MRA8_BANK1, MWA8_BANK1); /* RAM */ + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, MRA8_BANK2, MWA8_BANK2); /* RAM */ } /* other bits unknown/unused */ diff --git a/src/mame/drivers/crimfght.c b/src/mame/drivers/crimfght.c index c7e55a91521..50ce8f93db0 100644 --- a/src/mame/drivers/crimfght.c +++ b/src/mame/drivers/crimfght.c @@ -490,20 +490,19 @@ static void crimfght_banking( int lines ) int offs = 0; /* bit 5 = select work RAM or palette */ - if (lines & 0x20){ - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x03ff, 0, 0, MRA8_RAM); /* palette */ - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x03ff, 0, 0, paletteram_xBBBBBGGGGGRRRRR_be_w); /* palette */ - } - else{ - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x03ff, 0, 0, MRA8_BANK1); /* RAM */ - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x03ff, 0, 0, MWA8_BANK1); /* RAM */ + if (lines & 0x20) + { + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x03ff, 0, 0, MRA8_BANK3, paletteram_xBBBBBGGGGGRRRRR_be_w); + memory_set_bankptr(3, paletteram); } + else + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x03ff, 0, 0, MRA8_BANK1, MWA8_BANK1); /* RAM */ /* bit 6 = enable char ROM reading through the video RAM */ K052109_set_RMRD_line((lines & 0x40) ? ASSERT_LINE : CLEAR_LINE); - offs = 0x10000 + ( ( lines & 0x0f ) * 0x2000 ); - memory_set_bankptr( 2, &RAM[offs] ); + offs = 0x10000 + ((lines & 0x0f) * 0x2000); + memory_set_bankptr(2, &RAM[offs]); } static MACHINE_RESET( crimfght ) diff --git a/src/mame/drivers/vendetta.c b/src/mame/drivers/vendetta.c index 8550442fc62..866f7966122 100644 --- a/src/mame/drivers/vendetta.c +++ b/src/mame/drivers/vendetta.c @@ -204,17 +204,14 @@ static void vendetta_video_banking( int select ) { if ( select & 1 ) { - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, MRA8_RAM ); - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, paletteram_xBBBBBGGGGGRRRRR_be_w ); - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K053247_r ); - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K053247_w ); + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, MRA8_BANK4, paletteram_xBBBBBGGGGGRRRRR_be_w ); + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K053247_r, K053247_w ); + memory_set_bankptr(4, paletteram); } else { - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, vendetta_K052109_r ); - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, vendetta_K052109_w ); - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K052109_r ); - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K052109_w ); + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, vendetta_K052109_r, vendetta_K052109_w ); + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K052109_r, K052109_w ); } } diff --git a/src/mame/drivers/wardner.c b/src/mame/drivers/wardner.c index b53881e31f0..439b66385a1 100644 --- a/src/mame/drivers/wardner.c +++ b/src/mame/drivers/wardner.c @@ -142,9 +142,11 @@ static WRITE8_HANDLER( wardner_ramrom_bank_sw ) wardner_membank = data; - if (data) { + if (data) + { memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, MRA8_BANK1); - switch (data) { + switch (data) + { case 2: bankaddress = 0x10000; break; case 3: bankaddress = 0x18000; break; case 4: bankaddress = 0x20000; break; @@ -156,14 +158,16 @@ static WRITE8_HANDLER( wardner_ramrom_bank_sw ) } memory_set_bankptr(1,&RAM[bankaddress]); } - else { - memory_set_bankptr(1,&RAM[0x0000]); + else + { memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8fff, 0, 0, wardner_sprite_r); - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xadff, 0, 0, MRA8_RAM); + memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xadff, 0, 0, MRA8_BANK4); memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xae00, 0xafff, 0, 0, MRA8_BANK2); memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc7ff, 0, 0, MRA8_BANK3); + memory_set_bankptr(1, &RAM[0x0000]); memory_set_bankptr(2, rambase_ae00); memory_set_bankptr(3, rambase_c000); + memory_set_bankptr(4, paletteram); } } } diff --git a/src/mame/video/simpsons.c b/src/mame/video/simpsons.c index 76837c8c1f0..1ff4195fedf 100644 --- a/src/mame/video/simpsons.c +++ b/src/mame/video/simpsons.c @@ -103,25 +103,16 @@ void simpsons_video_banking(int bank) { if (bank & 1) { - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0fff, 0, 0, MRA8_RAM); - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0fff, 0, 0, paletteram_xBBBBBGGGGGRRRRR_be_w); + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0fff, 0, 0, MRA8_BANK5, paletteram_xBBBBBGGGGGRRRRR_be_w); + memory_set_bankptr(5, paletteram); } else - { - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0fff, 0, 0, K052109_r); - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0fff, 0, 0, K052109_w); - } + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0fff, 0, 0, K052109_r, K052109_w); if (bank & 2) - { - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, simpsons_K053247_r); - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, simpsons_K053247_w); - } + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, simpsons_K053247_r, simpsons_K053247_w); else - { - memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, simpsons_K052109_r); - memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, simpsons_K052109_w); - } + memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, simpsons_K052109_r, simpsons_K052109_w); }