Compiler for 8086 Embedded System

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Compiler for 8086 Embedded System

Post by myk »

Hello,

I am studying Computer Engineering in college and I have recently designed and built an 8086 computer. I have also written an operating system for it in x86 assembly (a little over 3000 lines of code :D ). I was wondering if anyone knew about what tools I would need to start writing C code for this embedded system.

I have been playing around with Turbo C 2.01 to compile and link the code and a program called turbo-locator to make a ROMable BIN file from the executable.

For example I have been using a simple program called example.c to test this process. Example.c looks something like this:

int main()
{
asm mov AX, 0x1234; //not sure if this is the right syntax, going from the top of my head
return 0;
}

Unfortunately, dis-assembling the BIN file does not contain the inline-asm instruction, nor any instruction that looks like it would do the samething. I can tell that the x86 Reset Address is correctly inserted into the BIN file, however the program code does not look correct.

Does anyone have any information about writing ROMable C code for the 8086?

Thanks a lot,
Mike

P.S. A short video of my computer in action :D
http://youtube.com/watch?v=bhv8hGZ2fSQ&search=8086
Da_Maestro
Member
Member
Posts: 144
Joined: Tue Oct 26, 2004 11:00 pm
Location: Australia

Post by Da_Maestro »

Take a look at the intel docs. There is all sorts of info regarding the CPU and how it looks when it's in real mode. There is links placed all over these forums (I don't remember them lol)
Two things are infinite: The universe and human stupidity. But I'm not quite sure about the universe.
--- Albert Einstein
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Post by myk »

Hey thanks for the tip. I actually just ordered the hard copies last night, I haven’t checked out the PDF’s yet though.

If I understand you right, I don't believe what I am looking for has to do with "real mode" operation of the 8086 (the 8086 actually has no real/protected mode). What I am looking for is a guide on compiling C code and "locating" all variables to specific memory locations given by my computers memory map. I understand how to do all of this in ASM, however I am not sure how to go about doing this in C. If I am mistaken about your advice, I'm sorry, could you clarify your answer a little.

Thank you,
Mikael
User avatar
chase
Site Admin
Posts: 710
Joined: Wed Oct 20, 2004 10:46 pm
Libera.chat IRC: chase_osdev
Location: Texas
Discord: chase/matt.heimer
Contact:

16-bit compilers

Post by chase »

What you want is a 16-bit real mode compiler. The problem is there aren't any I know of(free). There was an attempt to port DJGPP a couple years back but I don't think it went anywhere. Today most people write just enough assembly to get their cpus into PMode and then use something like GCC to write their 32-bit PMode OS. Looking around a little the only two I even see mentioned are BCC(Bruce's C Compiler) and Small-C, you might want to see if they are in your ports/yum/deb repositories if you are running a free Unix on any machine.

What's which the night-rider lights? :)
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Post by myk »

Hey thank you for the help,
I have looked at bcc before and that might be an option (I do dual boot w/ kubuntu linux), I will check out the Small-C and see how that is. I will also be contacting my professor about it because this upcoming semester we will be programming the 8086 in C, I just wanted to get a head start on it this summer :).

The led's were basicly the only "cool" thing the computer did at the time of that video haha, actually a friend of mine made a lookup table and used pulse width modulation to make his LED's have a trailing effect, it was very cool. My finished computer's OS had a scrolling menu system w/ about 8 functions such as edit, move, copy memory etc... It had most of the function that DOS's debug command had.
Post Reply