Pascal & OS development

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
kerim

Pascal & OS development

Post by kerim »

I was wondering why nobody uses Pascal in OS development. Why ?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Pascal & OS development

Post by Pype.Clicker »

i guess this is because the runtime for that language is heavy to implement. Which means there are pretty a lot of things to be rewritten prior to write a single line of kernel-mode pascal ...

It may also be due to the fact that OS development require a lot of bits&bytes manipulation and that Pascal isn't very good at this (or at least it isn't well known how to do it)

However, some people *do* use it. I can point out DelphineOS, among others, but Pascal has a reputation of being a "students language" and therefore, it doesn't have the same guru-aura as C or C++ does (which is pretty stupid, i agree).
DarylD

Re:Pascal & OS development

Post by DarylD »

I guess the reason that most people use C (or sometimes C++) for the OS kernel is the fact that that is what it was designed for! It makes it easy to get near the metal and its performance has never been in any doubt.

Also there is a wealth of material on the net regarding development in C which can really help speed things along.

Another language that could be applicable to OS development is Ada due to its robustness and its in-
built capabilities against buffer overflows and the like.

In the end, its your OS and you can code it however you want!

Daryl.
Nice

Re:Pascal & OS development

Post by Nice »

Pascal is just fine as a language. Infact, it compiles very nicely too. It can compile very efficiently, the pascal strings are a dream to work with, the lowlevelness of it is just fine (packed records, absolute addressing etc, bit manipulation, sets) and pascal calling convention saves valuable instructions.

The runtime is very light; with turbo pascal 6 or 7 you can get executables much smaller than with c compilers; entirely what I used to find first-hand.

You've guessed it: I used to love pascal. Object pascal is nice too. Look at freepascal - that can work with object pascal too.

As other posters alured to, the biggest thing pushing c as a good os language is convention.
cobrab

Re:Pascal & OS development

Post by cobrab »

Kerim:

If you want to use a Pascal lenguage to create an Operating System. Need to create a RTL file whit system-independent routines.

If you use Free Pascal compile the system.pp in the directory template of the RTL sources.

Or maybe see the message "OSDev in Pascal.." by crg in http://www.osdev.org/board.jsp page 5.
Schol-R-LEA

Re:Pascal & OS development

Post by Schol-R-LEA »

If you prefer Pascal to C, you may want to also consider Dr. Wirth's later languages, Modula-2, Oberon and Oberon-2. They were designed as systems languages, and have extensive (if rather verbose) tools for handling precisely those functions of seperate compilation, low-level hardware access, etc. that Pascal lacked. Modula-2 is the earlier of them, having been developed in the late 1970s and early 1980s; in tests at the time, Modula-2 compilers often generated code that was equal to or better than that of the C compilers that were available then. Oberon was Wirth's major effort of the late 1980s, being his first work in OOP, with Oberon-2 developing out of it in the late 1990s. All three have been used for OS development by Wirth and his students.

Note that each of the languages was, on some level, an experiment, and that they tend to reflect the professor's own rather quirky ideas as they developed. Also, they are quite verbose, and code in them tend to be a good deal more text-heavy than C or even LISP code (though they are usually a good deal clearer and easier to read than equivalent C code).
cobrab

Re:Pascal & OS development

Post by cobrab »

Schol-R-LEA:

Exist a free version of Modula-2, Oberon or Oberon-2. And work in i386.
Schol-R-LEA

Re:Pascal & OS development

Post by Schol-R-LEA »

cobrab wrote: Exist a free version of Modula-2, Oberon or Oberon-2. And work in i386.
Excuse me? ???

If you meant ask, "Are there any free or open source Modula-2, Oberon, and Oberon-2 compilers for the x86?", the answer is yes; if nothing else, the GNU project has compilers for all three, and their Modula-2 compiler is included in most Linux distrubutions AFAIK (the same applies to GNAT, the GNU Ada compiler and library, BTW). A quick Google search brings up several for Modula-2. A similar search for Oberon also nets some for Oberon and Oberon-2. HTH.
kerim

Re:Pascal & OS development

Post by kerim »

Thank you all, but I still plan to use only ASM and Pascal in PowerDOS development.

If anyone knows any web site or project related to OS development in Pascal, please tell me (or mail me) :)
cobrab

Re:Pascal & OS development

Post by cobrab »

cobrab

Re:Pascal & OS development

Post by cobrab »

Schol-R-LEA:

sorry for the stupid question.
Schol-R-LEA

Re:Pascal & OS development

Post by Schol-R-LEA »

Don't worry about it, CObrab. It happens to the best of us sometimes.
Silenger

Re:Pascal & OS development

Post by Silenger »

I let free pascal output nasm code.
I only use a pascal unit for the main code with a global proc Int_OS. then the other units are *.inc files.
The asemble it you have to write a simple asm prog that calls the int_os proc than asemble it and you got your binary. plz note that const strings are like this 'Hello ' so change it to 'Hello' before you asemble.
Schol-R-LEA

Re:Pascal & OS development

Post by Schol-R-LEA »

OK. It is, of course, your choice; I simply thought I'd mention the alternatives.

Even if you aren't interested in the language, however, you may find it useful to find out about the Native Oberon OS, a port of the the Oberon system to the PC. The OS has some interesting idea which have inspired some of my own design concepts, and while I disagree with certain aspects (e.g., the uses of polling and cooperative multitasking instead of preemptive multitasking), I can appreciate their reasons and see the advantages and disadvantages to them.

However, I'm still inclined to a more abstract system such as Scheme for my high-level code, personally. The LISP family had many of the 'advances' which Oberon and Java users have been touting since the early 1960s, and are flexible enough to support a wide variety of programming styles and paradigms. To each his own, however; I know that plenty of programmers find Scheme to be irritating at best, so I know I'm in the minority.
kerim

Re:Pascal & OS development

Post by kerim »

Well for my Real mode part of PowerDOS, I'll use NASM and Turbo Pascal 7.0, and for PowerMode (protected mode) part of PowerDOS I plan to use NASM and possibly Free Pascal, only because it is 32-bit compiler.
Post Reply