一、Windows 下
1、准备阶段
1、安装NASM
Nasm的官方网站:http://sourceforge.net/projects/nasm/。下载完成直接安装,记住你的安装文件夹。
2、dd命令工具
Windows下有dd for Windows的工具,下载地址http://www.chrysocome.net/download,找到dd-*(版本号).zip,下载解压即可使用。
3、Bochs安装
Bochs主页http://bochs.sourceforge.net/,可直接安装。
4、配置环境变量
将三个软件的安装位置加入环境变量中,相信安装过软件的都知道如何设置,这里就不详细说明了。
5、测试软件
在cmd下输入
nasm -version
dd
bochs
2、操作阶段
1、汇编boot.asm
1、nasm boot.asm -oboot.bin
2、生成软盘映像
bximage 输入 fd 一路回车
最终a.img生成在cmd的当前目录下,请注意目录。
3、写入引导
dd if=boot.bin of=a.img bs=512 count=1 conv=notrunc
rawwrite dd for windows version 0.3.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by the GPL. See copying.txt for details
Unknown command conv=notrunc
dd [bs=SIZE] [count=BLOCKS] [if=FILE] [of=FILE] [seek=BLOCKS] [skip=BLOCKS] [--list] [--progress]
SIZE may have one of the following suffix:
k = 1024
M = 1048576
G = 1073741824
这一步如果报错 Unknown command conv=notrunc,说明你的dd版本过高, 这个命令已经不存在了。直接去掉这个就行
dd if=boot.bin of=a.img bs=512 count=1
4、手动创建配置bochsrc.bxrc文件
##################################
# configure filefor Bochs in win7
##################################
# how much memorythe emulated machine will have
megs: 32
# filename of ROMimages
romimage:file=$BXSHARE/BIOS-bochs-latest
vgaromimage:file=$BXSHARE/VGABIOS-lgpl-latest
# what disk imagewill be used
floppya:image="a1.img", status=inserted
# floppya:1_44=floppyb.img, status=inserted
#hard disk
# ata0: enabled=1,ioaddr1=0x1fo, ioaddr2=0x3f0, irq=14
# ata0-master:type=disk, path="hd10meg.img", cylinders=306, heads=4, spt=17
# choose the bootdisk.
boot: a
# default configinterface is textconfig.
#config_interface:textconfig
#config_interface:w
#display_library:x
# other choices:win32 sdl wx carbon amigaos beos macintosh nogui rfb term
# where do we sendlog messages?
log: bochsout.txt
# disable themouse, since DLX is text only
mouse: enabled=0
# enable keymapping, using US layout as default.
#
# NOTE: In Bochs1.4, keyboard mapping is only 100% implemented on X windows.
# However, the keymapping tables are used in the paste function, so
# in the DLX Linuxexample I'm enabling keyboard_mapping so that paste
# will work. Cut&Paste is currently implemented onwin32 and X windows only.
#keyboard:keymap=C:/Program Files (x86)/Bochs-2.3.5/keymaps/x11-pc-us.map
keyboard_mapping:enabled=1, map=$BXSHARE/keymaps/x11-pc-fr.map
#keyboard_mapping:enabled=1, map=$BXSHARE/keymaps/x11-pc-de.map
#keyboard_mapping:enabled=1, map=$BXSHARE/keymaps/x11-pc-es.ma
注意改成自己的路径即可。
3、运行阶段
1、双击bochsrc.boxrc
2、命令运行 bochs -f bochsrc.bxrc