[Scummvm-git-logs] scummvm master -> 28710fb3ddb112fa828d1d8776f154977f155ef2

dreammaster noreply at scummvm.org
Thu Aug 13 08:38:43 UTC 2026


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
78ac6c0df1 MADS: Remove unused EMS/XMS code
28710fb3dd MADS: Remove unused himem.cpp


Commit: 78ac6c0df1be6a5af229dcdc15b1f1e9f02c4946
    https://github.com/scummvm/scummvm/commit/78ac6c0df1be6a5af229dcdc15b1f1e9f02c4946
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-13T18:38:34+10:00

Commit Message:
MADS: Remove unused EMS/XMS code

Assisted-by: Claude Code:sonnet-5

Changed paths:
  R engines/mads/core/ems.cpp
  R engines/mads/core/ems.h
  R engines/mads/core/xms.cpp
  R engines/mads/core/xms.h
    engines/mads/core/buffer.cpp
    engines/mads/core/buffer.h
    engines/mads/core/error.cpp
    engines/mads/core/game.cpp
    engines/mads/core/himem.cpp
    engines/mads/core/himem.h
    engines/mads/core/kernel.cpp
    engines/mads/core/loader.cpp
    engines/mads/core/loader.h
    engines/mads/core/matte.cpp
    engines/mads/core/object.cpp
    engines/mads/core/pack.cpp
    engines/mads/core/pack.h
    engines/mads/core/sprite.cpp
    engines/mads/core/sprite.h
    engines/mads/core/tile.cpp
    engines/mads/dragonsphere/main_menu.cpp
    engines/mads/module.mk
    engines/mads/phantom/main_menu.cpp


diff --git a/engines/mads/core/buffer.cpp b/engines/mads/core/buffer.cpp
index 59e08e36879..daede74db7b 100644
--- a/engines/mads/core/buffer.cpp
+++ b/engines/mads/core/buffer.cpp
@@ -25,7 +25,6 @@
 #include "mads/core/general.h"
 #include "mads/core/buffer.h"
 #include "mads/core/env.h"
-#include "mads/core/ems.h"
 #include "mads/core/fileio.h"
 #include "mads/core/mem.h"
 #include "mads/core/room.h"
@@ -750,12 +749,6 @@ int buffer_preserve(Buffer *source, int flags, int source_ems_handle, int x, int
 		}
 	}
 
-	// Try to preserve in EMS memory
-	preserve_handle = buffer_to_ems(source, flags, source_ems_handle, x, y, xs, ys);
-	if (preserve_handle >= 0) {
-		goto done;
-	}
-
 	// Try to preserve on disk
 	if (flags != BUFFER_PRESERVE_RAM) {
 		disk_number = buffer_to_disk(source, x, y, xs, ys);
@@ -799,72 +792,12 @@ void buffer_restore(Buffer *source, int preserve_handle, int target_ems_handle,
 
 	case BUFFER_NOT_PRESERVED:
 		break;
-
-	default:
-		if (buffer_restore_keep_flag) preserve_handle &= ~BUFFER_CREATED_PAGE_HANDLE;
-		buffer_from_ems(source, preserve_handle, target_ems_handle, x, y, xs, ys);
-		break;
 	}
 
 done:
 	;
 }
 
-int buffer_to_ems(Buffer *source, int page_handle, int source_ems_handle,
-		int x, int y, int xs, int ys) {
-	int special_page_handle = 0;
-	Buffer ems_buffer = { video_y, video_x, NULL };
-
-	if (page_handle < 0) {
-		page_handle = ems_get_page_handle(4);
-		special_page_handle = BUFFER_CREATED_PAGE_HANDLE;
-	}
-	if (page_handle < 0) {
-		goto done;
-	}
-
-	if (source_ems_handle < 0) {
-		ems_map_buffer(page_handle);
-		ems_buffer.data = ems_page[0];
-
-		buffer_rect_copy_2(*source, ems_buffer, x, y, x, y, xs, ys);
-	} else {
-		ems_buffer_to_buffer(source_ems_handle, page_handle);
-	}
-
-	page_handle |= special_page_handle;
-
-	ems_unmap_all();
-
-done:
-	return page_handle;
-}
-
-int buffer_from_ems(Buffer *source, int page_handle, int target_ems_handle,
-		int x, int y, int xs, int ys) {
-	Buffer ems_buffer = { video_y, video_x, NULL };
-	int special_page_handle;
-
-	special_page_handle = page_handle & BUFFER_CREATED_PAGE_HANDLE;
-
-	page_handle &= ~(BUFFER_CREATED_PAGE_HANDLE);
-
-	if (target_ems_handle < 0) {
-		ems_map_buffer(page_handle);
-		ems_buffer.data = ems_page[0];
-
-		buffer_rect_copy_2(ems_buffer, *source, x, y, x, y, xs, ys);
-	} else {
-		ems_buffer_to_buffer(page_handle, target_ems_handle);
-	}
-
-	if (special_page_handle) ems_free_page_handle(page_handle);
-
-	ems_unmap_all();
-
-	return page_handle;
-}
-
 bool buffer_rect_translate(Buffer from, Buffer unto, int from_x, int from_y,
 		int unto_x, int unto_y, int size_x, int size_y, byte *table) {
 	int from_wrap, unto_wrap;
diff --git a/engines/mads/core/buffer.h b/engines/mads/core/buffer.h
index f78e0006b7b..f185c2f4e2b 100644
--- a/engines/mads/core/buffer.h
+++ b/engines/mads/core/buffer.h
@@ -29,8 +29,6 @@ namespace MADS {
 
 #define MAX_PEEL_VALUE                  80
 
-#define BUFFER_CREATED_PAGE_HANDLE      16384   /* Mask if EMS page handle created on the fly */
-
 #define BUFFER_PRESERVE                 -1      /* Normal preserve attempt (EMS or disk) */
 #define BUFFER_PRESERVE_RAM             -2      /* Disallows disk preservation           */
 #define BUFFER_ATTEMPT_CONVENTIONAL     -8      /* Attempt conventional preserve         */
@@ -243,11 +241,6 @@ extern void buffer_peel_vert(Buffer *target, int peel,
 extern int buffer_to_disk(Buffer *source, int x, int y, int xs, int ys);
 extern void buffer_from_disk(Buffer *source, int buffer_id, int x, int y, int xs, int ys);
 
-extern int buffer_to_ems(Buffer *source, int page_handle,
-	int source_ems_handle, int x, int y, int xs, int ys);
-extern int buffer_from_ems(Buffer *source, int page_handle,
-	int target_ems_handle, int x, int y, int xs, int ys);
-
 extern int buffer_preserve(Buffer *source, int flags,
 	int source_ems_handle, int x, int y, int xs, int ys);
 extern void buffer_restore(Buffer *source, int preserve_handle,
diff --git a/engines/mads/core/ems.cpp b/engines/mads/core/ems.cpp
deleted file mode 100644
index 9c819f5e83f..00000000000
--- a/engines/mads/core/ems.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "mads/core/ems.h"
-
-namespace MADS {
-
-word ems_page_frame = 0;
-word ems_handle = 0;
-word ems_pages = 0;
-int ems_disabled = 0;
-word ems_high_version = 0;
-word ems_low_version = 0;
-byte *ems_page[4] = {};
-word ems_paging_active = 0;
-word ems_pages_free = 0;
-word ems_pages_reserved = 0;
-byte *ems_page_flag = nullptr;
-word ems_paging_reserve[EMS_PAGING_CLASSES] = {};
-
-int ems_mapping_changed = 0;
-int ems_page_mapped[4] = {};
-int ems_page_stack[4] = {};
-
-static byte *ems_physical_pool = nullptr;
-
-bool ems_driver = false;
-bool ems_exists = false;
-
-bool ems_detect() {
-	if (ems_disabled)
-		return false;
-
-	ems_physical_pool = new byte[4 * EMS_PAGE_SIZE]();  // zero-initialised
-	if (!ems_physical_pool)
-		return false;
-
-	for (int i = 0; i < 4; i++) {
-		ems_page[i] = ems_physical_pool + i * EMS_PAGE_SIZE;
-		ems_page_mapped[i] = i;
-	}
-
-	ems_high_version = 4;
-	ems_low_version = 0;
-	ems_driver = true;
-	ems_exists = true;
-	return true;
-}
-
-void ems_shutdown() {
-	delete[] ems_physical_pool;
-	ems_physical_pool = nullptr;
-
-	for (int i = 0; i < 4; i++)
-		ems_page[i] = nullptr;
-
-	ems_exists = false;
-}
-
-} // namespace MADS
diff --git a/engines/mads/core/ems.h b/engines/mads/core/ems.h
deleted file mode 100644
index 36472f5b4b8..00000000000
--- a/engines/mads/core/ems.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef MADS_CORE_EMS_H
-#define MADS_CORE_EMS_H
-
-#include "mads/core/pack.h"
-
-namespace MADS {
-
-#define EMS_PAGING_CLASSES      4       /* # of paging classes            */
-
-#define EMS_PAGING_SYSTEM       0       /* System class - fully available */
-#define EMS_PAGING_ROOM         1       /* Room class                     */
-#define EMS_PAGING_SECTION      2       /* Section class                  */
-#define EMS_PAGING_GLOBAL       3       /* Global class                   */
-
-#define         EMS_TILE_PAGE           0
-#define         EMS_PAGE_MAP_PAGE       1
-#define         EMS_PRELOAD_PAGE        2
-
-#define         EMS_MAX_RESIDENT        150
-#define         EMS_PAGE_SIZE           16384
-
-#define         EMS_DIRECTORY_ADDRESS   2048
-
-
-struct EmsDirectory {
-	byte flag;
-	byte level;
-	char list[14];
-	long size;
-	int num_packets;
-	long packet_size[PACK_MAX_LIST_LENGTH];
-};
-
-
-struct EmsPtr {
-	int handle;         /* EMS block handle         */
-	int page_marker;    /* Page marker in EMS block */
-	int page_offset;    /* Offset within the page   */
-};
-
-
-extern bool ems_driver;			/* Flag if EMS driver is installed      */
-extern bool ems_exists;			/* Flag if we've got some EMS available */
-extern word ems_page_frame;     /* Segment address of EMS page frame    */
-extern word ems_handle;         /* EMS handle of our allocated pages    */
-extern word ems_pages;          /* # of pages EMS allocated for us      */
-extern int ems_disabled;       /* Flag if EMS disabled altogether      */
-
-extern word ems_high_version;   /* High (integer) part of EMS version # */
-extern word ems_low_version;    /* Low (fraction) part of EMS version # */
-
-extern byte *ems_page[4];   /* Pointers to EMS physical pages       */
-
-extern word ems_paging_active;  /* EMS paging system is active          */
-extern word ems_pages_free;     /* # of pages available now             */
-extern word ems_pages_reserved; /* # of pages reserved                  */
-extern byte *ems_page_flag; /* Page allocation flag array           */
-
-extern word ems_paging_reserve[EMS_PAGING_CLASSES]; /* Reserve pages    */
-
-
-extern int ems_mapping_changed;/* EMS mapping has changed */
-
-extern int ems_page_mapped[4];
-extern int ems_page_stack[4];
-
-/**
- * Detects whether or not EMS memory is present.  If EMS is detected,
- * attempts to allocate all available pages.
- * @return	"true" if one or more pages were successfully allocated.
- * Returns "false" if EMS did not exist, if no pages were available,
- * or if an error occurred.
- */
-extern bool ems_detect();
-
-/**
- * Frees up any EMS memory that might have been allocated by ems_detect().
- */
-extern void ems_shutdown();
-
-/**
- * Maps a logical page (0 - (ems_pages-1)) to a physical page (0-3).
- * Does not actually generate an EMS interrupt if the page is already
- * mapped. Call only if EMS memory was detected.
- */
-inline int ems_map_page(word physical, word logical) { return 0; }
-
-inline void ems_unmap_all() {}
-inline void ems_push() {}
-inline void ems_pop() {}
-inline int ems_activate_directory() { return 0; }
-inline int ems_activate_page_map() { return 0; }
-inline int ems_paging_setup() { return 0; }
-inline void ems_free_page_handle(word handle) {}
-inline int ems_get_page_handle(word pages_needed) { return -1; }
-inline int ems_next_handle_page(int handle, int page_marker) { return -1; }
-inline void ems_paging_mode(int paging_mode) {}
-inline void ems_paging_shutdown() {}
-inline int ems_copy_it_up(int ems_paging_handle, int *ems_page_marker,
-	int *ems_page_offset, byte *source, long read_size) { return 0; }
-inline int ems_copy_it_down(int ems_paging_handle, int *ems_page_marker,
-	int *ems_page_offset, byte *target, long write_size) { return 0; }
-inline int ems_map_buffer(int buffer_page_handle) { return 0; }
-inline int ems_search_page(int ems_handle_, int page_number) { return 0; }
-inline void ems_buffer_to_buffer(int source_handle, int target_handle) {}
-
-} // namespace MADS
-
-#endif
diff --git a/engines/mads/core/error.cpp b/engines/mads/core/error.cpp
index 1d0a290410e..eafe276de35 100644
--- a/engines/mads/core/error.cpp
+++ b/engines/mads/core/error.cpp
@@ -26,7 +26,6 @@
 #include "mads/core/mouse.h"
 #include "mads/core/screen.h"
 #include "mads/core/echo.h"
-#include "mads/core/ems.h"
 #include "mads/core/himem.h"
 #include "mads/core/env.h"
 #include "mads/core/screen.h"
diff --git a/engines/mads/core/game.cpp b/engines/mads/core/game.cpp
index 62c18b92496..e2cdd9ee510 100644
--- a/engines/mads/core/game.cpp
+++ b/engines/mads/core/game.cpp
@@ -43,8 +43,6 @@
 #include "mads/core/env.h"
 #include "mads/core/player.h"
 #include "mads/core/cycle.h"
-#include "mads/core/ems.h"
-#include "mads/core/xms.h"
 #include "mads/core/loader.h"
 #include "mads/core/anim.h"
 #include "mads/core/error.h"
@@ -276,25 +274,10 @@ void flag_parse(const char **myscan) {
 		break;
 
 	case 'H':
+		// EMS/XMS preload is permanently disabled in ScummVM, so this flag's
+		// E/X/U suboptions no longer have anything to toggle.
 		if (scan_past(myscan, ':')) {
-			while (**myscan) {
-				switch (toupper(**myscan)) {
-				case 'E':
-					himem_preload_ems_disabled = true;
-					break;
-				case 'X':
-					himem_preload_xms_disabled = true;
-					break;
-				case 'U':
-					xms_disabled = true;
-					break;
-				}
-				(*myscan)++;
-			}
 			scan_past(myscan, 0);
-		} else {
-			himem_preload_ems_disabled = true;
-			himem_preload_xms_disabled = true;
 		}
 		break;
 
@@ -1199,7 +1182,6 @@ void game_control() {
 	if (game.difficulty < 0) game.difficulty = HARD_MODE;
 
 	if ((result != COPY_FAIL) && (result != COPY_ESCAPE)) {
-		ems_paging_mode(EMS_PAGING_GLOBAL);
 		global_init_code();
 	}
 
@@ -1228,8 +1210,6 @@ void game_control() {
 
 		global_sound_driver();
 
-		ems_paging_mode(EMS_PAGING_SECTION);
-
 		global_section_constructor();
 		game_exec_function(section_preload_code_pointer);
 
@@ -1286,8 +1266,6 @@ void game_control() {
 			picture_view_x = 0;
 			picture_view_y = 0;
 
-			ems_paging_mode(EMS_PAGING_ROOM);
-
 			kernel_initial_variant = 0;
 
 			kernel.disable_fastwalk = false;
@@ -1434,8 +1412,6 @@ void game_control() {
 
 			kernel.teleported_in = false;
 
-			ems_paging_mode(EMS_PAGING_SYSTEM);
-
 			if (quote_emergency && !game_any_emergency) {
 				room_id = previous_room;
 				game_any_emergency = true;
diff --git a/engines/mads/core/himem.cpp b/engines/mads/core/himem.cpp
index 79ed0c3a51c..a103ca66bab 100644
--- a/engines/mads/core/himem.cpp
+++ b/engines/mads/core/himem.cpp
@@ -21,635 +21,29 @@
 
 #include "mads/core/general.h"
 #include "mads/core/himem.h"
-#include "mads/core/ems.h"
-#include "mads/core/xms.h"
-#include "mads/core/mem.h"
-#include "mads/core/loader.h"
-#include "mads/core/sprite.h"
-#include "mads/core/fileio.h"
-#include "mads/core/pack.h"
-#include "mads/core/tile.h"
-#include "mads/core/env.h"
 
 namespace MADS {
 
-// EMS/XMS disabled in ScummVM
-byte                himem_preload_ems_disabled = true;
-byte                himem_preload_xms_disabled = true;
-
-byte                himem_directory_allocation = MEM_NONE;
-HimemDirectory      himem_directory_save_area;
-HimemDirectory *himem_directory;
-HimemDirectory *himem_directory_entry;
-HimemDirectory *himem_ems_directory = NULL;
-
-int himem_directory_xms_handle = -1;
-int himem_directory_ems_active = false;
-int himem_active = false;
-
-int himem_ems_preloaded = 0;
-int himem_xms_preloaded = 0;
-
-
-int himem_activate_directory() {
-	int error_flag = false;
-
-	if (himem_directory_allocation == MEM_EMS) {
-		himem_directory_ems_active = !ems_activate_page_map();
-
-		error_flag = !himem_directory_ems_active;
-	} else if (himem_directory_allocation == MEM_NONE) {
-		// Added for ScummVM, since we don't have EMS
-		error_flag = true;
-	}
-
-	return error_flag;
-}
-
-int himem_get_directory_entry(int id) {
-	int error_flag = true;
-	long dir_offset;
-
-	if (himem_directory_allocation == MEM_EMS) {
-		if (himem_activate_directory()) goto done;
-		himem_directory_entry = &himem_ems_directory[id];
-	} else {
-		dir_offset = ((long)sizeof(HimemDirectory)) * id;
-		if (xms_copy(sizeof(HimemDirectory),
-			himem_directory_xms_handle, (XMS)dir_offset,
-			MEM_CONV, &himem_directory_save_area)) goto done;
-	}
-
-	error_flag = false;
-
-done:
-	return error_flag;
-}
-
-int himem_put_directory_entry(int id) {
-	int error_flag = true;
-	long dir_offset;
-
-	if (himem_directory_allocation == MEM_EMS) {
-		if (himem_activate_directory()) goto done;
-		if (himem_directory_entry != &himem_ems_directory[id]) {
-			himem_ems_directory[id] = *himem_directory_entry;
-		}
-	} else {
-		dir_offset = ((long)sizeof(HimemDirectory)) * id;
-		if (xms_copy(sizeof(HimemDirectory),
-			MEM_CONV, himem_directory_entry,
-			himem_directory_xms_handle, (XMS)dir_offset)) goto done;
-	}
-
-	error_flag = false;
-
-done:
-	return error_flag;
-}
-
-int himem_resident(const char *filename) {
-	int id = -1;
-	int count;
-	const char *mark;
-	long dir_size;
-	HimemDirectory *himem_xms_directory = NULL;
-
-	if (!himem_active) goto done;
-
-	mark = strrchr(filename, '\\');
-	if (mark == NULL) mark = strchr(filename, '*');
-	if (mark == NULL) {
-		mark = filename;
-	} else {
-		mark++;
-	}
-
-	if (himem_directory_allocation == MEM_EMS) {
-		if (himem_activate_directory()) goto done;
-	} else {
-		dir_size = ((long)sizeof(HimemDirectory)) * HIMEM_MAX_RESIDENT;
-
-		himem_directory = himem_xms_directory = (HimemDirectory *)mem_get_name(dir_size, "$HIMEM$");
-		if (himem_xms_directory == NULL) goto done;
-
-		if (xms_copy(dir_size,
-			himem_directory_xms_handle, (XMS)0,
-			MEM_CONV, himem_xms_directory)) goto done;
-	}
-
-	for (count = 0; (count < HIMEM_MAX_RESIDENT) && (id < 0); count++) {
-		if (himem_directory[count].memory_type != MEM_NONE) {
-			if (scumm_stricmp(mark, himem_directory[count].list) == 0) {
-				id = count;
-			}
-		}
-	}
-
-done:
-	if (id >= 0)
-		himem_get_directory_entry(id);
-	if (himem_xms_directory != NULL)
-		mem_free(himem_xms_directory);
-	return id;
-}
-
-int himem_directory_setup() {
-	int  error_flag = true;
-	int  count;
-	long dir_size = 0;
-	HimemDirectory *himem_xms_directory = NULL;
-
-	if (ems_paging_active) {
-		himem_directory_allocation = MEM_EMS;
-		himem_directory = himem_ems_directory = (HimemDirectory *) (ems_page[EMS_PAGE_MAP_PAGE] + EMS_DIRECTORY_ADDRESS);
-		if (himem_activate_directory()) goto done;
-	} else if (!himem_preload_xms_disabled) {
-		himem_directory_allocation = MEM_XMS;
-		dir_size = ((long)sizeof(HimemDirectory)) * HIMEM_MAX_RESIDENT;
-
-		himem_directory_xms_handle = xms_get(dir_size);
-		if (himem_directory_xms_handle <= 0) goto done;
-
-		himem_directory = himem_xms_directory = (HimemDirectory *)mem_get_name(dir_size, "$HIMEM$");
-		if (himem_xms_directory == NULL) goto done;
-
-		himem_directory_entry = &himem_directory_save_area;
-	} else {
-		goto done;
-	}
-
-	for (count = 0; count < HIMEM_MAX_RESIDENT; count++) {
-		himem_directory[count].memory_type = MEM_NONE;
-	}
-
-	if (himem_directory_allocation == MEM_XMS) {
-		if (xms_copy(dir_size,
-			MEM_CONV, himem_xms_directory,
-			himem_directory_xms_handle, (XMS)0)) goto done;
-	}
-
-	himem_active = true;
-	error_flag = false;
-
-done:
-	if (himem_xms_directory != NULL) mem_free(himem_xms_directory);
-	if (error_flag) {
-		himem_directory_allocation = MEM_NONE;
-		if (himem_directory_xms_handle > 0) {
-			xms_free(himem_directory_xms_handle);
-			himem_directory_xms_handle = -1;
-		}
-	}
-
-	return error_flag;
-}
-
+// EMS/XMS support doesn't exist in ScummVM, so the himem directory that
+// preloaded resources into expanded/extended memory can never activate;
+// these entry points are kept only because callers throughout the engine
+// use them as preload hints.
 
 void himem_shutdown() {
-	int count;
-
-	if (!himem_activate_directory()) {
-		for (count = 0; count < HIMEM_MAX_RESIDENT; count++) {
-			himem_get_directory_entry(count);
-			if (himem_directory_entry->memory_type == MEM_XMS) {
-				xms_free(himem_directory_entry->xms_handle);
-			}
-		}
-	}
-
-	if (himem_directory_allocation == MEM_XMS) {
-		xms_free(himem_directory_xms_handle);
-	}
-
-	himem_active = false;
-
-	xms_umb_purge();
-	ems_shutdown();
 }
 
 void himem_startup() {
-	ems_detect();
-	ems_paging_setup();
-
-	xms_detect();
-
-	himem_directory_setup();
 }
 
 int himem_preload(char *filename, int level) {
-	int preload_handle = -1;
-	int new_handle = -1;
-	int page_marker = -1;
-	int page_offset = EMS_PAGE_SIZE;
-	int count;
-	int memory_type = MEM_NONE;
-	int xms_handle = -1;
-	long xms_offset = 0;
-	long size, page_size;
-	long read_size;
-	char *mark;
-	byte *load_buf = NULL;
-	Load handle;
-
-	handle.open = false;
-
-	if ((himem_resident(filename) >= 0) || !himem_active) goto done;
-
-	if (loader_open(&handle, filename, "rb", false)) goto done;
-
-	size = handle.decompress_size;
-	page_size = (size >> 14);
-	if ((page_size << 14) < size)  page_size++;
-
-	if (ems_paging_active && !himem_preload_ems_disabled) {
-		new_handle = ems_get_page_handle((word)page_size);
-		if (new_handle >= 0) {
-			memory_type = MEM_EMS;
-			himem_directory_entry->ems_page_handle = (byte)new_handle;
-		}
-	}
-
-	if ((memory_type == MEM_NONE) && !himem_preload_xms_disabled) {
-		xms_handle = xms_get((word)size);
-		if (xms_handle > 0) {
-			new_handle = himem_resident(NULL);
-			if (new_handle >= 0) {
-				memory_type = MEM_XMS;
-				himem_directory_entry->xms_handle = xms_handle;
-				himem_directory_entry->ems_page_handle = (byte)new_handle;
-			} else {
-				xms_free(xms_handle);
-			}
-		}
-	}
-
-	if (memory_type == MEM_NONE) goto done;
-
-	himem_directory_entry->memory_type = (byte)memory_type;
-	himem_directory_entry->size = size;
-	himem_directory_entry->level = (byte)level;
-
-	himem_directory_entry->num_packets = handle.pack.num_records;
-	for (count = 0; count < (int)handle.pack.num_records; count++) {
-		himem_directory_entry->packet_size[count] = handle.pack.strategy[count].size;
-	}
-
-	for (count = 0; count < (int)handle.pack.num_records; count++) {
-		read_size = handle.pack.strategy[count].size;
-		load_buf = (byte *)mem_get_name(read_size, "$PRELOAD");
-		if (load_buf == NULL) goto done;
-
-		if (!loader_read(load_buf, read_size, 1, &handle)) goto done;
-
-		if (memory_type == MEM_EMS) {
-			if (ems_copy_it_up(new_handle, &page_marker, &page_offset, load_buf, read_size)) goto done;
-		} else {
-
-			if (xms_copy(read_size,
-				MEM_CONV, load_buf,
-				xms_handle, (XMS)xms_offset)) goto done;
-			xms_offset += read_size;
-		}
-
-		mem_free(load_buf);
-		load_buf = NULL;
-	}
-
-	mark = strrchr(filename, '\\');
-	if (mark == NULL) mark = strchr(filename, '*');
-	if (mark == NULL) {
-		mark = filename;
-	} else {
-		mark++;
-	}
-
-	Common::strcpy_s(himem_directory_entry->list, mark);
-	mads_strlwr(himem_directory_entry->list);
-
-	preload_handle = new_handle;
-
-done:
-	if (load_buf != NULL) mem_free(load_buf);
-	if (handle.open) loader_close(&handle);
-	if (preload_handle != new_handle) {
-		if (memory_type == MEM_EMS) {
-			ems_free_page_handle(new_handle);
-		} else if (memory_type == MEM_XMS) {
-			xms_free(xms_handle);
-		}
-		if (new_handle >= 0) {
-			himem_directory_entry->memory_type = MEM_NONE;
-		}
-	}
-	if (new_handle >= 0) {
-		himem_put_directory_entry(new_handle);
-	}
-
-	return preload_handle;
+	return -1;
 }
 
-int himem_preload_series(const char *fname, int level) {
-	int preload_handle = -1;
-	int new_handle = -1;
-	int page_marker = -1;
-	int page_offset = EMS_PAGE_SIZE;
-	int count;
-	int memory_type = 0;
-	int xms_handle = 0;
-	int num_records;
-	int might_be_series = false;
-	int sprite_packed = false;
-	int tile_packed = false;
-	int tile_type = 0;
-	int packing_flag;
-	int already_unpacked = false;
-	long xms_offset = 0;
-	long size, page_size;
-	long read_size;
-	long base_offset;
-	long top_of_file;
-	long compressed_size;
-	char *mark;
-	char *marker;
-	char file_buf[80];
-	char temp_buf[80];
-	byte *load_buf = NULL;
-	byte *decompress_buffer = NULL;
-	Load handle;
-	FileSeriesPtr file_series = NULL;
-	FileSpritePtr file_sprite = NULL;
-	TileResource *tile_resource = NULL;
-	Tile         *tile = NULL;
-
-	handle.open = false;
-
-	Common::strcpy_s(file_buf, fname);
-	char *filename = file_buf;
-
-	fileio_add_ext(filename, "SS");  // Default to Sprite Series
-
-	if ((himem_resident(filename) >= 0) || !himem_active) goto done;
-
-	if (loader_open(&handle, filename, "rb", false)) goto done;
-
-	top_of_file = handle.handle->pos();
-
-	Common::strcpy_s(temp_buf, filename);
-	mads_strupr(temp_buf);
-	if (strstr(temp_buf, ".SS") != NULL) might_be_series = true;
-	if (strstr(temp_buf, ".TT") != NULL) {
-		tile_packed = true;
-		tile_type = TILE_PICTURE;
-		marker = strchr(temp_buf, '.');
-		if (marker != NULL) {
-			marker++;
-			while (*marker && (*marker == 'T')) marker++;
-			if (Common::isDigit(*marker)) {
-				tile_type = TILE_ATTRIBUTE;
-			}
-		}
-	}
-
-	size = handle.decompress_size;
-	page_size = (size >> 14);
-	if ((page_size << 14) < size)  page_size++;
-
-	memory_type = MEM_NONE;
-	if (ems_paging_active && !himem_preload_ems_disabled) {
-		new_handle = ems_get_page_handle((word)page_size);
-		if (new_handle >= 0) {
-			memory_type = MEM_EMS;
-			himem_directory_entry->ems_page_handle = (byte)new_handle;
-		}
-	}
-
-	if ((memory_type == MEM_NONE) && !himem_preload_xms_disabled) {
-		xms_handle = xms_get((word)size);
-		if (xms_handle > 0) {
-			new_handle = himem_resident(NULL);
-			if (new_handle >= 0) {
-				memory_type = MEM_XMS;
-				himem_directory_entry->xms_handle = xms_handle;
-			} else {
-				xms_free(xms_handle);
-			}
-		}
-	}
-
-	if (memory_type == MEM_NONE) goto done;
-
-	himem_directory_entry->memory_type = (byte)memory_type;
-	himem_directory_entry->size = size;
-	himem_directory_entry->level = (byte)level;
-
-	himem_directory_entry->num_packets = handle.pack.num_records;
-	for (count = 0; count < (int)handle.pack.num_records; count++) {
-		himem_directory_entry->packet_size[count] = handle.pack.strategy[count].size;
-	}
-
-	num_records = handle.pack.num_records;
-
-	for (count = 0; count < (int)num_records; count++) {
-		read_size = handle.pack.strategy[count].size;
-		load_buf = (byte *)mem_get_name(read_size, "$PRELOAD");
-		if (load_buf == NULL) goto done;
-
-		if (!loader_read(load_buf, read_size, 1, &handle)) goto done;
-
-		if ((count == 0) && might_be_series) {
-			file_series = (FileSeriesPtr)load_buf;
-			sprite_packed = file_series->pack_by_sprite;
-			if (sprite_packed) {
-				num_records--;
-			}
-			file_series = NULL;
-		}
-
-
-		if (memory_type == MEM_EMS) {
-			if (ems_copy_it_up(new_handle, &page_marker, &page_offset, load_buf, read_size)) goto done;
-		} else {
-			if (xms_copy(read_size,
-				MEM_CONV, load_buf,
-				xms_handle, (XMS)xms_offset)) goto done;
-			xms_offset += read_size;
-		}
-
-		if (sprite_packed) {
-			if (count == 0) {
-				file_series = (FileSeriesPtr)load_buf;
-				load_buf = NULL;
-			} else if (count == 1) {
-				file_sprite = (FileSpritePtr)load_buf;
-				load_buf = NULL;
-			}
-		}
-
-		if (tile_packed) {
-			if (count == 0) {
-				tile_resource = (TileResource *) load_buf;
-				load_buf = NULL;
-
-				if (tile_type == TILE_PICTURE) {
-					tile_resource->chunk_size = (long)tile_resource->tile_x * (long)tile_resource->tile_y;
-				} else {
-					tile_resource->chunk_size = ((((long)tile_resource->tile_x - 1) >> 1) + 1) * (long)tile_resource->tile_y;
-				}
-			} else if (count == 1) {
-				tile = (Tile *) load_buf;
-				load_buf = NULL;
-			}
-		}
-
-		mem_free(load_buf);
-		load_buf = NULL;
-	}
-
-	if (sprite_packed) {
-		base_offset = handle.handle->pos();
-
-		for (count = 0; count < file_series->num_sprites; count++) {
-			read_size = file_sprite[count].memory_needed;
-
-			load_buf = (byte *)mem_get(read_size);
-			if (load_buf == NULL) goto done;
-
-			fileio_setpos(handle.handle, base_offset + file_sprite[count].file_offset);
-
-			if (pack_data(file_series->compression, read_size,
-				FROM_DISK, handle.handle,
-				TO_MEMORY, load_buf) != read_size) goto done;
-
-			if (memory_type == MEM_EMS) {
-				if (ems_copy_it_up(new_handle, &page_marker, &page_offset, load_buf, read_size)) goto done;
-			} else {
-				if (xms_copy(read_size,
-					MEM_CONV, load_buf,
-					xms_handle, (XMS)xms_offset)) goto done;
-				xms_offset += read_size;
-			}
-
-			mem_free(load_buf);
-			load_buf = NULL;
-		}
-	}
-
-	if (tile_packed) {
-		base_offset = handle.handle->pos();
-
-		for (count = 0; count < tile_resource->num_tiles; count++) {
-			read_size = tile_resource->chunk_size;
-
-			load_buf = (byte *)mem_get(read_size);
-			if (load_buf == NULL) goto done;
-
-			fileio_setpos(handle.handle, base_offset + tile[count].file_offset);
-
-			if (count < (tile_resource->num_tiles - 1)) {
-				compressed_size = tile[count + 1].file_offset - tile[count].file_offset;
-			} else {
-				compressed_size = (env_get_file_size(handle.handle) - PACK_OVERHEAD) -
-					(tile[count].file_offset + (base_offset - top_of_file));
-			}
-
-			pack_strategy = tile_resource->compression;
-			packing_flag = (tile_resource->compression != PACK_NONE) ? PACK_EXPLODE : PACK_RAW_COPY;
-
-			if (packing_flag == PACK_EXPLODE) {
-				decompress_buffer = (byte *)mem_get_name(compressed_size, "$hipack");
-				if (decompress_buffer != NULL) {
-
-					if (!fileio_fread_f(decompress_buffer, compressed_size, 1, handle.handle)) goto done;
-
-					if (pack_data(packing_flag, read_size,
-						FROM_MEMORY, decompress_buffer,
-						TO_MEMORY, load_buf) != read_size) goto done;
-
-					mem_free(decompress_buffer);
-					decompress_buffer = NULL;
-
-					already_unpacked = true;
-				}
-			}
-
-			if (!already_unpacked) {
-				if (pack_data(packing_flag, read_size,
-					FROM_DISK, handle.handle,
-					TO_MEMORY, load_buf) != read_size) goto done;
-			}
-
-			if (memory_type == MEM_EMS) {
-				if (ems_copy_it_up(new_handle, &page_marker, &page_offset, load_buf, read_size)) goto done;
-			} else {
-				if (xms_copy(read_size,
-					MEM_CONV, load_buf,
-					xms_handle, (XMS)xms_offset)) goto done;
-				xms_offset += read_size;
-			}
-
-			mem_free(load_buf);
-			load_buf = NULL;
-		}
-	}
-
-
-	mark = strrchr(filename, '\\');
-	if (mark == NULL) mark = strchr(filename, '*');
-	if (mark == NULL) {
-		mark = filename;
-	} else {
-		mark++;
-	}
-
-	Common::strcpy_s(himem_directory_entry->list, mark);
-	mads_strlwr(himem_directory_entry->list);
-
-	preload_handle = new_handle;
-
-done:
-	if (decompress_buffer != NULL) mem_free(decompress_buffer);
-	if (load_buf != NULL) mem_free(load_buf);
-	if (file_sprite != NULL) mem_free(file_sprite);
-	if (file_series != NULL) mem_free(file_series);
-	if (tile != NULL) mem_free(tile);
-	if (tile_resource != NULL) mem_free(tile_resource);
-	if (handle.open) loader_close(&handle);
-	if (preload_handle != new_handle) {
-		if (memory_type == MEM_EMS) {
-			ems_free_page_handle(new_handle);
-		} else if (memory_type == MEM_XMS) {
-			xms_free(xms_handle);
-		}
-		if (new_handle >= 0) {
-			himem_directory_entry->memory_type = MEM_NONE;
-		}
-	}
-	if (new_handle >= 0) {
-		himem_put_directory_entry(new_handle);
-	}
-
-	return preload_handle;
+int himem_preload_series(const char *filename, int level) {
+	return -1;
 }
 
 void himem_flush(int level) {
-	int count;
-
-	if (!himem_active) return;
-	if (himem_activate_directory()) return;
-
-	for (count = 0; count < HIMEM_MAX_RESIDENT; count++) {
-		himem_get_directory_entry(count);
-		if (himem_directory_entry->level == (byte)level) {
-			if (himem_directory_entry->memory_type == MEM_EMS) {
-				ems_free_page_handle(count);
-			} else if (himem_directory_entry->memory_type == MEM_XMS) {
-				xms_free(himem_directory_entry->xms_handle);
-			}
-			himem_directory_entry->memory_type = MEM_NONE;
-			himem_put_directory_entry(count);
-		}
-	}
 }
 
 } // namespace MADS
diff --git a/engines/mads/core/himem.h b/engines/mads/core/himem.h
index ea942f52a92..e8711967a69 100644
--- a/engines/mads/core/himem.h
+++ b/engines/mads/core/himem.h
@@ -23,48 +23,11 @@
 #define MADS_CORE_HIMEM_H
 
 #include "mads/core/pack.h"
-#include "mads/core/ems.h"
 #include "mads/core/mem.h"
 
 namespace MADS {
 
-#define         HIMEM_MAX_RESIDENT        150
-
-struct HimemDirectory {
-	byte memory_type;                           /* Memory type       */
-	byte ems_page_handle;                       /* EMS paging info   */
-	byte level;                                 /* Preload level     */
-	char list[14];                              /* File name info    */
-	word xms_handle;                            /* Handle in XMS     */
-	long size;                                  /* Size in bytes     */
-	int num_packets;                            /* Number of packets */
-	long packet_size[PACK_MAX_LIST_LENGTH];     /* Sizes of packets  */
-};
-
-
-extern byte himem_preload_ems_disabled;
-extern byte himem_preload_xms_disabled;
-
-extern byte himem_directory_allocation;
-extern HimemDirectory himem_directory_save_area;
-extern HimemDirectory *himem_directory;
-extern HimemDirectory *himem_directory_entry;
-extern HimemDirectory *himem_ems_directory;
-
-extern int himem_directory_xms_handle;
-extern int himem_directory_ems_active;
-extern int himem_active;
-
-extern int himem_ems_preloaded;
-extern int himem_xms_preloaded;
-
-
-extern int himem_activate_directory();
-extern int himem_get_directory_entry(int id);
-extern int himem_put_directory_entry(int id);
-extern int  himem_resident(const char *filename);
 extern void himem_catalog();
-extern int himem_directory_setup();
 extern void himem_shutdown();
 extern void himem_startup();
 extern int himem_preload(char *filename, int level);
diff --git a/engines/mads/core/kernel.cpp b/engines/mads/core/kernel.cpp
index a4922624b5e..9b2f8f23c9b 100644
--- a/engines/mads/core/kernel.cpp
+++ b/engines/mads/core/kernel.cpp
@@ -33,7 +33,6 @@
 #include "mads/core/error.h"
 #include "mads/core/screen.h"
 #include "mads/core/speech.h"
-#include "mads/core/ems.h"
 #include "mads/core/himem.h"
 #include "mads/core/echo.h"
 #include "mads/core/mcga.h"
@@ -44,7 +43,6 @@
 #include "mads/core/pack.h"
 #include "mads/core/room.h"
 #include "mads/core/sound.h"
-#include "mads/core/xms.h"
 #include "mads/core/tile.h"
 #include "mads/core/popup.h"
 #include "mads/core/pal.h"
@@ -233,8 +231,7 @@ void kernel_game_shutdown() {
 	font_inter = font_main = font_tele = NULL;
 
 	// Deallocate main screen buffer
-	if (work_screen_ems_handle < 0)
-		buffer_free(&scr_main);
+	buffer_free(&scr_main);
 
 	// Turn of speech system
 	if (speech_system_active)
@@ -271,10 +268,6 @@ void kernel_force_refresh() {
 int kernel_game_startup(int game_video_mode, int load_flag,
 		const char *release_version, const char *release_date) {
 	int error_flag = true;
-	int count, count2;
-	int ems_temp;
-	int pages;
-	int reserve[EMS_PAGING_CLASSES];
 	byte *interrupt_stack;
 
 	// Set up EMS/XMS paging system, if any
@@ -282,47 +275,6 @@ int kernel_game_startup(int game_video_mode, int load_flag,
 
 	speech_init();
 
-	if (ems_exists) {
-		if (load_flag & KERNEL_STARTUP_POPUP) {
-			object_ems_handle = ems_get_page_handle(4);
-
-			ems_temp = ems_get_page_handle(4);
-			if (ems_temp >= 0) popup_preserve_initiator[0] = ems_temp;
-
-			ems_temp = ems_get_page_handle(4);
-			if (ems_temp >= 0) popup_preserve_initiator[1] = ems_temp;
-
-			ems_temp = ems_get_page_handle(4);
-			if (ems_temp >= 0) popup_preserve_initiator[2] = ems_temp;
-		}
-	}
-
-
-	if (ems_exists) {
-		pages = ems_pages_free;
-		for (count = 0; count < EMS_PAGING_CLASSES; count++) {
-			reserve[count] = 0;
-		}
-		if (pages >= 4) {
-			reserve[EMS_PAGING_SYSTEM] = 4;
-			pages -= 4;
-		}
-		ems_temp = MIN(pages >> 1, 64);
-		reserve[EMS_PAGING_ROOM] = ems_temp;
-		pages -= ems_temp;
-
-		ems_temp = pages >> 2;
-		reserve[EMS_PAGING_SECTION] = ems_temp;
-		pages -= ems_temp;
-
-		for (count = 0; count < EMS_PAGING_CLASSES; count++) {
-			ems_paging_reserve[count] = 0;
-			for (count2 = count - 1; count2 >= 0; count2--) {
-				ems_paging_reserve[count] += reserve[count2];
-			}
-		}
-	}
-
 	timer_set_sound_flag(0);
 
 	// Video initialization
@@ -335,14 +287,7 @@ int kernel_game_startup(int game_video_mode, int load_flag,
 	}
 
 	// Initialize the main screen work buffer & its sub-buffers
-	if (work_screen_ems_handle >= 0) {
-		scr_main.x = video_x;
-		scr_main.y = video_y;
-		scr_main.data = ems_page[0];
-		ems_map_buffer(work_screen_ems_handle);
-	} else {
-		buffer_init_name(&scr_main, video_x, video_y, "$scrmain");
-	}
+	buffer_init_name(&scr_main, video_x, video_y, "$scrmain");
 	if (scr_main.data == NULL) {
 		goto done;
 	}
diff --git a/engines/mads/core/loader.cpp b/engines/mads/core/loader.cpp
index 5aa86114435..110967b299e 100644
--- a/engines/mads/core/loader.cpp
+++ b/engines/mads/core/loader.cpp
@@ -23,22 +23,17 @@
 #include "common/compression/dcl.h"
 #include "common/memstream.h"
 #include "mads/core/loader.h"
-#include "mads/core/general.h"
-#include "mads/core/pack.h"
-#include "mads/core/ems.h"
-#include "mads/core/xms.h"
-#include "mads/core/himem.h"
 #include "mads/core/env.h"
-#include "mads/core/fileio.h"
+#include "mads/core/general.h"
 #include "mads/core/error.h"
+#include "mads/core/fileio.h"
+#include "mads/core/mem.h"
+#include "mads/core/pack.h"
 #include "mads/core/popup.h"
 #include "mads/core/timer.h"
-#include "mads/core/pack.h"
 
 namespace MADS {
 
-int loader_ems_search_disabled = false;
-
 char loader_last[14] = "";
 
 
@@ -77,59 +72,32 @@ LoaderReadStream::~LoaderReadStream() {
 
 int loader_open(LoadHandle handle, const char *filename, const char *options, int flags) {
 	int error_flag = true;
-	int found_himem = -1;
 	int reading;
 	int count;
-	int search_himem;
 
 	strncpy(loader_last, filename, 13);
 
-	search_himem = flags;
 	handle->open = false;
 
 	reading = strchr(options, 'r') != NULL;
 
-	if (reading && search_himem && !loader_ems_search_disabled) {
-		found_himem = himem_resident(filename);
-	}
+	handle->mode = LOADER_DISK;
+	handle->handle = env_open(filename, options);
+	if (handle->handle == NULL) goto done;
 
-	if (found_himem >= 0) {
-		handle->mode = (byte)((himem_directory_entry->memory_type == MEM_EMS) ? LOADER_EMS : LOADER_XMS);
-		handle->xms_handle = himem_directory_entry->xms_handle;
-		handle->xms_offset = 0;
-		handle->ems_handle = found_himem;
-		handle->ems_page_marker = -1;
-		handle->ems_page_offset = EMS_PAGE_SIZE;
-		handle->decompress_size = himem_directory_entry->size;
-		handle->pack.num_records = himem_directory_entry->num_packets;
-		handle->pack_list_marker = 0;
-		handle->reading = true;
+	handle->reading = reading;
+	handle->pack_list_marker = 0;
 
+	if (reading) {
+		if (!handle->pack.load(handle->handle))
+			goto done;
+
+		handle->decompress_size = 0;
 		for (count = 0; count < (int)handle->pack.num_records; count++) {
-			handle->pack.strategy[count].type = PACK_NONE;
-			handle->pack.strategy[count].size = himem_directory_entry->packet_size[count];
-			handle->pack.strategy[count].compressed_size = himem_directory_entry->packet_size[count];
+			handle->decompress_size += handle->pack.strategy[count].size;
 		}
 	} else {
-		handle->mode = LOADER_DISK;
-		handle->ems_handle = -1;
-		handle->handle = env_open(filename, options);
-		if (handle->handle == NULL) goto done;
-
-		handle->reading = reading;
-		handle->pack_list_marker = 0;
-
-		if (reading) {
-			if (!handle->pack.load(handle->handle))
-				goto done;
-
-			handle->decompress_size = 0;
-			for (count = 0; count < (int)handle->pack.num_records; count++) {
-				handle->decompress_size += handle->pack.strategy[count].size;
-			}
-		} else {
-			error("Open for writing not supported in ScummVM");
-		}
+		error("Open for writing not supported in ScummVM");
 	}
 
 	handle->open = true;
@@ -137,12 +105,6 @@ int loader_open(LoadHandle handle, const char *filename, const char *options, in
 	error_flag = false;
 
 done:
-
-	if (error_flag && !found_himem) {
-		if (handle->handle != NULL)
-			delete handle->handle;
-	}
-
 	return error_flag;
 }
 
@@ -154,17 +116,11 @@ int loader_close(LoadHandle handle) {
 	int error_flag = false;
 
 	if (handle->open) {
-		if ((handle->mode == LOADER_EMS) || (handle->mode == LOADER_XMS)) {
-			handle->ems_page_marker = -1;
-			handle->ems_page_offset = EMS_PAGE_SIZE;
-			handle->xms_offset = 0;
-		} else {
-			if (!handle->reading) {
-				error("loader_close for writing not supported in ScummVM");
-			}
-
-			delete handle->handle;
+		if (!handle->reading) {
+			error("loader_close for writing not supported in ScummVM");
 		}
+
+		delete handle->handle;
 	}
 	handle->open = false;
 
@@ -188,57 +144,38 @@ long loader_read(void *target, long record_size, long record_count, LoadHandle h
 
 	marker = handle->pack_list_marker++;
 
-	if (handle->mode == LOADER_EMS) {
-		result = 0;
-		if (ems_copy_it_down(handle->ems_handle,
-			&handle->ems_page_marker,
-			&handle->ems_page_offset,
-			(byte *)target,
-			total_size)) goto done;
-		result = total_size;
-	} else if (handle->mode == LOADER_XMS) {
-		result = 0;
-
-		if (xms_copy(total_size,
-			handle->xms_handle, (XMS)handle->xms_offset,
-			MEM_CONV, target)) goto done;
-
-		result = total_size;
-		handle->xms_offset += total_size;
-	} else {
-		result = 0;
-		pack_strategy = handle->pack.strategy[marker].type;
-		compressed_size = handle->pack.strategy[marker].compressed_size;
-		packing_flag = (pack_strategy != PACK_NONE) ? PACK_EXPLODE : PACK_RAW_COPY;
-
-		if (packing_flag == PACK_EXPLODE) {
-			decompress_buffer = (byte *)mem_get(compressed_size);
-			if (decompress_buffer != NULL) {
-				if (!fileio_fread_f(decompress_buffer, compressed_size, 1, handle->handle)) goto done;
-
-				if (pack_strategy == PACK_DCL) {
-					Common::MemoryReadStream stream(decompress_buffer, compressed_size);
-					result = Common::decompressDCL(&stream, (byte *)target,
-						compressed_size, total_size) ? total_size : 0;
-				} else {
-					result = pack_data(packing_flag, total_size,
-						FROM_MEMORY, decompress_buffer,
-						TO_MEMORY, target);
-				}
-				already_unpacked = true;
+	result = 0;
+	pack_strategy = handle->pack.strategy[marker].type;
+	compressed_size = handle->pack.strategy[marker].compressed_size;
+	packing_flag = (pack_strategy != PACK_NONE) ? PACK_EXPLODE : PACK_RAW_COPY;
+
+	if (packing_flag == PACK_EXPLODE) {
+		decompress_buffer = (byte *)mem_get(compressed_size);
+		if (decompress_buffer != NULL) {
+			if (!fileio_fread_f(decompress_buffer, compressed_size, 1, handle->handle)) goto done;
+
+			if (pack_strategy == PACK_DCL) {
+				Common::MemoryReadStream stream(decompress_buffer, compressed_size);
+				result = Common::decompressDCL(&stream, (byte *)target,
+					compressed_size, total_size) ? total_size : 0;
+			} else {
+				result = pack_data(packing_flag, total_size,
+					FROM_MEMORY, decompress_buffer,
+					TO_MEMORY, target);
 			}
+			already_unpacked = true;
 		}
+	}
 
-		if (!already_unpacked) {
-			file_position = handle->handle->pos();
+	if (!already_unpacked) {
+		file_position = handle->handle->pos();
 
-			result = pack_data(packing_flag, total_size,
-				FROM_DISK, handle->handle,
-				TO_MEMORY, target);
+		result = pack_data(packing_flag, total_size,
+			FROM_DISK, handle->handle,
+			TO_MEMORY, target);
 
-			if (packing_flag == PACK_EXPLODE)
-				handle->handle->seek(file_position + compressed_size);
-		}
+		if (packing_flag == PACK_EXPLODE)
+			handle->handle->seek(file_position + compressed_size);
 	}
 
 done:
diff --git a/engines/mads/core/loader.h b/engines/mads/core/loader.h
index 957dd1cb04d..f07c1e839b0 100644
--- a/engines/mads/core/loader.h
+++ b/engines/mads/core/loader.h
@@ -30,20 +30,13 @@
 namespace MADS {
 
 #define LOADER_DISK     0       /* File being read from disk */
-#define LOADER_EMS      1       /* File being read from ems  */
-#define LOADER_XMS      2       /* File being read from xms  */
 
 
 struct Load {
 	int open;                   /* Open status (true = open)             */
 	int reading;                /* Read/Write status (true = reading)    */
-	byte mode;                  /* Access mode (LOADER_EMS/LOADER_DISK)  */
+	byte mode;                  /* Access mode (LOADER_DISK)             */
 	Common::SeekableReadStream *handle; /* File handle (if LOADER_DISK)          */
-	int ems_handle;             /* EMS handle  (if LOADER_EMS)           */
-	int xms_handle;             /* XMS handle  (if LOADER_XMS)           */
-	long xms_offset;            /* XMS offset  (if LOADER_XMS)           */
-	int ems_page_marker;        /* Current EMS logical page #            */
-	int ems_page_offset;        /* Current EMS logical page offset       */
 	long decompress_size;       /* Decompressed size of file             */
 	int pack_list_marker;       /* Packing list marker                   */
 	PackList pack;              /* Packing list                          */
@@ -79,7 +72,6 @@ public:
 	}
 };
 
-extern int  loader_ems_search_disabled;
 extern char loader_last[14];
 
 extern int loader_open(LoadHandle handle, const char *filename, const char *options, int flags);
diff --git a/engines/mads/core/matte.cpp b/engines/mads/core/matte.cpp
index 9069d78d298..f3e01923628 100644
--- a/engines/mads/core/matte.cpp
+++ b/engines/mads/core/matte.cpp
@@ -31,7 +31,6 @@
 #include "mads/core/magic.h"
 #include "mads/core/mcga.h"
 #include "mads/core/tile.h"
-#include "mads/core/ems.h"
 #include "mads/core/keys.h"
 #include "mads/core/timer.h"
 #include "mads/core/sound.h"
@@ -97,16 +96,7 @@ Buffer scr_inter_orig = { 0, 0, NULL }; /* Interface original buffer */
 
 
 int matte_map_work_screen() {
-	int error_flag = false;
-
-	if (work_screen_ems_handle >= 0) {
-		if (ems_mapping_changed) {
-			error_flag = ems_map_buffer(work_screen_ems_handle);
-		}
-		ems_mapping_changed = false;
-	}
-
-	return error_flag;
+	return false;
 }
 
 static void matte_init_series() {
diff --git a/engines/mads/core/object.cpp b/engines/mads/core/object.cpp
index cff3083b70a..ddeac9c8deb 100644
--- a/engines/mads/core/object.cpp
+++ b/engines/mads/core/object.cpp
@@ -22,7 +22,6 @@
 #include "mads/core/general.h"
 #include "mads/core/buffer.h"
 #include "mads/core/cycle.h"
-#include "mads/core/ems.h"
 #include "mads/core/env.h"
 #include "mads/core/error.h"
 #include "mads/core/fileio.h"
diff --git a/engines/mads/core/pack.cpp b/engines/mads/core/pack.cpp
index 8abb041696c..19d2907ab57 100644
--- a/engines/mads/core/pack.cpp
+++ b/engines/mads/core/pack.cpp
@@ -21,7 +21,6 @@
 
 #include "mads/core/general.h"
 #include "mads/core/dialog.h"
-#include "mads/core/ems.h"
 #include "mads/core/error.h"
 #include "mads/core/fileio.h"
 #include "mads/core/implode.h"
@@ -43,10 +42,6 @@ long pack_write_count;          /* Size written so */
 
 int pack_default = PACK_NONE;
 
-int pack_ems_page_handle;
-int pack_ems_page_marker;
-int pack_ems_page_offset;
-
 Common::SeekableReadStream *pack_read_file_handle;
 Common::WriteStream *pack_write_file_handle;
 
@@ -315,7 +310,6 @@ long pack_data(int packing_flag, long size,
 	int explode_mode = 0;
 	long *loop_value;
 	long *return_value;
-	EmsPtr *ems_dest;
 	int result;
 
 	// Select the read data routine
@@ -329,13 +323,7 @@ long pack_data(int packing_flag, long size,
 	}
 
 	// Select the write data routine
-	if (dest_type == TO_EMS) {
-		pack_write_routine = pack_write_ems;
-		ems_dest = (EmsPtr *)dest;
-		pack_ems_page_handle = ems_dest->handle;
-		pack_ems_page_marker = ems_dest->page_marker;
-		pack_ems_page_offset = ems_dest->page_offset;
-	} else if (dest_type == TO_MEMORY) {
+	if (dest_type == TO_MEMORY) {
 		pack_write_routine = pack_write_memory;
 		pack_write_memory_ptr = (byte *)dest;
 	} else {
@@ -376,7 +364,7 @@ long pack_data(int packing_flag, long size,
 				return_value = &size;  // Fake return value
 				pack_buffer_size = PACK_PFABEXP2_SIZE;
 				explode_mode = 2;
-			} else if ((dest_type == TO_DISK) || (dest_type == TO_EMS)) {
+			} else if (dest_type == TO_DISK) {
 				return_value = &pack_write_count;  // Return value is # bytes written
 				pack_buffer_size = PACK_PFABEXP0_SIZE;
 				explode_mode = 0;
@@ -589,53 +577,4 @@ packed:
 	return (long)dx;
 }
 
-word pack_write_ems(char *buffer, word *mysize) {
-	word write_this_time;
-	word write_left;
-	word write_this_loop;
-	byte *from_pointer;
-	byte *unto_pointer;
-
-	if (pack_write_size >= 0) {
-		write_this_time = (word)MIN((long)*mysize, pack_write_size);
-	} else {
-		write_this_time = *mysize;
-	}
-
-	if (write_this_time == 0) goto done;
-
-	write_left = write_this_time;
-	from_pointer = (byte *)buffer;
-	unto_pointer = ems_page[0];
-
-	do {
-		if (pack_ems_page_offset >= EMS_PAGE_SIZE) {
-			pack_ems_page_marker = ems_next_handle_page(pack_ems_page_handle,
-				pack_ems_page_marker);
-			pack_ems_page_offset = 0;
-			if (pack_ems_page_marker < 0) goto done;
-		}
-
-		write_this_loop = MIN((int)(EMS_PAGE_SIZE - pack_ems_page_offset), (int)write_left);
-
-		ems_map_page(0, pack_ems_page_marker);
-
-		memcpy(unto_pointer + pack_ems_page_offset, from_pointer, write_this_loop);
-
-		from_pointer = (byte *)mem_normalize(from_pointer + write_this_loop);
-
-		write_left -= write_this_loop;
-		pack_ems_page_offset += write_this_loop;
-
-		if (pack_write_size > 0) {
-			pack_write_size -= write_this_loop;
-		}
-		pack_write_count += write_this_loop;
-
-	} while (write_left > 0);
-
-done:
-	return write_this_time;
-}
-
 } // namespace MADS
diff --git a/engines/mads/core/pack.h b/engines/mads/core/pack.h
index ab875013d76..1614eedb81d 100644
--- a/engines/mads/core/pack.h
+++ b/engines/mads/core/pack.h
@@ -40,7 +40,6 @@ namespace MADS {
 #define FROM_DISK                     1       /* Read disk    */
 #define TO_MEMORY                     0       /* Write memory */
 #define TO_DISK                       1       /* Write disk   */
-#define TO_EMS                        2       /* Write EMS    */
 
 #define PACK_NONE                     0       /* No compression */
 #define PACK_PFAB                     1       /* Dave's Stuff   */
@@ -134,10 +133,6 @@ extern byte pack_zip_enabled;           /* ZIP packing enabled           */
 extern byte pack_pfab_enabled;          /* PFAB packing enabled          */
 extern int  pack_strategy;              /* Current packing strategy      */
 
-extern int pack_ems_page_handle;
-extern int pack_ems_page_marker;
-extern int pack_ems_page_offset;
-
 /* All compression routines called through function pointers, so that */
 /* we can determine at compile time which compression modules will be */
 /* linked.                                                            */
@@ -211,10 +206,8 @@ extern word pack_a_packet(int packing_flag, int explode_mode);
  * source          If FROM_DISK, then this is a FILE *handle.
  * If FROM_MEMORY, this is a far memory pointer.
  * dest_type       Specifies the destination type:
- * TO_DISK, TO_MEMORY, or TO_EMS.
- * dest            Same as "source" but for destination. For
- * TO_EMS, "dest" is a far pointer to an
- * EmsPtr structure.
+ * TO_DISK or TO_MEMORY.
+ * dest            Same as "source" but for destination.
  * Example:
  * result =pack_data (PACK_EXPLODE, 132000,
  * FROM_DISK, file_handle,
@@ -250,7 +243,6 @@ extern void pack_enable_pfab();
 extern void pack_enable_pfab_explode();
 extern void pack_enable_zip_explode();
 extern long pack_rle(byte *target, byte *source, word source_size);
-extern word pack_write_ems(char *buffer, word *mysize);
 
 } // namespace MADS
 
diff --git a/engines/mads/core/sprite.cpp b/engines/mads/core/sprite.cpp
index f6dc7c8a6e0..fb4951c517a 100644
--- a/engines/mads/core/sprite.cpp
+++ b/engines/mads/core/sprite.cpp
@@ -27,8 +27,6 @@
 #include "mads/core/pal.h"
 #include "mads/core/env.h"
 #include "mads/core/loader.h"
-#include "mads/core/ems.h"
-#include "mads/core/xms.h"
 #include "mads/core/fileio.h"
 
 namespace MADS {
@@ -588,32 +586,15 @@ SeriesPtr sprite_series_load(const char *filename, int load_flags) {
 		page_info->packing_mode = header.compression;
 		page_info->paging_source = (byte)load_handle.mode;
 
-		if ((page_info->paging_source == LOADER_EMS) ||
-			(page_info->paging_source == LOADER_XMS)) {
-			page_info->ems_handle = load_handle.ems_handle;
-			page_info->ems_page_marker = load_handle.ems_page_marker;
-			page_info->ems_page_offset = load_handle.ems_page_offset;
-			page_info->xms_handle = load_handle.xms_handle;
-			page_info->xms_offset = load_handle.xms_offset;
-			largest_block = 0;
-			total_offset = 0;
-			for (count = 0; count < target->num_sprites; count++) {
-				page_table[count].file_offset = total_offset;
-				page_table[count].memory_needed = sprite[count].memory_needed;
-				total_offset += page_table[count].memory_needed;
-				largest_block = MAX(largest_block, page_table[count].memory_needed);
-			}
-		} else {
-			page_info->handle = load_handle.handle;
-			total_offset = load_handle.handle->pos();
-			page_info->base_sprite_offset = total_offset;
-
-			largest_block = 0;
-			for (count = 0; count < target->num_sprites; count++) {
-				page_table[count].file_offset = sprite[count].file_offset;
-				page_table[count].memory_needed = sprite[count].memory_needed;
-				largest_block = MAX(largest_block, page_table[count].memory_needed);
-			}
+		page_info->handle = load_handle.handle;
+		total_offset = load_handle.handle->pos();
+		page_info->base_sprite_offset = total_offset;
+
+		largest_block = 0;
+		for (count = 0; count < target->num_sprites; count++) {
+			page_table[count].file_offset = sprite[count].file_offset;
+			page_table[count].memory_needed = sprite[count].memory_needed;
+			largest_block = MAX(largest_block, page_table[count].memory_needed);
 		}
 
 		if (!(load_flags & SPRITE_LOAD_HEADER_ONLY)) {
@@ -1081,13 +1062,8 @@ done:
 
 int sprite_data_load(SeriesPtr series, int id, byte *target) {
 	int error_flag = true;
-	int ems_page_marker = -1;
-	int ems_page_offset;
-	int count;
 	int already_unpacked = false;
 	long my_offset;
-	long my_ems_marker;
-	long my_ems_offset;
 	long decompress_size;
 	byte *decompress_buffer = NULL;
 	SpritePageInfoPtr  page_info;
@@ -1100,59 +1076,34 @@ int sprite_data_load(SeriesPtr series, int id, byte *target) {
 
 	if (page_table[id].memory_needed == 0) goto ok;
 
-	if (page_info->paging_source == LOADER_EMS) {
-		my_offset = page_table[id].file_offset;
-		my_ems_marker = my_offset / EMS_PAGE_SIZE;
-		my_ems_offset = my_offset - (my_ems_marker * EMS_PAGE_SIZE);
-		for (count = 0; count < (int)my_ems_marker; count++) {
-			ems_page_marker = ems_next_handle_page(page_info->ems_handle, ems_page_marker);
-		}
-		ems_page_offset = (int)my_ems_offset + page_info->ems_page_offset;
-		if (ems_page_offset >= EMS_PAGE_SIZE) {
-			ems_page_offset -= EMS_PAGE_SIZE;
-			ems_page_marker = ems_next_handle_page(page_info->ems_handle, ems_page_marker);
-		}
-
-		if (!ems_copy_it_down(page_info->ems_handle,
-			&ems_page_marker,
-			&ems_page_offset,
-			target,
-			page_table[id].memory_needed)) goto done;
-	} else if (page_info->paging_source == LOADER_XMS) {
-		my_offset = page_table[id].file_offset;
-		if (!xms_copy(page_table[id].memory_needed,
-			page_info->xms_handle, (XMS)(page_info->xms_offset + my_offset),
-			MEM_CONV, target)) goto done;
-	} else {
-		my_offset = page_info->base_sprite_offset +
-			page_table[id].file_offset;
+	my_offset = page_info->base_sprite_offset +
+		page_table[id].file_offset;
 
-		fileio_setpos(page_info->handle, my_offset);
+	fileio_setpos(page_info->handle, my_offset);
 
-		pack_strategy = (page_info->packing_mode == PACK_EXPLODE) ? PACK_PFAB : PACK_NONE;
+	pack_strategy = (page_info->packing_mode == PACK_EXPLODE) ? PACK_PFAB : PACK_NONE;
 
-		if (id < series->num_sprites - 1) {
-			decompress_size = page_table[id + 1].file_offset - page_table[id].file_offset;
-			decompress_buffer = (byte *)mem_get_name(decompress_size, "$sp_data");
-			if (decompress_buffer != NULL) {
-				if (!fileio_fread_f(decompress_buffer, decompress_size, 1, page_info->handle)) goto done;
+	if (id < series->num_sprites - 1) {
+		decompress_size = page_table[id + 1].file_offset - page_table[id].file_offset;
+		decompress_buffer = (byte *)mem_get_name(decompress_size, "$sp_data");
+		if (decompress_buffer != NULL) {
+			if (!fileio_fread_f(decompress_buffer, decompress_size, 1, page_info->handle)) goto done;
 
-				if (pack_data(page_info->packing_mode, page_table[id].memory_needed,
-					FROM_MEMORY, decompress_buffer,
-					TO_MEMORY, target) != page_table[id].memory_needed) goto done;
+			if (pack_data(page_info->packing_mode, page_table[id].memory_needed,
+				FROM_MEMORY, decompress_buffer,
+				TO_MEMORY, target) != page_table[id].memory_needed) goto done;
 
-				mem_free(decompress_buffer);
-				decompress_buffer = NULL;
+			mem_free(decompress_buffer);
+			decompress_buffer = NULL;
 
-				already_unpacked = true;
-			}
+			already_unpacked = true;
 		}
+	}
 
-		if (!already_unpacked) {
-			if (pack_data(page_info->packing_mode, page_table[id].memory_needed,
-				FROM_DISK, page_info->handle,
-				TO_MEMORY, target) != page_table[id].memory_needed) goto done;
-		}
+	if (!already_unpacked) {
+		if (pack_data(page_info->packing_mode, page_table[id].memory_needed,
+			FROM_DISK, page_info->handle,
+			TO_MEMORY, target) != page_table[id].memory_needed) goto done;
 	}
 
 ok:
diff --git a/engines/mads/core/sprite.h b/engines/mads/core/sprite.h
index c9c3e7d1164..7201e30d087 100644
--- a/engines/mads/core/sprite.h
+++ b/engines/mads/core/sprite.h
@@ -213,11 +213,6 @@ struct SpritePageInfo {
 	byte packing_mode;          /* Type of compression involved      */
 	Common::SeekableReadStream *handle; /* File handle for hard disk load    */
 	long base_sprite_offset;    /* Base file offset for sprite data  */
-	int  ems_handle;            /* EMS handle for preloaded sprites  */
-	int  ems_page_marker;       /* EMS page number of current read   */
-	int  ems_page_offset;       /* EMS page offset of current read   */
-	int  xms_handle;            /* XMS handle for preloaded sprites  */
-	long xms_offset;            /* XMS offset for current read       */
 };
 
 typedef SpritePageInfo *SpritePageInfoPtr;
diff --git a/engines/mads/core/tile.cpp b/engines/mads/core/tile.cpp
index ce144e87b98..9e344f0f6fb 100644
--- a/engines/mads/core/tile.cpp
+++ b/engines/mads/core/tile.cpp
@@ -28,7 +28,6 @@
 #include "mads/core/mem.h"
 #include "mads/core/pack.h"
 #include "mads/core/color.h"
-#include "mads/core/ems.h"
 #include "mads/core/env.h"
 #include "mads/core/room.h"
 #include "mads/core/pal.h"
@@ -36,7 +35,6 @@
 #include "mads/core/matte.h"
 #include "mads/core/mcga.h"
 #include "mads/core/screen.h"
-#include "mads/core/xms.h"
 #include "mads/core/error.h"
 
 namespace MADS {
@@ -84,7 +82,6 @@ int tile_load(const char *base, int tile_type, TileResource *tile_resource,
 	int color_handle = -1;
 	int x_size;
 	int pan;
-	int memory_mode;
 	int already_unpacked = false;
 	char resource_name[80];
 	char map_name[80];
@@ -92,7 +89,6 @@ int tile_load(const char *base, int tile_type, TileResource *tile_resource,
 	long map_size;
 	long top_of_file = 0;
 	long base_position;
-	long my_offset;
 	long compressed_size;
 	byte *decompress_buffer = NULL;
 	Tile *tile = NULL;
@@ -176,11 +172,7 @@ int tile_load(const char *base, int tile_type, TileResource *tile_resource,
 		goto done;
 	}
 
-	memory_mode = load_handle.mode;
-
-	if (memory_mode == LOADER_DISK) {
-		top_of_file = load_handle.handle->pos();
-	}
+	top_of_file = load_handle.handle->pos();
 
 	// Read tile resource header record
 	{
@@ -380,74 +372,51 @@ int tile_load(const char *base, int tile_type, TileResource *tile_resource,
 	}
 
 	// Get current (base) position in file
-	if (memory_mode == LOADER_DISK) {
-		base_position = load_handle.handle->pos();
-	} else {
-		base_position = 0;
-		for (count = 0; count < (int)load_handle.pack.num_records; count++) {
-			base_position += load_handle.pack.strategy[count].size;
-		}
-	}
+	base_position = load_handle.handle->pos();
 
 	// Load tile data into memory
 	for (count = 0; count < tile_resource->num_tiles; count++) {
-		switch (memory_mode) {
-		case LOADER_XMS:
-			my_offset = base_position + (tile_resource->chunk_size * count);
-			if (!xms_copy(tile_resource->chunk_size,
-				load_handle.xms_handle,
-				(XMS)(my_offset),
-				MEM_CONV, tile_buffer.data)) {
-				tile_load_error = 18;
-				goto done;
-			}
-			break;
-
-		case LOADER_DISK:
-		default:
-			// Set to appropriate file position
-			if (count < (tile_resource->num_tiles - 1)) {
-				compressed_size = tile[count + 1].file_offset - tile[count].file_offset;
-			} else {
-				compressed_size = (env_get_file_size(load_handle.handle) - PACK_OVERHEAD) - (tile[count].file_offset + (base_position - top_of_file));
-			}
-
-			fileio_setpos(load_handle.handle, base_position + tile[count].file_offset);
-			pack_strategy = tile_resource->compression;
-			packing_flag = (pack_strategy != PACK_NONE) ? PACK_EXPLODE : PACK_RAW_COPY;
-
-			// Unpack the tile data
-			if (packing_flag == PACK_EXPLODE) {
-				decompress_buffer = (byte *)mem_get_name(compressed_size, "$tilpack");
-				if (decompress_buffer != NULL) {
-					if (!fileio_fread_f(decompress_buffer, compressed_size, 1, load_handle.handle)) {
-						tile_load_error = 50;
-						goto done;
-					}
-
-					if (pack_data(packing_flag, tile_resource->chunk_size,
-						FROM_MEMORY, decompress_buffer,
-						TO_MEMORY, tile_buffer.data) != (long)tile_resource->chunk_size) {
-						tile_load_error = 51;
-						goto done;
-					}
+		// Set to appropriate file position
+		if (count < (tile_resource->num_tiles - 1)) {
+			compressed_size = tile[count + 1].file_offset - tile[count].file_offset;
+		} else {
+			compressed_size = (env_get_file_size(load_handle.handle) - PACK_OVERHEAD) - (tile[count].file_offset + (base_position - top_of_file));
+		}
 
-					already_unpacked = true;
+		fileio_setpos(load_handle.handle, base_position + tile[count].file_offset);
+		pack_strategy = tile_resource->compression;
+		packing_flag = (pack_strategy != PACK_NONE) ? PACK_EXPLODE : PACK_RAW_COPY;
 
-					mem_free(decompress_buffer);
-					decompress_buffer = NULL;
+		// Unpack the tile data
+		if (packing_flag == PACK_EXPLODE) {
+			decompress_buffer = (byte *)mem_get_name(compressed_size, "$tilpack");
+			if (decompress_buffer != NULL) {
+				if (!fileio_fread_f(decompress_buffer, compressed_size, 1, load_handle.handle)) {
+					tile_load_error = 50;
+					goto done;
 				}
-			}
 
-			if (!already_unpacked) {
 				if (pack_data(packing_flag, tile_resource->chunk_size,
-					FROM_DISK, load_handle.handle,
+					FROM_MEMORY, decompress_buffer,
 					TO_MEMORY, tile_buffer.data) != (long)tile_resource->chunk_size) {
-					tile_load_error = 19;
+					tile_load_error = 51;
 					goto done;
 				}
+
+				already_unpacked = true;
+
+				mem_free(decompress_buffer);
+				decompress_buffer = NULL;
+			}
+		}
+
+		if (!already_unpacked) {
+			if (pack_data(packing_flag, tile_resource->chunk_size,
+				FROM_DISK, load_handle.handle,
+				TO_MEMORY, tile_buffer.data) != (long)tile_resource->chunk_size) {
+				tile_load_error = 19;
+				goto done;
 			}
-			break;
 		}
 
 		// Translate color information for background pictures
diff --git a/engines/mads/core/xms.cpp b/engines/mads/core/xms.cpp
deleted file mode 100644
index 344e4da237f..00000000000
--- a/engines/mads/core/xms.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "mads/core/xms.h"
-
-namespace MADS {
-
-bool xms_exists = false;
-bool xms_disabled = false;
-word xms_version = 0;
-dword xms_controller = 0;
-word xms_chain_seg = 0;
-word xms_umb_list[XMS_MAX_UMB] = {};
-word xms_umb_mark = 0;
-
-} // namespace MADS
diff --git a/engines/mads/core/xms.h b/engines/mads/core/xms.h
deleted file mode 100644
index 29b2a0abac0..00000000000
--- a/engines/mads/core/xms.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef MADS_CORE_XMS_H
-#define MADS_CORE_XMS_H
-
-#include "mads/core/general.h"
-
-namespace MADS {
-
-#define XMS_MAX_UMB     16              /* Max UMB blocks to allocate */
-
-#define XMS             byte *      /* XMS fake pointer type      */
-
-extern bool  xms_exists;           /* Flag if we've got some XMS memory  */
-extern bool  xms_disabled;         /* Flag to disable XMS altogether     */
-extern word  xms_version;          /* XMS driver version #               */
-extern dword xms_controller;       /* XMS controller address             */
-extern word  xms_chain_seg;        /* First UMB MCB segment for us       */
-
-extern word xms_umb_list[XMS_MAX_UMB];
-extern word xms_umb_mark;
-
-inline int xms_detect() { return 0; }
-inline long xms_umb_get_avail() { return 0;}
-inline void *xms_umb_get(long mem_to_get) { return nullptr; }
-inline void xms_umb_free(void *mem_to_free) {}
-inline void xms_umb_purge() {}
-
-/**
- * Returns the size of the largest free XMS block.
- */
-inline long xms_get_avail() { return 0; }
-
-/**
- * Allocates an XMS block of the appropriate size, and returns a handle for it.
- */
-inline int  xms_get(long size_in_bytes) { return 0; }
-
-/**
- * Deallocates an XMS block
- */
-inline void xms_free(int xms_handle) {}
-
-/**
- * Copy data to/from/between XMS memory blocks.  Note that the parameter
- * stack format corresponds precisely to the XMS function spec, so we
- * can just point directly at the parameter stack and call XMS.
- *
- * For conventional memory, use handle "0", and a traditional
- * segmented far pointer.
- *
- * For extended memory, use the proper handle number, and a full
- * 32-bit (unsegmented) pointer.
- */
-inline int xms_copy(long copy_size, word source_handle, void *source, word dest_handle, void *dest) { return 0; }
-
-} // namespace MADS
-
-#endif
diff --git a/engines/mads/dragonsphere/main_menu.cpp b/engines/mads/dragonsphere/main_menu.cpp
index a8607bcc1b3..41ff16c21c2 100644
--- a/engines/mads/dragonsphere/main_menu.cpp
+++ b/engines/mads/dragonsphere/main_menu.cpp
@@ -45,8 +45,6 @@
 #include "mads/core/btype.h"
 #include "mads/core/hspot.h"
 #include "mads/core/magic.h"
-#include "mads/core/ems.h"
-#include "mads/core/xms.h"
 #include "mads/core/imath.h"
 #include "mads/core/kernel.h"
 #include "mads/core/game.h"
diff --git a/engines/mads/module.mk b/engines/mads/module.mk
index 51e0dffca1a..90b71aa1e67 100644
--- a/engines/mads/module.mk
+++ b/engines/mads/module.mk
@@ -18,7 +18,6 @@ MODULE_OBJS := \
 	core/cursor.o \
 	core/cycle.o \
 	core/dialog.o \
-	core/ems.o \
 	core/env.o \
 	core/error.o \
 	core/fileio.o \
@@ -66,7 +65,6 @@ MODULE_OBJS := \
 	core/video.o \
 	core/vocab.o \
 	core/window.o \
-	core/xms.o \
 	nebular/bonus/bonus.o \
 	nebular/bonus/bonus_exe_data.o \
 	nebular/bonus/bonus_text_ui.o \
diff --git a/engines/mads/phantom/main_menu.cpp b/engines/mads/phantom/main_menu.cpp
index 3fd8c3fc266..c77d74bd04f 100644
--- a/engines/mads/phantom/main_menu.cpp
+++ b/engines/mads/phantom/main_menu.cpp
@@ -45,8 +45,6 @@
 #include "mads/core/btype.h"
 #include "mads/core/hspot.h"
 #include "mads/core/magic.h"
-#include "mads/core/ems.h"
-#include "mads/core/xms.h"
 #include "mads/core/imath.h"
 #include "mads/core/kernel.h"
 #include "mads/core/game.h"


Commit: 28710fb3ddb112fa828d1d8776f154977f155ef2
    https://github.com/scummvm/scummvm/commit/28710fb3ddb112fa828d1d8776f154977f155ef2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-13T18:38:34+10:00

Commit Message:
MADS: Remove unused himem.cpp

Assisted-by: Claude Code:sonnet-5

Changed paths:
  R engines/mads/core/himem.cpp
  R engines/mads/core/himem.h
    engines/mads/animview/animview.cpp
    engines/mads/core/anim.cpp
    engines/mads/core/error.cpp
    engines/mads/core/game.cpp
    engines/mads/core/kernel.cpp
    engines/mads/core/player.cpp
    engines/mads/core/room.cpp
    engines/mads/dragonsphere/main.cpp
    engines/mads/forest/main.cpp
    engines/mads/module.mk
    engines/mads/nebular/main.cpp
    engines/mads/nebular/rooms/room109.cpp
    engines/mads/phantom/main.cpp
    engines/mads/phantom/phantom.cpp


diff --git a/engines/mads/animview/animview.cpp b/engines/mads/animview/animview.cpp
index 6e52f5ce4aa..d5cca961c68 100644
--- a/engines/mads/animview/animview.cpp
+++ b/engines/mads/animview/animview.cpp
@@ -22,9 +22,9 @@
 #include "audio/audiostream.h"
 #include "common/file.h"
 #include "mads/core/env.h"
-#include "mads/core/himem.h"
 #include "mads/core/kernel.h"
 #include "mads/core/matte.h"
+#include "mads/core/mem.h"
 #include "mads/core/mcga.h"
 #include "mads/core/mouse.h"
 #include "mads/core/pack.h"
@@ -426,13 +426,12 @@ static void run_animation(int animIndex) {
 static void animate() {
 	char buf[80];
 	AnimFile anim_in;
-	int count, series_ctr, ctr;
+	int count, ctr;
 	int soundLoadFlag = 0;
 	int imageIndex;
 	static int packIndex = 0;
 	bool found_sound = false;
 
-	himem_startup();
 	(void)tile_setup();
 
 	mcga_compute_retrace_parameters();
@@ -450,33 +449,10 @@ static void animate() {
 		AnimEntry &entry = anim_list[count];
 
 		MADS_FORMAT(buf, entry.name);
-		himem_preload_series(buf, 0);
 
 		if (anim_get_header_info(buf, &anim_in))
 			continue;
 
-		// Preload resources used by the animation
-		if (anim_in.load_flags & AA_LOAD_FONT) {
-			*buf = '\0';
-			if (in_mads_mode)
-				Common::strcpy_s(buf, "*");
-			Common::strcat_s(buf, anim_in.font_file);
-			himem_preload_series(buf, 0);
-		}
-
-		for (series_ctr = 0; series_ctr < anim_in.num_series; ++series_ctr) {
-			MADS_FORMAT(buf, anim_in.series_name[series_ctr]);
-			himem_preload_series(buf, 0);
-		}
-
-		if (anim_in.background_type == AA_ROOM) {
-			static const char *EXT[5] = { ".dat", ".tt", ".mm", ".tt0", ".mm0" };
-			for (int i = 0; i < 5; ++i) {
-				env_get_level_path(buf, anim_in.background_room, EXT[i], 3, 0);
-				himem_preload_series(buf, 0);
-			}
-		}
-
 		if (g_engine->shouldQuit())
 			error_code = 1;
 	}
@@ -659,7 +635,6 @@ done:
 		g_engine->_soundManager->removeDriver();
 
 	timer_remove();
-	himem_shutdown();
 }
 
 void animview_main(const char *resName) {
diff --git a/engines/mads/core/anim.cpp b/engines/mads/core/anim.cpp
index f5a886e3a4e..3ecd5492f1f 100644
--- a/engines/mads/core/anim.cpp
+++ b/engines/mads/core/anim.cpp
@@ -22,7 +22,6 @@
 #include "common/algorithm.h"
 #include "common/memstream.h"
 #include "mads/core/anim.h"
-#include "mads/core/himem.h"
 #include "mads/core/env.h"
 #include "mads/core/sprite.h"
 #include "mads/core/room.h"
@@ -30,6 +29,7 @@
 #include "mads/core/fileio.h"
 #include "mads/core/buffer.h"
 #include "mads/core/matte.h"
+#include "mads/core/mem.h"
 #include "mads/core/inter.h"
 #include "mads/core/pal.h"
 #include "mads/core/mads.h"
@@ -581,54 +581,7 @@ int anim_get_header_info(char *file_name,
 }
 
 int anim_himem_preload(char *name, int level) {
-	int error_flag = true;
-	char temp_buf[80];
-	AnimFile anim_in;
-	int count2;
-	int mads_mode;
-
-	mads_mode = (name[0] == '*');
-
-	himem_preload_series(name, level);
-
-	if (anim_get_header_info(name, &anim_in)) goto done;
-
-	if (anim_in.load_flags & AA_LOAD_FONT) {
-		temp_buf[0] = 0;
-		if (mads_mode) Common::strcat_s(temp_buf, "*");
-		Common::strcat_s(temp_buf, anim_in.font_file);
-		himem_preload_series(temp_buf, level);
-	}
-
-	for (count2 = 0; count2 < anim_in.num_series; count2++) {
-		temp_buf[0] = 0;
-		if (mads_mode) Common::strcpy_s(temp_buf, "*");
-		Common::strcat_s(temp_buf, anim_in.series_name[count2]);
-		himem_preload_series(temp_buf, level);
-	}
-
-	if (anim_in.background_type == AA_ROOM) {
-		env_get_level_path(temp_buf, ROOM, ".DAT", 0, anim_in.background_room);
-		himem_preload_series(temp_buf, level);
-		env_get_level_path(temp_buf, ROOM, ".TT", 0, anim_in.background_room);
-		himem_preload_series(temp_buf, level);
-		env_get_level_path(temp_buf, ROOM, ".MM", 0, anim_in.background_room);
-		himem_preload_series(temp_buf, level);
-		env_get_level_path(temp_buf, ROOM, ".TT0", 0, anim_in.background_room);
-		himem_preload_series(temp_buf, level);
-		env_get_level_path(temp_buf, ROOM, ".MM0", 0, anim_in.background_room);
-		himem_preload_series(temp_buf, level);
-	} else if (anim_in.background_type == AA_INTERFACE) {
-		temp_buf[0] = 0;
-		if (mads_mode) Common::strcat_s(temp_buf, "*");
-		Common::strcat_s(temp_buf, anim_in.background_name);
-		himem_preload_series(temp_buf, level);
-	}
-
-	error_flag = false;
-
-done:
-	return error_flag;
+	return false;
 }
 
 void init_anim() {
diff --git a/engines/mads/core/error.cpp b/engines/mads/core/error.cpp
index eafe276de35..b4864e90ba8 100644
--- a/engines/mads/core/error.cpp
+++ b/engines/mads/core/error.cpp
@@ -26,7 +26,6 @@
 #include "mads/core/mouse.h"
 #include "mads/core/screen.h"
 #include "mads/core/echo.h"
-#include "mads/core/himem.h"
 #include "mads/core/env.h"
 #include "mads/core/screen.h"
 #include "mads/core/timer.h"
@@ -179,7 +178,6 @@ static void error_explode(const char *error_buf, const char *module_buf,
 
 	timer_remove();
 	keys_remove();
-	himem_shutdown();
 
 	mouse_init(false, 3);
 	screen_dominant_mode(text_mode);
diff --git a/engines/mads/core/game.cpp b/engines/mads/core/game.cpp
index e2cdd9ee510..a66a4c9ca60 100644
--- a/engines/mads/core/game.cpp
+++ b/engines/mads/core/game.cpp
@@ -48,7 +48,6 @@
 #include "mads/core/error.h"
 #include "mads/core/popup.h"
 #include "mads/core/object.h"
-#include "mads/core/himem.h"
 #include "mads/core/magic.h"
 #include "mads/core/btype.h"
 #include "mads/core/pack.h"
@@ -1463,9 +1462,6 @@ void game_control() {
 
 			new_section = new_room / 100;
 
-			// Flush all EMS/XMS preloads at the room level
-			himem_flush(ROOM);
-
 			// Rex Nebular menu display
 			if (g_engine->getGameID() == GType_RexNebular && kernel.activate_menu != GAME_NO_MENU &&
 					player.commands_allowed && !global[RexNebular::kCopyProtectFailed]) {
@@ -1503,9 +1499,6 @@ void game_control() {
 
 		// Shut down current section
 		kernel_section_shutdown();
-
-		// Flush all EMS/XMS preloads at the section level
-		himem_flush(SECTION);
 	}
 
 	// Shut down the game
diff --git a/engines/mads/core/himem.cpp b/engines/mads/core/himem.cpp
deleted file mode 100644
index a103ca66bab..00000000000
--- a/engines/mads/core/himem.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "mads/core/general.h"
-#include "mads/core/himem.h"
-
-namespace MADS {
-
-// EMS/XMS support doesn't exist in ScummVM, so the himem directory that
-// preloaded resources into expanded/extended memory can never activate;
-// these entry points are kept only because callers throughout the engine
-// use them as preload hints.
-
-void himem_shutdown() {
-}
-
-void himem_startup() {
-}
-
-int himem_preload(char *filename, int level) {
-	return -1;
-}
-
-int himem_preload_series(const char *filename, int level) {
-	return -1;
-}
-
-void himem_flush(int level) {
-}
-
-} // namespace MADS
diff --git a/engines/mads/core/himem.h b/engines/mads/core/himem.h
deleted file mode 100644
index e8711967a69..00000000000
--- a/engines/mads/core/himem.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef MADS_CORE_HIMEM_H
-#define MADS_CORE_HIMEM_H
-
-#include "mads/core/pack.h"
-#include "mads/core/mem.h"
-
-namespace MADS {
-
-extern void himem_catalog();
-extern void himem_shutdown();
-extern void himem_startup();
-extern int himem_preload(char *filename, int level);
-extern int himem_preload_series(const char *filename, int level);
-extern void himem_flush(int level);
-
-} // namespace MADS
-
-#endif
diff --git a/engines/mads/core/kernel.cpp b/engines/mads/core/kernel.cpp
index 9b2f8f23c9b..137c6ccc8eb 100644
--- a/engines/mads/core/kernel.cpp
+++ b/engines/mads/core/kernel.cpp
@@ -33,7 +33,6 @@
 #include "mads/core/error.h"
 #include "mads/core/screen.h"
 #include "mads/core/speech.h"
-#include "mads/core/himem.h"
 #include "mads/core/echo.h"
 #include "mads/core/mcga.h"
 #include "mads/core/timer.h"
@@ -243,9 +242,6 @@ void kernel_game_shutdown() {
 	mouse_init(false, text_mode);
 	video_init(text_mode, (check_mode != text_mode));
 
-	// Deallocate EMS/XMS memory
-	himem_shutdown();
-
 	// Remove timer interrupt stuff
 	timer_activate_low_priority(NULL);
 
@@ -270,9 +266,6 @@ int kernel_game_startup(int game_video_mode, int load_flag,
 	int error_flag = true;
 	byte *interrupt_stack;
 
-	// Set up EMS/XMS paging system, if any
-	himem_startup();
-
 	speech_init();
 
 	timer_set_sound_flag(0);
diff --git a/engines/mads/core/player.cpp b/engines/mads/core/player.cpp
index 5d121ac34f0..138401cbaa5 100644
--- a/engines/mads/core/player.cpp
+++ b/engines/mads/core/player.cpp
@@ -31,7 +31,6 @@
 #include "mads/core/matte.h"
 #include "mads/core/error.h"
 #include "mads/core/pal.h"
-#include "mads/core/himem.h"
 #include "mads/core/object.h"
 #include "mads/mads.h"
 #include "mads/nebular/extra.h"
@@ -670,17 +669,6 @@ void player_preserve_palette() {
 }
 
 void player_himem_preload(const char *name, int level) {
-	char temp_buf[80];
-	int count;
-
-	for (count = 1; count <= 9; count++) {
-		if (count != 5) {
-			Common::strcpy_s(temp_buf, name);
-			Common::strcat_s(temp_buf, "_0");
-			temp_buf[strlen(temp_buf) - 1] += count;
-			himem_preload_series(kernel_full_name(0, 0, -1, temp_buf, KERNEL_SS), level);
-		}
-	}
 }
 
 /**
diff --git a/engines/mads/core/room.cpp b/engines/mads/core/room.cpp
index bdf65181148..3f82c89b566 100644
--- a/engines/mads/core/room.cpp
+++ b/engines/mads/core/room.cpp
@@ -32,7 +32,6 @@
 #include "mads/core/matte.h"
 #include "mads/core/mads.h"
 #include "mads/core/mem.h"
-#include "mads/core/himem.h"
 #include "mads/core/sprite.h"
 #include "mads/core/loader.h"
 #include "mads/core/tile.h"
@@ -527,14 +526,6 @@ void room_file_name(char *target, const char *suffix, int code, char *main_name,
 }
 
 void room_himem_preload(int roomNum, int level) {
-	himem_preload_series(kernel_full_name(roomNum, 0, -1, NULL, KERNEL_DAT), level);
-	himem_preload_series(kernel_full_name(roomNum, 0, -1, NULL, KERNEL_HH), level);
-
-	himem_preload_series(kernel_full_name(roomNum, 0, -1, NULL, KERNEL_MM), level);
-	himem_preload_series(kernel_full_name(roomNum, 0, -1, NULL, KERNEL_WW), level);
-
-	himem_preload_series(kernel_full_name(roomNum, 0, 0, NULL, KERNEL_MM), level);
-	himem_preload_series(kernel_full_name(roomNum, 0, 0, NULL, KERNEL_WW), level);
 }
 
 int room_picture_load(int roomId, Buffer *picture, int load_flags) {
diff --git a/engines/mads/dragonsphere/main.cpp b/engines/mads/dragonsphere/main.cpp
index 6d2ffc9b700..285ec1dd1be 100644
--- a/engines/mads/dragonsphere/main.cpp
+++ b/engines/mads/dragonsphere/main.cpp
@@ -28,7 +28,6 @@
 #include "mads/core/error.h"
 #include "mads/core/fileio.h"
 #include "mads/core/game.h"
-#include "mads/core/himem.h"
 #include "mads/core/kernel.h"
 #include "mads/core/magic.h"
 #include "mads/core/matte.h"
@@ -187,10 +186,6 @@ static void game_main(int argc, const char **argv) {
 		art_hags_are_on_hd = false;
 	}
 
-	himem_startup();
-
-	himem_shutdown();
-
 	if (!mads_mode && (env_search_mode == ENV_SEARCH_MADS_PATH))
 		error("false start");
 
diff --git a/engines/mads/forest/main.cpp b/engines/mads/forest/main.cpp
index defed1c1c93..508ab3d109a 100644
--- a/engines/mads/forest/main.cpp
+++ b/engines/mads/forest/main.cpp
@@ -28,7 +28,6 @@
 #include "mads/core/error.h"
 #include "mads/core/fileio.h"
 #include "mads/core/game.h"
-#include "mads/core/himem.h"
 #include "mads/core/kernel.h"
 #include "mads/core/magic.h"
 #include "mads/core/matte.h"
@@ -118,10 +117,6 @@ static void game_main(int argc, const char **argv) {
 		art_hags_are_on_hd = false;
 	}
 
-	himem_startup();
-
-	himem_shutdown();
-
 	if (!mads_mode && (env_search_mode == ENV_SEARCH_MADS_PATH))
 		error("false start");
 
diff --git a/engines/mads/module.mk b/engines/mads/module.mk
index 90b71aa1e67..1e7571f6a52 100644
--- a/engines/mads/module.mk
+++ b/engines/mads/module.mk
@@ -25,7 +25,6 @@ MODULE_OBJS := \
 	core/game.o \
 	core/global.o \
 	core/heap.o \
-	core/himem.o \
 	core/hspot.o \
 	core/image.o \
 	core/imath.o \
diff --git a/engines/mads/nebular/main.cpp b/engines/mads/nebular/main.cpp
index 04e957b28e6..75e4facfaae 100644
--- a/engines/mads/nebular/main.cpp
+++ b/engines/mads/nebular/main.cpp
@@ -28,7 +28,6 @@
 #include "mads/core/error.h"
 #include "mads/core/fileio.h"
 #include "mads/core/game.h"
-#include "mads/core/himem.h"
 #include "mads/core/imath.h"
 #include "mads/core/keys.h"
 #include "mads/core/kernel.h"
@@ -291,10 +290,6 @@ static void game_main(int argc, const char **argv) {
 		art_hags_are_on_hd = false;
 	}
 
-	himem_startup();
-
-	himem_shutdown();
-
 	if (!mads_mode && (env_search_mode == ENV_SEARCH_MADS_PATH))
 		error("false start");
 
diff --git a/engines/mads/nebular/rooms/room109.cpp b/engines/mads/nebular/rooms/room109.cpp
index f716bc876f7..23cb2737117 100644
--- a/engines/mads/nebular/rooms/room109.cpp
+++ b/engines/mads/nebular/rooms/room109.cpp
@@ -21,7 +21,6 @@
 
 #include "mads/core/config.h"
 #include "mads/core/game.h"
-#include "mads/core/himem.h"
 #include "mads/core/matte.h"
 #include "mads/core/pal.h"
 #include "mads/nebular/global.h"
@@ -462,10 +461,6 @@ void room_109_preload() {
 	room_parser_code_pointer = room_109_parser;
 	room_daemon_code_pointer = room_109_daemon;
 
-	for (int count = 0; count < 4; ++count) {
-		himem_preload_series(kernel_full_name(109, 'H', count, nullptr, 0), 3);
-	}
-
 	vocab_make_active(words_dead_purple_monster);
 	vocab_make_active(words_monster_sludge);
 
diff --git a/engines/mads/phantom/main.cpp b/engines/mads/phantom/main.cpp
index abed2d1ce5e..4a4fb8a8da3 100644
--- a/engines/mads/phantom/main.cpp
+++ b/engines/mads/phantom/main.cpp
@@ -28,7 +28,6 @@
 #include "mads/core/error.h"
 #include "mads/core/fileio.h"
 #include "mads/core/game.h"
-#include "mads/core/himem.h"
 #include "mads/core/kernel.h"
 #include "mads/core/magic.h"
 #include "mads/core/matte.h"
@@ -198,10 +197,6 @@ static void game_main(int argc, const char **argv) {
 		art_hags_are_on_hd = false;
 	}
 
-	himem_startup();
-
-	himem_shutdown();
-
 	if (!mads_mode && (env_search_mode == ENV_SEARCH_MADS_PATH))
 		error("false start");
 
diff --git a/engines/mads/phantom/phantom.cpp b/engines/mads/phantom/phantom.cpp
index b135bc87548..fc42effb535 100644
--- a/engines/mads/phantom/phantom.cpp
+++ b/engines/mads/phantom/phantom.cpp
@@ -25,7 +25,6 @@
 #include "mads/core/conv.h"
 #include "mads/core/env.h"
 #include "mads/core/game.h"
-#include "mads/core/himem.h"
 #include "mads/core/imath.h"
 #include "mads/core/inter.h"
 #include "mads/core/kernel.h"
@@ -152,18 +151,6 @@ void PhantomEngine::global_init_code() {
 	/* Global preload items */
 
 	player_himem_preload("RAL", GLOBAL);
-	himem_preload_series("*BOX", GLOBAL);
-	himem_preload_series("*LOGO", GLOBAL);
-	himem_preload_series("*MENU", GLOBAL);
-	himem_preload_series("*CURSOR", GLOBAL);
-	himem_preload_series("*FACERAL", GLOBAL);
-	himem_preload_series("*RRD_8", GLOBAL);
-	himem_preload_series("*RRD_9", GLOBAL);
-	himem_preload_series("*RDR_6", GLOBAL);
-	himem_preload_series("*RDR_9", GLOBAL);
-	himem_preload_series("*RTK_6", GLOBAL);
-	himem_preload_series("*RTK_9", GLOBAL);
-	himem_preload_series("*RALRH_9", GLOBAL);
 }
 
 void PhantomEngine::section_music(int section_num) {




More information about the Scummvm-git-logs mailing list