From f81dee10ef19f0c82eb89d0e528bcbfb7a38b016 Mon Sep 17 00:00:00 2001 From: kotorifan Date: Sat, 7 Mar 2026 17:14:14 +0100 Subject: Kernel loads now, bootloader works kind of --- src/boot/boot.stage2.print.asm | 54 ++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'src/boot/boot.stage2.print.asm') diff --git a/src/boot/boot.stage2.print.asm b/src/boot/boot.stage2.print.asm index d567d6d..4527b87 100644 --- a/src/boot/boot.stage2.print.asm +++ b/src/boot/boot.stage2.print.asm @@ -1,39 +1,37 @@ ;; 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 + pusha + mov edi, VGA_BUFFER + mov ah, WB_COLOR + xor ecx, ecx + xor edx, edx - .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 + .print_loop: + lodsb + test al, al + jz .done -pos_x: db 0 -pos_y: db 0 + push eax + mov eax, edx + imul eax, eax, 160 + lea edi, [VGA_BUFFER + eax] + lea edi, [edi + ecx * 2] + pop eax + ;; Advance cursor + inc cl + cmp cl, 80 + jb .print_loop + xor cl, cl + inc dl + + jmp .print_loop + .done: + popa + ret -- cgit v1.3