Compare commits

...

4 Commits
Day01 ... Day02

Author SHA1 Message Date
Yourtion
358f1a4d33 汉化 2014-09-05 15:01:38 +08:00
Yourtion
e041908391 Create README.md 2014-09-05 14:59:23 +08:00
Yourtion
70af4152d2 修正Day1代码问题 2014-09-05 14:52:54 +08:00
Yourtion
5c10d16cd1 Add day2 code 2014-09-05 14:49:14 +08:00
7 changed files with 114 additions and 2 deletions

View File

@@ -33,9 +33,9 @@
; 信息显示部分
DB 0x0a, 0x0a ; ?个?行
DB 0x0a, 0x0a ; 换行两次
DB "hello, world"
DB 0x0a ; ?
DB 0x0a ;
DB 0
RESB 0x1fe-$ ; 填写0x00直到0x001fe

1
02_day/!cons_9x.bat Normal file
View File

@@ -0,0 +1 @@
command

1
02_day/!cons_nt.bat Normal file
View File

@@ -0,0 +1 @@
cmd.exe

39
02_day/Makefile Normal file
View File

@@ -0,0 +1,39 @@
# 默认动作
default :
../z_tools/make.exe img
# 镜像文件生成
ipl.bin : ipl.nas Makefile
../z_tools/nask.exe ipl.nas ipl.bin ipl.lst
helloos.img : ipl.bin Makefile
../z_tools/edimg.exe imgin:../z_tools/fdimg0at.tek \
wbinimg src:ipl.bin len:512 from:0 to:0 imgout:helloos.img
# 其他指令
asm :
../z_tools/make.exe -r ipl.bin
img :
../z_tools/make.exe -r helloos.img
run :
../z_tools/make.exe img
copy helloos.img ..\z_tools\qemu\fdimage0.bin
../z_tools/make.exe -C ../z_tools/qemu
install :
../z_tools/make.exe img
../z_tools/imgtol.com w a: helloos.img
clean :
-del ipl.bin
-del ipl.lst
src_only :
../z_tools/make.exe clean
-del helloos.img

60
02_day/ipl.nas Normal file
View File

@@ -0,0 +1,60 @@
; hello-os
; TAB=4
ORG 0x7c00 ; 指明程序装载地址
; 标准FAT12格式软盘专用的代码 Stand FAT12 format floppy code
JMP entry
DB 0xeb, 0x4e, 0x90
DB "HELLOIPL" ; 启动扇区名称8字节
DW 512 ; 每个扇区sector大小必须512字节
DB 1 ; 簇cluster大小必须为1个扇区
DW 1 ; FAT起始位置一般为第一个扇区
DB 2 ; FAT个数必须为2
DW 224 ; 根目录大小一般为224项
DW 2880 ; 该磁盘大小必须为2880扇区1440*1024/512
DB 0xf0 ; 磁盘类型必须为0xf0
DW 9 ; FAT的长度必??9扇区
DW 18 ; 一个磁道track有几个扇区必须为18
DW 2 ; 磁头数(必??2
DD 0 ; 不使用分区必须是0
DD 2880 ; 重写一次磁盘大小
DB 0,0,0x29 ; 意义不明(固定)
DD 0xffffffff ; (可能是)卷标号码
DB "HELLO-OS " ; 磁盘的名称必须为11字?,不足填空格)
DB "FAT12 " ; 磁盘格式名称(必??8字?,不足填空格)
RESB 18 ; 先空出18字节
; 程序主体
entry:
MOV AX,0 ; 初始化寄存器
MOV SS,AX
MOV SP,0x7c00
MOV DS,AX
MOV ES,AX
MOV SI,msg
putloop:
MOV AL,[SI]
ADD SI,1 ; 给SI加1
CMP AL,0
JE fin
MOV AH,0x0e ; 显示一个文字
MOV BX,15 ; 指定字符颜色
INT 0x10 ; 调用显卡BIOS
JMP putloop
fin:
HLT ; 让CPU停止等待指令
JMP fin ; 无限循环
msg:
DB 0x0a, 0x0a ; 换行两次
DB "hello, world"
DB 0x0a ; 换行
DB 0
RESB 0x7dfe-$ ; 填写0x00直到0x001fe
DB 0x55, 0xaa

1
02_day/make.bat Normal file
View File

@@ -0,0 +1 @@
..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9

10
README.md Normal file
View File

@@ -0,0 +1,10 @@
30dayMakeOS
===========
《30天自制操作系统》源码中文版。自己制作一个操作系统的过程
阅读过程会一边汉化源码,一边执行还有根据一些相关的内容进行代码的书写,欢迎大家交流。
运行方法在“tolset”中新建一个run文件夹把代码拷贝进去然后根据系统版本运行!cons_**.bat。
命令跟进每天的内容会有不同,接下来会写博客跟进,也可以直接看书。