summaryrefslogtreecommitdiff
path: root/builtin_reboot.asm
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2018-06-19 00:54:43 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2018-06-19 00:54:43 -0400
commit47e691cb0b7a49a797c622b6c79162428358fbe1 (patch)
tree11cbfcd397d92567953507a0f8482d269bd299d6 /builtin_reboot.asm
parent16ce91dac78f9a522d6b5a5f4b0f651e25635a4f (diff)
downloadminos-47e691cb0b7a49a797c622b6c79162428358fbe1.tar.gz
Implement builtin terminal commands
* Reboot * Exit * Echo
Diffstat (limited to 'builtin_reboot.asm')
-rw-r--r--builtin_reboot.asm29
1 files changed, 29 insertions, 0 deletions
diff --git a/builtin_reboot.asm b/builtin_reboot.asm
new file mode 100644
index 0000000..54d6f8a
--- /dev/null
+++ b/builtin_reboot.asm
@@ -0,0 +1,29 @@
+%ifndef _BUILTIN_REBOOT_ASM
+%define _BUILTIN_REBOOT_ASM
+
+builtin_reboot:
+ mov bx, 3 ; number of seconds
+ .countdown:
+ push bx
+ push .msg_reboot_count
+ call printf
+ add sp, 2 * 2
+
+ mov ah, 86h
+ mov cx, 0fh
+ mov dx, 4240h
+ int 15h
+
+ dec bx
+ jne .countdown
+
+ push .msg_reboot
+ call printf
+ add sp, 2 * 1
+
+ jmp 0FFFFh:0000h ; issue reboot
+ .msg_reboot_count db 'rebooting in %d seconds...\r', 0
+ .msg_reboot db '\nreboot...\n', 0
+ ; no return, and the stack is irrelevant here
+
+%endif