diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/common.asm | 2 | ||||
| -rw-r--r-- | src/common/common.protmode.clear.asm | 9 | ||||
| -rw-r--r-- | src/common/common.protmode.print.asm | 24 |
3 files changed, 23 insertions, 12 deletions
diff --git a/src/common/common.asm b/src/common/common.asm index a98ef67..87444db 100644 --- a/src/common/common.asm +++ b/src/common/common.asm @@ -13,7 +13,7 @@ %define VGA_COLOR_BLACK 0 %define VGA_COLOR_GREEN 2 %define VGA_COLOR_RED 4 -%define VGA_WHITE_ON_BLACK 0x0f20 +%define VGA_WHITE_ON_BLACK 0x0f %define VGA_BUFFER 0xb8000 %define VGA_SCREEN_X 80 %define VGA_SCREEN_Y 25 diff --git a/src/common/common.protmode.clear.asm b/src/common/common.protmode.clear.asm index 47cb980..8d26e2f 100644 --- a/src/common/common.protmode.clear.asm +++ b/src/common/common.protmode.clear.asm @@ -1,13 +1,18 @@ ;; common.protmode.print.asm +%ifndef COMMON_PROTMODE_CLEAR_ASM +%define COMMON_PROTMODE_CLEAR_ASM + %include "common.asm" _clear_screen: mov edi, VGA_BUFFER mov ecx, VGA_SCREEN - mov ax, VGA_WHITE_ON_BLACK + mov ax, 0x0f20 ; Empty char with white on black .clear: - mov [edi], eax + mov [edi], ax add edi, 2 loop .clear ret + +%endif diff --git a/src/common/common.protmode.print.asm b/src/common/common.protmode.print.asm index 5995e69..82ed3f4 100644 --- a/src/common/common.protmode.print.asm +++ b/src/common/common.protmode.print.asm @@ -1,11 +1,13 @@ ;; common.protmode.print.asm +%ifndef COMMON_PROTMODE_PRINT_ASM +%define COMMON_PROTMODE_PRINT_ASM %include "common.asm" _print_string_pm_vga: pusha mov edi, VGA_BUFFER - mov ah, WB_COLOR + mov ah, VGA_WHITE_ON_BLACK xor ecx, ecx xor edx, edx @@ -14,22 +16,26 @@ _print_string_pm_vga: test al, al jz .done - push eax - mov eax, edx - imul eax, eax, 160 - lea edi, [VGA_BUFFER + eax] - lea edi, [edi + ecx * 2] - pop eax + mov ebx, edx + imul ebx, ebx, 160 + lea ebx, [VGA_BUFFER + ebx + ecx * 2] + + mov ah, VGA_WHITE_ON_BLACK + mov [ebx], ax ;; Advance cursor inc cl - cmp cl, 80 - jb .print_loop + cmp cl, 80 ; Check if screen is full X pos + jne .print_loop xor cl, cl inc dl + cmp dl, 25 + jb .print_loop ; Check if screen is full Y pos jmp .print_loop .done: popa ret + +%endif |
