我正在尝试将我用汇编语言编写的引导加载程序转换为ISO图像文件。以下是代码来自MikeOS http://mikeos.sourceforge.net/write-your-own-os.html引导加载程序。这是我的引导加载程序代码:
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: unrecognized operand ‘skip’
。我读到DD文档表明,skip 属性必须分配有一个编号。任何想法我应该使用skip属性输入什么数字(例如skip = 1)。
接下来我输入以下命令:
mkdosfs -C floppy.img 1440
我收到以下错误:mkdosfs: unable to create floppy.img
。如何解决我遇到的问题?有没有另一种更简单的方法可以将我的引导加载程序 .bin 文件转换为ISO image?