bootsector_c/boot.c

32 lines
499 B
C
Raw Permalink Normal View History

2024-10-20 11:53:40 +00:00
#include "hedley.h"
HEDLEY_ALWAYS_INLINE void putchar(char);
HEDLEY_ALWAYS_INLINE void write(char*);
2024-10-19 17:09:19 +00:00
void _start(void) {
__asm__ volatile (
"movl $0x8000, %esp\n"
"ljmp $(0),$(start)\n"
"start:\n"
);
2024-10-19 17:09:19 +00:00
write("Hello World!\r\n\0");
while(1)
;
}
2024-10-20 11:53:40 +00:00
HEDLEY_ALWAYS_INLINE void write(char *out) {
2024-10-19 17:09:19 +00:00
for (char *i = out; *i != 0; i++)
putchar(*i);
}
2024-10-20 11:53:40 +00:00
HEDLEY_ALWAYS_INLINE void putchar(char out) {
2024-10-19 17:09:19 +00:00
__asm__ volatile (
"movb $0x0e, %%ah;"
"movb %0, %%al;"
"int $0x10;"
:
:"r"(out)
:"%ax"
);
}