protected override void UpdateMapping() { m_lock = (CMR0 & 0x20) != 0; var norom = CPUS; // CPUS if (!norom) { if (m_lock) { SetAfeAfb(AFE, (byte)(AFB & 0x7F), false); } if (DOSEN && CPNET) // what is CPNET? { // more priority, then 7FFD SetAfeAfb(AFE, (byte)(AFB | 0x80), false); } } int romPage; if (CPSYS) { romPage = GetRomIndex(RomId.ROM_SYS); } else if (DOSEN) // trdos or 48/128 { romPage = GetRomIndex(RomId.ROM_DOS); } else { romPage = (CMR0 & 0x10) != 0 ? GetRomIndex(RomId.ROM_SOS) : GetRomIndex(RomId.ROM_128); } romPage |= CMR1 & 4; // extended 64K rom (if exists) var videoPage = (CMR0 & 0x08) == 0 ? 5 : 7; var ramPage = CMR0 & 7; var sega = CMR1 & 3; // & 7 for 1024K ramPage |= sega << 3; if (m_ulaAtm != null) { var videoMode = (AtmVideoMode)(((AFE >> 6) & 1) | ((AFE >> 4) & 2)); // (m_aFE >> 5) & 3 m_ulaAtm.SetPageMappingAtm( videoMode, videoPage, norom ? 0 : -1, norom ? 4 : 5, 2, ramPage); } else { m_ula.SetPageMapping( videoPage, norom ? 0 : -1, norom ? 4 : 5, 2, ramPage); } MapRead0000 = norom ? RamPages[0] : RomPages[romPage]; MapRead4000 = norom ? RamPages[4] : RamPages[5]; MapRead8000 = RamPages[2]; MapReadC000 = RamPages[ramPage]; MapWrite0000 = norom ? MapRead0000 : m_trashPage; MapWrite4000 = MapRead4000; MapWrite8000 = MapRead8000; MapWriteC000 = MapReadC000; }
protected override void UpdateMapping() { m_lock = (CMR0 & 0x20) != 0; if (PEN) { int videoPage = (CMR0 & 0x08) == 0 ? 5 : 7; if (m_ulaAtm != null) { m_ulaAtm.SetPageMappingAtm( RG, videoPage, -1, -1, -1, -1); } else { m_ula.SetPageMapping( videoPage, -1, -1, -1, -1); } int romPage = RomPages.Length - 1; MapRead0000 = RomPages[romPage]; MapRead4000 = RomPages[romPage]; MapRead8000 = RomPages[romPage]; MapReadC000 = RomPages[romPage]; MapWrite0000 = m_trashPage; MapWrite4000 = m_trashPage; MapWrite8000 = m_trashPage; MapWriteC000 = m_trashPage; Map48[0] = -1; Map48[1] = -1; Map48[2] = -1; Map48[3] = -1; } else { int videoPage = (CMR0 & 0x08) == 0 ? 5 : 7; var index = (CMR0 & 0x10) >> 2; var w0 = m_ru2[index + 0] ^ 0xFF; var w1 = m_ru2[index + 1] ^ 0xFF; var w2 = m_ru2[index + 2] ^ 0xFF; var w3 = m_ru2[index + 3] ^ 0xFF; var kpa0 = CMR0 & 7; var kpa8 = (DOSEN | SYSEN) ? 1 : 0; var romPage0 = ((w0 & 0x80) == 0 ? kpa8 | (w0 & 6) : w0 & 7) & m_romMask; var romPage1 = ((w1 & 0x80) == 0 ? kpa8 | (w1 & 6) : w1 & 7) & m_romMask; var romPage2 = ((w2 & 0x80) == 0 ? kpa8 | (w2 & 6) : w2 & 7) & m_romMask; var romPage3 = ((w3 & 0x80) == 0 ? kpa8 | (w3 & 6) : w3 & 7) & m_romMask; var ramPage0 = ((w0 & 0x80) == 0 ? (w0 & 0x38) | kpa0 : w0 & 0x3F) & m_ramMask; var ramPage1 = ((w1 & 0x80) == 0 ? (w1 & 0x38) | kpa0 : w1 & 0x3F) & m_ramMask; var ramPage2 = ((w2 & 0x80) == 0 ? (w2 & 0x38) | kpa0 : w2 & 0x3F) & m_ramMask; var ramPage3 = ((w3 & 0x80) == 0 ? (w3 & 0x38) | kpa0 : w3 & 0x3F) & m_ramMask; var isRam0 = (w0 & 0x40) == 0; var isRam1 = (w1 & 0x40) == 0; var isRam2 = (w2 & 0x40) == 0; var isRam3 = (w3 & 0x40) == 0; if (m_ulaAtm != null) { m_ulaAtm.SetPageMappingAtm( RG, videoPage, isRam0 ? ramPage0 : -1, isRam1 ? ramPage1 : -1, isRam2 ? ramPage2 : -1, isRam3 ? ramPage3 : -1); } else { m_ula.SetPageMapping( videoPage, isRam0 ? ramPage0 : -1, isRam1 ? ramPage1 : -1, isRam2 ? ramPage2 : -1, isRam3 ? ramPage3 : -1); } MapRead0000 = isRam0 ? RamPages[ramPage0] : RomPages[romPage0]; MapRead4000 = isRam1 ? RamPages[ramPage1] : RomPages[romPage1]; MapRead8000 = isRam2 ? RamPages[ramPage2] : RomPages[romPage2]; MapReadC000 = isRam3 ? RamPages[ramPage3] : RomPages[romPage3]; MapWrite0000 = isRam0 ? MapRead0000 : m_trashPage; MapWrite4000 = isRam1 ? MapRead4000 : m_trashPage; MapWrite8000 = isRam2 ? MapRead8000 : m_trashPage; MapWriteC000 = isRam3 ? MapReadC000 : m_trashPage; Map48[0] = isRam0 ? -1 : romPage0; Map48[1] = isRam1 ? ramPage1 : -1; Map48[2] = isRam2 ? ramPage2 : -1; Map48[3] = isRam3 ? ramPage3 : -1; } }