From b94b14469e8b16009385457705d7b20cea617cfe Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 9 Oct 2019 21:02:22 -0400 Subject: [PATCH] thomson.cpp: Make a separate region for cartridge stuff (nw) --- src/mame/drivers/thomson.cpp | 157 ++++++++++++++++++++--------------- src/mame/includes/thomson.h | 2 + src/mame/machine/thomson.cpp | 98 ++++++++++++---------- 3 files changed, 143 insertions(+), 114 deletions(-) diff --git a/src/mame/drivers/thomson.cpp b/src/mame/drivers/thomson.cpp index 2f077ce9494..fc12ee5349f 100644 --- a/src/mame/drivers/thomson.cpp +++ b/src/mame/drivers/thomson.cpp @@ -395,21 +395,25 @@ void thomson_state::to7_map(address_map &map) ROM_START ( to7 ) - ROM_REGION ( 0x20000, "maincpu", 0 ) + ROM_REGION ( 0x10000, "maincpu", 0 ) ROM_LOAD ( "to7.rom", 0xe800, 0x1800, CRC(0e7826da) SHA1(23a2f84b03c01d385cc1923c8ece95c43756297a) ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) + + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL ( 0x00000, 0x10000, 0x39 ) ROM_FLOPPY7 ROM_END ROM_START ( t9000 ) - ROM_REGION ( 0x20000, "maincpu", 0 ) + ROM_REGION ( 0x10000, "maincpu", 0 ) ROM_LOAD ( "t9000.rom", 0xe800, 0x1800, CRC(daa8cfbf) SHA1(a5735db1ad4e529804fc46603f838d3f4ccaf5cf) ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) + + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL ( 0x00000, 0x10000, 0x39 ) ROM_FLOPPY7 ROM_END @@ -863,21 +867,25 @@ void thomson_state::to770_map(address_map &map) /* ------------ ROMS ------------ */ ROM_START ( to770 ) - ROM_REGION ( 0x20000, "maincpu", 0 ) + ROM_REGION ( 0x10000, "maincpu", 0 ) ROM_LOAD ( "to770.rom", 0xe800, 0x1800, /* BIOS */ CRC(89518862) SHA1(cd34474c0bcc758f6d71c90fbd40cef379d61374) ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) + + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL ( 0x00000, 0x10000, 0x39 ) ROM_FLOPPY7 ROM_END ROM_START ( to770a ) - ROM_REGION ( 0x20000, "maincpu", 0 ) + ROM_REGION ( 0x10000, "maincpu", 0 ) ROM_LOAD ( "to770a.rom", 0xe800, 0x1800, CRC(378ea808) SHA1(f4575b537dfdb46ff2a0e7cbe8dfe4ba63161b8e) ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) + + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL ( 0x00000, 0x10000, 0x39 ) ROM_FLOPPY7 ROM_END @@ -1061,7 +1069,7 @@ void thomson_state::mo5_map(address_map &map) /* ------------ ROMS ------------ */ ROM_START ( mo5 ) - ROM_REGION ( 0x20000, "maincpu", 0 ) + ROM_REGION ( 0x14000, "maincpu", 0 ) ROM_LOAD ( "mo5.rom", 0xf000, 0x1000, CRC(f0ea9140) SHA1(36ce2d3df1866ec2fe368c1c28757e2f5401cf44) ) @@ -1069,11 +1077,14 @@ ROM_START ( mo5 ) CRC(c2c11b9d) SHA1(512dd40fb45bc2b51a24c84b3723a32bc8e80c06) ) + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL( 0x00000, 0x10000, 0x39 ) + ROM_FLOPPY5 ROM_END ROM_START ( mo5e ) - ROM_REGION ( 0x20000, "maincpu", 0 ) + ROM_REGION ( 0x14000, "maincpu", 0 ) ROM_LOAD ( "mo5e.rom", 0xf000, 0x1000, CRC(6520213a) SHA1(f17a7a59baf2819ec80991b34b204795536a5e01) ) @@ -1081,6 +1092,9 @@ ROM_START ( mo5e ) CRC(934a72b2) SHA1(b37e2b1afbfba368c19be87b3bf61dfe6ad8b0bb) ) + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL( 0x00000, 0x10000, 0x39 ) + ROM_FLOPPY5 ROM_END @@ -1289,38 +1303,39 @@ void thomson_state::to9_map(address_map &map) */ ROM_START ( to9 ) - ROM_REGION ( 0x40000, "maincpu", 0 ) + ROM_REGION ( 0x30000, "maincpu", 0 ) ROM_LOAD ( "to9.rom", 0xe000, 0x2000, /* BIOS & floppy controller */ CRC(f9278bf7) SHA1(9e99e6ae0285950f007b19161de642a4031fe46e) ) /* BASIC & software */ - ROM_LOAD ( "basic9-0.rom", 0x20000, 0x4000, + ROM_LOAD ( "basic9-0.rom", 0x10000, 0x4000, CRC(c7bac620) SHA1(4b2a8b30cf437858ce978ba7b0dfa2bbd57eb38a) ) - ROM_LOAD ( "basic9-1.rom", 0x24000, 0x4000, + ROM_LOAD ( "basic9-1.rom", 0x14000, 0x4000, CRC(ea5f3e43) SHA1(5e58a29c2d117fcdb1f5e7ca31dbfffa0f9218f2) ) - ROM_LOAD ( "basic9-2.rom", 0x28000, 0x4000, + ROM_LOAD ( "basic9-2.rom", 0x18000, 0x4000, CRC(0f5581b3) SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) - ROM_LOAD ( "basic9-3.rom", 0x2c000, 0x4000, + ROM_LOAD ( "basic9-3.rom", 0x1c000, 0x4000, CRC(6b5b19e3) SHA1(0e832670c185694d9abbcebcc3ad90e94eed585d) ) - ROM_LOAD ( "soft9-0a.rom", 0x30000, 0x4000, + ROM_LOAD ( "soft9-0a.rom", 0x20000, 0x4000, CRC(8cee157e) SHA1(f32fc39b95890c00571e9f3fbcc2d8e0596fc4a1) ) - ROM_LOAD ( "soft9-1a.rom", 0x34000, 0x4000, + ROM_LOAD ( "soft9-1a.rom", 0x24000, 0x4000, CRC(cf39ac93) SHA1(b97e6b7389398e5706624973c11ee7ddba323ce1) ) - ROM_LOAD ( "soft9-0b.rom", 0x38000, 0x4000, + ROM_LOAD ( "soft9-0b.rom", 0x28000, 0x4000, CRC(033aee3f) SHA1(f3604e500329ec0489b05dbab05530322e9463c5) ) - ROM_LOAD ( "soft9-1b.rom", 0x3c000, 0x4000, + ROM_LOAD ( "soft9-1b.rom", 0x2c000, 0x4000, CRC(214fe527) SHA1(0d8e3f1ca347026e906c3d00a0371e8238c44a60) ) - ROM_FILL( 0x10000, 0x10000, 0x39 ) + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL( 0x00000, 0x10000, 0x39 ) ROM_FLOPPY7 ROM_END @@ -1608,61 +1623,63 @@ void thomson_state::to8_map(address_map &map) /* ------------ ROMS ------------ */ ROM_START ( to8 ) - ROM_REGION ( 0x34000, "maincpu", 0 ) + ROM_REGION ( 0x24000, "maincpu", 0 ) /* BIOS & floppy */ - ROM_LOAD ( "to8-0.rom", 0x30000, 0x2000, + ROM_LOAD ( "to8-0.rom", 0x20000, 0x2000, CRC(3c4a640a) SHA1(0a4952f0ca002d82ac83755e1f694d56399413b2) ) - ROM_LOAD ( "to8-1.rom", 0x32000, 0x2000, + ROM_LOAD ( "to8-1.rom", 0x22000, 0x2000, CRC(cb9bae2d) SHA1(a4a55a6e2c74bca15951158c5164970e922fc1c1) ) /* BASIC */ - ROM_LOAD ( "basic8-0.rom", 0x20000, 0x4000, + ROM_LOAD ( "basic8-0.rom", 0x10000, 0x4000, CRC(e5a00fb3) SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) - ROM_LOAD ( "basic8-1.rom", 0x24000, 0x4000, + ROM_LOAD ( "basic8-1.rom", 0x14000, 0x4000, CRC(4b241e63) SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) ) - ROM_LOAD ( "basic8-2.rom", 0x28000, 0x4000, + ROM_LOAD ( "basic8-2.rom", 0x18000, 0x4000, CRC(0f5581b3) SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) - ROM_LOAD ( "basic8-3.rom", 0x2c000, 0x4000, + ROM_LOAD ( "basic8-3.rom", 0x1c000, 0x4000, CRC(f552e7e3) SHA1(3208e0d7d90241a327ed24e4921303f16e167bd5) ) - ROM_FILL( 0x10000, 0x10000, 0x39 ) + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL( 0x00000, 0x10000, 0x39 ) ROM_FLOPPY7 ROM_END ROM_START ( to8d ) - ROM_REGION ( 0x34000, "maincpu", 0 ) + ROM_REGION ( 0x24000, "maincpu", 0 ) /* BIOS & floppy */ - ROM_LOAD ( "to8d-0.rom", 0x30000, 0x2000, + ROM_LOAD ( "to8d-0.rom", 0x20000, 0x2000, CRC(30ea4950) SHA1(6705100cd337fffb26ce999302b55fb71557b128) ) - ROM_LOAD ( "to8d-1.rom", 0x32000, 0x2000, + ROM_LOAD ( "to8d-1.rom", 0x22000, 0x2000, CRC(926cf0ca) SHA1(8521613ac00e04dd94b69e771aeaefbf4fe97bf7) ) /* BASIC */ - ROM_LOAD ( "basic8-0.rom", 0x20000, 0x4000, + ROM_LOAD ( "basic8-0.rom", 0x10000, 0x4000, CRC(e5a00fb3) SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) - ROM_LOAD ( "basic8-1.rom", 0x24000, 0x4000, + ROM_LOAD ( "basic8-1.rom", 0x14000, 0x4000, CRC(4b241e63) SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) ) - ROM_LOAD ( "basic8-2.rom", 0x28000, 0x4000, + ROM_LOAD ( "basic8-2.rom", 0x18000, 0x4000, CRC(0f5581b3) SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) - ROM_LOAD ( "basic8-3.rom", 0x2c000, 0x4000, + ROM_LOAD ( "basic8-3.rom", 0x1c000, 0x4000, CRC(f552e7e3) SHA1(3208e0d7d90241a327ed24e4921303f16e167bd5) ) - ROM_FILL( 0x10000, 0x10000, 0x39 ) + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL( 0x00000, 0x10000, 0x39 ) ROM_FLOPPY7 ROM_END @@ -1819,31 +1836,32 @@ void thomson_state::to9p_map(address_map &map) /* ------------ ROMS ------------ */ ROM_START ( to9p ) - ROM_REGION ( 0x34000, "maincpu", 0 ) + ROM_REGION ( 0x24000, "maincpu", 0 ) /* BIOS & floppy */ - ROM_LOAD ( "to9p-0.rom", 0x30000, 0x2000, + ROM_LOAD ( "to9p-0.rom", 0x20000, 0x2000, CRC(a2731296) SHA1(b30e06127d6e99d4ac5a5bb67881df27bbd9a7e5) ) - ROM_LOAD ( "to9p-1.rom", 0x32000, 0x2000, + ROM_LOAD ( "to9p-1.rom", 0x22000, 0x2000, CRC(c52ce315) SHA1(7eacbd796e76bc72b872f9700c9b90414899ea0f) ) /* BASIC */ - ROM_LOAD ( "basicp-0.rom", 0x20000, 0x4000, + ROM_LOAD ( "basicp-0.rom", 0x10000, 0x4000, CRC(e5a00fb3) SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) ) - ROM_LOAD ( "basicp-1.rom", 0x24000, 0x4000, + ROM_LOAD ( "basicp-1.rom", 0x14000, 0x4000, CRC(4b241e63) SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) ) - ROM_LOAD ( "basicp-2.rom", 0x28000, 0x4000, + ROM_LOAD ( "basicp-2.rom", 0x18000, 0x4000, CRC(0f5581b3) SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) ) - ROM_LOAD ( "basicp-3.rom", 0x2c000, 0x4000, + ROM_LOAD ( "basicp-3.rom", 0x1c000, 0x4000, CRC(ebe9c8d9) SHA1(b667ad09a1181f65059a2cbb4c95421bc544a334) ) - ROM_FILL( 0x10000, 0x10000, 0x39 ) + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL( 0x00000, 0x10000, 0x39 ) ROM_FLOPPY7 ROM_END @@ -1992,61 +2010,63 @@ void thomson_state::mo6_map(address_map &map) /* ------------ ROMS ------------ */ ROM_START ( mo6 ) - ROM_REGION ( 0x30000, "maincpu", 0 ) + ROM_REGION ( 0x20000, "maincpu", 0 ) /* BIOS */ - ROM_LOAD ( "mo6-0.rom", 0x23000, 0x1000, + ROM_LOAD ( "mo6-0.rom", 0x13000, 0x1000, CRC(0446eef6) SHA1(b57fcda69c95f0c97c5cb0605d17c49a0c630300) ) - ROM_LOAD ( "mo6-1.rom", 0x27000, 0x1000, + ROM_LOAD ( "mo6-1.rom", 0x17000, 0x1000, CRC(eb6df8d4) SHA1(24e2232f582ce04f260acd8e9ec710468a81505c) ) /* BASIC */ - ROM_LOAD ( "basic6-0.rom", 0x20000, 0x3000, + ROM_LOAD ( "basic6-0.rom", 0x10000, 0x3000, CRC(18789833) SHA1(fccbf69cbc6deba45a767a26cd6454cf0eedfc2b) ) - ROM_LOAD ( "basic6-1.rom", 0x24000, 0x3000, + ROM_LOAD ( "basic6-1.rom", 0x14000, 0x3000, CRC(c9b4d6f4) SHA1(47487d2bc4c9a9c09c733bd89c49693c52e262de) ) - ROM_LOAD ( "basic6-2.rom", 0x28000, 0x4000, + ROM_LOAD ( "basic6-2.rom", 0x18000, 0x4000, CRC(08eac9bb) SHA1(c0231fdb3bcccbbb10c1f93cc529fc3b96dd3f4d) ) - ROM_LOAD ( "basic6-3.rom", 0x2c000, 0x4000, + ROM_LOAD ( "basic6-3.rom", 0x1c000, 0x4000, CRC(19d66dc4) SHA1(301b6366269181b74cb5d7ccdf5455b7290ae99b) ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL ( 0x00000, 0x10000, 0x39 ) ROM_FLOPPY5 ROM_END ROM_START ( pro128 ) - ROM_REGION ( 0x30000, "maincpu", 0 ) + ROM_REGION ( 0x20000, "maincpu", 0 ) /* BIOS */ - ROM_LOAD ( "pro128-0.rom", 0x23000, 0x1000, + ROM_LOAD ( "pro128-0.rom", 0x13000, 0x1000, CRC(a8aef291) SHA1(2685cca841f405a37ef48b0115f90c865ce79d0f) ) - ROM_LOAD ( "pro128-1.rom", 0x27000, 0x1000, + ROM_LOAD ( "pro128-1.rom", 0x17000, 0x1000, CRC(5b3340ec) SHA1(269f2eb3e3452014b8d1f0f9e1c63fe56375a863) ) /* BASIC */ - ROM_LOAD ( "basico-0.rom", 0x20000, 0x3000, + ROM_LOAD ( "basico-0.rom", 0x10000, 0x3000, CRC(98b10d5e) SHA1(d6b77e694fa85e1114293448e5a64f6e2cf46c22) ) - ROM_LOAD ( "basico-1.rom", 0x24000, 0x3000, + ROM_LOAD ( "basico-1.rom", 0x14000, 0x3000, CRC(721d2124) SHA1(51db1cd03b3891e212a24aa6563b09968930d897) ) - ROM_LOAD ( "basico-2.rom", 0x28000, 0x4000, + ROM_LOAD ( "basico-2.rom", 0x18000, 0x4000, CRC(135438ab) SHA1(617d4e4979842bea2c21ef7f8c50f3b08b15239a) ) - ROM_LOAD ( "basico-3.rom", 0x2c000, 0x4000, + ROM_LOAD ( "basico-3.rom", 0x1c000, 0x4000, CRC(2c2befa6) SHA1(3e94e182bacbb55bb07be2af4c76c0b0df47b3bf) ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL ( 0x00000, 0x10000, 0x39 ) ROM_FLOPPY5 ROM_END @@ -2345,31 +2365,32 @@ void thomson_state::mo5nr_map(address_map &map) /* ------------ ROMS ------------ */ ROM_START ( mo5nr ) - ROM_REGION ( 0x30000, "maincpu", 0 ) + ROM_REGION ( 0x20000, "maincpu", 0 ) /* BIOS */ - ROM_LOAD ( "mo5nr-0.rom", 0x23000, 0x1000, + ROM_LOAD ( "mo5nr-0.rom", 0x13000, 0x1000, CRC(06e31115) SHA1(7429cc0c15475398b5ab514cb3d3efdc71cf082f) ) - ROM_LOAD ( "mo5nr-1.rom", 0x27000, 0x1000, + ROM_LOAD ( "mo5nr-1.rom", 0x17000, 0x1000, CRC(7cda17c9) SHA1(2ff6480ce9e30acc4c89b6113d7c8ea6095d90a5) ) /* BASIC */ - ROM_LOAD ( "basicn-0.rom", 0x20000, 0x3000, + ROM_LOAD ( "basicn-0.rom", 0x10000, 0x3000, CRC(fae9e691) SHA1(62fbfd6d4ca837f6cb8ed37f828eca97f80e6200) ) - ROM_LOAD ( "basicn-1.rom", 0x24000, 0x3000, + ROM_LOAD ( "basicn-1.rom", 0x14000, 0x3000, CRC(cf134dd7) SHA1(1bd961314e16e460d37a65f5e7f4acf5604fbb17) ) - ROM_LOAD ( "basicn-2.rom", 0x28000, 0x4000, + ROM_LOAD ( "basicn-2.rom", 0x18000, 0x4000, CRC(b69d2e0d) SHA1(ea3220bbae991e08259d38a7ea24533b2bb86418) ) - ROM_LOAD ( "basicn-3.rom", 0x2c000, 0x4000, + ROM_LOAD ( "basicn-3.rom", 0x1c000, 0x4000, CRC(7785610f) SHA1(c38b0be404d8af6f409a1b52cb79a4e10fc33177) ) - ROM_FILL ( 0x10000, 0x10000, 0x39 ) /* TODO: network ROM */ + ROM_REGION ( 0x10000, "cartridge", 0 ) + ROM_FILL ( 0x00000, 0x10000, 0x39 ) /* TODO: network ROM */ ROM_FLOPPY5 ROM_END diff --git a/src/mame/includes/thomson.h b/src/mame/includes/thomson.h index 6b4c6ef2939..c86c066e963 100644 --- a/src/mame/includes/thomson.h +++ b/src/mame/includes/thomson.h @@ -146,6 +146,7 @@ public: m_biosbank(*this, TO8_BIOS_BANK), m_cartlobank(*this, MO6_CART_LO), m_carthibank(*this, MO6_CART_HI), + m_cart_rom(*this, "cartridge"), m_thmfc(*this, "thmfc"), m_floppy_led(*this, "floppy"), m_floppy_image(*this, "floppy%u", 0U) @@ -427,6 +428,7 @@ private: optional_memory_bank m_biosbank; optional_memory_bank m_cartlobank; optional_memory_bank m_carthibank; + required_region_ptr m_cart_rom; required_device m_thmfc; output_finder<> m_floppy_led; diff --git a/src/mame/machine/thomson.cpp b/src/mame/machine/thomson.cpp index 763f114549f..f97ffe108ac 100644 --- a/src/mame/machine/thomson.cpp +++ b/src/mame/machine/thomson.cpp @@ -272,7 +272,7 @@ void thomson_state::thom_set_caps_led( int led ) DEVICE_IMAGE_LOAD_MEMBER( thomson_state::to7_cartridge ) { int i,j; - uint8_t* pos = memregion("maincpu" )->base() + 0x10000; + uint8_t* pos = &m_cart_rom[0]; offs_t size; char name[129]; @@ -373,8 +373,7 @@ WRITE8_MEMBER( thomson_state::to7_cartridge_w ) /* read signal to 0000-0003 generates a bank switch */ READ8_MEMBER( thomson_state::to7_cartridge_r ) { - uint8_t* pos = memregion( "maincpu" )->base() + 0x10000; - uint8_t data = pos[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; + uint8_t data = m_cart_rom[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; if ( !machine().side_effects_disabled() ) { m_thom_cart_bank = offset & 3; @@ -989,8 +988,7 @@ MACHINE_RESET_MEMBER( thomson_state, to7 ) MACHINE_START_MEMBER( thomson_state, to7 ) { - address_space& space = m_maincpu->space(AS_PROGRAM); - uint8_t* mem = memregion("maincpu")->base(); + uint8_t* cartmem = &m_cart_rom[0]; uint8_t* ram = m_ram->pointer(); LOG (( "to7: machine start called\n" )); @@ -1006,11 +1004,12 @@ MACHINE_START_MEMBER( thomson_state, to7 ) m_thom_vram = ram; m_basebank->configure_entry( 0, ram + 0x4000); m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entries( 0, 4, cartmem, 0x4000 ); m_basebank->set_entry( 0 ); m_vrambank->set_entry( 0 ); m_cartbank->set_entry( 0 ); + address_space& space = m_maincpu->space(AS_PROGRAM); space.unmap_readwrite(0x8000, 0xdfff); if ( m_ram->size() > 24*1024 ) @@ -1032,7 +1031,7 @@ MACHINE_START_MEMBER( thomson_state, to7 ) save_item(NAME(m_thom_cart_bank)); save_item(NAME(m_to7_lightpen)); save_item(NAME(m_to7_lightpen_step)); - save_pointer(NAME((mem + 0x10000)), 0x10000 ); + save_pointer(NAME(cartmem), 0x10000 ); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to7_update_cart_bank_postload),this)); } @@ -1213,7 +1212,7 @@ MACHINE_RESET_MEMBER( thomson_state, to770 ) MACHINE_START_MEMBER( thomson_state, to770 ) { - uint8_t* mem = memregion("maincpu")->base(); + uint8_t* cartmem = &m_cart_rom[0]; uint8_t* ram = m_ram->pointer(); LOG (( "to770: machine start called\n" )); @@ -1230,7 +1229,7 @@ MACHINE_START_MEMBER( thomson_state, to770 ) m_basebank->configure_entry( 0, ram + 0x4000); m_rambank->configure_entries( 0, 6, ram + 0x8000, 0x4000 ); m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entries( 0, 4, cartmem, 0x4000 ); m_basebank->set_entry( 0 ); m_rambank->set_entry( 0 ); m_vrambank->set_entry( 0 ); @@ -1241,7 +1240,7 @@ MACHINE_START_MEMBER( thomson_state, to770 ) save_item(NAME(m_thom_cart_bank)); save_item(NAME(m_to7_lightpen)); save_item(NAME(m_to7_lightpen_step)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); + save_pointer(NAME(cartmem), 0x10000 ); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to770_update_ram_bank_postload), this)); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to7_update_cart_bank_postload), this)); } @@ -1371,7 +1370,7 @@ WRITE8_MEMBER( thomson_state::mo5_gatearray_w ) DEVICE_IMAGE_LOAD_MEMBER( thomson_state::mo5_cartridge ) { - uint8_t* pos = memregion("maincpu")->base() + 0x10000; + uint8_t* pos = &m_cart_rom[0]; uint64_t size, i; int j; char name[129]; @@ -1533,8 +1532,7 @@ WRITE8_MEMBER( thomson_state::mo5_cartridge_w ) /* read signal to bffc-bfff generates a bank switch */ READ8_MEMBER( thomson_state::mo5_cartridge_r ) { - uint8_t* pos = memregion( "maincpu" )->base() + 0x10000; - uint8_t data = pos[offset + 0xbffc + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; + uint8_t data = m_cart_rom[offset + 0x3ffc + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; if ( !machine().side_effects_disabled() ) { m_thom_cart_bank = offset & 3; @@ -1593,6 +1591,7 @@ MACHINE_RESET_MEMBER( thomson_state, mo5 ) MACHINE_START_MEMBER( thomson_state, mo5 ) { uint8_t* mem = memregion("maincpu")->base(); + uint8_t* cartmem = &m_cart_rom[0]; uint8_t* ram = m_ram->pointer(); LOG (( "mo5: machine start called\n" )); @@ -1609,7 +1608,8 @@ MACHINE_START_MEMBER( thomson_state, mo5 ) m_mo5_reg_cart = 0; m_thom_vram = ram; m_basebank->configure_entry( 0, ram + 0x4000); - m_cartbank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entry( 0, mem + 0x10000); + m_cartbank->configure_entries( 1, 3, cartmem + 0x4000, 0x4000 ); m_cartbank->configure_entries( 4, 4, ram + 0xc000, 0x4000 ); m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); m_basebank->set_entry( 0 ); @@ -1622,7 +1622,7 @@ MACHINE_START_MEMBER( thomson_state, mo5 ) save_item(NAME(m_to7_lightpen)); save_item(NAME(m_to7_lightpen_step)); save_item(NAME(m_mo5_reg_cart)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); + save_pointer(NAME(cartmem), 0x10000 ); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo5_update_cart_bank_postload), this)); } @@ -1938,8 +1938,7 @@ WRITE8_MEMBER( thomson_state::to9_cartridge_w ) /* read signal to 0000-0003 generates a bank switch */ READ8_MEMBER( thomson_state::to9_cartridge_r ) { - uint8_t* pos = memregion( "maincpu" )->base() + 0x10000; - uint8_t data = pos[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; + uint8_t data = m_cart_rom[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; if ( !machine().side_effects_disabled() ) { m_thom_cart_bank = offset & 3; @@ -2535,6 +2534,7 @@ MACHINE_RESET_MEMBER( thomson_state, to9 ) MACHINE_START_MEMBER( thomson_state, to9 ) { uint8_t* mem = memregion("maincpu")->base(); + uint8_t* cartmem = &m_cart_rom[0]; uint8_t* ram = m_ram->pointer(); LOG (( "to9: machine start called\n" )); @@ -2551,7 +2551,7 @@ MACHINE_START_MEMBER( thomson_state, to9 ) m_thom_vram = ram; m_thom_cart_bank = 0; m_vrambank->configure_entries( 0, 2, m_thom_vram, 0x2000 ); - m_cartbank->configure_entries( 0, 12, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entries( 0, 12, cartmem, 0x4000 ); m_basebank->configure_entry( 0, ram + 0x4000); m_rambank->configure_entries( 0, 10, ram + 0x8000, 0x4000 ); m_vrambank->set_entry( 0 ); @@ -2565,7 +2565,7 @@ MACHINE_START_MEMBER( thomson_state, to9 ) save_item(NAME(m_to7_lightpen)); save_item(NAME(m_to7_lightpen_step)); save_item(NAME(m_to9_soft_bank)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); + save_pointer(NAME(cartmem), 0x10000 ); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to9_update_ram_bank_postload), this)); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to9_update_cart_bank_postload), this)); } @@ -3139,8 +3139,7 @@ WRITE8_MEMBER( thomson_state::to8_cartridge_w ) /* read signal to 0000-0003 generates a bank switch */ READ8_MEMBER( thomson_state::to8_cartridge_r ) { - uint8_t* pos = memregion( "maincpu" )->base() + 0x10000; - uint8_t data = pos[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; + uint8_t data = m_cart_rom[offset + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; if ( !machine().side_effects_disabled() ) { m_thom_cart_bank = offset & 3; @@ -3167,7 +3166,7 @@ void thomson_state::to8_floppy_reset() to7_floppy_reset(); if ( THOM_FLOPPY_INT ) m_thmfc->floppy_reset(); - m_flopbank->configure_entries( TO7_NB_FLOP_BANK, 2, mem + 0x30000, 0x2000 ); + m_flopbank->configure_entries( TO7_NB_FLOP_BANK, 2, mem + 0x20000, 0x2000 ); } @@ -3543,6 +3542,7 @@ MACHINE_RESET_MEMBER( thomson_state, to8 ) MACHINE_START_MEMBER( thomson_state, to8 ) { uint8_t* mem = memregion("maincpu")->base(); + uint8_t* cartmem = &m_cart_rom[0]; uint8_t* ram = m_ram->pointer(); LOG (( "to8: machine start called\n" )); @@ -3558,7 +3558,8 @@ MACHINE_START_MEMBER( thomson_state, to8 ) /* memory */ m_thom_cart_bank = 0; m_thom_vram = ram; - m_cartbank->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entries( 0, 4, cartmem, 0x4000 ); + m_cartbank->configure_entries( 4, 4, mem + 0x10000, 0x4000 ); if ( m_ram->size() == 256*1024 ) { m_cartbank->configure_entries( 8, 16, ram, 0x4000 ); @@ -3577,7 +3578,7 @@ MACHINE_START_MEMBER( thomson_state, to8 ) m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); m_syslobank->configure_entry( 0, ram + 0x6000); m_syshibank->configure_entry( 0, ram + 0x4000); - m_biosbank->configure_entries( 0, 2, mem + 0x30800, 0x2000 ); + m_biosbank->configure_entries( 0, 2, mem + 0x20800, 0x2000 ); m_cartbank->set_entry( 0 ); m_vrambank->set_entry( 0 ); m_syslobank->set_entry( 0 ); @@ -3601,7 +3602,7 @@ MACHINE_START_MEMBER( thomson_state, to8 ) save_item(NAME(m_to8_lightpen_intr)); save_item(NAME(m_to8_data_vpage)); save_item(NAME(m_to8_cart_vpage)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); + save_pointer(NAME(cartmem), 0x10000 ); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_ram_bank_postload), this)); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_cart_bank_postload), this)); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_floppy_bank_postload), this)); @@ -3692,6 +3693,7 @@ MACHINE_RESET_MEMBER( thomson_state, to9p ) MACHINE_START_MEMBER( thomson_state, to9p ) { uint8_t* mem = memregion("maincpu")->base(); + uint8_t* cartmem = &m_cart_rom[0]; uint8_t* ram = m_ram->pointer(); LOG (( "to9p: machine start called\n" )); @@ -3707,14 +3709,15 @@ MACHINE_START_MEMBER( thomson_state, to9p ) /* memory */ m_thom_cart_bank = 0; m_thom_vram = ram; - m_cartbank->configure_entries( 0, 8, mem + 0x10000, 0x4000 ); + m_cartbank->configure_entries( 0, 4, cartmem, 0x4000 ); + m_cartbank->configure_entries( 4, 4, mem + 0x10000, 0x4000 ); m_cartbank->configure_entries( 8, 32, ram, 0x4000 ); m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); m_syslobank->configure_entry( 0, ram + 0x6000 ); m_syshibank->configure_entry( 0, ram + 0x4000 ); m_datalobank->configure_entries( 0, 32, ram + 0x2000, 0x4000 ); m_datahibank->configure_entries( 0, 32, ram + 0x0000, 0x4000 ); - m_biosbank->configure_entries( 0, 2, mem + 0x30800, 0x2000 ); + m_biosbank->configure_entries( 0, 2, mem + 0x20800, 0x2000 ); m_cartbank->set_entry( 0 ); m_vrambank->set_entry( 0 ); m_syslobank->set_entry( 0 ); @@ -3738,7 +3741,7 @@ MACHINE_START_MEMBER( thomson_state, to9p ) save_item(NAME(m_to8_lightpen_intr)); save_item(NAME(m_to8_data_vpage)); save_item(NAME(m_to8_cart_vpage)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); + save_pointer(NAME(cartmem), 0x10000 ); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_ram_bank_postload), this)); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_cart_bank_postload), this)); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::to8_update_floppy_bank_postload), this)); @@ -4008,8 +4011,7 @@ WRITE8_MEMBER( thomson_state::mo6_cartridge_w ) /* read signal generates a bank switch */ READ8_MEMBER( thomson_state::mo6_cartridge_r ) { - uint8_t* pos = memregion( "maincpu" )->base() + 0x10000; - uint8_t data = pos[offset + 0xbffc + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; + uint8_t data = m_cart_rom[offset + 0x3ffc + (m_thom_cart_bank % m_thom_cart_nb_banks) * 0x4000]; if ( !machine().side_effects_disabled() ) { m_thom_cart_bank = offset & 3; @@ -4376,6 +4378,7 @@ MACHINE_RESET_MEMBER( thomson_state, mo6 ) MACHINE_START_MEMBER( thomson_state, mo6 ) { uint8_t* mem = memregion("maincpu")->base(); + uint8_t* cartmem = &m_cart_rom[0]; uint8_t* ram = m_ram->pointer(); LOG (( "mo6: machine start called\n" )); @@ -4392,20 +4395,21 @@ MACHINE_START_MEMBER( thomson_state, mo6 ) m_thom_cart_bank = 0; m_mo5_reg_cart = 0; m_thom_vram = ram; - m_cartlobank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - m_cartlobank->configure_entries( 4, 2, mem + 0x1f000, 0x4000 ); - m_cartlobank->configure_entries( 6, 2, mem + 0x28000, 0x4000 ); + m_cartlobank->configure_entries( 0, 4, cartmem, 0x4000 ); + m_cartlobank->configure_entry( 4, cartmem + 0xf000 ); // FIXME: this is wrong + m_cartlobank->configure_entry( 5, mem + 0x13000 ); // FIXME: this is wrong + m_cartlobank->configure_entries( 6, 2, mem + 0x18000, 0x4000 ); m_cartlobank->configure_entries( 8, 8, ram + 0x3000, 0x4000 ); - m_carthibank->configure_entries( 0, 4, mem + 0x10000 + 0x1000, 0x4000 ); - m_carthibank->configure_entries( 4, 2, mem + 0x1f000 + 0x1000, 0x4000 ); - m_carthibank->configure_entries( 6, 2, mem + 0x28000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 0, 4, cartmem + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 4, 2, mem + 0x10000, 0x4000 ); + m_carthibank->configure_entries( 6, 2, mem + 0x18000 + 0x1000, 0x4000 ); m_carthibank->configure_entries( 8, 8, ram, 0x4000 ); m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); m_syslobank->configure_entry( 0, ram + 0x6000); m_syshibank->configure_entry( 0, ram + 0x4000); m_datalobank->configure_entries( 0, 8, ram + 0x2000, 0x4000 ); m_datahibank->configure_entries( 0, 8, ram + 0x0000, 0x4000 ); - m_biosbank->configure_entries( 0, 2, mem + 0x23000, 0x4000 ); + m_biosbank->configure_entries( 0, 2, mem + 0x13000, 0x4000 ); m_cartlobank->set_entry( 0 ); m_carthibank->set_entry( 0 ); m_vrambank->set_entry( 0 ); @@ -4428,7 +4432,7 @@ MACHINE_START_MEMBER( thomson_state, mo6 ) save_item(NAME(m_to8_data_vpage)); save_item(NAME(m_to8_cart_vpage)); save_item(NAME(m_mo5_reg_cart)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); + save_pointer(NAME(cartmem), 0x10000 ); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_ram_bank_postload), this)); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_cart_bank_postload), this)); } @@ -4598,6 +4602,7 @@ MACHINE_RESET_MEMBER( thomson_state, mo5nr ) MACHINE_START_MEMBER( thomson_state, mo5nr ) { uint8_t* mem = memregion("maincpu")->base(); + uint8_t* cartmem = &m_cart_rom[0]; uint8_t* ram = m_ram->pointer(); LOG (( "mo5nr: machine start called\n" )); @@ -4615,20 +4620,21 @@ MACHINE_START_MEMBER( thomson_state, mo5nr ) m_mo5_reg_cart = 0; m_thom_vram = ram; - m_cartlobank->configure_entries( 0, 4, mem + 0x10000, 0x4000 ); - m_cartlobank->configure_entries( 4, 2, mem + 0x1f000, 0x4000 ); - m_cartlobank->configure_entries( 6, 2, mem + 0x28000, 0x4000 ); + m_cartlobank->configure_entries( 0, 4, cartmem, 0x4000 ); + m_cartlobank->configure_entry( 4, cartmem + 0xf000 ); // FIXME: this is wrong + m_cartlobank->configure_entry( 5, mem + 0x13000 ); // FIXME: this is wrong + m_cartlobank->configure_entries( 6, 2, mem + 0x18000, 0x4000 ); m_cartlobank->configure_entries( 8, 8, ram + 0x3000, 0x4000 ); - m_carthibank->configure_entries( 0, 4, mem + 0x10000 + 0x1000, 0x4000 ); - m_carthibank->configure_entries( 4, 2, mem + 0x1f000 + 0x1000, 0x4000 ); - m_carthibank->configure_entries( 6, 2, mem + 0x28000 + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 0, 4, cartmem + 0x1000, 0x4000 ); + m_carthibank->configure_entries( 4, 2, mem + 0x10000, 0x4000 ); + m_carthibank->configure_entries( 6, 2, mem + 0x18000 + 0x1000, 0x4000 ); m_carthibank->configure_entries( 8, 8, ram, 0x4000 ); m_vrambank->configure_entries( 0, 2, ram, 0x2000 ); m_syslobank->configure_entry( 0, ram + 0x6000); m_syshibank->configure_entry( 0, ram + 0x4000); m_datalobank->configure_entries( 0, 8, ram + 0x2000, 0x4000 ); m_datahibank->configure_entries( 0, 8, ram + 0x0000, 0x4000 ); - m_biosbank->configure_entries( 0, 2, mem + 0x23000, 0x4000 ); + m_biosbank->configure_entries( 0, 2, mem + 0x13000, 0x4000 ); m_cartlobank->set_entry( 0 ); m_carthibank->set_entry( 0 ); m_vrambank->set_entry( 0 ); @@ -4651,7 +4657,7 @@ MACHINE_START_MEMBER( thomson_state, mo5nr ) save_item(NAME(m_to8_data_vpage)); save_item(NAME(m_to8_cart_vpage)); save_item(NAME(m_mo5_reg_cart)); - save_pointer(NAME(mem + 0x10000), 0x10000 ); + save_pointer(NAME(cartmem), 0x10000 ); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_ram_bank_postload), this)); machine().save().register_postload(save_prepost_delegate(FUNC(thomson_state::mo6_update_cart_bank_postload), this)); }