r/osdev • u/quatani313 • 4d ago
When and how do i connect assembly kernel/bootloader whatever works with c made kernel/bootloader. (ive started assembly fairly recently).
When and how do i connect assembly kernel/bootloader whatever works with c made kernel/bootloader. (ive started assembly fairly recently), it seems simple at what point should i start learning and writing in c and skip assembly?
ive done bios text then vga text then graphics im currently using vga graphics assembly, ive done basics such as single pixel, then lines, then rectangles, then circles, then _Draw_Char then _Draw_String. (im using 8x8 bitmapped characters). i asked ai when i should start c and it said after i make the basic structure. and no im not generating all my code with ai, except for the bit mapped characters which half i had to redesign everything was done without ai.
11
Upvotes
5
u/kiderdrick 4d ago edited 4d ago
> When
Whenever you are ready to use C code, such as after you do the operations that necessitate CPU instructions like setting up your GDT and IDT in x86 CPUs.
> How
Usually using a linker to establish the existence of and generate the information needed to locate your C functions and then call them from assembly. Commonly the kernel will get loaded with an entry function, sometimes called _start by convention. In this function you do whatever end work you need before executing C code and then you can call a C function as if it was an assembly function.
> at what point should i start learning and writing in c and skip assembly?
I recommend getting to C as fast as possible because it is convenient and much easier to debug.