Added support for \n, \t and \\ in the string printing function

This commit is contained in:
2025-11-01 12:38:02 +00:00
parent 015d4d1fce
commit 7906c48a2e
8 changed files with 125 additions and 85 deletions

View File

@@ -23,36 +23,29 @@ os_read_cli:
.check_matches: ; Check if the user input matches any internal commands
; Help
mov di, user_input
mov si, help_string
mov si, user_input
mov di, help_string
call os_compare_strings
cmp cl, 1
je help
; Clear screen
mov di, user_input
mov si, clear_string
mov si, user_input
mov di, clear_string
call os_compare_strings
cmp cl, 1
je clear
; Reboot
mov di, user_input
mov si, reboot_string
mov si, user_input
mov di, reboot_string
call os_compare_strings
cmp cl, 1
je os_reboot
; Reboot
mov di, user_input
mov si, cat_string
call os_compare_strings
cmp cl, 1
je cat
je power_reboot
; Pong
mov di, user_input
mov si, pong_string
mov si, user_input
mov di, pong_string
call os_compare_strings
cmp cl, 1
je pong
@@ -63,7 +56,7 @@ os_read_cli:
mov si, unknown_command
call os_print_string
mov si, user_input
call os_print_string_nl
call os_print_string
jmp .finish
.finish:
@@ -76,19 +69,15 @@ clear:
help:
mov si, help_text
call os_print_string_nl
call os_print_string
call os_read_cli.finish
cat:
call util_cat
call os_read_cli.finish
pong:
call game_pong
call os_read_cli.finish
section .data
welcome_text db 'Welcome to CrawOS, the Cool, Real and AWsome Operating System', 0
welcome_text db 'Welcome to CrawOS, the Cwick, Real and AWsome Operating System\n', 0
user_input times 20 db 0
prompt_length db 20
prompt db 'CrawOS sh> ', 0
@@ -97,6 +86,6 @@ section .data
reboot_string db 'REBOOT', 0
cat_string db 'CAT', 0
pong_string db 'PONG', 0
help_text db 'This is for Cowards: "HELP" for this help text, "CLEAR" to clear the screen, esc or "REBOOT" to reboot', 0
help_text db 'This is for Cowards:\n"HELP" for this helpful text,\n"CLEAR" to clear the screen,\n"REBOOT" or esc to reboot\n', 0
command_result_text db 'You typed: ', 0
unknown_command db 'Error: Unkown Command.. ', 0
unknown_command db 'Error: Unkown Command.. \n', 0