简单的引导程序

    org 07c00h     ;告诉编译器程序开始地址是07c00h

    mov ax,cs      ;把代码段地址赋值给ax寄存器
    mov ds,ax      ;把ax寄存器内容赋值给数据段寄存器
    mov es,ax      ;把ax寄存器内容赋值给es段寄存器
    call showmsg   ;调用showmsg子程序
    jmp $          ;不断跳转到当前位置是个死循环

showmsg:
    mov ax,bootmsg ;把字符串首地址赋值给ax寄存器
    mov cx,001fh   ;CX = 串长度
    mov bp,ax      ;ES:BP = 串地址
    mov dx,1216h   ;DH = 显示的行号 DL = 显示的列号
    mov bx,000ch   ;页号为0(BH = 0) 黑底红字(BL = 0ch 高亮)
    mov ax,1301h   ;AH = 调用13h子程序 AL = 显示的是串结构
    int 10h        ;调用10h号中断
ret
bootmsg: db "Welcome to my operation system!"
times 510-($-$$) db 0 ;填充剩下的空间,使生成的二进制代码恰好为512字节
dw 55ah ;结束标志 

你可能感兴趣的:(简单的引导程序)