Add secondary VRAM as heap when using direct-DD access

Ultimate Doom E1M6 now loads!
This commit is contained in:
Lephenixnoir 2021-08-04 15:58:40 +02:00
parent 8c643db6a4
commit 4832390802
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
5 changed files with 36 additions and 5 deletions

View File

@ -53,6 +53,29 @@ enum {
disable.) */
#define CGDOOM_DIRECT_R61524
//---
// Memory distribution
//---
/* When direct-display access is disabled, put the screens in secondary VRAM
and use VRAM for rendering. When it's enabled, put the screens in VRAM and
use the secondary VRAM as heap. We swap because using the VRAM as heap would
cause problems with error screens (stepping through errors would crash). */
#ifdef CGDOOM_DIRECT_R61524
# define CGDOOM_SCREENS_BASE ((void *)GetVRAMAddress())
#else
# define CGDOOM_SCREENS_BASE SaveVRAMBuffer
#endif
/* The primary/secondary VRAM covers 384*216*2 = 162 kiB:
-> Give 320*200 = 64 kB to screens[0] (main display)
-> Give 320*200 = 64 kB to screens[1] (intermissions)
-> Give 320*32 = 10 kiB to screens[4] (status bar)
-> 27 kiB are left */
#define CGDOOM_SCREENS_0 (CGDOOM_SCREENS_BASE)
#define CGDOOM_SCREENS_1 (CGDOOM_SCREENS_BASE + 320*200)
#define CGDOOM_SCREENS_4 (CGDOOM_SCREENS_BASE + 320*200*2)
//---
#include "keyboard.hpp"

3
README
View File

@ -19,13 +19,12 @@ UI improvements TODO:
WAD support TODO:
-> Unmodified 1.9 shareware WAD works all the way through?
-> Shareware WAD from Planète Casio should work 100%
-> Ultimate DOOM WAD runs out of memory in E1M6, otherwise should work
-> Ultimate Doom WAD should work 100% for episode 1
Technical support TODO:
-> Supply more VRAM memory to internal allocator
=> Merge internal heap into Z_Zone? (< 50 kB)
=> Rewrite video code to use long PRAM0 access? (138 kB)
=> Use the XRAM/R61524 combo and use VRAM as heap? (160 kB)
-> Rate-limit the game when overclocking
-> Load/Save game would be very cool
-> Reenable LTO if possible

View File

@ -75,6 +75,15 @@ byte* I_ZoneBase (int* size, int i)
*size = &eextra - &sextra;
return &sextra;
}
#ifdef CGDOOM_DIRECT_R61524
if (i == 2)
{
/* Secondary VRAM (screen buffers being in the main VRAM because we're
doing direct access so we don't need Bdisp_PutDisp_DD() */
*size = 384 * 216 * 2;
return SaveVRAMBuffer;
}
#endif
return NULL;
}

View File

@ -1114,5 +1114,5 @@ void ST_Init (void)
{
veryfirsttime = 0;
ST_loadData();
screens[4] = SaveVRAMBuffer + 2 * SCREENWIDTH * SCREENHEIGHT;
screens[4] = CGDOOM_SCREENS_4;
}

View File

@ -352,9 +352,9 @@ void V_GetBlock( int x, int y, int scrn, int width, int height, byte* dest
void V_Init (void)
{
/* screens[0] is the main screen */
screens[0] = SaveVRAMBuffer;
screens[0] = CGDOOM_SCREENS_0;
/* screens[1] is used for the level end sequence (intermission) */
screens[1] = SaveVRAMBuffer + SCREENWIDTH * SCREENHEIGHT;
screens[1] = CGDOOM_SCREENS_1;
/* screens[2] and screens[3] are used for wipe effects (disabled here) */
/* screens[4] is used for the status bar (allocated by st_stuff.c) */