Created
February 28, 2013 10:00
-
-
Save rve/5055619 to your computer and use it in GitHub Desktop.
asm class snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org 7c00h ; 告诉编译器程序加载到7C00H处 | |
mov ax,cs | |
mov ds,ax | |
mov es,ax | |
call DispStr | |
Jmp $ ; 无限循环 | |
DispStr: ; 显示字符串例程 | |
;clear screen | |
mov al,0 | |
mov cx,0 | |
mov dh,24 | |
mov dl,79 | |
mov ah,06h | |
int 10h | |
;dis | |
mov ax,BootMsg | |
mov bp,ax ; ES:BP=串地址 | |
mov cx,16 ; CX=串长 | |
mov ax,1301h ; AH=BIOS中断的功能号、AL=1表示光标放到串尾 | |
mov bx,0c | |
h ; BH=页号、BL=颜色(黑底红字) | |
mov dl,0 | |
int 10h ; 调用10H号中断 | |
ret | |
BootMsg: | |
db "Hello, OS world!" | |
times 510-($-$$) db 0 ; 用0填充剩余部分($=当前地址、$$=当前节地址) | |
dw 0aa55h ; 启动扇区的结束标志,可以改为:db 55h,0aah |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment