Getting code generation working for Small-C

Started by latte, September 26, 2010, 01:35:54 AM

Previous topic - Next topic

latte

Hi all - 
  I'm in the process of getting a copy of Small-C up and running.  Unfortunately, I have a problem.
The code-generation files that Small-C has are very old (they are for 8080, Vax and so on).  So, I've found that I've "bitten off rather more then I can chew" with trying to do a new code-generation file - one for modern x86 PCs. 

( I should mention that I'm doing this on Linux, so the assembly code that would be preferable to generate would probably be NASM or gas. )   

My knowledge of assembly is quite limited, although I do have a very small bootloader written in asm, and I can understand how that works.  But this Small-C code generation has me stumped.  It is the process of mapping the C code to the various asm commands, and knowing *which* command (of "mov", "jmp" and so on) goes *where* that I am struggling with. 

So, if anyone is willing and able to help out, that would truly be great!  You will be fulsomely acknowledged, I can assure you of that, along the lines of "it would not have been possible to get this working without developer Foo from the MASM forum." 

Anyone wanting to help out can find the code here - I've called the compiler "Crystal" -
http://github.com/mooseman/crystal 

The relevant code-generation files are the "codeXXXX.c" ones, e.g. code8080.c, codevax.c and so on.
( Oh, and I'll need to update the Makefiles too - arrgh -  but that won't take long. ). 
Many thanks for your time, and for any help received.....  :) 
Bye for now -
- latte

FORTRANS

Hi,

   There have been some postings on SmallC on alt.lang.asm
and alt.os.development.  One current is;

http://groups.google.com/group/alt.lang.asm/browse_thread/thread/08f8f1bae0dcdec9?hl=en#

   I am not following those, but there were a number of
older ones that pointed to source code resources.

Regards,

Steve

latte

Quote from: FORTRANS on September 26, 2010, 12:03:29 PM
Hi,

   There have been some postings on SmallC on alt.lang.asm
and alt.os.development.  One current is;

http://groups.google.com/group/alt.lang.asm/browse_thread/thread/08f8f1bae0dcdec9?hl=en#

   I am not following those, but there were a number of
older ones that pointed to source code resources.

Regards,

Steve

Hi Steve! 

Thanks very much for that! I'll check those groups out - they should be very useful! 
( I apologise for not having looked at them before now..... ) 
Bye for now -
- latte