程序集引导加载程序循环不进入循环



这是一个引导加载程序,但我有一个问题。它打印名称,课程,Student_num和fav_movie。但是我试图打印一行".",但它只打印一个点。我不确定我是否正确使用了循环

[BITS 16]
[ORG 0x7C00]
top:
        ;; Put 0 into ds (data segment)
        ;; Can't do it directly
        mov ax,0x0000
        mov ds,ax
        mov cx, 10
        ;; si is the location relative to the data segment of the
        ;; string/char to display
        mov si, Name
        call writeString
        mov si ,Course
        call writeString
        mov si, Student_num
        call writeString
        mov si, fav_movie
        call writeString
        call repeat
        jmp $; Spin

repeat:
        mov dx, square
        mov bh,09h
        loop repeat
        int 21h
writeString:
        mov ah,0x0E ; Display a chacter (as before)
        mov bh,0x00
        mov bl,0x07
        mov di,si
        int 21h
nextchar:
        Lodsb ; Loads [SI] into AL and increases SI by one
        ;; Effectively "pumps" the string through AL
        cmp al,0 ; End of the string?
        jz done
        int 0x10 ; BIOS interrupt
        jmp nextchar
done:
        ret
Name db 'Petar',13,10,0 ; Null-terminated
Course db '1234',13,10,0
Student_num db '123456789',13,10,0
fav_movie db 'GoT',13,10,0
square db '.',13,10,0
    times 510-($-$$) db 0
        dw 0xAA55

在此处输入图像描述

您正在尝试通过引导扇区的int 21h调用 DOS API。这永远行不通。

您需要改为致电int 10h

AH = 功能代码 (0Ah(al = 字符bh = 0(视频页面(cx = 1(重复计数(

最新更新