如何在我的程序集引导加载程序中获取用户输入?

How can I get user input in my assembly bootloader?

我正在开发程序集引导加载程序。我需要帮助获取用户的输入。我使用这样的代码在屏幕上打印(start)。在 getInput 中,我尝试从用户那里获取输入但没有成功。那么,我该怎么做呢?

org 0x7C00
BITS 16

start:
    cli                ; Disable interrupts
mov si, bootMsg1   ; Point SI to message
mov ah, 0x0E     ; Indicate BIOS we're going to print chars
.loop lodsb       ; Loads SI to AL
or al,al      ; Checks if the end of string
jz seperate
or al,al
jz halt   ; Jump to halt at the end
int 0x10      ; Otherwise, call interrupt for printing the char
jmp .loop     ; Next iteration of loop

...
getInput:
    cli
mov ah, 08 ; Indicate BIOS to get input
int 21h
mov ah,02
mov DL,AL
int 21h
MOV AH,4Ch   ; Function to exit
    MOV AL,00    ; Return 00
    INT 21h



halt: hlt ; CPU command to halt the execution
bootMsg1:   db "Slight Bootloader 1, Welcome!",13,10     ; Message
bootMsg2: db"------------",13,10

使用Int 16h/AH=00h.
一些输出为 Int 21h/AH=08h.

Int 16h has input utilities, Int 10h has output (video) utilities.


示例。
等待用户按下一个键然后 "reboot".

BITS 16

xor ax, ax
int 16h

int 19h

TIMES 510 - ($-$$) db 0
dw 0aa55h