diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | stage3/colors.asm | 16 | ||||
-rw-r--r-- | stage3/framebuffer.asm | 176 | ||||
-rw-r--r-- | stage3/main.c | 3 | ||||
-rw-r--r-- | stage3/paging.asm | 20 |
5 files changed, 9 insertions, 207 deletions
@@ -19,7 +19,6 @@ STAGE3 = \ stage3/halt.o \ stage3/interrupts.o \ stage3/isr.o \ - stage3/framebuffer.o \ stage3/memory.o \ stage3/paging.o \ stage3/heap.o \ diff --git a/stage3/colors.asm b/stage3/colors.asm deleted file mode 100644 index a53efff..0000000 --- a/stage3/colors.asm +++ /dev/null @@ -1,16 +0,0 @@ -%define COLOR_BLACK 0 -%define COLOR_BLUE 1 -%define COLOR_GREEN 2 -%define COLOR_CYAN 3 -%define COLOR_RED 4 -%define COLOR_MAGENTA 5 -%define COLOR_BROWN 6 -%define COLOR_LIGHT_GREY 7 -%define COLOR_DARK_GREY 8 -%define COLOR_LIGHT_BLUE 9 -%define COLOR_LIGHT_GREEN 10 -%define COLOR_LIGHT_CYAN 11 -%define COLOR_LIGHT_RED 12 -%define COLOR_LIGHT_MAGENTA 13 -%define COLOR_LIGHT_BROWN 14 -%define COLOR_WHITE 15 diff --git a/stage3/framebuffer.asm b/stage3/framebuffer.asm deleted file mode 100644 index e55ad04..0000000 --- a/stage3/framebuffer.asm +++ /dev/null @@ -1,176 +0,0 @@ -%include "stage3/colors.asm" -global print_chr, print_str, print_dec, print_hex, clear_screen, newline -extern memcpy - -section .data - -pos: -.row: db 0 -.col: db 0 - -cursor: dq 0xB8000 -color: db COLOR_WHITE | (COLOR_BLACK << 4) - -section .text - -set_color: - shl sil, 4 - add dil, sil - mov [color], dil - -update_cursor: - mov rbx, [cursor] - sub rbx, 0xB8000 - shr rbx, 1 - - mov dx, 0x3D4 - mov al, 14 - out dx, al - - mov dx, 0x3D5 - mov al, bh - out dx, al - - mov dx, 0x3D4 - mov al, 15 - out dx, al - - mov dx, 0x3D5 - mov al, bl - out dx, al - - ret - -set_chr: - mov rax, [cursor] - mov byte[rax], dil - inc rax - mov dil, [color] - mov [rax], dil - inc rax - mov [cursor], rax - jmp update_cursor - -vertical_tab: - mov al, [pos.row] - inc al - cmp al, 25 - je .scroll - mov [pos.row], al - mov rax, [cursor] - add rax, 160 - mov [cursor], rax - jmp update_cursor -.scroll: - mov rdi, 0xB8000 - mov rsi, 0xB80A0 - mov rdx, 0xF00 - jmp memcpy - -carriage_return: - mov rax, [cursor] - xor rbx, rbx - mov bl, [pos.col] - shl bl, 1 - sub rax, rbx - mov [cursor], rax - mov byte[pos.col], 0 - jmp update_cursor - -newline: - call vertical_tab - jmp carriage_return - -print_chr: - cmp dil, 10 - je newline - cmp dil, 11 - je vertical_tab - cmp dil, 13 - je carriage_return - mov al, [pos.col] - inc al - cmp al, 80 - je .newline - mov [pos.col], al - jmp set_chr -.newline: - push rdi - call newline - pop rdi - jmp set_chr - -print_str: - mov rax, rdi -.print: - mov dil, [rax] - cmp dil, 0 - je .return - push rax - call print_chr - pop rax - inc rax - jmp .print -.return: - ret - -print_hex: - mov rsi, 0x10 - jmp print_num -print_dec: - mov rsi, 10 -print_num: - mov rax, rdi - xor rcx, rcx -.convert: - inc rcx - xor rdx, rdx - div rsi - cmp dl, 10 - jb .digit - add dl, 'A'-10 - jmp .next -.digit: - add dl, '0' -.next: - push rdx - cmp rax, 0 - jne .convert -.print: - cmp rcx, 0 - je .return - dec rcx - pop rdi - push rcx - call print_chr - pop rcx - jmp .print -.return: - ret - -clear_screen: - push rbx - push r12 - push r13 - push r14 - push r15 - - mov qword[cursor], 0xB8000 -.clr: - cmp qword[cursor], 0xB8FA0 - je .return - mov dil, ' ' - call set_chr - jmp .clr -.return: - mov qword[cursor], 0xB8000 - mov byte[pos.row], 0 - mov byte[pos.col], 0 - call update_cursor - - pop r15 - pop r14 - pop r13 - pop r12 - pop rbx - ret diff --git a/stage3/main.c b/stage3/main.c index f87b0b3..9ddcacf 100644 --- a/stage3/main.c +++ b/stage3/main.c @@ -7,11 +7,8 @@ #include "letters.h" #include "interrupts.h" -void clear_screen(); // framebuffer.asm - void init() { - clear_screen(); letters_init(); heap_init(); diff --git a/stage3/paging.asm b/stage3/paging.asm index 8b1d571..783649e 100644 --- a/stage3/paging.asm +++ b/stage3/paging.asm @@ -1,6 +1,4 @@ global page_region -extern print_hex, print_chr, newline, print_dec, print_str - section .text pagebuf_init: @@ -87,12 +85,12 @@ alloc: push rdi mov rdi, .oom_msg - call print_str + ; call print_str pop rdi - call print_hex - call newline + ; call print_hex + ; call newline jmp $ @@ -163,7 +161,7 @@ get_tables: space: mov dil, ' ' - jmp print_chr + ; jmp print_chr page_region: push rbx @@ -182,15 +180,15 @@ page_region: mov rax, 1 << 63 or rdi, rax - call print_hex - call space + ; call print_hex + ; call space mov rdi, [r9+8] add rdi, [rsp] or rdi, rax - call print_hex - call newline + ; call print_hex + ; call newline pop rdi @@ -318,7 +316,7 @@ page_region: .bruh: mov rdi, .bruh_msg - call print_str + ; call print_str jmp $ .bruh_msg: db "bruh why do you have more than 256TB of RAM (you fucking glow)", 10, 0 |