1
1
Fork 0

Printing stuff to screen

This commit is contained in:
Lauren Toivanen 2023-06-13 09:45:04 +03:00
parent f30433dd27
commit aaffd2351f
Signed by: jt
GPG key ID: 9151B109B73ECAD5
5 changed files with 180 additions and 37 deletions

View file

@ -1,12 +1,6 @@
; Tutorial: A small kernel with Fasm & TCC
; By Tommy.
format elf
use32
;
; Equates
;
format elf
use32
MULTIBOOT_PAGE_ALIGN equ (1 shl 0)
MULTIBOOT_MEMORY_INFO equ (1 shl 1)
MULTIBOOT_AOUT_KLUDGE equ (1 shl 16)
@ -14,30 +8,49 @@ MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN or MULTIBOOT_MEMORY_INFO
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
;
; Multiboot header
;
.multiboot: align 4
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
section '.bss' writable align 16
stack_bottom:
rb 16384
stack_top:
section '.text' executable
;
; Kernel entry point.
;
public _start
extrn kmain
section '.text' executable
public _start
extrn kmain
disable_cursor:
pushf
push eax
push edx
mov dx, 0x3D4
mov al, 0xA ; low cursor shape register
out dx, al
inc dx
mov al, 0x20 ; bits 6-7 unused, bit 5 disables the cursor, bits 0-4 control the cursor shape
out dx, al
pop edx
pop eax
popf
ret
_start:
; Call the main kernel function.
call kmain
; Setup stack
;mov esp, stack_top
; Call the main kernel function.
call disable_cursor
call kmain
@@:
jmp @b
cli
hlt
jmp @b