dd 指令(window) http://www.chrysocome.net/downloads/dd-0.6beta3.zip
将 dd.exe
放到 C:\WINDOWS
下。
bochs https://sourceforge.net/projects/bochs/files/bochs/
安装完成后,需要配置环境变量。
nasm https://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=Dhttps://www.bilibili.com/read/cv15135008/
要配置环境变量。
D:\user> bximage
========================================================================
bximage
Disk Image Creation / Conversion / Resize and Commit Tool for Bochs
$Id: bximage.cc 14091 2021-01-30 17:37:42Z sshwarts $
========================================================================
1. Create new floppy or hard disk image
2. Convert hard disk image to other format (mode)
3. Resize hard disk image
4. Commit 'undoable' redolog to base image
5. Disk image info
0. Quit
Please choose one [0] 1
Create image
Do you want to create a floppy disk image or a hard disk image?
Please type hd or fd. [hd] fd
Choose the size of floppy disk image to create.
Please type 160k, 180k, 320k, 360k, 720k, 1.2M, 1.44M, 1.68M, 1.72M, or 2.88M.
[1.44M]
What should be the name of the image?
[a.img]
Creating floppy image 'a.img' with 2880 sectors
The following line should appear in your bochsrc:
floppya: image="a.img", status=inserted
(The line is stored in your windows clipboard, use CTRL-V to paste)
Press any key to continue
;%define _BOOT_DEBUG_ ; 制作 Boot Sector 时一定将此行注释掉!
; 去掉此行注释后可做成.COM文件易于调试:
; nasm Boot.asm -o Boot.com
%ifdef _BOOT_DEBUG_
org 0100h ; 调试状态, 做成 .COM 文件, 可调试
%else
org 07c00h ; BIOS 将把 Boot Sector 加载到 0:7C00 处
%endif
mov ax, cs
mov ds, ax
mov es, ax
call DispStr ; 调用显示字符串例程
jmp $ ; 无限循环
DispStr:
mov ax, BootMessage
mov bp, ax ; ES:BP = 串地址
mov cx, 16 ; CX = 串长度
mov ax, 01301h ; AH = 13, AL = 01h
mov bx, 000ch ; 页号为0(BH = 0) 黑底红字(BL = 0Ch,高亮)
mov dl, 0
int 10h ; int 10h
ret
BootMessage: db "Hello, OS world!"
times 510-($-$$) db 0 ; 填充剩下的空间,使生成的二进制代码恰好为512字节
dw 0xaa55 ; 结束标志
nasm boot.asm -o boot.bin
最后会得到一个 boot.bin
文件。
dd if=boot.bin of=a.img bs=512 count=1 conv=notrunc
#设置运行时使用的内存,本例为32MB
megs: 32
#设置BIOS和VGA BIOS
romimage: file="D:\Program Files\Bochs-2.7\BIOS-bochs-latest"
vgaromimage: file="D:\Program Files\Bochs-2.7\VGABIOS-lgpl-latest"
#软盘a,使用a.img
floppya: 1_44=a.img, status=inserted
#设置为软盘启动
boot: floppy
#日志文件
log: bochsout.txt
#关闭鼠标、打开键盘
mouse: enabled=0
keyboard: keymap="D:\Program Files\Bochs-2.7\keymaps\x11-pc-us.map"
bochs -f bochsrc.bxrc
或者直接双击 bochsrc.bxrc
文件。