summaryrefslogtreecommitdiff
path: root/src/boot.asm
diff options
context:
space:
mode:
authorBenji Dial <Benji3.141@gmail.com>2020-08-11 11:33:21 -0400
committerBenji Dial <Benji3.141@gmail.com>2020-08-11 11:33:21 -0400
commit63167f223e1f54910f6b80e698390ee60aec79ee (patch)
tree41844f646bdcb5c9ba241bb5867c5e4f51737d52 /src/boot.asm
parent77d7a284c02bc6b1b3a3a92ad5d957172cee9b81 (diff)
downloadportland-os-63167f223e1f54910f6b80e698390ee60aec79ee.tar.gz
lots of progress
currently, BAR fields of IDE drives are all returning zero, and the ATA read function isn't working. i'm not sure why. i'm going to work on VESA next, and come back to the IDE driver later
Diffstat (limited to 'src/boot.asm')
-rw-r--r--src/boot.asm55
1 files changed, 51 insertions, 4 deletions
diff --git a/src/boot.asm b/src/boot.asm
index 8e463be..eb3b2c9 100644
--- a/src/boot.asm
+++ b/src/boot.asm
@@ -1,9 +1,17 @@
bits 16
org 0x7c3e
-kernel_sectors equ 16
+kernel_sectors equ 64
kernel_segment equ 0x3000
+support_flags equ 0x4000
+pci_hw_char equ 0x4001
+pci_ver equ 0x4002
+
+pci_support equ 0x80
+
+vesa_segment equ 0x0420
+
in al, 0x92
or al, 0x02
out 0x92, al
@@ -24,6 +32,31 @@ kernel_segment equ 0x3000
xor dh, dh
int 0x13
+ mov ax, 0xb101
+ int 0x1a
+
+ cmp edx, 0x20494350
+ jne no_pci
+
+ test ah, ah
+ jnz no_pci
+
+ mov byte [support_flags], pci_support
+ mov byte [pci_hw_char], al
+ mov word [pci_ver], bx
+
+no_pci:
+ mov dword [vesa_segment * 16], 'V' + 'B' * 256 + 'E' * 65535 + '2' * 16777216
+
+ mov ax, vesa_segment
+ mov es, ax
+ xor di, di
+ mov ax, 0x4f00
+ int 0x10
+
+ cmp ax, 0x004f
+ jne no_vbe
+
cli
lgdt [gdt]
@@ -34,6 +67,15 @@ kernel_segment equ 0x3000
jmp 0x08:pmode
+no_vbe:
+ ;TODO
+
+ cli
+
+real_halt:
+ hlt
+ jmp real_halt
+
bits 32
pmode:
@@ -49,14 +91,19 @@ halt:
hlt
jmp halt
+times $$ + 0x018a - $ db 0
+
+;0x7dc8
gdt:
dw .e - .t
dd .t
.t:
dq 0x0000_0000_0000_0000
- dq 0x00c0_9a00_0000_007f
- dq 0x00c0_9200_0000_00ff
+ dq 0x00c0_9a00_0000_0037
+ dq 0x00c1_9200_0000_ffff
+ dq 0x0000_0000_0000_0000;TODO: task
+ dq 0x0000_0000_0000_0000
+ dq 0x0000_0000_0000_0000
.e:
-times $$ + 448 - $ db 0
dw 0xaa55 \ No newline at end of file