Page 1 of 1

Combining C and Assembly for the bootloader

Posted: Fri Sep 28, 2012 8:30 am
by Yashas
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
:)

Re: Combining C and Assembly for the bootloader

Posted: Fri Sep 28, 2012 8:18 pm
by Andyhhp
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

Re: Combining C and Assembly for the bootloader

Posted: Sat Sep 29, 2012 2:32 pm
by Yashas
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.

Re: Combining C and Assembly for the bootloader

Posted: Sat Sep 29, 2012 2:35 pm
by Yashas
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.