Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Smaller C compiler (Announce)

posted by alexfru(R), USA, 03.01.2014, 06:46

Hello fellow DOS lovers!

I'm not sure whether this fits best the Announce category or the Misc one, (moderator(s), feel free to correct).

I've come across this thread, Old 8086 version of pcc spotted (cross-compiles to DOS), and I'd like to share with you my recent work in the field.

For the past year I've been working in my spare time on a C compiler that could potentially target DOS. And, in fact, it already can. :)

Meet Smaller C!

Smaller C in not too many words (more on github):

- is much like the original Small C by Cain/Hendrix/etc and Micro-C by Dunfield, but with normal ANSI/C89 syntax and behavior (=no foul play in expressions as in Micro-C), work is underway to support more of C89

- generates NASM-agreeable 16- or 32-bit i80386 assembly code, and should be fairly easily adaptable to other assemblers if needed (I've been told, it takes an hour to adapt it to NBASM)

- -seg16t,-seg16,-flat16 options are for the 16-bit tiny/small memory models (ints and pointers are 16-bit, pointers are near)

- -seg32,-flat32 options are for 32-bit code (ints and pointers are 32-bit, pointers are near)

- -huge option is for a memory model similar to the huge memory model found in Borland/Turbo C/C++ compilers (ints and pointers are 32-bit, pointers are physical addresses, transparently converted into segments and offsets, no need to mess with far, MK_FP(), FP_SEG(), FP_OFF() and the like, you can pretend you're in 32-bit mode!; this should help with porting code to DOS or even writing new code for DOS)

- is trivially compilable with any C89+ compiler (Turbo/Borland C/C++, Open Watcom C/C++, djgpp, gcc, you name it) and can run in DOS

- (re)compiles itself (you can already make a DOS .EXE of Smaller C using only Smaller C (compiled with another compiler or itself) and NASM (2.03 or better), no linker needed)

- doesn't yet provide libc, though it should be easy to implement a basic library for DOS (the compiler itself needs only a handful of ctype/string/stdlib/stdio functions to operate and those are already available for bootstrapping for DOS)

- BSD licensed

More details (live document) can be found here, in the Wiki.

In the near future I'm going to add support for struct, short and long.

You're most welcome to play with Smaller C, report bugs and discuss it (and contribute:).

P.S. Robert, indeed, I'm the author of the Frounze Commander. :) Thanks for my new account on the forum!


Complete thread:

Back to the forum
Board view  Mix view
15317 Postings in 1383 Threads, 254 registered users, 12 users online (0 registered, 12 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum