Skip to content

Commit

Permalink
Add 256, 512 and 1024 MB emulated memory options (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
schellingb committed May 28, 2023
1 parent 04a965a commit 0fa0eff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 4 additions & 1 deletion core_options.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Bernhard Schelling
* Copyright (C) 2020-2023 Bernhard Schelling
*
* 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
Expand Down Expand Up @@ -478,6 +478,9 @@ static retro_core_option_v2_definition option_defs[] =
{ "96", "96 MB" },
{ "128", "128 MB" },
{ "224", "224 MB" },
{ "256", "256 MB" },
{ "512", "512 MB" },
{ "1024", "1024 MB" },
},
"16"
},
Expand Down
6 changes: 4 additions & 2 deletions src/dbp_serialize.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Bernhard Schelling
* Copyright (C) 2020-2023 Bernhard Schelling
*
* 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
Expand Down Expand Up @@ -285,9 +285,11 @@ void DBPSerialize_All(DBPArchive& ar, bool dos_running, bool game_running)
}
}

Bitu memory_mb = MEM_TotalPages() / ((1024*1024)/MEM_PAGE_SIZE);
Bit8u serialized_machine = (Bit8u)machine, current_machine = serialized_machine;
Bit8u serialized_memory = (Bit8u)(MEM_TotalPages() * MEM_PAGE_SIZE / (1024*1024)), current_memory = serialized_memory;
Bit8u serialized_memory = (Bit8u)(memory_mb < 225 ? memory_mb : (223+memory_mb/128)), current_memory = serialized_memory;
Bit8u serialized_vgamem = (Bit8u)(vga.vmemsize / (1024*128)), current_vgamem = serialized_vgamem;
DBP_ASSERT(MEM_TotalPages() == (current_memory < 225 ? current_memory : (current_memory-223)*128)*256);
ar << serialized_machine << serialized_memory << serialized_vgamem;
if (ar.mode == DBPArchive::MODE_LOAD)
{
Expand Down
10 changes: 5 additions & 5 deletions src/hardware/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
#define SAFE_MEMORY 32
#define MAX_MEMORY 64
#else
#define MAX_MEMORY 225 // needs to be <= 255 (MAXUINT8) due to DBPSerialize_All
#define MAX_MEMORY 2049 // needs to be <= 4097 due to DBPSerialize_All
#endif
#define MAX_PAGE_ENTRIES (MAX_MEMORY*1024*1024/4096)
#define LFB_PAGES 512
#define MAX_LINKS ((MAX_MEMORY*1024/4)+4096) //Hopefully enough

//DBP: Unused
//#define MAX_PAGE_ENTRIES (MAX_MEMORY*1024*1024/4096)
//#define LFB_PAGES 512
//#define MAX_LINKS ((MAX_MEMORY*1024/4)+4096) //Hopefully enough
//
//struct LinkBlock {
// Bitu used;
// Bit32u pages[MAX_LINKS];
Expand Down

0 comments on commit 0fa0eff

Please sign in to comment.