手动写一个小型的操作系统

需要工具:nasm,Bochs,dd,Notepad++
安装并配置环境
安装Bochs时需要完全安装
创建工作文件夹
创建文本文件编写源代码
改文件后缀名为asm
利用nasm进行编译
在此目录下打开cmd运行
nasm hello.asm -o hello.bin
这样目录下就会多一个文件 hello.bin
下一步创建软盘
bximage
在这里插入图片描述

创建成功后,当前目录下就会多出一个镜像文件 hello.img
使用dd命令写入软盘,
dd if = hello.bin of = hello.img bs=512 count=1 conv=notrunc
if和of表示输入输出,bs=512表示写512个字节大小,count=1表示写入次数为1,conv=notrunc表示不截短输出文件,因为输出文件有1.44M,而输出只有512B

在 Bochs的安装目录下有一个dlxlinux目录,进入这个目录下复制文件bochsrc.bxrc到工作文件夹下,使用Notepad++打开这个文件
在这里插入图片描述
1,2,4都是bochs安装目录下的文件,根据自己的实际情况修改,3是刚刚写入的镜像文件,改完之后保存修改并退出

打开cmd,输入命令bochsdbg -f bochsrc.bxrc
在这里插入图片描述
点击start开始运行
在这里插入图片描述
在窗口输入命令b 0x7c00 b表示break,表示在0x7c00地址处打一个断点,输入c确定表示运行到这一个断点,接下来再执行c则屏幕会打出Hello OS!字样
在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一个小型操作系统,采用gcc进行开发,几千行的代码,方便初学者学习,内含有编译好的映像文件,及bochs模拟器配置文件,可在bochs下模拟运行。如下为源码包内的README文件: # # Snixos Project version 1.0, 2003.6 # (C) Copyright 2003,2004,2005 Jockeyson,KeqianGao # All Rights Reserved. # Distributed under the terms of the GNU General Public License. # # This program is a free and open source software and you can redistribute # it and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation. As no any liability is assumed # for any incidental or consequential damages in connection with the # information or program fragments contained herein,so any exception arised # is at your own risk. It is ABSOLUTELY WITHOUT ANY WARRANTY. # Bug report please send to Snallie@tom.com . # 0. What is Snixos Project? Snixos Project is an experimental operating system designed by Jockeyson , KeqianGao aiming at multitask/multithread, Chinese envionment including Chinese characters input and ouput etc... 1. What you need to run Snixos PC with the following minimum configuration: CPU: i386 or above MEM: 2M extended memory or more DISPLAY: VGA or above Floppy Drive: 1.44M 2. Compile Environment RH Linux 7.2 or above (kernel 2.4.7-10 ) NASM 0.98 gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98) 3. Compile and install a. unpack the source package tar zxvf snixos_x.x_YYYYMMDD_HHMMSS.tgz b. cd to snixos cd snixos c. before make insert a 1.44M floppy in drive c.1 to make snixos run in VGA text mode make clean make VIDEO=TEXT diskimg make floppy c.2 to make snixos run VGA graphics mode make clean make diskimg make floppy d. bootup with the floppy just created in step c also you can follow this way to run snixos in bochs either in Windows or Linux a. just as the above b. just as the above c. invoke these command: make clean; make diskimg you'll get a snixos ima

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值