; (c) 2009-2010 by Gerhard Wiesinger ; Source Code released under GNU GPL, v2 only and not any later version. ; http://www.gnu.org/licenses/gpl-2.0.html public _int15_e820h .model medium .code .286 _int15_e820h proc far ; http://dmst.aueb.gr/dds/news/14.html ; Sorry, but the above is not exactly correct. It is true that most of the ; 386 instructions can be used in the real mode, but the segment limit is ; still limited to 64K. That is the base address (the one that is added ; to the segment) even when using 32 bit operands must be less than 65535. ; If it is more an exception will occur. Because of this you miss the linear ; addressing feature of the 386. In order to increase the segment limit ; you have to go to protected mode. ; Try the following program to convince yourself: ; mov ebx,010000h ; This is more than the segment limit ; mov al, [ebx] ; You should get an exception in real ; mode at this point. ; => One can use 386 instructions, but must be within the segment limits! ; http://www.unixwiz.net/techtips/win32-callconv-asm.html ; 10 (bp) - third function parameter (rightmost) ; 8 (bp) - second function parameter ; 6 (bp) - first function parameter (leftmost) ; 4 (bp) - old CS (the function's "return address") ; 2 (bp) - old IP (the function's "return address") ; 0 (bp) - old BP (previous function's base pointer) ;-2 (bp) - first local variable ;-4 (bp) - second local variable ;-6 (bp) - third local variable ; ; http://en.wikipedia.org/wiki/X86_calling_conventions ; http://courses.ece.illinois.edu/ece390/lecture/lockwood/l8.html ; http://ftp.lanet.lv/ftp/mirror/x2ftp/msdos/programming/watcom/00index.html ; http://ftp.lanet.lv/ftp/mirror/x2ftp/msdos/programming/watcom/lesson1.zip push bp mov bp,sp mov es,word ptr [bp+6] ; first function parameter (leftmost) mov di,word ptr [bp+8] ; second function parameter .386 mov eax,0000E820h ; mov edx,534D4150h ; ('SMAP') mov ebx,00000000h ; start at beginning of map mov ecx,20 ; 20 bytes .286 int 15h ; call interrupt jc int_error ; error? mov ax,cx ; length=cx jmp return_i int_error: mov ax,0 ; set length=0 return_i: pop bp retf _int15_e820h endp end