Hi again,

On Wed, Nov 4, 2020 at 7:45 PM Rugxulo <rugx...@gmail.com> wrote:
>
> On Sat, Oct 31, 2020 at 4:11 PM Paul Dufresne via Freedos-devel
> <freedos-devel@lists.sourceforge.net> wrote:
> >
> > Well, after having a problem with IA-16 gcc (which seems to requires DJGPP 
> > gcc installed and working), I have search for an other free C compiler for 
> > FreeDOS.
>
> I can send you a .BAT to setup IA16-GCC in FreeDOS

No takers? This is one of the few ways to build FOSS 16-bit DOS
binaries in C. (Yes, you need p7zip due to LZMA method in the .ZIPs.)

=== I16GCC.BAT begins ===
@echo off
REM ... takes roughly 52 MB of space! ...
if "%RAMDRIVE%"=="" goto end
if not "%DJGPP%"=="" goto end
if exist %RAMDRIVE%:\i16\NUL goto end
for %%a in (md pushd) do %%a %RAMDRIVE%:\i16
set D1=c:c:\tmp\tkchia
p7zip920 x -x!SOURCE\* %D1%\i16gcc.zip >NUL
p7zip920 x -x!SOURCE\* %D1%\i16butil.zip >NUL
p7zip920 x -x!SOURCE\* %D1%\i16newli.zip >NUL
unzip -qn C:\ZIPS\DJGPP\djdev205.zip >NUL
set DJGPP=%RAMDRIVE%:\i16\djgpp.env
set D1=
call mypath %RAMDRIVE%:\i16\bin
call mypath %RAMDRIVE%:\i16\devel\i16gnu\bin
popd
if not "%1"=="" i16gcc.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
:end
=== I16GCC.BAT ends ===

Just to reiterate, that old p7zip build (7za) was mine (from 2012) but
still has latent bugs and missing features. I'm not smart enough to
fix or document everything, but it "kinda" works. I have no idea if
that particular version is "100% better" than the current package we
now include (older 4.65). The only unique advantage was that I tried
to support backslashes properly for paths, for convenience. "Testing"
implies that it needs more work.

* 
https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/util/file/7zip/9.20.1/testing/p7z9201-latest.zip

> > I have found Smaller C:
> > https://github.com/alexfru/SmallerC/blob/master/v0100/doc/smlrc.md
>
> Note that I made a 3.5" 1.44 MB single-floppy .7z (compressed) DJGPP
> installation years ago. It was fairly old even then (GCC 2.95.3,
> BinUtils 2.16.1, DJDEV 2.03p2) with a few bundled utils, but it worked

Try this, it should be good enough for reasonable ANSI C89 projects:

* https://sites.google.com/site/rugxulo/DJGPP203.7Z?attredirects=0

(Yes, my site has full sources [20 MB, mostly in .tar.bz2]. No, it
doesn't bootstrap atop FreeDOS proper yet, unfortunately.)

> Note that SmallerC is always 386+ (same as DJGPP) but it can output
> real mode (-dosh is default Huge)

If you really want to be masochistic, you could "maybe" try the old
shareware (real-mode-only) 386 emulator TSR (emu386) with SmallerC
code. Maybe it'd actually work (186's int6)! I think ecm's fixed fork
of 8086tiny supported "INT 6" properly, but I haven't tested this
particularly. Still, it would be weird if it actually worked! (And
someone here could easily reimplement that TSR [famous last words!].)

* https://github.com/ecm-pushbx/8086tiny
* https://github.com/barotto/IBMulator/wiki/Processor-Identification

> He recommends YASM, which is much *much* faster than NASM here.

* https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/devel/asm/yasm/1.3.0/

****************************************************************************************
(more rambling ahead)
****************************************************************************************

We already have TinyAsm (30 kb .EXE built by DeSmet) for 8086 + bin
output. It can also be built with IA16-GCC. But to build it with
SmallerC, you have to fix the old K&R function definitions. This is
not a huge deal since most people have heavily preferred ANSI since
forever (and then some). (L. Peter Deutsch wrote ANSI2KNR.C years ago,
but I don't remember where it is. Perhaps old BinUtils source
archives?? Dunno if that's a "better" solution here.)

I ended up just writing a Sed script (admittedly somewhat sloppily),
but it works. The ANSI-fied compiled .EXE (from Turbo C++ 1.01, for
comparison) matches that of the original K&R version .EXE exactly. So
I guess I didn't mess anything up!

There are too many Sed derivatives (most old ones based upon code by
Eric Raymond), yet none is perfect. I tend to test many
implementations on my scripts just to weed out any accidental
portability bugs. Even though Sed is quite simple and a POSIX
standard, implementations vary a lot. IIRC, SmallerC will compile CSed
but not MiniSed due to bitfields. And IA16-GCC has trouble with all of
them (for other, unknown reasons) except ancient HHsed. But at least
an IA16-GCC build of HHsed does seem to work (after defining
__TURBOC__ [for prototypes? hey, this code was 1991] and removing an
errant 0x1a from SEDCOMP.C). Well, it outputs *nix "LF only" text,
even for DOS-style CR+LF inputs, which confuses some tools (as always,
I don't know why that's such a prevalent problem, even nowadays ...
unix2dos FTW!).

So yeah, HHsed (circa 1991, compiled by Turbo C) was widely available
on both Simtel and Garbo, back in the day:

(sources)
* http://cd.textfiles.com/simtel/simtel20/MSDOS/TXTUTL/SED15.ZIP
* ftp://ftp.lyx.org/pub/pc/garbo/pc/unix/sed15.zip

So that's my limited experience getting these things to build, just FYI.


_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to