summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/msx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mess/machine/msx.c')
-rw-r--r--src/mess/machine/msx.c747
1 files changed, 69 insertions, 678 deletions
diff --git a/src/mess/machine/msx.c b/src/mess/machine/msx.c
index c2c82e9f777..9b635c9fb2f 100644
--- a/src/mess/machine/msx.c
+++ b/src/mess/machine/msx.c
@@ -16,347 +16,9 @@
#define VERBOSE 0
-static int msx_probe_type (UINT8* pmem, int size)
-{
- int kon4, kon5, asc8, asc16, i;
-
- if (size <= 0x10000) return 0;
-
- if ( (pmem[0x10] == 'Y') && (pmem[0x11] == 'Z') && (size > 0x18000) )
- return 6;
-
- kon4 = kon5 = asc8 = asc16 = 0;
-
- for (i=0;i<size-3;i++)
- {
- if (pmem[i] == 0x32 && pmem[i+1] == 0)
- {
- switch (pmem[i+2])
- {
- case 0x60:
- case 0x70:
- asc16++;
- asc8++;
- break;
- case 0x68:
- case 0x78:
- asc8++;
- asc16--;
- }
-
- switch (pmem[i+2])
- {
- case 0x60:
- case 0x80:
- case 0xa0:
- kon4++;
- break;
- case 0x50:
- case 0x70:
- case 0x90:
- case 0xb0:
- kon5++;
- }
- }
- }
-
- if (MAX (kon4, kon5) > MAX (asc8, asc16) )
- return (kon5 > kon4) ? 2 : 3;
- else
- return (asc8 > asc16) ? 4 : 5;
-}
-
-DEVICE_IMAGE_LOAD_MEMBER(msx_state,msx_cart)
-{
- int size;
- int size_aligned;
- UINT8 *mem;
- int type = -1;
- astring extra;
- char *sramfile;
- slot_state *st;
- int id = -1;
-
- if (strcmp(image.device().tag(),":cart1")==0)
- id = 0;
-
- if (strcmp(image.device().tag(),":cart2")==0)
- id = 1;
-
- if( id == -1 )
- {
- //logerror ("error: invalid cart tag '%s'\n", image->tag);
- return IMAGE_INIT_FAIL;
- }
-
- if ( image.software_entry() != NULL )
- {
- /* Load software from software list */
- /* TODO: Add proper SRAM (size) handling */
-
- const char *mapper = image.get_feature("mapper");
- if (mapper != NULL)
- {
- static const struct { const char *mapper_name; int mapper_type; } mapper_types[] =
- {
- { "NOMAPPER", SLOT_EMPTY },
- { "M60002-0125SP", SLOT_ASCII8 },
- { "LZ93A13", SLOT_ASCII8 },
- { "NEOS MR6401", SLOT_ASCII8 },
- { "BS6202", SLOT_ASCII8 },
- { "BS6101", SLOT_ASCII8 },
- { "M60002-0125SP-16", SLOT_ASCII16 },
- { "LZ93A13-16", SLOT_ASCII16 },
- { "BS6101-16", SLOT_ASCII16 },
- { "MR6401", SLOT_ASCII16 },
- { "CROSS-BLAIM", SLOT_CROSS_BLAIM },
- { "GMASTER2", SLOT_GAMEMASTER2 },
- { "80IN1", SLOT_KOREAN_80IN1 },
- { "90IN1", SLOT_KOREAN_90IN1 },
- { "126IN1", SLOT_KOREAN_126IN1 },
- { "FM-PAC", SLOT_FMPAC },
- { "IREM TAM-S1", SLOT_RTYPE },
- { "KONAMI", SLOT_KONAMI },
- { "KONAMI-SCC", SLOT_KONAMI_SCC },
- { "SUPERLODE", SLOT_SUPERLODERUNNER },
- { "MAJUTSUSHI", SLOT_MAJUTSUSHI },
- { "DISK_ROM", SLOT_DISK_ROM },
- };
-
- for (int i = 0; i < ARRAY_LENGTH(mapper_types) && type < 0; i++)
- {
- if (!core_stricmp(mapper, mapper_types[i].mapper_name))
- type = mapper_types[i].mapper_type;
- }
-
- if (-1 == type)
- logerror("Mapper '%s' not recognized!\n", mapper);
- }
-
- UINT8 *tmp_sram = image.get_software_region("sram");
- if (tmp_sram)
- {
- if (type == SLOT_ASCII8) type = SLOT_ASCII8_SRAM;
- if (type == SLOT_ASCII16) type = SLOT_ASCII16_SRAM;
- }
-
- UINT8 *rom_region = image.get_software_region("rom");
- size = size_aligned = image.get_software_region_length("rom");
-
- mem = auto_alloc_array(machine(), UINT8, size_aligned);
- memcpy(mem, rom_region, size_aligned);
- }
- else
- {
- /* Old style image loading */
-
- size = image.length ();
- if (size < 0x2000)
- {
- logerror ("cart #%d: error: file is smaller than 2kb, too small to be true!\n", id);
- return IMAGE_INIT_FAIL;
- }
-
- /* allocate memory and load */
- size_aligned = 0x2000;
- while (size_aligned < size)
- size_aligned *= 2;
-
- mem = auto_alloc_array(machine(),UINT8,size_aligned);
- if (!mem)
- {
- logerror ("cart #%d: error: failed to allocate memory for cartridge\n", id);
- return IMAGE_INIT_FAIL;
- }
-
- if (size < size_aligned)
- memset (mem, 0xff, size_aligned);
-
- if (image.fread(mem, size) != size)
- {
- logerror ("cart #%d: %s: can't read full %d bytes\n", id, image.filename (), size);
- return IMAGE_INIT_FAIL;
- }
-
- /* see if msx.crc will tell us more */
- if (!hashfile_extrainfo(image, extra))
- {
- logerror("cart #%d: warning: no information in crc file\n", id);
- type = -1;
- }
- else
- if ((1 != sscanf(extra.cstr(), "%d", &type) ) || type < 0 || type > SLOT_LAST_CARTRIDGE_TYPE)
- {
- logerror("cart #%d: warning: information in crc file not valid\n", id);
- type = -1;
- }
- else
- logerror ("cart #%d: info: cart extra info: '%s' = %s\n", id, extra.cstr(), msx_slot_list[type].name);
-
- /* if not, attempt autodetection */
- if (type < 0)
- {
- type = msx_probe_type (mem, size);
-
- if (mem[0] != 'A' || mem[1] != 'B')
- logerror("cart #%d: %s: May not be a valid ROM file\n", id, image.filename ());
-
- logerror("cart #%d: Probed cartridge mapper %d/%s\n", id, type, msx_slot_list[type].name);
- }
- }
-
- /* mapper type 0 always needs 64kB */
- if (!type && size_aligned != 0x10000)
- {
- UINT8 *old_mem = mem;
- int old_size_aligned = size_aligned;
-
- size_aligned = 0x10000;
- mem = auto_alloc_array(machine(),UINT8, 0x10000);
- if (!mem)
- {
- auto_free(machine(),old_mem);
- logerror ("cart #%d: error: cannot allocate memory\n", id);
- return IMAGE_INIT_FAIL;
- }
-
- if (size < 0x10000)
- memset (mem + size, 0xff, 0x10000 - size);
-
- if (size > 0x10000)
- {
- logerror ("cart #%d: warning: rom truncated to 64kb due to mapperless type (possibly detected)\n", id);
-
- size = 0x10000;
- }
-
- /* Copy old contents to newly claimed memory */
- memcpy(mem,old_mem,old_size_aligned);
- auto_free(machine(),old_mem);
- }
-
- /* mapper type 0 (ROM) might need moving around a bit */
- if (!type)
- {
- int i, page = 1;
-
- /* find the correct page */
- if (mem[0] == 'A' && mem[1] == 'B')
- {
- for (i=2; i<=8; i += 2)
- {
- if (mem[i] || mem[i+1])
- {
- page = mem[i+1] / 0x40;
- break;
- }
- }
- }
-
- if (size <= 0x4000)
- {
- if (page == 1 || page == 2)
- {
- /* copy to the respective page */
- memcpy (mem + (page * 0x4000), mem, 0x4000);
- memset (mem, 0xff, 0x4000);
- }
- else
- {
- /* memory is repeated 4 times */
- page = -1;
- memcpy (mem + 0x4000, mem, 0x4000);
- memcpy (mem + 0x8000, mem, 0x4000);
- memcpy (mem + 0xc000, mem, 0x4000);
- }
- }
- else /*if (size <= 0xc000) */
- {
- if (page)
- {
- /* shift up 16kB; custom memcpy so overlapping memory isn't corrupted. ROM starts in page 1 (0x4000) */
- UINT8 *m;
-
- page = 1;
- i = 0xc000; m = mem + 0xffff;
- while (i--)
- {
- *m = *(m - 0x4000);
- m--;
- }
- memset (mem, 0xff, 0x4000);
- }
- }
-
- if (page)
- logerror ("cart #%d: info: rom in page %d\n", id, page);
- else
- logerror ("cart #%d: info: rom duplicted in all pages\n", id);
- }
-
- /* kludge */
- if (type == 0)
- type = SLOT_ROM;
-
- /* allocate and set slot_state for this cartridge */
- st = auto_alloc(machine(),slot_state);
- if (!st)
- {
- logerror ("cart #%d: error: cannot allocate memory for cartridge state\n", id);
- return IMAGE_INIT_FAIL;
- }
- memset (st, 0, sizeof (slot_state));
-
- st->m_type = type;
- sramfile = auto_alloc_array(machine(), char, strlen (image.filename ()) + 1);
-
- if (sramfile)
- {
- char *ext;
-
- strcpy (sramfile, image.basename ());
- ext = strrchr (sramfile, '.');
- if (ext)
- *ext = 0;
-
- st->m_sramfile = sramfile;
- }
-
- if (msx_slot_list[type].init (machine(), st, 0, mem, size_aligned))
- return IMAGE_INIT_FAIL;
-
- if (msx_slot_list[type].loadsram)
- msx_slot_list[type].loadsram (machine(), st);
-
- m_cart_state[id] = st;
- msx_memory_set_carts();
-
- return IMAGE_INIT_PASS;
-}
-
-DEVICE_IMAGE_UNLOAD_MEMBER(msx_state, msx_cart)
-{
- int id = -1;
-
- if (strcmp(image.device().tag(),":cart1")==0)
- id = 0;
-
- if (strcmp(image.device().tag(),":cart2")==0)
- id = 1;
-
- if( id == -1 )
- {
- //logerror ("error: invalid cart tag '%s'\n", image->tag);
- return;
- }
-
- if (msx_slot_list[m_cart_state[id]->m_type].savesram)
- msx_slot_list[m_cart_state[id]->m_type].savesram (machine(), m_cart_state[id]);
-}
-
WRITE_LINE_MEMBER(msx_state::msx_vdp_interrupt)
{
- m_maincpu->set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE));
+ m_maincpu->set_input_line(0, (state ? ASSERT_LINE : CLEAR_LINE));
}
void msx_state::msx_ch_reset_core ()
@@ -373,7 +35,6 @@ MACHINE_START_MEMBER(msx_state,msx)
MACHINE_START_MEMBER(msx_state,msx2)
{
m_port_c_old = 0xff;
- m_dsk_stat = 0x3f;
}
MACHINE_RESET_MEMBER(msx_state,msx)
@@ -612,16 +273,6 @@ WRITE8_MEMBER(msx_state::msx_psg_port_b_w)
m_psg_b = data;
}
-WRITE8_MEMBER( msx_state::msx_fmpac_w )
-{
- if (m_opll_active)
- {
- if (offset == 1)
- m_ym->write(space, 1, data);
- else
- m_ym->write(space, 0, data);
- }
-}
/*
** RTC functions
@@ -642,53 +293,6 @@ READ8_MEMBER( msx_state::msx_rtc_reg_r )
return m_rtc->read(space, m_rtc_latch);
}
-/*
-From: erbo@xs4all.nl (erik de boer)
-
-sony and philips have used (almost) the same design
-and this is the memory layout
-but it is not a msx standard !
-
-WD1793 or wd2793 registers
-
-address
-
-7FF8H read status register
- write command register
-7FF9H r/w track register (r/o on NMS 8245 and Sony)
-7FFAH r/w sector register (r/o on NMS 8245 and Sony)
-7FFBH r/w data register
-
-
-hardware registers
-
-address
-
-7FFCH r/w bit 0 side select
-7FFDH r/w b7>M-on , b6>in-use , b1>ds1 , b0>ds0 (all neg. logic)
-7FFEH not used
-7FFFH read b7>drq , b6>intrq
-
-set on 7FFDH bit 2 always to 0 (some use it as disk change reset)
-
-*/
-
-WRITE_LINE_MEMBER( msx_state::msx_wd179x_intrq_w )
-{
- if (state)
- m_dsk_stat &= ~0x40;
- else
- m_dsk_stat |= 0x40;
-}
-
-WRITE_LINE_MEMBER( msx_state::msx_wd179x_drq_w )
-{
- if (state)
- m_dsk_stat &= ~0x80;
- else
- m_dsk_stat |= 0x80;
-}
-
/*
** The PPI functions
@@ -705,7 +309,7 @@ WRITE8_MEMBER( msx_state::msx_ppi_port_a_w )
WRITE8_MEMBER( msx_state::msx_ppi_port_c_w )
{
- keylatch = data & 0x0f;
+ m_keylatch = data & 0x0f;
/* caps lock */
if ( BIT(m_port_c_old ^ data, 6) )
@@ -732,7 +336,7 @@ READ8_MEMBER( msx_state::msx_ppi_port_b_r )
int row, data;
ioport_port *keynames[] = { m_io_key0, m_io_key1, m_io_key2, m_io_key3, m_io_key4, m_io_key5 };
- row = keylatch;
+ row = m_keylatch;
if (row <= 10)
{
data = keynames[row / 2]->read();
@@ -750,198 +354,65 @@ READ8_MEMBER( msx_state::msx_ppi_port_b_r )
*
***********************************************************************/
-void msx_state::msx_memory_init()
+void msx_state::install_slot_pages(device_t &owner, UINT8 prim, UINT8 sec, UINT8 page, UINT8 numpages, device_t *device)
{
- int prim, sec, page, extent, option;
- int size = 0;
- const msx_slot_layout *layout= (msx_slot_layout*)NULL;
- const msx_slot *slot;
- slot_state *st;
- UINT8 *mem = NULL;
-
- if ( m_layout == NULL ) {
- fatalerror("No msx slot layout defined for this system!\n");
- }
+ msx_state &msx = downcast<msx_state &>(owner);
+ msx_internal_slot_interface *internal_slot = dynamic_cast<msx_internal_slot_interface *>(device);
- m_empty = auto_alloc_array(machine(), UINT8, 0x4000);
- memset (m_empty, 0xff, 0x4000);
-
- for (prim=0; prim<4; prim++) {
- for (sec=0; sec<4; sec++) {
- for (page=0; page<4; page++) {
- m_all_state[prim][sec][page]= (slot_state*)NULL;
- }
- }
+ for ( int i = page; i < MIN(page + numpages, 4); i++ )
+ {
+ msx.m_all_slots[prim][sec][i] = internal_slot;
}
-
- for (layout = m_layout; layout->entry != MSX_LAYOUT_LAST; layout++) {
- switch (layout->entry) {
- case MSX_LAYOUT_SLOT_ENTRY:
- prim = layout->slot_primary;
- sec = layout->slot_secondary;
- page = layout->slot_page;
- extent = layout->page_extent;
-
- if (layout->slot_secondary) {
- m_slot_expanded[layout->slot_primary]= TRUE;
- }
-
- slot = &msx_slot_list[layout->type];
- if (slot->slot_type != layout->type) {
- logerror ("internal error: msx_slot_list[%d].type != %d\n",
- slot->slot_type, slot->slot_type);
- }
-
- size = layout->size;
- option = layout->option;
-
- if (layout->type != SLOT_CARTRIDGE1 && layout->type != SLOT_CARTRIDGE2)
- {
- int size_tmp = 0;
- if (size < 0x4000)
- size_tmp = 0x4000;
- else if (size > 0x10000)
- size_tmp = 0x10000;
- else
- size_tmp = size;
- int extent_tmp = size_tmp / 0x4000;
- if (extent_tmp != extent)
- fatalerror("incorrect MSX_LAYOUT_SLOT configuration - expected extent %d but found %d\n", extent, extent_tmp);
- }
-
- if (VERBOSE)
- {
- logerror ("slot %d/%d/%d-%d: type %s, size 0x%x\n",
- prim, sec, page, page + extent - 1, slot->name, size);
- }
-
- st = (slot_state*)NULL;
- if (layout->type == SLOT_CARTRIDGE1) {
- st = m_cart_state[0];
- if (!st) {
- slot = &msx_slot_list[SLOT_SOUNDCARTRIDGE];
- size = 0x20000;
- }
- }
- if (layout->type == SLOT_CARTRIDGE2) {
- st = m_cart_state[1];
- if (!st) {
- /* Check whether the optional FM-PAC rom is present */
- option = 0x10000;
- size = 0x10000;
- mem = m_region_maincpu->base() + option;
- if (m_region_maincpu->bytes() >= size + option && mem[0] == 'A' && mem[1] == 'B') {
- slot = &msx_slot_list[SLOT_FMPAC];
- }
- else {
- slot = &msx_slot_list[SLOT_EMPTY];
- }
- }
- }
-
- if (!st) {
- switch (slot->mem_type) {
- case MSX_MEM_HANDLER:
- case MSX_MEM_ROM:
- mem = m_region_maincpu->base() + option;
- break;
- case MSX_MEM_RAM:
- mem = NULL;
- break;
- }
- st = auto_alloc_clear (machine(), slot_state);
- memset (st, 0, sizeof (slot_state));
-
- if (slot->init (machine(), st, layout->slot_page, mem, size)) {
- continue;
- }
- }
-
- while (extent--) {
- if (page > 3) {
- logerror ("internal error: msx_slot_layout wrong, "
- "page + extent > 3\n");
- break;
- }
- m_all_state[prim][sec][page] = st;
- page++;
- }
- break;
- }
+ if ( sec )
+ {
+ msx.m_slot_expanded[prim] = true;
}
}
-void msx_state::msx_memory_reset ()
+void msx_state::msx_memory_init()
{
- slot_state *st, *last_st = (slot_state*)NULL;
- int prim, sec, page;
-
- m_primary_slot = 0;
+ int count_populated_pages = 0;
- for (prim=0; prim<4; prim++)
+ // Populate all unpopulated slots with the dummy interface
+ for ( int prim = 0; prim < 4; prim++ )
{
- m_secondary_slot[prim] = 0;
- for (sec=0; sec<4; sec++)
+ for ( int sec = 0; sec < 4; sec++ )
{
- for (page=0; page<4; page++)
+ for ( int page = 0; page < 4; page++ )
{
- st = m_all_state[prim][sec][page];
- if (st && st != last_st)
- msx_slot_list[st->m_type].reset (machine(), st);
- last_st = st;
+ if ( m_all_slots[prim][sec][page] == NULL )
+ {
+ m_all_slots[prim][sec][page] = &m_empty_slot;
+ }
+ else
+ {
+ count_populated_pages++;
+ }
}
}
}
+
+ if ( count_populated_pages == 0 ) {
+ fatalerror("No msx slot layout defined for this system!\n");
+ }
}
-void msx_state::msx_memory_set_carts()
+void msx_state::msx_memory_reset ()
{
- const msx_slot_layout *layout;
- int page;
-
- if (!m_layout)
- return;
+ m_primary_slot = 0;
- for (layout = m_layout; layout->entry != MSX_LAYOUT_LAST; layout++)
+ for (int prim=0; prim<4; prim++)
{
- if (layout->entry == MSX_LAYOUT_SLOT_ENTRY)
- {
- switch (layout->type)
- {
- case SLOT_CARTRIDGE1:
- for (page=0; page<4; page++)
- m_all_state[layout->slot_primary][layout->slot_secondary][page]
- = m_cart_state[0];
- break;
- case SLOT_CARTRIDGE2:
- for (page=0; page<4; page++)
- m_all_state[layout->slot_primary][layout->slot_secondary][page]
- = m_cart_state[1];
- break;
- }
- }
+ m_secondary_slot[prim] = 0;
}
}
void msx_state::msx_memory_map_page (UINT8 page)
{
- int slot_primary;
- int slot_secondary;
- slot_state *st;
- const msx_slot *slot;
-
- slot_primary = (m_primary_slot >> (page * 2)) & 3;
- slot_secondary = (m_secondary_slot[slot_primary] >> (page * 2)) & 3;
+ int slot_primary = (m_primary_slot >> (page * 2)) & 3;
+ int slot_secondary = (m_secondary_slot[slot_primary] >> (page * 2)) & 3;
- st = m_all_state[slot_primary][slot_secondary][page];
- slot = st ? &msx_slot_list[st->m_type] : &msx_slot_list[SLOT_EMPTY];
- m_state[page] = st;
- m_slot[page] = slot;
-
- if (VERBOSE)
- logerror ("mapping %s in %d/%d/%d\n", slot->name, slot_primary, slot_secondary, page);
-
- slot->map (machine(), st, page);
+ m_current_page[page] = m_all_slots[slot_primary][slot_secondary][page];
}
void msx_state::msx_memory_map_all ()
@@ -950,94 +421,14 @@ void msx_state::msx_memory_map_all ()
msx_memory_map_page (i);
}
-WRITE8_MEMBER( msx_state::msx_page0_w )
-{
- if ( offset == 0 )
- {
- m_superloderunner_bank = data;
- if (m_slot[2]->slot_type == SLOT_SUPERLODERUNNER)
- m_slot[2]->map (machine(), m_state[2], 2);
- }
-
- switch (m_slot[0]->mem_type)
- {
- case MSX_MEM_RAM:
- m_ram_pages[0][offset] = data;
- break;
- case MSX_MEM_HANDLER:
- m_slot[0]->write (machine(), m_state[0], offset, data);
- }
-}
-
-WRITE8_MEMBER( msx_state::msx_page0_1_w )
+READ8_MEMBER( msx_state::msx_mem_read )
{
- msx_page0_w( space, 0x2000 + offset, data );
+ return m_current_page[offset >> 14]->read(space, offset);
}
-WRITE8_MEMBER( msx_state::msx_page1_w )
+WRITE8_MEMBER( msx_state::msx_mem_write )
{
- switch (m_slot[1]->mem_type)
- {
- case MSX_MEM_RAM:
- m_ram_pages[1][offset] = data;
- break;
- case MSX_MEM_HANDLER:
- m_slot[1]->write (machine(), m_state[1], 0x4000 + offset, data);
- }
-}
-
-WRITE8_MEMBER( msx_state::msx_page1_1_w )
-{
- msx_page1_w( space, 0x2000 + offset, data );
-}
-
-WRITE8_MEMBER( msx_state::msx_page1_2_w )
-{
- msx_page1_w( space, 0x3ff8 + offset, data );
-}
-
-WRITE8_MEMBER( msx_state::msx_page2_w )
-{
- switch (m_slot[2]->mem_type)
- {
- case MSX_MEM_RAM:
- m_ram_pages[2][offset] = data;
- break;
- case MSX_MEM_HANDLER:
- m_slot[2]->write (machine(), m_state[2], 0x8000 + offset, data);
- }
-}
-
-WRITE8_MEMBER( msx_state::msx_page2_1_w )
-{
- msx_page2_w( space, 0x1800 + offset, data );
-}
-
-WRITE8_MEMBER( msx_state::msx_page2_2_w )
-{
- msx_page2_w( space, 0x2000 + offset, data );
-}
-
-WRITE8_MEMBER( msx_state::msx_page2_3_w )
-{
- msx_page2_w( space, 0x3800 + offset, data );
-}
-
-WRITE8_MEMBER( msx_state::msx_page3_w )
-{
- switch (m_slot[3]->mem_type)
- {
- case MSX_MEM_RAM:
- m_ram_pages[3][offset] = data;
- break;
- case MSX_MEM_HANDLER:
- m_slot[3]->write (machine(), m_state[3], 0xc000 + offset, data);
- }
-}
-
-WRITE8_MEMBER( msx_state::msx_page3_1_w )
-{
- msx_page3_w( space, 0x2000 + offset, data );
+ m_current_page[offset >> 14]->write(space, offset, data);
}
WRITE8_MEMBER( msx_state::msx_sec_slot_w )
@@ -1052,42 +443,21 @@ WRITE8_MEMBER( msx_state::msx_sec_slot_w )
msx_memory_map_all ();
}
else
- msx_page3_w(space, 0x3fff, data);
+ m_current_page[3]->write(space, 0xffff, data);
}
READ8_MEMBER( msx_state::msx_sec_slot_r )
{
- UINT8 result;
int slot = m_primary_slot >> 6;
if (m_slot_expanded[slot])
- result = ~m_secondary_slot[slot];
+ {
+ return ~m_secondary_slot[slot];
+ }
else
- result = m_top_page[0x1fff];
-
- return result;
-}
-
-WRITE8_MEMBER( msx_state::msx_ram_mapper_w )
-{
- m_ram_mapper[offset] = data;
- if (m_slot[offset]->slot_type == SLOT_RAM_MM)
- m_slot[offset]->map (machine(), m_state[offset], offset);
-}
-
-READ8_MEMBER( msx_state::msx_ram_mapper_r )
-{
- return m_ram_mapper[offset] | m_ramio_set_bits;
-}
-
-WRITE8_MEMBER( msx_state::msx_90in1_w )
-{
- m_korean90in1_bank = data;
- if (m_slot[1]->slot_type == SLOT_KOREAN_90IN1)
- m_slot[1]->map (machine(), m_state[1], 1);
-
- if (m_slot[2]->slot_type == SLOT_KOREAN_90IN1)
- m_slot[2]->map (machine(), m_state[2], 2);
+ {
+ return m_current_page[3]->read(space, 0xffff);
+ }
}
READ8_MEMBER( msx_state::msx_kanji_r )
@@ -1112,3 +482,24 @@ WRITE8_MEMBER( msx_state::msx_kanji_w )
else
m_kanji_latch = (m_kanji_latch & 0x1f800) | ((data & 0x3f) << 5);
}
+
+READ8_MEMBER( msx_state::msx_switched_r )
+{
+ // Read from selected switched device
+ return this->space().read_byte( (m_current_switched_device << 8) | offset );
+}
+
+WRITE8_MEMBER( msx_state::msx_switched_w )
+{
+ if (offset == 0)
+ {
+ // Select switched device
+ m_current_switched_device = data;
+ }
+ else
+ {
+ // Write to selected switched device
+ this->space().write_byte( (m_current_switched_device << 8) | offset, data );
+ }
+}
+