DragonVM/extra/dss/DragonOS/kernel0.dss
2025-04-06 16:31:29 +02:00

70 lines
No EOL
2 KiB
Text

.load 0x2C00
.fixed 1024, 0xFF
.entry _kernel0_main
.header KERNEL0_BOOT
@include <../bios_api.dss>
@include <palette.dss>
@include <keyboard_driver.dss>
## =========================================================================================================================
.data
$textCell <Text16VModeCell>
$test_str "Hello DragonOS! :)"
## =========================================================================================================================
## =========================================================================================================================
.code
_kernel0_main:
push DefaultPalette.Black
push 1
call $_clear_screen
debug_break
push $test_str
push 1
call $_print_string
## Init Keyboard driver
push $_key_pressed ## KeyPressed handler address passed to the _init_keyboard subroutine
push 1
call $_init_keyboard
hlt
## =========================================================================================================================
## =========================================================================================================================
_print_string: ## _print_string(string* str)
arg R1 ## @Param: str
movb [$textCell.CoordX], 0
movb [$textCell.CoordY], 0
movb [$textCell.Foreground], DefaultPalette.Blue
movb [$textCell.Background], DefaultPalette.Black
mov R10, 0x22
mov R8, R1
mov R9, $textCell
int 0x30
ret
## =========================================================================================================================
## =========================================================================================================================
_clear_screen: ## _clear_screen(int8_t color)
arg R1
movb [$textCell.Foreground], R1
movb [$textCell.Background], R1
movb [$textCell.Character], 0x20
mov R10, 0x24
mov R9, $textCell
int 0x30
ret
## =========================================================================================================================