From 5641fc69879a366c7fa46e81a78f5fc44aa1b335 Mon Sep 17 00:00:00 2001 From: jn Date: Mon, 30 Jan 2023 01:04:01 +0100 Subject: [PATCH] sh: Add shutdown command --- applications/sh/commands/commands.asm | 6 ++++++ applications/sh/commands/help.asm | 1 + applications/sh/commands/shutdown.asm | 7 +++++++ 3 files changed, 14 insertions(+) create mode 100644 applications/sh/commands/shutdown.asm diff --git a/applications/sh/commands/commands.asm b/applications/sh/commands/commands.asm index 8f6031a..4c8434d 100644 --- a/applications/sh/commands/commands.asm +++ b/applications/sh/commands/commands.asm @@ -33,6 +33,11 @@ shell_parse_command: call compare_string ifz jmp shell_help_command + ; shutdown + mov r1, shell_shutdown_command_string + call compare_string + ifz jmp shell_shutdown_command + ; type mov r1, shell_type_command_string call compare_string @@ -57,3 +62,4 @@ shell_invalid_command_string: data.str "invalid command or FXF binary" data.8 10 #include "commands/exit.asm" #include "commands/help.asm" #include "commands/type.asm" + #include "commands/shutdown.asm" diff --git a/applications/sh/commands/help.asm b/applications/sh/commands/help.asm index 2cd8f63..223b1dd 100644 --- a/applications/sh/commands/help.asm +++ b/applications/sh/commands/help.asm @@ -21,6 +21,7 @@ shell_help_text: data.str "exit | exit the shell" data.8 10 data.str "help | show this help text" data.8 10 data.str "type | print file $0 of type $1" data.8 10 + data.str "shutdown| turn the computer off" data.8 10 data.8 10 data.str "type the name of an FXF binary to launch" data.8 10 data.str "it as a new task; the shell will suspend" data.8 10 diff --git a/applications/sh/commands/shutdown.asm b/applications/sh/commands/shutdown.asm new file mode 100644 index 0000000..c796c2d --- /dev/null +++ b/applications/sh/commands/shutdown.asm @@ -0,0 +1,7 @@ +; shutdown command + +shell_shutdown_command_string: data.str "shutdown" data.8 0 + +shell_shutdown_command: + call poweroff + ret