hdd*_*ddh 5 assembly operating-system virtualbox nasm bin
我在Windows 7上使用VirtualBox 4.1.14,我试图让它运行我的测试操作系统.我正在使用下面的汇编代码,我正在编译它
nasm -f bin -o boot.bin boot.asm
我试图将生成的bin文件转换为VB4.1.14可以使用的ISO(我不想付钱或者试用程序有任何限制).我尝试下载像bin2iso这样的不同转换器,但每当我尝试在VERR_NOT_SUPPORTED等中打开生成的ISO时,VB就会出现不同的错误.
我更喜欢该解决方案是一个命令行工具,所以我可以在批处理脚本中使用它来更快地进行测试.
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
Run Code Online (Sandbox Code Playgroud)
cop*_*opy 10
您可以使用dd(搜索dd for windows)为初学者创建一张软盘.二进制文件只写入1440 kib文件的前256个字节.
dd if=/dev/zero of=floppy.img ibs=1k count=1440
dd if=boot.img of=floppy.img conv=notrunc
Run Code Online (Sandbox Code Playgroud)
现在我们开始:

| 归档时间: |
|
| 查看次数: |
4144 次 |
| 最近记录: |