- Published on
Writing Your Own OS on Ubuntu, Day 2
- Authors

- Name
- Daisuke Kobayashi
- https://twitter.com
Recently I have been reading 30 Days OS from Scratch.
I use a laptop as my development environment and run Ubuntu inside VirtualBox.
The book mainly explains things in a Windows-centered way, but since I had the chance, I decided to do it on Ubuntu. These are my notes. I am using nasm. I know almost nothing about assembly, so I had quite a hard time starting from Chapter 2.
Notes:
DB "HELLO-OS "
DB "FAT12 "
The two lines above stop working if the number of spaces changes.
RESB 18 => TIMES 18 DB 0
RESB 0x7dfe-$ => 0x1fe-($-$$) DB 0
RESB 1469432 => TIMES 1469432 DB 0
After saving the following source code to a file:
qemu-system-i386 -fda helloos.img
; helloos.asm
ORG 0x7c00
JMP entry
DB 0x90
DB "HELLOIPL"
DW 512
DB 1
DW 1
DB 2
DW 224
DW 2880
DB 0xf0
DW 9
DW 18
DW 2
DD 0
DD 2880
DB 0, 0, 0x29
DD 0xffffffff
DB "HELLO-OS "
DB "FAT12 "
TIMES 18 DB 0
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
CMP AL,0
JE fin
MOV AH,0x0e
MOV BX,15
INT 0x10
JMP putloop
fin:
HLT
JMP fin
msg:
DB 0x0a, 0x0a
DB "hello, world"
DB 0x0a
DB 0
TIMES 0x1fe-($-$$) DB 0
DB 0x55, 0xaa
DB 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00
TIMES 4600 DB 0
DB 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00
TIMES 1469432 DB 0