Moved stuff around and added a makefile also got a custom bootloader
based on the JazzOS bootloader (modified a bit)
This commit is contained in:
70
source/kernel/features/text.asm
Executable file
70
source/kernel/features/text.asm
Executable file
@@ -0,0 +1,70 @@
|
||||
; SI = pointer to start of string to be printed
|
||||
os_print_string:
|
||||
pusha
|
||||
|
||||
mov ah, 0Eh ; int 10h teletype function, we're telling the BIOS we will print something
|
||||
|
||||
.repeat:
|
||||
lodsb ; Get char from si into al
|
||||
cmp al, 0 ; Compare al to 0
|
||||
je .done ; If char is zero, end of string
|
||||
|
||||
int 10h ; Otherwise, print it
|
||||
jmp .repeat ; And move on to next char
|
||||
|
||||
.done:
|
||||
popa
|
||||
ret
|
||||
|
||||
; Exact same as the above procedure, but this adds a newline
|
||||
; after priting, similar to the difference between Rust's print! and println!
|
||||
os_print_string_nl:
|
||||
pusha
|
||||
|
||||
mov ah, 0Eh ; int 10h teletype function, we're telling the BIOS we will print something
|
||||
|
||||
.repeat:
|
||||
lodsb ; Get char from si into al
|
||||
cmp al, 0 ; Compare al to 0
|
||||
je .done ; If char is zero, end of string
|
||||
|
||||
int 10h ; Otherwise, print it
|
||||
jmp .repeat ; And move on to next char
|
||||
|
||||
.done:
|
||||
call os_print_newline
|
||||
popa
|
||||
ret
|
||||
|
||||
; --------------------------------------------
|
||||
|
||||
os_print_newline:
|
||||
pusha
|
||||
|
||||
mov ah, 0Eh
|
||||
mov al, 13
|
||||
int 10h
|
||||
mov al, 10
|
||||
int 10h
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
; -------------------------------------------
|
||||
|
||||
os_set_text_mode:
|
||||
pusha
|
||||
; Set mode = 80x25 (text mode)
|
||||
mov ah, 00h
|
||||
mov al, 03h
|
||||
int 10h
|
||||
|
||||
; Move cursor to the top left
|
||||
mov ah, 02h
|
||||
mov dh, 0
|
||||
mov dl, 0
|
||||
int 10h
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user