From 47e691cb0b7a49a797c622b6c79162428358fbe1 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 19 Jun 2018 00:54:43 -0400 Subject: Implement builtin terminal commands * Reboot * Exit * Echo --- builtin_reboot.asm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 builtin_reboot.asm (limited to 'builtin_reboot.asm') 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 -- cgit