aboutsummaryrefslogtreecommitdiffstats
path: root/src/boot/boot.stage2.print.asm
diff options
context:
space:
mode:
authorkotorifan <kotorifan05@gmail.com>2026-02-03 22:50:32 +0100
committerkotorifan <kotorifan05@gmail.com>2026-02-04 09:01:10 +0100
commit8a0ab6de92c0e2b4260d6a149c43c58d004d74d9 (patch)
treeb1bfdc5d119dd01e6c603ddcb40b922e672b6c24 /src/boot/boot.stage2.print.asm
parent7ce57a428f4c85771582c7f486c3553cacf80c15 (diff)
downloadkotori-os-8a0ab6de92c0e2b4260d6a149c43c58d004d74d9.tar.gz
Added common.asm
Diffstat (limited to 'src/boot/boot.stage2.print.asm')
-rw-r--r--src/boot/boot.stage2.print.asm39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/boot/boot.stage2.print.asm b/src/boot/boot.stage2.print.asm
new file mode 100644
index 0000000..d567d6d
--- /dev/null
+++ b/src/boot/boot.stage2.print.asm
@@ -0,0 +1,39 @@
+ ;; boot.stage2.print.asm
+
+ section .stage2
+
+ %define VGA_BUFFER 0xb8000
+ %define WB_COLOR 0xf
+
+
+_print_string_pm_vga:
+ mov eax, [esi]
+ lea esi, [esi+1]
+ cmp al, 0
+ jne .print_char_pm_vga
+ add byte [pos_x], 0
+ add byte [pos_y], 1
+ ret
+
+ .print_char_pm_vga:
+ mov ah, WB_COLOR ; White on black
+ mov ecx, eax
+ movzx eax, byte [pos_y]
+ mov edx, 160
+ mul edx
+ movzx ebx, byte [pos_x]
+ shl ebx, 1
+
+ mov edi, VGA_BUFFER ; Video memory start
+ add edi, ebx ; Add X offset
+ add edi, eax ; Add Y offset
+
+ mov eax, ecx ; Restore char
+ mov word [ds:edi], ax
+ add byte [pos_x], 1 ; Advance to right
+ ret
+
+pos_x: db 0
+pos_y: db 0
+
+