summaryrefslogtreecommitdiff
path: root/boot/arch/amd64/mbr
diff options
context:
space:
mode:
authorChloe M. <chloe@aptel.org>2026-08-20 07:16:51 +0000
committerChloe M. <chloe@aptel.org>2026-08-20 07:22:52 +0000
commitf361ec5264f8b2655b76d7f69f25fd9c9957f530 (patch)
tree91b0b176ae6832689e0136f7570fcb0dd69e93f2 /boot/arch/amd64/mbr
parent6d606dbd3d39e7a1dc1315822f8b8e57f9e44992 (diff)
boot/amd64: mbr: Add some feedback via serial out
Signed-off-by: Chloe M. <chloe@aptel.org>
Diffstat (limited to 'boot/arch/amd64/mbr')
-rw-r--r--boot/arch/amd64/mbr/mbr.S32
1 files changed, 32 insertions, 0 deletions
diff --git a/boot/arch/amd64/mbr/mbr.S b/boot/arch/amd64/mbr/mbr.S
index fa33707..a548ce7 100644
--- a/boot/arch/amd64/mbr/mbr.S
+++ b/boot/arch/amd64/mbr/mbr.S
@@ -35,11 +35,43 @@ reloc:
/* Set our stack */
mov $0x7C00, %sp
+ /* Write out our boot string */
+ mov $boot_msg, %si
+ call putstr
+
cli
hlt
jmp reloc
+/*
+ * Write a string to the console
+ *
+ * %si: String to write
+ *
+ * XXX: Clobbers %AL
+ */
+putstr:
+ lodsb
+ or %al, %al
+ jz 1f
+ call putchr
+ jmp putstr
+1: ret
+
+/*
+ * Write a single character to the console
+ *
+ * %al: Character to write
+ */
+putchr:
+ push %dx
+ mov $0x3F8, %dx
+ out %al, %dx
+ pop %dx
+ ret
+
drive_num: .byte 0x00
+boot_msg: .ascii "booting\0"
.org 510
.byte 0x55