我试图将我在汇编语言中编写的引导加载程序转换为ISO映像文件.以下是
MikeOS bootloader的代码.这是我的引导程序代码:
BITS 16
start:
mov ax, 07C0h ; Set up 4K stack space after this bootloader
add ax, 288 ; (4096 + 512) / 16 bytes per paragraph
mov ss, ax
mov sp, 4096
mov ax, 07C0h ; Set data segment to where we're loaded
mov ds, ax
mov si, text_string ; Put string position into SI
call print_string ; Call our string-printing routine
jmp $ ; Jump here - infinite loop!
text_string db 'This is my cool new OS!', 0
print_string: ; Routine: output string in SI to screen
mov ah, 0Eh ; int 10h 'print char' function
.repeat:
lodsb ; Get character from string
cmp al, 0
je .done ; If char is zero, end of string
int 10h ; Otherwise, print it
jmp .repeat
.done:
ret
times 510-($-$$) db 0 ; Pad remainder of boot sector with 0s
dw 0xAA55 ; The standard PC boot signature
我输入以下命令:
nasm -f bin -o boot.bin boot.asm
此命令工作正常,它提供.bin输出.接下来我输入以下命令:
dd if=boot.bin of=floppy.img count=1 bs=512
这也很好,并给了我.img输出文件.当我输入此命令时:
dd if=boot.bin of=floppy.img skip seek=1 count=1339
我收到以下错误:dd:无法识别的操作数’skip’.我在DD文档中读到skip属性必须分配一个编号.任何想法我应该使用skip属性键入什么数字(例如,skip = 1).
接下来我输入以下命令:
mkdosfs -C floppy.img 1440
我收到以下错误:mkdosfs:无法创建floppy.img.我如何解决我遇到的问题?还有另一种更简单的方法可以将我的bootloader .bin文件转换为ISO映像吗?