diff options
| author | kotorifan <kotorifan05@gmail.com> | 2026-03-07 17:14:14 +0100 |
|---|---|---|
| committer | kotorifan <kotorifan05@gmail.com> | 2026-03-07 17:14:14 +0100 |
| commit | f81dee10ef19f0c82eb89d0e528bcbfb7a38b016 (patch) | |
| tree | 32e733d4ad2471419bdc9e1dd112d1d6a5b90958 /src/boot/boot.stage2.print.asm | |
| parent | 857f2d6fe4a77a485d9ed46c0c80eecf61142607 (diff) | |
| download | kotori-os-f81dee10ef19f0c82eb89d0e528bcbfb7a38b016.tar.gz | |
Kernel loads now, bootloader works kind of
Diffstat (limited to 'src/boot/boot.stage2.print.asm')
| -rw-r--r-- | src/boot/boot.stage2.print.asm | 54 |
1 files changed, 26 insertions, 28 deletions
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 |
