学了下汇编后自己写了个小型操作系统. 名字暂时叫做ISystem. 源代码见下面的地址.
该系统主要由一个启动程序(boot.bin, 会被放置到影像文件第0个扇区的位置)和一个核心文件(kernel.bin, 会被放置到影像文件第1~64扇区的位置)构成. 并且使用工具把这两个文件合并为软盘影像文件(isystem.img). 可以使用virtual box, VMware等虚拟机加载该映像文件.
程序的启动步骤
位于第0扇区的启动程序被加载到内存位于7C00H:0000H的地方并执行. 然后启动程序加载核心文件到内存位于1000H:0000H的地方并跳转到那里执行.
系统软盘影像文件结构
扇区 | 说明 |
0 | Boot Loader(512字节) |
1-64 | Kernel(32768字节) |
65-128 | 保留 |
129 | 系统参数 |
130~2879 | 用户文件 |
应用程序的启动
通过命令exec可以启动一个程序. 系统会把程序加载到内存位于3000H:0000H的地方执行. 应用程序可以使用NASM生成的bin文件(起始点必须为0H!!!).
ORG 0H
MOV SI, Message
MOV AH, 4
INT 21H
MOV AH, 0
INT 21H
Message DB 'Hello, World!', 0
现在正在尝试用TC2的编译器产生能够在该系统上运行的程序. 继续敲代码去了~~~
下载地址: http://www.vdisk.cn/down/index/12419439