summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Zabka <zabkaste@hu-berlin.de>2020-04-29 15:14:21 +0200
committerStefan Zabka <zabkaste@hu-berlin.de>2020-04-29 15:14:21 +0200
commit86a7c9a8de1d4fb4709f0f0c5e3f1d6f0be1f941 (patch)
tree578cd022bd3b1356df1006afc4446f94b15aa042
parenta132d3df55a39ae12507ee09c3acb79982dd7c91 (diff)
downloadbetriebssysteme-86a7c9a8de1d4fb4709f0f0c5e3f1d6f0be1f941.tar.gz
betriebssysteme-86a7c9a8de1d4fb4709f0f0c5e3f1d6f0be1f941.zip
Wrote put()
-rw-r--r--01_exercise/bootloader.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/01_exercise/bootloader.c b/01_exercise/bootloader.c
index 0260c82..850250d 100644
--- a/01_exercise/bootloader.c
+++ b/01_exercise/bootloader.c
@@ -3,21 +3,21 @@ asm(".code16gcc\njmp $0, $main");
/* space for additional code */
-void main(void)
-{
- asm(
- "mov $0x007, %%ebx;"
- "mov $0xE4E, %%eax; int $0x10;"
- "mov $0xE69, %%eax; int $0x10;"
- "mov $0xE63, %%eax; int $0x10;"
- "mov $0xE65, %%eax; int $0x10;"
- "mov $0xE20, %%eax; int $0x10;"
- "mov $0xE42, %%eax; int $0x10;"
- "mov $0xE6F, %%eax; int $0x10;"
- "mov $0xE6F, %%eax; int $0x10;"
- "mov $0xE74, %%eax; int $0x10;"
- "mov $0xE73, %%eax; int $0x10;"
- "jmp .;"
- ::: "eax", "ebx"
+char WRITE_CHARACTER_TTY = 0x0E;
+void put(char c) {
+ short command = WRITE_CHARACTER_TTY << 8 | c;
+ // volatile because there is no output, so the function might get optimized away
+ asm volatile("int $0x10;"
+ :: "a"(command)
);
}
+
+
+void main(void)
+{
+ put('h');
+ put('e');
+ put('l');
+ put('l');
+ put('o');
+}