From c6f2743b2c14d4110cc2c739d23426a804b5e27b Mon Sep 17 00:00:00 2001 From: Wilbert Pol Date: Wed, 22 May 2013 19:13:53 +0000 Subject: [PATCH] (MESS) to8/to8d: Fixed support for 256K RAM; should hopefully fix MT#5160. (nw) --- src/mess/machine/thomson.c | 10 +++++++++- src/mess/video/thomson.c | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mess/machine/thomson.c b/src/mess/machine/thomson.c index 3c9eed60015..7e32d7c7233 100644 --- a/src/mess/machine/thomson.c +++ b/src/mess/machine/thomson.c @@ -4110,7 +4110,15 @@ MACHINE_START_MEMBER( thomson_state, to8 ) m_thom_cart_bank = 0; m_thom_vram = ram; membank( THOM_CART_BANK )->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); - membank( THOM_CART_BANK )->configure_entries( 8, 32, ram, 0x4000 ); + if ( m_ram->size() == 256*1024 ) + { + membank( THOM_CART_BANK )->configure_entries( 8, 16, ram, 0x4000 ); + membank( THOM_CART_BANK )->configure_entries( 8+16, 16, ram, 0x4000 ); + } + else + { + membank( THOM_CART_BANK )->configure_entries( 8, 32, ram, 0x4000 ); + } membank( THOM_VRAM_BANK )->configure_entries( 0, 2, ram, 0x2000 ); membank( TO8_SYS_LO )->configure_entry( 0, ram + 0x6000); membank( TO8_SYS_HI )->configure_entry( 0, ram + 0x4000); diff --git a/src/mess/video/thomson.c b/src/mess/video/thomson.c index 727e19a34d2..235055788d6 100644 --- a/src/mess/video/thomson.c +++ b/src/mess/video/thomson.c @@ -1192,7 +1192,7 @@ WRITE8_MEMBER( thomson_state::to8_sys_hi_w ) WRITE8_MEMBER( thomson_state::to8_data_lo_w ) { - UINT8* dst = m_thom_vram + offset + 0x4000 * m_to8_data_vpage + 0x2000; + UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_data_vpage + 0x2000 ) & m_ram->mask() ); assert( offset < 0x2000 ); if ( *dst == data ) return; @@ -1207,7 +1207,7 @@ WRITE8_MEMBER( thomson_state::to8_data_lo_w ) WRITE8_MEMBER( thomson_state::to8_data_hi_w ) { - UINT8* dst = m_thom_vram + offset + 0x4000 * m_to8_data_vpage; + UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_data_vpage ) & m_ram->mask() ); assert( offset < 0x2000 ); if ( *dst == data ) return; @@ -1223,7 +1223,7 @@ WRITE8_MEMBER( thomson_state::to8_data_hi_w ) /* write to video memory page through cartridge addresses space */ WRITE8_MEMBER( thomson_state::to8_vcart_w ) { - UINT8* dst = m_thom_vram + offset + 0x4000 * m_to8_cart_vpage; + UINT8* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_cart_vpage ) & m_ram->mask() ); assert( offset < 0x4000 ); if ( *dst == data ) return;