FrenkelS / Doom8088

Doom for 16-bit DOS computers
GNU General Public License v2.0
140 stars 5 forks source link

add 63 kB of XMS / UMB memory #2

Open FrenkelS opened 10 months ago

FrenkelS commented 10 months ago

just like in Commander Keen 4

FrenkelS commented 10 months ago

Using Upper Memory Blocks requires assembly. Using inline assembly is compiler specific. Let's first decide on the compiler before we start using inline assembly.

https://www.phatcode.net/res/219/files/xms30.txt

SeanRamey commented 9 months ago

Hey, I don't think you HAVE to use inline assembly to do that. I would try to do it with C first.

FrenkelS commented 9 months ago

The way to get upper memory blocks is:

  1. Call interrupt 2F with AX = 4300 to see if XMS is installed.
  2. Call interrupt 2F with AX = 4310 to get the address of the XMS driver.
  3. Call the driver with AH = 10 and DX = FFFF to get the size of the largest upper memory block.
  4. ...

Step 1 and 2 can be done by using int86() with union REGS. Step 3 is the problem, because I don't know how to set AH and DX in C. Digital Mars and CC386 have the variable _EAX to set EAX directly, but I don't think Watcom and GCC have something similar in pure C.