Detecting Memory (x86): Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
mNo edit summary
BIOS bug
Line 166: Line 166:
====BIOS Function: INT 0x15, AX = 0xDA88====
====BIOS Function: INT 0x15, AX = 0xDA88====


This function returns the number of contiguous KiB of usable RAM starting at 0x00100000 in Cl:BX in KiB. This is very similar to "INT 0x15, AX=0x8A" - if this function says there's 14 MiB of RAM at 0x00100000 then you can't assume there isn't more RAM at 0x01000000, so you'd probe for any extra memory starting at 0x01000000.
This function returns the number of contiguous KiB of usable RAM starting at 0x00100000 in CL:BX in KiB. This is very similar to "INT 0x15, AX=0x8A" - if this function says there's 14 MiB of RAM at 0x00100000 then you can't assume there isn't more RAM at 0x01000000, so you'd probe for any extra memory starting at 0x01000000.


If this function isn't supported it'll return "carry = set".
If this function isn't supported it'll return "carry = set".
Line 174: Line 174:


Note: This function may limit itself to reporting 15M (for legacy reasons) even if BIOS detects more
Note: This function may limit itself to reporting 15M (for legacy reasons) even if BIOS detects more
memory than that. It may also report up to 64M. It only reports contiguous (usable) RAM.
memory than that. It may also report up to 64M. It only reports contiguous (usable) RAM. In some BIOSes, it may not clear the CF flag on success.


Usage:
Usage:
<source lang="asm">
<source lang="asm">
CLC ; CF bug workaround
MOV AH, 0x88
MOV AH, 0x88
INT 0x15 ; request upper memory size
INT 0x15 ; request upper memory size
Line 183: Line 184:
TEST AX, AX ; size = 0 is an error
TEST AX, AX ; size = 0 is an error
JE SHORT .ERR
JE SHORT .ERR
; AX = number of contiguous KB above 1M
CMP AH, 0x86 ; unsupported function
JE SHORT .ERR
CMP AH, 0x80 ; invalid command
JE SHORT .ERR
; AX = number of contiguous Kb above 1M
</source>
</source>