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:
90
source/kernel/features/cli.asm
Executable file
90
source/kernel/features/cli.asm
Executable file
@@ -0,0 +1,90 @@
|
||||
os_start_cli:
|
||||
pusha
|
||||
|
||||
call os_print_newline
|
||||
|
||||
mov si, prompt
|
||||
call os_print_string
|
||||
|
||||
mov ax, 20
|
||||
|
||||
mov di, user_input
|
||||
|
||||
call os_display_input
|
||||
|
||||
|
||||
; ------------------------------------------------
|
||||
|
||||
os_read_cli:
|
||||
pusha
|
||||
|
||||
.output_the_user_input:
|
||||
call os_print_newline
|
||||
|
||||
.check_matches: ; Check if the user input matches any internal commands
|
||||
mov si, user_input
|
||||
mov di, help_string
|
||||
call os_compare_strings
|
||||
cmp cl, 1
|
||||
je help
|
||||
|
||||
mov si, user_input
|
||||
mov di, clear_string
|
||||
call os_compare_strings
|
||||
cmp cl, 1
|
||||
je clear
|
||||
|
||||
mov si, user_input
|
||||
mov di, pong_string
|
||||
call os_compare_strings
|
||||
cmp cl, 1
|
||||
je pong
|
||||
|
||||
mov si, user_input
|
||||
mov di, snake_string
|
||||
call os_compare_strings
|
||||
cmp cl, 1
|
||||
je snake
|
||||
|
||||
jmp .unkown
|
||||
|
||||
.unkown:
|
||||
mov si, unknown_command
|
||||
call os_print_string
|
||||
mov si, user_input
|
||||
call os_print_string_nl
|
||||
jmp .finish
|
||||
|
||||
.finish:
|
||||
popa
|
||||
call os_start_cli
|
||||
|
||||
clear:
|
||||
call os_set_text_mode
|
||||
call os_read_cli.finish
|
||||
|
||||
help:
|
||||
mov si, help_text
|
||||
call os_print_string_nl
|
||||
call os_read_cli.finish
|
||||
|
||||
pong:
|
||||
call game_pong
|
||||
call os_read_cli.finish
|
||||
|
||||
snake:
|
||||
call game_snake
|
||||
call os_read_cli.finish
|
||||
|
||||
section .data
|
||||
welcome_text db 'Welcome to CrawOS, the Cool, Real and AWsome Operating System', 0
|
||||
user_input times 20 db 0
|
||||
prompt_length db 20
|
||||
prompt db 'CrawOS sh> ', 0
|
||||
help_string db 'HELP', 0
|
||||
clear_string db 'CLEAR', 0
|
||||
pong_string db 'PONG', 0
|
||||
snake_string db 'SNAKE', 0
|
||||
help_text db 'This is for Cowards: "HELP" for this help text, "CLEAR" to clear the screen, esc to reboot', 0
|
||||
command_result_text db 'You typed: ', 0
|
||||
unknown_command db 'Error: Unkown Command.. ', 0
|
||||
Reference in New Issue
Block a user