Using the MS-DOS 4 release to compile programs

Sdílet
Vložit
  • čas přidán 19. 05. 2024
  • Someone had asked me if it was possible to use the Microsoft MS-DOS 4.00 source code release to compile new programs.
    And that's an interesting question, because as I showed in my other video at the time, the BAK (the Binary Adaptability Kit) includes a C compiler and an assembler so it could compile the source code.
    So the short answer is Yes, you can use the Microsoft C compiler they included in the source code release to compile your own programs. The C compiler is provided as binary only, no source code, but it's a working C compiler.
    So let's look at how you can use the C compiler there to compile your own programs.
    Visit our website
    www.freedos.org/
    Join us on Facebook
    / freedosproject
    Follow us on Mastodon
    fosstodon.org/@freedosproject
    Consider supporting me on Patreon
    / freedos
    And don't forget to Like and Subscribe!
    Standard comment rules apply.
  • Věda a technologie

Komentáře • 44

  • @kenielf
    @kenielf Před měsícem +12

    For absolutely no practical reason, I'd love to see a benchmark between ms-dos 4 and current free dos. It'd be great to see how it differs - even when virtualized

  • @OpenGL4ever
    @OpenGL4ever Před měsícem +2

    I already extracted the MS C compiler, its libs and include files and the additional tools and MASM from the MS-DOS 4 release a couple of weeks ago, when the source code of MS-DOS 4 was released.

  • @MattKasdorf
    @MattKasdorf Před 26 dny +1

    Just stumbled across this video, you make a great teacher.

  • @ahmad-murery
    @ahmad-murery Před měsícem +3

    Nice video as usual,
    Programming sessions are always welcome and I expect there will be more to come(I hope)
    Thanks Jim!

    • @freedosproject
      @freedosproject  Před měsícem +3

      More to come. I'm trying not to be "all programming all the time" but we'll definitely come back to more programming exmaples.

    • @ahmad-murery
      @ahmad-murery Před měsícem +1

      @@freedosproject 👍💯

  • @hubstrangers3450
    @hubstrangers3450 Před měsícem

    Thank you...

  • @SlideRSB
    @SlideRSB Před měsícem +6

    I think you may have missed a sys directory inside the headers directory.

    • @freedosproject
      @freedosproject  Před měsícem +5

      Oops, I did! The 'sys' directory contains locking.h, stat.h, timeb.h, types.h and utime.h. I didn't spot that when I looked at the DIR listing.

  • @alexandershendi7428
    @alexandershendi7428 Před měsícem +2

    A question: the provided multitasking version of MS-DOS stops other programs wenn you use "normal" DOS EXEs. Can the Microsoft compiler produce Windows-style "new" executables that you could concurrently? Thank you for the video!

  • @StringerNews1
    @StringerNews1 Před měsícem +4

    If I had access to a free compiler like that 30 years ago, I could have done some things.

    • @OpenGL4ever
      @OpenGL4ever Před měsícem +1

      I agree. This compiler was very expensive at that time.

    • @rnts08
      @rnts08 Před 28 dny +1

      Agreed, so many expensive options back then for a teenager. I ended up with the borland c compiler.

    • @rigen97
      @rigen97 Před 22 dny +1

      apparently gcc was already a thing as early as 1987
      but I suppose it was quite obscure back then

    • @OpenGL4ever
      @OpenGL4ever Před 22 dny

      @@rigen97 That may be true for expensive Unix server systems. But on the x86 PC at home for MS-DOS, gcc was only available after DJ Delorie ported it to DOS and released it under the name DJGCC. And anyone who didn't have a modem at the time didn't find out about it until the advent of CD-ROM collections. The compiler therefore only became really well known after 1995 at the earliest.
      Personally I first discovered DJGCC on a CD-ROM shareware collection and because it was a version for OS/2, it was of no use to me. I only encountered GCC in a usable form in 1999, when I installed Linux on my computer for the first time.

    • @OpenGL4ever
      @OpenGL4ever Před 22 dny +2

      @@rigen97 That may be true for expensive Unix server systems. But on the x86 PC at home for MS-DOS, gcc was only available after DJ Delorie ported it to DOS and released it under the name DJGCC. And anyone who didn't have a modem at the time didn't find out about it until the advent of CD-ROM collections. The compiler therefore only became really well known after 1995 at the earliest.

  • @maxmuster7003
    @maxmuster7003 Před 29 dny

    Very good.

  • @simpleprogrammingcodes
    @simpleprogrammingcodes Před měsícem

    I noticed that this compiler can understand the modern syntax for the function parameters, and it's a 1986 compiler, before K&R 2. When was the new syntax introduced and when did it become the norm for a compiler to support it?

    • @zoomosis
      @zoomosis Před měsícem +2

      Microsoft C 5.1 shown in this video is from 1988, the same year MS-DOS 4.0 was released. ANSI/ISO C was ratified two years later. From memory MSC 5.0 was their first to support ANSI/ISO C.
      Trivia: Most of the early OS/2 1.x C source code from 1986-7 was written in K&R syntax.

  • @grappydingus
    @grappydingus Před měsícem +1

    I await the ultimate showdown! Which is better ed or edlin!

    • @freedosproject
      @freedosproject  Před měsícem +2

      OMG, I should totally do a video on that! :-)

  • @Maxjoker98
    @Maxjoker98 Před měsícem +2

    Why is the second version of the array.exe program 10x smaller?
    At 18:22 it's ~700 bytes, while at 14:00 it's ~7kB.

    • @TSteffi
      @TSteffi Před měsícem

      I was curious after seeing this comment, but watching closely, the second .EXE was around 7k, too.

    • @Maxjoker98
      @Maxjoker98 Před měsícem +1

      @@TSteffi Oh, I must have read the wrong row. My bad!

    • @freedosproject
      @freedosproject  Před měsícem

      @@Maxjoker98 No problem. 🙂 In fact, the [corrected] ARRAY.EXE at 14:16 is 7,825 .. and after copying the libs and includes, the recompiled ARRAY.EXE at 19:04 is also 7,825. So it's the same size (i.e. nothing "broke" when copying files to a new "CC" directory)

  • @MonochromeWench
    @MonochromeWench Před měsícem +2

    Sure it's nice that Microsoft released this but why would you want to use it when we have OpenWatcom that can target 16bit dos and supports a relatively modern C standard. I guess this might be useful if cl itself actually is 16 bit and you absolutely need to compile a program on an AT or an XT. Benchmark comparison might be interesting but it seems unlikely this old compiler could win but maybe it has optimizations better targeted to 8086 and 80286 cpus than what you'd find in a 32 bit compiler.

    • @OpenGL4ever
      @OpenGL4ever Před měsícem

      One reason could be better compatibility with old programming books written for the Microsoft C compiler. Not all early C compilers were ANSI compatible. Some had their proprietary extensions.
      Another one could be lower RAM requirements. It may require less RAM than the 16-bit version of gcc.
      When it comes to code optimization, especially program speed, modern compilers are probably better. However, the MS compiler could have been optimized for generated program code size since memory was expensive back then.
      In the end you will have to test it and directly compare who performs better where.
      In any case, the later 32-bit C compilers from Microsoft for Windows were still very bad at the time. They were only significantly improved after the release of Windows NT 3.1. Which meant that Windows NT 3.5 ran significantly more efficiently than its predecessor. The slow speed of Windows NT 3.1 was the main reason for Microsoft to improve the compiler.

    • @freedosproject
      @freedosproject  Před měsícem +2

      I agree, I prefer the newer open source compilers like OpenWatcom and IA-16 GCC. We also have BCC and a few other open source compilers that are older but work fine.
      The MS compiler is interesting for some. And it's interesting that they included the binaries for free in the MS-DOS 4.00 BAK source code release.
      Another legit free (gratis) proprietary compiler is Borland Turbo C 2.01 and Borland Turbo C++ 1.01, which you can download from Embarcadero's museum, if you don't mind registering a free account with them. We have a link to them from our website under the 'Developer' section. Works great on FreeDOS - I did a video a while back about TurboC++ on FreeDOS and the IDE was super slow in that video because it doesn't run well under JEMMEX; boot "without drivers" and the IDE runs fine.

    • @zoomosis
      @zoomosis Před měsícem +1

      Borland also released a version of Turbo C++ as freeware years ago which is arguably an easier compiler to use if all you want is to target 16-bit DOS.

  • @aintaintaword666
    @aintaintaword666 Před 29 dny

    13:18 Why did the program work? I imagined it should have crashed right after that null pointer assignment?

    • @tehlaser
      @tehlaser Před 29 dny

      Ah, the joys of undefined behavior. “Everything appears to work just fine at first, but then sometime later something weird happens” is surprisingly common.

  • @MasterH2005
    @MasterH2005 Před 29 dny

    I know this is gonna sound strange, considering the fact that DOS is mainly a CLI OS, but is it possible to get a desktop environment running on FreeDOS?

    • @maciejstachowski183
      @maciejstachowski183 Před 28 dny +1

      Windows 3.1 seems to work with some tinkering. DESQView I think runs out of the box, but I haven't tried it.

    • @freedosproject
      @freedosproject  Před 23 dny +2

      You can run Windows 3.x in Standard Mode on FreeDOS. Jeremy (kernel developer) has an in-development version of the FreeDOS kernel that runs Windows 3.11 in Enhanced Mode .. I'm hoping that can get released so we can share it. But you can find it in his GitHub.
      You can also use other graphical environmnets on FreeDOS, too. See my other videos for OpenGEM and Seal.

  • @Australian_Made
    @Australian_Made Před měsícem

    😎👌

  • @snap_oversteer
    @snap_oversteer Před měsícem +2

    Nice video as always, I have never properly programmed in C under DOS but the usage of malloc got me thinking, when it's running (presumably) in real mode you're limited to what's left of 640K base memory, right? And if I wanted to use more memory I'd have to use a different compiler that can produce programs that run in protected/enhanced mode.

    • @rugxulo
      @rugxulo Před měsícem +3

      No, you could (manually??) use EMS or XMS (286+), if available. Or use overlays or swap to disk.

    • @zoomosis
      @zoomosis Před měsícem +1

      You also can't allocate more than 64K at a time unless you use the "huge" memory model.
      The easiest way around both this and the 640K limit is to use Watcom's wcl386 compiler to build 32-bit DOS4G executables.

  • @SensualSquirrel
    @SensualSquirrel Před měsícem

    What's lib short for?