org 7c00h ; 告诉编译器程序被加载到段内7c00偏移处
mov ax, cs
mov ds, ax
mov es, ax
call DspStr ; 调用显示字符串函数
jmp $ ; 死循环
DspStr:
mov ax, BootMsg
mov bp, ax ; es:bp = 字符串地址
mov cx, 16 ; cx = 字符串长度
mov ax, 1301h ; ah = 13h, al = 01h
mov bx, 000ch ; 页号为0(bh = 0)黑底红字(bl = 0ch,高亮)
mov dl, 0
int 10h ; bios 10h 号中断
ret
BootMsg: db "Hello, OS world!"
times 510 - ($ - $$) db 0 ; 填充剩下的空间填充0,至此生成的com文件长度为510字节
dw 0xaa55 ; 结束标值,至此长度为512字节
网友评论