Set video mode

This commit is contained in:
notsomeidiot123 2024-10-14 13:35:45 -04:00
parent bba12fa97a
commit 738dc826b9
3 changed files with 12 additions and 29 deletions

View File

@ -300,6 +300,7 @@ times 1024-($-$$) db 0
part_2: part_2:
call get_mmap call get_mmap
call paging_en call paging_en
call set_video_mode
mov esi, 0 mov esi, 0
call cache_file_table call cache_file_table
mov edi, kernel_file mov edi, kernel_file
@ -311,7 +312,6 @@ part_2:
; debug ; debug
mov esi, kload_paddr mov esi, kload_paddr
call load_elf call load_elf
push eax push eax
cli cli
mov eax, page_table mov eax, page_table
@ -381,6 +381,10 @@ get_mmap:
mov ax, 1 mov ax, 1
ret ret
set_video_mode: set_video_mode:
mov ah, 0x0
mov al, 0x3
int 0x10
ret
paging_en: paging_en:
mov eax, cr4 mov eax, cr4
or eax, 0x00000010 ;enable 4mb pages or eax, 0x00000010 ;enable 4mb pages
@ -747,9 +751,9 @@ k_info:
.memory_map_count: dw 0 .memory_map_count: dw 0
.padding: db 0 .padding: db 0
.bpp: db 0;if depth == 0 then video is text mode .bpp: db 0;if depth == 0 then video is text mode
.xres: dw 0 .xres: dw 80
.yres: dw 0 .yres: dw 25
.framebuffer_ptr: dd 0 .framebuffer_ptr: dd 0xb8000
.loaded_modules: dd 0 .loaded_modules: dd 0
;loaded_modules points to a struct array containing a ptr to the entry point of each pre-loaded module to be executed during startup ;loaded_modules points to a struct array containing a ptr to the entry point of each pre-loaded module to be executed during startup
;module_struct: ;module_struct:

View File

@ -1,33 +1,10 @@
bits 32 bits 32
global _start global _start
extern kmain
section .text section .text
_start: _start:
mov ebx, 0xb8000 call kmain
mov esi, string
mov ecx, 0
mov ah, 0x8f
; mov ax, 0x55aaaa55
.lp:
lodsb
cmp al, 0
je .end
cmp al, 0xa
je .nl
cmp al, 0xd
je .cr
mov [ebx + ecx], ax
add ecx, 2
jmp .lp
.nl:
add ebx, 160
; mov word [ebx + ecx], 0xf41
jmp .lp
.cr:
xor ecx, ecx
jmp .lp
.end:
jmp $ jmp $
section .data section .data

View File

@ -1,3 +1,5 @@
void kmain(){ void kmain(){
unsigned short *tm_ptr = (unsigned short*)(0xb8000);
tm_ptr[0] = 0xf41;
return; return;
} }