/* * Exit emulator */ static void do_exit_machine (void) { graphics_leave (); inputdevice_close (); #ifdef SCSIEMU scsidev_exit (); #endif DISK_free (); audio_close (); dump_counts (); #ifdef SERIAL_PORT serial_exit (); #endif #ifdef CD32 akiko_free (); #endif gui_exit (); #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef FILESYS filesys_cleanup (); hardfile_cleanup (); rtarea_cleanup (); #endif #ifdef SAVESTATE savestate_free (); #endif memory_cleanup (); cfgfile_addcfgparam (0); }
static void rtarea_init_mem (void) { rtarea = mapped_malloc (0x10000, "rtarea"); if (!rtarea) { write_log ("virtual memory exhausted (rtarea)!\n"); return; } /* TODO: *** reinitializing rtarea with filesys/expansion code *** * Moved here from memory_reset(), so we don't lose all the extension/filesys * traps that will be set up later */ rtarea_cleanup(); /* FAMEC fast (direct) memory access instead of functions */ rtarea_bank.baseaddr = rtarea; }
void memory_reset (void) { int i, custom_start; if (mainMenu_useOneMegaChip) prefs_chipmem_size=0x00100000; else prefs_chipmem_size=0x00100000>>1; #ifdef DEBUG_MEMORY dbg("memory_reset!"); #endif #ifdef NATMEM_OFFSET delete_shmmaps (0, 0xFFFF0000); #endif init_mem_banks (); memset(chipmemory,0,allocated_chipmem); #ifdef USE_FAME_CORE clear_fame_mem_dummy(); #endif rtarea_cleanup(); allocate_memory (); /* Map the chipmem into all of the lower 8MB */ i = allocated_chipmem > 0x200000 ? (allocated_chipmem >> 16) : 32; #ifdef DEBUG_MEMORY dbg("map_banks : chipmem_bank"); #endif map_banks (&chipmem_bank, 0x00, i, allocated_chipmem); custom_start = 0xC0; #ifdef DEBUG_MEMORY dbg("map_banks : custom_bank"); #endif map_banks (&custom_bank, custom_start, 0xE0 - custom_start, 0); #ifdef DEBUG_MEMORY dbg("map_banks : cia_bank"); #endif map_banks (&cia_bank, 0xA0, 32, 0); #ifdef DEBUG_MEMORY dbg("map_banks : clock_bank"); #endif map_banks (&clock_bank, 0xDC, 1, 0); /* @@@ Does anyone have a clue what should be in the 0x200000 - 0xA00000 * range on an Amiga without expansion memory? */ custom_start = allocated_chipmem >> 16; if (custom_start < 0x20) custom_start = 0x20; #ifdef DEBUG_MEMORY dbg("map_banks : dummy_bank"); #endif map_banks (&dummy_bank, custom_start, 0xA0 - custom_start, 0); /*map_banks (&mbres_bank, 0xDE, 1); */ if (bogomemory != 0) { int t = allocated_bogomem >> 16; if (t > 0x1C) t = 0x1C; #ifdef DEBUG_MEMORY dbg("map_banks : bogomem_bank"); #endif map_banks (&bogomem_bank, 0xC0, t, allocated_bogomem); }