OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 25, 2024 4:28 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: 16bit kernel what compiler????
PostPosted: Sun Mar 03, 2002 9:31 pm 
Hi All,

i'm need a compiler wich outputs raw binary 16bit code for
realmode kernel, but i don't know how to make it in Turbo C 3.1.
Seems that the C preprocessor can not be overwritten....
Does anybody know how to do this? Can i even use Pascal?

Thanx in advance


Top
  
 
 Post subject: Re: 16bit kernel what compiler????
PostPosted: Mon Mar 04, 2002 1:22 am 
You need a linker which outputs flat binary. TC can do this, by getting the linker to output a .COM file (IIRC you need to use the tiny memory model and give the linker the /t switch, but check up on that).

A drawback of using the tiny model with 16-bit code is that the compiler will output code that can access a maximum of 64KB (code, data and stack combined). If you're writing a real-mode OS, you might want to write your loader as a .COM program (which can be run off a boot floppy or even from the DOS command line) and get it to load the kernel which is in a special format.


Top
  
 
 Post subject: Re: 16bit kernel what compiler????
PostPosted: Mon Mar 04, 2002 3:18 am 
Thanx for your help, but i know that...my problem is that the linker outputs a .com file with dos-system calls at the start
(C StartUpCode) but how can i default this?


Top
  
 
 Post subject: Re: 16bit kernel what compiler????
PostPosted: Mon Mar 04, 2002 9:31 am 
You'll need to override the startup assembly code that your compiler uses.

For an example, see Chris Giese's BING boot loader:
http://www.execpc.com/~geezer/os/bing.zip

Web page:
http://www.execpc.com/~geezer/os/


Top
  
 
 Post subject: Re: 16bit kernel what compiler????
PostPosted: Fri Mar 15, 2002 9:46 pm 
You can use TP7 or other free Tp compiler. Use a asm boot code, that loads a exe with MZ at the begining. So you write special procedures or functions in Tp that don't use dos.
Like:

procedure WriteChr(Chr: Char);
begin
    asm
     MOV      Al, Chr
     PUSHA
     MOV      Ah, 0Eh
     INT      10h
     POPA
    end;
end;

You can test your progr


Top
  
 
 Post subject: Re: 16bit kernel what compiler????
PostPosted: Fri Mar 15, 2002 9:48 pm 
am in dos and boot it with your boot code.
So you have to write functions to get on the disk and harddisk.
You can still use functions in TP that not use dos.


Top
  
 
 Post subject: Re: 16bit kernel what compiler????
PostPosted: Fri Mar 15, 2002 9:50 pm 
Like this you can use the pascal string unit to write the str with the writechr procedure.

procedure WriteStr(Str: String);
var
  Pos: Integer;
  Chr: array[0..254] of Char;
begin
    StrPCopy(Chr, Str);

    for Pos := 0 to (Length(Str) - 1)  do
    begin
         WriteChr(Chr[Pos]);
    end;
end;


Top
  
 
 Post subject: Re: 16bit kernel what compiler????
PostPosted: Fri Mar 15, 2002 9:53 pm 
Go to http://membres.lycos.fr/placr/os/picodos.html.
You can remove the interupts when you write then in Tp.
So the the boot code is very small.


Top
  
 
 Post subject: Re: 16bit kernel what compiler????
PostPosted: Tue Mar 19, 2002 3:28 am 
Thank you for the help!

But i need more information about exe-files...didnt found on web :(

how works the relocation? how can i load exe-files under TP?

Thanx!


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot], RayanMargham and 234 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group