112 lines
1.6 KiB
NASM
112 lines
1.6 KiB
NASM
os_start_cli:
|
|
pusha
|
|
|
|
call os_print_newline
|
|
|
|
mov si, prompt
|
|
call os_print_string
|
|
|
|
mov bx, 20
|
|
|
|
mov ax, user_input
|
|
|
|
call keyboard_display_input
|
|
jmp os_read_cli
|
|
|
|
|
|
; ------------------------------------------------
|
|
|
|
os_read_cli:
|
|
pusha
|
|
mov ax, user_input
|
|
call string_upper_case ; Make the input uppercase so it's case insensitive
|
|
|
|
.output_the_user_input:
|
|
call os_print_newline
|
|
|
|
.check_matches: ; Check if the user input matches any internal commands
|
|
; Help
|
|
mov si, user_input
|
|
mov di, help_string
|
|
call os_compare_strings
|
|
cmp cl, 1
|
|
je .help
|
|
|
|
; Clear screen
|
|
mov si, user_input
|
|
mov di, clear_string
|
|
call os_compare_strings
|
|
cmp cl, 1
|
|
je .clear
|
|
|
|
; Reboot
|
|
mov si, user_input
|
|
mov di, reboot_string
|
|
call os_compare_strings
|
|
cmp cl, 1
|
|
je power_reboot
|
|
|
|
; Basic
|
|
mov si, user_input
|
|
mov di, basic_string
|
|
call os_compare_strings
|
|
cmp cl, 1
|
|
je .basic
|
|
|
|
; Cat
|
|
mov si, user_input
|
|
mov di, cat_string
|
|
call os_compare_strings
|
|
cmp cl, 1
|
|
je .cat
|
|
|
|
; LS
|
|
mov si, user_input
|
|
mov di, ls_string
|
|
call os_compare_strings
|
|
cmp cl, 1
|
|
je .ls
|
|
|
|
; ED
|
|
mov si, user_input
|
|
mov di, ed_string
|
|
call os_compare_strings
|
|
cmp cl, 1
|
|
je .ed
|
|
|
|
jmp .unkown
|
|
|
|
.unkown:
|
|
mov si, unknown_command
|
|
call os_print_string
|
|
mov si, user_input
|
|
call os_print_string
|
|
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
|
|
call os_read_cli.finish
|
|
|
|
.basic:
|
|
call util_basic
|
|
call os_read_cli.finish
|
|
.cat:
|
|
call util_cat
|
|
call os_read_cli.finish
|
|
.ls:
|
|
call util_ls
|
|
call os_read_cli.finish
|
|
.ed:
|
|
call util_ed
|
|
call os_read_cli.finish
|
|
|