Re: Is there any example of using int 15h,ax=e820h?



bog wrote:
Hi,everybody
I'm now trying to get my machine's memory map under 1MB space using int
15h ax=e820h,but haven't succeeded till now.

Can somebody give me an example of using int 15h,ax=e820h?If it is run
under DOS or windows,that is better.Sorry,I don't know if it could run
under DOS or windows.

Dunno if it's correct - here's what I've got. This uses dos - change the display function for bios...


Best,
Frank

; nasm -f bin -o inte820.com inte820.asm

org 100h

struc mm_ent
    .base resq 1
    .len resq 1
    .type resd 1
endstruc


section .text mov di, buffer xor ebx, ebx xor si, si ; counter top: mov eax, 0E820h mov edx, 534D4150h ; 'SMAP' mov ecx, 20 int 15h jc error inc si ; bump counter add di, cx or ebx, ebx jz done jmp short top done:

    mov cx, si            ; count
    mov si, buffer
show:
    mov eax, [si + mm_ent.base + 4]
    call showeax
    mov eax, [si + mm_ent.base]
    call showeax
    call newline

    mov eax, [si + mm_ent.len + 4]
    call showeax
    mov eax, [si + mm_ent.len]
    call showeax
    call newline

    mov eax, [si + mm_ent.type]
    call showeax
    call newline

    add si, mm_ent_size
;    cmp si, di
;    jne show
    loop show

error:

exit:
    ret

;------------------
showeax:
    push cx
    mov cx, 8
...top:
    rol eax, 4
    push eax
    and al, 0Fh
    cmp al, 0Ah
    sbb al, 69h
    das
    call putc
    pop eax
    loop .top
    pop cx
    ret
;-------------------

;-------------------
newline:
    push ax
    mov al, 13
    call putc
    mov al, 10
    call putc
    pop ax
    ret
;--------------------

;--------------------
putc:
    push ax
    push dx
    mov dl, al
    mov ah, 2
    int 21h
    pop dx
    pop ax
    ret
;----------------

section .bss
    buffer resb 200h


.



Relevant Pages