From a9f36c6c7c31387385e474aae54311dfe949590a Mon Sep 17 00:00:00 2001 From: Yourtion Date: Thu, 4 Sep 2014 15:39:40 +0800 Subject: [PATCH] Add day1 code --- 01_day/!cons_9x.bat | 1 + 01_day/!cons_nt.bat | 1 + 01_day/asm.bat | 1 + 01_day/helloos.nas | 50 +++++++++++++++++++++++++++++++++++++++++++++ 01_day/install.bat | 1 + 01_day/run.bat | 2 ++ 6 files changed, 56 insertions(+) create mode 100644 01_day/!cons_9x.bat create mode 100644 01_day/!cons_nt.bat create mode 100644 01_day/asm.bat create mode 100644 01_day/helloos.nas create mode 100644 01_day/install.bat create mode 100644 01_day/run.bat diff --git a/01_day/!cons_9x.bat b/01_day/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/01_day/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/01_day/!cons_nt.bat b/01_day/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/01_day/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/01_day/asm.bat b/01_day/asm.bat new file mode 100644 index 0000000..906313d --- /dev/null +++ b/01_day/asm.bat @@ -0,0 +1 @@ +..\z_tools\nask.exe helloos.nas helloos.img \ No newline at end of file diff --git a/01_day/helloos.nas b/01_day/helloos.nas new file mode 100644 index 0000000..d44b3d1 --- /dev/null +++ b/01_day/helloos.nas @@ -0,0 +1,50 @@ +; hello-os +; TAB=4 + +; Stand FAT12 format floppy code ?准FAT12格式???用代? + + DB 0xeb, 0x4e, 0x90 + DB "HELLOIPL" ; ブートセクタの名前を自由に書いてよい(8バイト) + DW 512 ; 1セクタの大きさ(512にしなければいけない) + DB 1 ; クラスタの大きさ(1セクタにしなければいけない) + DW 1 ; FATがどこから始まるか(普通は1セクタ目からにする) + DB 2 ; FATの個数(2にしなければいけない) + DW 224 ; ルートディレクトリ領域の大きさ(普通は224エントリにする) + DW 2880 ; このドライブの大きさ(2880セクタにしなければいけない) + DB 0xf0 ; メディアのタイプ(0xf0にしなければいけない) + DW 9 ; FAT領域の長さ(9セクタにしなければいけない) + DW 18 ; 1トラックにいくつのセクタがあるか(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バイトあけておく + +; プログラム本体 + + DB 0xb8, 0x00, 0x00, 0x8e, 0xd0, 0xbc, 0x00, 0x7c + DB 0x8e, 0xd8, 0x8e, 0xc0, 0xbe, 0x74, 0x7c, 0x8a + DB 0x04, 0x83, 0xc6, 0x01, 0x3c, 0x00, 0x74, 0x09 + DB 0xb4, 0x0e, 0xbb, 0x0f, 0x00, 0xcd, 0x10, 0xeb + DB 0xee, 0xf4, 0xeb, 0xfd + +; メッセージ部分 + + DB 0x0a, 0x0a ; 改行を2つ + DB "hello, world" + DB 0x0a ; 改行 + DB 0 + + RESB 0x1fe-$ ; 0x001feまでを0x00で埋める命令 + + DB 0x55, 0xaa + +; 以下はブートセクタ以外の部分の記述 + + DB 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 + RESB 4600 + DB 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 + RESB 1469432 diff --git a/01_day/install.bat b/01_day/install.bat new file mode 100644 index 0000000..bae51c8 --- /dev/null +++ b/01_day/install.bat @@ -0,0 +1 @@ +..\z_tools\imgtol.com w a: helloos.img \ No newline at end of file diff --git a/01_day/run.bat b/01_day/run.bat new file mode 100644 index 0000000..8870588 --- /dev/null +++ b/01_day/run.bat @@ -0,0 +1,2 @@ +copy helloos.img ..\z_tools\qemu\fdimage0.bin +..\z_tools\make.exe -C ../z_tools/qemu \ No newline at end of file