I want to write a simple operating system for learning purposes. Can I write an operating system using asm() in C instead of assembly language?
Example:
int main()
{
asm("mov ax,70C0h"
"add ax,520"
"jmp $");
}
I want to write a simple operating system for learning purposes. Can I write an operating system using asm() in C instead of assembly language?
Example:
int main()
{
asm("mov ax,70C0h"
"add ax,520"
"jmp $");
}
Copyright © 2021 Jogjafile Inc.
You can't write an OS using inline Assembly, as the C compiler is going to compile and link the code on your existing OS. It can only be executed on your OS after that. I recommend writing your OS in Assembly and then compiling it using NASM (a common x86 compiler). I recommend this tutorial for creating your own bootloader. After that you can stick to 16-bit real mode or switch to 32-bit protected mode.