Combining C and Assembly for the bootloader

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
Yashas
Posts:3
Joined:Tue May 22, 2012 6:42 am
Combining C and Assembly for the bootloader

Post by Yashas » Fri Sep 28, 2012 8:30 am

I know C much better than Assembly.I am trying to mix both C and Assembly.I have created a C File and used "extern _blmain jmp _blmain"
in the assembly.But the trouble I face it that NASM give me a list of errors when I try to produce the code in aout format.

Whats the problem here??
Or is there any way I can combine C and Assembly?(These Assembly stuff, I mean the Stage 2 Bootloader of the tut).

Thanks for your consideration
:)

Andyhhp
Moderator
Posts:387
Joined:Tue Oct 23, 2007 10:05 am
Location:127.0.0.1
Contact:

Re: Combining C and Assembly for the bootloader

Post by Andyhhp » Fri Sep 28, 2012 8:18 pm

You will get errors because you are delaring an extern variable but not linking.

As a result, nasm cant work out where that jump is supposed to go, so cant make a valid executable.

~Andrew
Image

Yashas
Posts:3
Joined:Tue May 22, 2012 6:42 am

Re: Combining C and Assembly for the bootloader

Post by Yashas » Sat Sep 29, 2012 2:32 pm

LOL, I am not so dumb.I have been programing Hardware since 2 years.I used to mix C and Assembly.But I have unusual error.
NASM builds fyn in BIN as ouput but not in aout format.

Yashas
Posts:3
Joined:Tue May 22, 2012 6:42 am

Re: Combining C and Assembly for the bootloader

Post by Yashas » Sat Sep 29, 2012 2:35 pm

It says that the operand "org" cannot be used in AOUT.
I dnt have my comp, soon I wil giv my source and a photo of the error.

Post Reply