diff options
author | Benji Dial <benji3.141@gmail.com> | 2020-05-16 13:25:46 -0400 |
---|---|---|
committer | Benji Dial <benji3.141@gmail.com> | 2020-05-16 13:25:46 -0400 |
commit | 53801b9baed096e57b40df6147d9ff0f3da0c737 (patch) | |
tree | 4d1987c277cc02b53ff06ee756f67f85b62d1acc /src/boot.asm | |
parent | c0daede46df4f546639bd2d3e11dcf064d554966 (diff) | |
download | portland-os-53801b9baed096e57b40df6147d9ff0f3da0c737.tar.gz |
Hello world
Diffstat (limited to 'src/boot.asm')
-rw-r--r-- | src/boot.asm | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/boot.asm b/src/boot.asm new file mode 100644 index 0000000..b476581 --- /dev/null +++ b/src/boot.asm @@ -0,0 +1,55 @@ +bits 16 +org 0x7c3e + +kernel_sectors equ 16 +kernel_segment equ 0x3000 + + in al, 0x92 + or al, 0x02 + out 0x92, al + + xor ax, ax + mov ss, ax + mov sp, 0x7ffc + + mov ax, kernel_segment + mov es, ax + mov ax, 0x0200 + kernel_sectors + xor bx, bx + mov cx, 0x0002 + xor dh, dh + int 0x13 + + cli + + lgdt [gdt] + + mov eax, cr0 + or al, 0x01 + mov cr0, eax + + jmp 0x08:pmode + +bits 32 + +pmode: + mov ax, 0x10 + mov ds, ax + mov ax, 0x18 + mov ss, ax + mov sp, 0x7ffc + + jmp kernel_segment * 16 + +gdt: + dw .e - .t + dd .t +.t: + dq 0x0000_0000_0000_0000 + dq 0x00c0_9a00_0000_007f + dq 0x00c0_9200_0000_007f + dq 0x0040_9203_8000_7fff +.e: + +times $$ + 448 - $ db 0 +dw 0xaa55
\ No newline at end of file |