Skip to content
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

DPMI function 0800h crashes when trying to map more than 8Mb #4

Open
viti95 opened this issue Apr 5, 2024 · 0 comments
Open

DPMI function 0800h crashes when trying to map more than 8Mb #4

viti95 opened this issue Apr 5, 2024 · 0 comments

Comments

@viti95
Copy link

viti95 commented Apr 5, 2024

While testing VESA modes on FastDoom I've discovered that DPMI function 0800h crashes if you try to map more than 8Mb. This issue also happens on other games, and it's why the NOLFB utility was created. This is the code I use (modified to avoid crashes).

#define MEMORY_LIMIT (128*64*1024)

void *DPMI_MAP_PHYSICAL(void *p, unsigned long size)
{
  // Limit memory to 8Mb, mapping 16Mb crashes
  if (size > MEMORY_LIMIT)
    size = MEMORY_LIMIT;

  /* DPMI call 800h map physical memory*/
  PrepareRegisters();
  regs.w.ax = 0x0800;
  regs.w.bx = (unsigned short)(((unsigned long)p) >> 16);
  regs.w.cx = (unsigned short)(((unsigned long)p) & 0xffff);
  regs.w.si = (unsigned short)(size >> 16);
  regs.w.di = (unsigned short)(size & 0xffff);
  int386x(0x31, &regs, &regs, &sregs);
  return (void *)(((unsigned long)regs.w.bx << 16) | regs.w.cx);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant