-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory management #11
Comments
At startup, *Technically it can be one big contiguous block of memory plus 64 kB of EMS memory. Point is, all memory should be addressable without having to use bank switching. |
I am a bit confused. I thought IBM PC means 16 bit 8088 or 8086, but I see that _dos_allocmem is only used with: #if defined DJGPP || defined _M_I386 where DJGPP is 32 bit compiler and the other is 386 which gives the impression that _dos_allocmem is only 32 bit? |
The IBM PC 16-bit version can be compiled with gcc-ia16 and Open Watcom. In those cases |
So for 16bit OW on а 16 bit OS different from DOS and OS/2 (such as ELKS) a new custom version of _dos_allocmem is required in i_ibm.c? The built-in version uses DOS system calls, so it won't work for ELKS. |
So fmemalloc from ELKS can be used as a replacement of _dos_allocmem for ELKS. Question: are there any special timer and interrupt routines that needs to be refactored for ELKS for doomtd3? |
To port doomtd3 to ELKS create the file For example, segment_t I_ZoneBase(uint32_t *size)
{
uint32_t paragraphs = 550 * 1024L / PARAGRAPH_SIZE;
uint8_t __far* ptr = fmemalloc(paragraphs * PARAGRAPH_SIZE);
while (!ptr)
{
paragraphs--;
ptr = fmemalloc(paragraphs * PARAGRAPH_SIZE);
}
// align ptr
uint32_t m = (uint32_t) ptr;
if ((m & (PARAGRAPH_SIZE - 1)) != 0)
{
paragraphs--;
while ((m & (PARAGRAPH_SIZE - 1)) != 0)
m = (uint32_t) ++ptr;
}
*size = paragraphs * PARAGRAPH_SIZE;
return D_FP_SEG(ptr);
} Or when segment_t I_ZoneBase(uint32_t *size)
{
unsigned int max, segment;
_fmemalloc(0xffff, &max);
_fmemalloc(max, &segment);
*size = (uint32_t)max * PARAGRAPH_SIZE;
return segment;
} In my opinion, there are no special timer routines. |
An IBM PC 16 bit will use 8086 real-mode. Even with Open Watcom large model pointers are still limited to a 64k range of memory and program's heap (using malloc) is also limited to 64k, just like in small model.
So doomtd3 needs to use code that manage separately-allocated 64K chunks of memory in order to use more than 64 kb of memory. Is that how doomtd3 is programmed to use 300kb of memory?
Or maybe there is never a need for an array that is bigger than 64 kb, so everything is indeed done in chunks of 64 kb.
The text was updated successfully, but these errors were encountered: