Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

DOSes written in assembly (Developers)

posted by Rugxulo Homepage, Usono, 08.04.2024, 02:45

> > > Can you explain why it is not appropriate for FreeDOS to be written in
> > C?
> >
> > I didn't say "appropriate", I just don't like C, no offense meant.

I find ANSI C89 reasonable, but I usually prefer ISO or TP Pascal (or derivatives).

> I tried to learn C by starting with Borland C but then my programs
> wouldn't compile under GCC nor CodeBlocks: each had its own complaints.

Code::Blocks is an IDE, not a compiler, but it supports several:

"GCC (MingW / GNU GCC), MSVC++, clang, Digital Mars, Borland C++ 5.5, Open Watcom, …and more"

> Sounds like you didn't write according to the actual C89/C90
> standard, which is ... a total joy to read.

tcc/bcc have -A to switch on ANSI. I think you also need "-ff-". It could be various hidden problems (memory model, total RAM limits, library bugs, undefined behavior, file system). Usually you want to also test with "gcc -ansi -pedantic -Wall -Wextra" and/or lint.

> Show me one single program that follows the C90 standard,
> and compiles on Borland C, but doesn't compile on GCC etc.

Most reasonable things are possible, but only with effort (and testing). There's a lot of gotchas in portability (and bugs in compilers).

> > Also I'm happy with
> > FreePascal/Lazarus. I'm trying to run UCSD Pascal under DOS and, if
> > possible again, even as a bootable version. But that is just dreaming
> > now.

UCSD's P system was its own OS and was offered as an alternative to PC-DOS or CP/M-86.

DOS has (or can use) many Pascal compilers (FPC, GPC, Irie, P5, Alice, p2c, TP, TMT, VP under HX).

> My question is more generic, but you appear to have
> answered it below, which would have been "what's
> wrong with Pascal for writing an OS?".

Pascal (with variations) has indeed been used for OSes. (GCC was originally based upon Pastel, "an off-color Pascal".) But the language itself didn't inherently have system-specific stuff. Modula-2 and Oberon were more commonly used for OSes and put the non-portable stuff in pseudo-module SYSTEM.

>> Programs written in assembly are smaller and faster than ones
>> written in C or Pascal.

Not necessarily. Sure, if you write every instruction by hand, you don't need calling conventions or stack frames, and you can hand-optimize better and not rely on bloated overly-generic libraries. Actually, bytecode can be MUCH smaller but usually slower. And strictly smaller doesn't always mean faster.

People willingly trade speed for convenience. As flawed as C and Pascal are for portability, they're much better for program maintainability.

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 148 users online (1 registered, 147 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum