问题描述
我在写的引导程序一个新手。我已经写在ASM一个HelloWorld引导装载程序和
现在我试图写一个在C.我已经用C写一个HelloWorld引导程序,但我不能编译。
这是我的code。我究竟做错了什么?我是不是采取错误的做法完全?
无效PRINT_CHAR();
诠释主要(无效){
字符* MSG =的Hello World!;
INT I;__asm __(
MOV%0 %% SI;
:
:G(MSG)
);
对于(i = 0; I< 12;我++){
__asm __(
MOV%0 %% AL;
:
:G(MSG [I])
);
PRINT_CHAR();
}返回0;
}无效PRINT_CHAR(){
__asm __(
MOV $ 0x0E的,AH%;
MOV $ 0×00,BH%;
MOV $ 0×04,BL%;
INT $为0x10
);
}
我建议你看看http://wiki.osdev.org/Rolling_Your_Own_Bootloader还的Bootloader的部分:http://www.brokenthorn.com/Resources/OSDevIndex.html
有出色的教程,让自己开始让自己自己的引导程序。你也可以加入#osdev通道Freenode的,如果你需要更多的信息来加入讨论。
I am a newbie in writing bootloaders. I have written a helloworld bootloader in asm, andI am now trying to write one in C. I have written a helloworld bootloader in C, but I cannot compile it.
This is my code. What am I doing wrong? Am I taking the wrong approach entirely?
void print_char();
int main(void){
char *MSG = "Hello World!";
int i;
__asm__(
"mov %0, %%SI;"
:
:"g"(MSG)
);
for(i=0;i<12;i++){
__asm__(
"mov %0, %%AL;"
:
:"g"(MSG[i])
);
print_char();
}
return 0;
}
void print_char(){
__asm__(
"mov $0X0E, %AH;"
"mov $0x00, %BH;"
"mov $0x04, %BL;"
"int $0x10"
);
}
I would suggest you to have a look at http://wiki.osdev.org/Rolling_Your_Own_Bootloader and also the Bootloader section of : http://www.brokenthorn.com/Resources/OSDevIndex.html
There are excellent tutorials to get yourself started to make yourself your own bootloader. Also you can join the #osdev channel in freenode to join a discussion if you need more information.
这篇关于写的Bootloader用C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!