From f869f45d0dd3c88ddbb1d7f5b8da84122b2e4f36 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Mon, 26 Jul 2021 17:24:28 +0200 Subject: [PATCH] Split in ROM sectors of 512 bytes instead of clusters of 4 kiB This makes the search quite a bit slower, I'll look into that later. --- CGDOOM-minisdk/CGDOOM/platform.h | 8 ++++---- README | 1 + cgdoom/cgdoom.c | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CGDOOM-minisdk/CGDOOM/platform.h b/CGDOOM-minisdk/CGDOOM/platform.h index 8281d9c..3bf01e2 100644 --- a/CGDOOM-minisdk/CGDOOM/platform.h +++ b/CGDOOM-minisdk/CGDOOM/platform.h @@ -88,11 +88,11 @@ extern TSysCallFuncPtr fnSysCallFuncPtr; #define ASSERT(x) //flash file mapping -#define FLASH_START (0xA0B60000) //0x80000000 //0xA0000000 +#define FLASH_START (0xA0000000) #define FLASH_END (0xA2000000) -//page has 4 KB (I hope) -#define FLASH_PAGE_SIZE 4096 -#define FLASH_PAGE_SIZE_LOG2 12 +//Lephe: Yatis established that allocation is in sectors of 512 bytes +#define FLASH_PAGE_SIZE 512 +#define FLASH_PAGE_SIZE_LOG2 9 #define FLASH_PAGE_OFFSET_MASK (FLASH_PAGE_SIZE - 1) // diff --git a/README b/README index e448baf..925ad85 100644 --- a/README +++ b/README @@ -11,6 +11,7 @@ TODO: -> HUD glitches? -> Try and use more memory regions in z_zone.c -> Overclocking etc. +-> Improve file mapping speed CGDOOM used to be compiled with the mini-SDK. However, it's become quite difficult to get a copy of that. Instead, this port is built with a slightly diff --git a/cgdoom/cgdoom.c b/cgdoom/cgdoom.c index f0a3069..32b09dd 100644 --- a/cgdoom/cgdoom.c +++ b/cgdoom/cgdoom.c @@ -301,7 +301,7 @@ const unsigned short wadfile[] = {'\\','\\','f','l','s','0','\\','d','o','o','m' //descriptor for 1 fragment typedef struct { - short msOffset;//page index (0 ~ 8K) + unsigned short msOffset;//page index (0 ~ 64K) short msCount;//count of pages in this fragment }FileMappingItem; @@ -400,7 +400,7 @@ int CreateFileMapping(const unsigned short *pFileName,FileMapping *pMap){ iResult = -3; goto lbExit; } - pMap->mTable[pMap->miItemCount-1].msOffset = (short)iPageIndx; + pMap->mTable[pMap->miItemCount-1].msOffset = (unsigned short)iPageIndx; pMap->mTable[pMap->miItemCount-1].msCount = 0; //assume fragment has more pages for(;;)