32 lines
499 B
C
32 lines
499 B
C
#include "hedley.h"
|
|
|
|
HEDLEY_ALWAYS_INLINE void putchar(char);
|
|
HEDLEY_ALWAYS_INLINE void write(char*);
|
|
|
|
void _start(void) {
|
|
__asm__ volatile (
|
|
"movl $0x8000, %esp\n"
|
|
"ljmp $(0),$(start)\n"
|
|
"start:\n"
|
|
);
|
|
write("Hello World!\r\n\0");
|
|
while(1)
|
|
;
|
|
}
|
|
|
|
HEDLEY_ALWAYS_INLINE void write(char *out) {
|
|
for (char *i = out; *i != 0; i++)
|
|
putchar(*i);
|
|
}
|
|
|
|
HEDLEY_ALWAYS_INLINE void putchar(char out) {
|
|
__asm__ volatile (
|
|
"movb $0x0e, %%ah;"
|
|
"movb %0, %%al;"
|
|
"int $0x10;"
|
|
:
|
|
:"r"(out)
|
|
:"%ax"
|
|
);
|
|
}
|