min*_*gle 4 x86 assembly bios bootloader
我正在使用NASM编写我的第一个OS引导扇区.我有它的工作,它只显示"Hello OS world!" 用红色字母.很简单.我已将boot.asm转换为boot.bin,并将其转换为boot.img.我正在使用VMWare播放器,我将boot.img作为软盘驱动器安装并从那里启动它工作得很好.但是这个汇编代码有几行是我不明白的目的.
org 07c00h
mov ax, cs
mov ds, ax
mov es, ax
call DispStr
jmp $
DispStr:
mov ax, BootMessage
mov bp, ax
mov cx, 16
mov ax, 01301h ;
mov bx, 000ch ;
mov dl, 0 ;
int 10h ;
ret
BootMessage: db "Hello, OS world!"
times 510-($-$$) db 0
dw 0xaa55 ;
Run Code Online (Sandbox Code Playgroud)
以分号结尾的行是我不理解的行.我做了很多谷歌搜索,并能够弄清楚其他的东西.我很擅长写作大会.因此,例如,我知道mov ax,01301h移动01301h到AX寄存器.但我不明白为什么,或者有多01301h重要.我猜他们有点像格式化字符串的参数,但这只是猜测.任何和所有的帮助将不胜感激.
有关更多信息,请查看此页关于INT 10H的信息.这些数字是控制该中断行为的参数.在你的情况下:
ax = 0x1301 -> ah = 0x13 al = 0x01
bx = 0x000c -> bh = 0x00 bl = 0x0c
cx = 16
dl = 0x00
Run Code Online (Sandbox Code Playgroud)
的AH=0x13手段"写字符串",与各种其它控制参数:
AL = write mode -> 1
BL = color -> 0x0c = light red
BH = page number -> 0
CX = string length -> = 16
DH = row -> 0
DL = column -> 0
ES:BP = offset of string -> pointer to BootMessage string
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
353 次 |
| 最近记录: |