| 1989 | //=========================================================================== |
| 1990 | |
| 1991 | void MemInitialize() |
| 1992 | { |
| 1993 | // ALLOCATE MEMORY FOR THE APPLE MEMORY IMAGE AND ASSOCIATED DATA STRUCTURES |
| 1994 | // NB. alloc memaux even if a IIe with an empty aux slot - writes still go to memaux, but reads are from floating bus |
| 1995 | memaux = ALIGNED_ALLOC(_6502_MEM_LEN); // NB. alloc even if model is Apple II/II+, since it's used by VidHD card |
| 1996 | memmain = ALIGNED_ALLOC(_6502_MEM_LEN); |
| 1997 | memimage = AllocMemImage(); |
| 1998 | |
| 1999 | memdirty = new BYTE[0x100]; |
| 2000 | memrom = new BYTE[0x3000 * MaxRomPages]; |
| 2001 | |
| 2002 | pCxRomInternal = new BYTE[CxRomSize]; |
| 2003 | pCxRomPeripheral = new BYTE[CxRomSize]; |
| 2004 | |
| 2005 | if (!memaux || !memdirty || !memimage || !memmain || !memrom || !pCxRomInternal || !pCxRomPeripheral) |
| 2006 | { |
| 2007 | GetFrame().FrameMessageBox( |
| 2008 | "The emulator was unable to allocate the memory it " |
| 2009 | "requires. Further execution is not possible.", |
| 2010 | g_pAppTitle.c_str(), |
| 2011 | MB_ICONSTOP | MB_SETFOREGROUND); |
| 2012 | ExitProcess(1); |
| 2013 | } |
| 2014 | |
| 2015 | RWpages[0] = memaux; |
| 2016 | |
| 2017 | #ifdef RAMWORKS |
| 2018 | if (GetCardMgr().QueryAux() == CT_RamWorksIII) |
| 2019 | { |
| 2020 | // allocate memory for RamWorks III - up to 16MB |
| 2021 | UINT i = 1; |
| 2022 | while ((i < g_uMaxExBanks) && (RWpages[i] = ALIGNED_ALLOC(_6502_MEM_LEN))) |
| 2023 | i++; |
| 2024 | while (i < kMaxExMemoryBanks) |
| 2025 | RWpages[i++] = NULL; |
| 2026 | } |
| 2027 | #endif |
| 2028 | |
| 2029 | // |
| 2030 | |
| 2031 | // Load the No-Slot clock state |
| 2032 | uint32_t hasNoSlotClock; |
| 2033 | REGLOAD_DEFAULT(REGVALUE_NO_SLOT_CLOCK, &hasNoSlotClock, 1); |
| 2034 | hasNoSlotClock ? MemInsertNoSlotClock() : MemRemoveNoSlotClock(); |
| 2035 | |
| 2036 | // |
| 2037 | |
| 2038 | CreateLanguageCard(); |
| 2039 | |
| 2040 | MemInitializeROM(); |
| 2041 | MemInitializeCustomROM(); |
| 2042 | MemInitializeCustomF8ROM(); |
| 2043 | MemInitializeIO(); |
| 2044 | MemReset(); |
| 2045 | } |
| 2046 | |
| 2047 | void MemInitializeROM(void) |
| 2048 | { |
no test coverage detected