From 247a79f26485eaa062f1cdd4545a3bfe6cd6ca81 Mon Sep 17 00:00:00 2001 From: Niklas Halle Date: Tue, 5 May 2020 16:23:02 +0200 Subject: sleep --- 01_exercise/bootloader.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/01_exercise/bootloader.c b/01_exercise/bootloader.c index 1ba5786..e891116 100644 --- a/01_exercise/bootloader.c +++ b/01_exercise/bootloader.c @@ -33,7 +33,20 @@ char getc() { return ret; } +void sleep(short ms) { + long ys = ms * 1000; + short cx = ys >> 16; + short dx = ys; + + // http://www.ctyme.com/intr/rb-1525.htm : Int 15/AH=86h bios wait + char ah = 0x86; + char al = 0x00; + short command = ah << 8 | al; + + asm volatile("int $0x15;" : : "a"(command), "cx"(cx), "dx"(dx)); +} + void main(void) { print("Hello!"); - put(getc()); -} + print("\n\r > "); +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf