Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Old 8086 version of pcc spotted (cross-compiles to DOS) (Miscellaneous)

posted by Rugxulo(R) Homepage, Usono, 27.03.2012, 20:28

> One of the unstated rules:
> If it can't compile itself and is written in the language it implements,
> it's not good enough...

I don't like the difficulties in compilers that aren't able to (portably) bootstrap. It seems so senseless to me. In a way, I almost prefer interpreters or things that compile in ANSI C because it's so much simpler and portable. But the king of simple bootstrapping is Forth, so maybe I'm looking in the wrong place. It just bugs me that Wirth-family compilers are so hard to build (which is ironic considering how much Wirth himself keeps things simple, but nobody seems to take his advice ... reminds me that I need to study closer Oberon-0 or P4 or Pascal_s sometime).

> This pretty much kills dev86, since BCC-CC1.EXE is 120+ k. :(

While you're probably right, code size isn't always equivalent between compilers. So I don't think it's totally impossible that BCC could one day compile itself. Though it probably won't, it's mostly meant for cross-compiling from *nix. Most C libraries are notoriously bloated.

> DeSmet 3.03 will bootstrap itself, and runs small enough to fit on a floppy
> with some room free (600 k for the standard compiler, 450 k for the large
> one).
> There's a bit of old code written for DeSmet, since it was the main
> shareware compiler (PCC).
> I may poke and see if nasm 0.9x can build with this, so I have a full
> bootstrap environment.

I would be very very surprised if you could get NASM built with it. Actually, a fair number of assemblers are written in themselves (e.g. Octasm, FASM), so it'd be easier just to use one of those, though I admit those aren't 8086 friendly. (But check out Venksi's very tiny 8086 one here.)

Old NASM was indeed pure ANSI C89, though, so I guess it's possible, but Desmet doesn't have full ANSI libs / headers.

> DeSmet may be weird, but it still beats a K&R-ish small model compiler that
> supports DOS as an afterthought and can use unprotoize if you really need
> to try building ANSI. Allegedly, 3.1h supported ANSI C natively - I
> haven't verified this.

I haven't heavily used Desmet, but 3.1h does seem pretty good. Granted, I didn't test too much with it, and as mentioned I had to nop out any mention of stdlib.h and time.h, so you're going to be lacking things. But the syntax part and code generation seems to work (in at least one very unofficial test). Yes, it's surprisingly capable, but I wouldn't pin too high hopes on it (though it does support both small and, optionally, large model too).

> For BASIC, I'm looking at http://exmortis.narod.ru/src_compilers_eng.html
> (they have a near-QBASIC compatible compiler that outputs NASM code, and a
> GABASIC knockoff with IDE, written in GABASIC)

I'd be surprised if those were much use. Similarly it reminds me of old BASM286, but I don't think that's quite robust enough for you, but hey, it ain't too too bad, last I checked.

BTW, I know you want a real compiler, not an interpreter, but I must mention this: EiC (Detlef's port) is probably best for interpreting (and seems very very ANSI compatible). The advantage is, of course, that you don't need assembler, linker, libraries, hence no worries about calling conventions, object formats, etc. Of course, that will be slightly slower and makes it harder to share code. But for quick prototyping or simple demos, it's plenty good.

I really also wanted to mention PicoC. With DJGPP 2.03p2 and UPX, the NO_FP version is only 78k for me (with my silly patch to fix a few minor nits). Granted, it has some omissions, so it's not fully ANSI compatible, esp. the lack of (almost entire) CPP preprocessor capabilities. But if you workaround that (easy, use pre-existing external CPP.EXE), it works quite well and is small and self-contained, even slightly moreso than EiC even. So I find it interesting.

 

Complete thread:

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