这是一个引导程序,但我有问题。 它显示名称,课程,学生编号和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
答案 0 :(得分:2)
您正试图通过int 21h
从引导扇区调用DOS API。那永远都行不通。
您需要致电int 10h
。
AH =功能代码(0Ah) al =字符 bh = 0(视频页面) cx = 1(重复计数)