blob: fe2d829199e42d8c5d959da8a6e29b35170738ed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/* needs to stay the first line */
asm(".code16gcc\njmp $0, $main");
/* space for additional code */
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
// clang-format off
asm volatile(
"int $0x10;"
::"a"(command)
);
// clang-format on
}
char WRITE_STRING = 0x13;
void print(char const * const str) {
for(int i = 0; str[i] != '\0'; ++i ) {
put(str[i]);
}
}
void main(void) {
print("Hello!");
}
|