繁体   English   中英

我如何在引导区中显示数字

[英]how can i display a number in my boot sector

我正在尝试在开机时显示一个数字,但是什么也没显示。 实际上,我正在尝试从int 12h确定内存大小,我是否做了一些不正常的事情?

那是我的启动代码:

    bits 16
    org 0x0

    jmp start

    %include "display.INC"

    start : 
        mov ax , 0x07c0
        mov ds , ax
        mov es , ax

        mov ax , 0x8000
        mov ss , ax
        mov sp , 0x7000

        int 12h
    mov cx , 0
    call digit
    mov si ,  buffer_string 
    call afficher

digit : 
    div 10
    test al , 0
    jz end_digit
    mov bx , al
    add bx , 0x30
    mov byte [buffer_string+cx] , byte [bx]
    inc cx
    jmp digit

end_digit : ret

    end :
        jmp end

    times 510-($-$$) db 144
    dw 0xaa55

并且有要显示的文件:

afficher :
    push ax
    push bx

debut :
    lodsb
    cmp al , 0
    jz fin
    mov ah ,0x0e
    mov bx  ,0x07
    int 10h
    JMP debut

fin :
    pop bx
    pop ax
    ret

你能帮我吗 ??

我找到了我需要的东西,请参见上文。

bits 16
org 0x0
jmp start
%include "display.INC"
start : 
    mov ax , 0x07c0
    mov ds , ax
    mov es , ax

    mov ax , 0x8000
    mov ss , ax
    mov sp , 0x7000

    int 12h
    mov bx, 10
    mov di, tab
    mov si, reste
    xor cx, cx
digit:
    xor dx, dx
    div bx
    cmp ax, 0
    jz copystr
    add dx, 0x30
    mov byte [si], dl
    mov dx, ax
    xchg ax, dx
    inc cx
    inc si
    jmp digit
copystr:
    dec cx
        dec si
        mov al, byte [si]
        mov byte [di], al
        inc di
        cmp cx, 0
        jnz copystr
end:
    mov byte [di], 0
    mov si , tab
    call afficher
end_boot :
    jmp end_boot
tab times 30 db 0
reste times 30 db 0


times 510-($-$$) db 144
dw 0xaa55

我等待一些建议

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM