Vineet Garg wrote:
> --- Thomas Hruska <[EMAIL PROTECTED]> wrote:
> 
>> Vineet Garg wrote:
>>> Hello guys..
>>> Let us suppose that i have made a c program to add
>> two
>>> numbers and i have compiled it too. Now i want to
>> run
>>> this program on bare pc(means without any OS).
>> Suppose
>>> i want my BIOS to load this program instead of
>> boot
>>> loader. So how can i do that?
>>>
>>> Vineet Garg 
>> You can't.  At least not as-is.  Your program is
>> compiled for a specific OS.
>>
>> If you write your own boot sector* (requires
>> knowledge of assembler), 
>> then you can have the BIOS load the boot sector and
>> the code can add two 
>> numbers.  But that isn't C and therefore outside the
>> scope of the group. 
>>   AFAIK, you can't do what you want in C on Intel
>> architecture...at 
>> least not without writing or using an OS.
> 
> But GRUB boot loader is written in C language too. So
> how tht program works without OS?
> 
> Vineet Garg 

Vineet,

'grub-1.95/boot/i386/pc/*.S' says otherwise.  Those are assembler files. 
  And the .c files, when compiled, are most likely stripped of all 
headers and other fluff.  Also, those .c files use their own internal 
run-time library.  Things like printf() from the regular C run-time 
library will NOT work.  You have to roll your own stuff at that level of 
interaction.

Your EXE, as-is, will NOT run without the OS it was compiled for.  You 
would have to re-write it from the ground up to get it working.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to