Hello! I am writing my own OS. I really liked MikeOS, but it is all in assembly language. I'm trying to make my own. There is an assembly code:
BITS 16 extern main start: mov ax, 07C0h add ax, 288 mov ss, ax mov sp, 4096 mov ax, 07C0h mov ds, ax mov si, text_string call clear_screen call print_string jmp $ text_string db 'EOS ready', 0 ;call main clear_screen: pusha mov dx, 0 mov ah, 6 mov al, 0 mov bh, 7 mov cx, 0 mov dh, 24 mov dl, 79 int 10h popa ret print_string: mov ah, 0Eh .repeat: lodsb cmp al, 0 je .done int 10h jmp .repeat .done: ret times 510-($-$$) db 0 dw 0xAA55 This is a pitiful semblance of a system loader. There is also a C code describing the main function.
#include <stdio.h> extern int main (void) { char* str = "print from C :)"; printf("%s", str); return 0; } How is it all glue together? (Mix C and Assembler)?
How to call a function described in a C file in an assembler program? When trying to compile such code:
void kernel_main(){ ... } ... call kernel_main ... writes:
boot/boot.s:16: error: symbol `kernel_main' undefined What should I tell the nasm compiler where this function is?
printf. - VladD