summaryrefslogtreecommitdiff
path: root/stage1/entry.S
diff options
context:
space:
mode:
Diffstat (limited to 'stage1/entry.S')
-rw-r--r--stage1/entry.S56
1 files changed, 56 insertions, 0 deletions
diff --git a/stage1/entry.S b/stage1/entry.S
new file mode 100644
index 0000000..81390d9
--- /dev/null
+++ b/stage1/entry.S
@@ -0,0 +1,56 @@
+.intel_syntax noprefix
+
+.section .mbr, "ax"
+
+.extern _stack_start
+.extern _stack_end
+.extern centry
+
+.global _start
+.code16
+
+_start:
+ xor ax, ax
+ mov ds, ax
+ jmp 0x0:_entry
+
+_entry:
+ mov ah, 0x42
+ mov si, offset dap
+
+ int 0x13
+
+ jc error
+
+ mov ah, 0x0E
+ mov al, 'S'
+ mov bh, 0x0
+ mov bl, 0x0
+
+ int 0x10
+
+ jmp 0x0:stage1_sector
+
+ cli
+ hlt
+
+error:
+ mov ah, 0x0e
+ mov al, 'E'
+ mov bh, 0x0
+ mov bl, 0x0
+
+ int 0x10
+
+ cli
+ hlt
+
+.section .mbr_data, "aw"
+
+dap:
+ .byte 0x10
+ .byte 0
+ .word 14
+ .word 0x7e00
+ .word 0x0
+ .quad 1