PASCAl or C

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.
trey_monty
Member
Member
Posts: 44
Joined: Thu Mar 10, 2005 12:00 am

Re: PASCAl or C

Post by trey_monty »

I also just got a new OS writen in PASCAL.
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: PASCAl or C

Post by bubach »

writing a whole OS in asm is possible but it's a very bad idea, coz it makes code maintaining herder, also, if you code your OS in assembly it will not be portable, coz assembly is arch. dependent
The only "real" reason not to code in Assembly should be that you don't want to.

Come on, what makes you say that "code maintaining herder" ? I think that it's easier then GCC stupid syntax (esp. inline asm) which makes many C hobby OS'es source unreadable.

"also, if you code your OS in assembly it will not be portable" - So how portable is your OS? I think that it's a load of **** to say something like that about asm, how many of you even plan to support more platforms then x86? And even if you do, you will problably never reach that state. Even if you have reach that point it'll be much to do before your OS compiles for another platform.

/ Christoffer
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: PASCAl or C

Post by bubach »

Oh, BTW: http://freepascal.org/ could be nice to check out...
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Re: PASCAl or C

Post by Legend »

*NIX-based system, a class of systems, mostly it seemed to split into a lot of different systems after System V UNIX from what I have read. GNU/Linux works like a UNIX system, too, don't forget both have been programmed to be a free implementation of the concept.

What works better for os dev in a unix system:
- gcc and ld work a good deal better
- copying images to floppies is easier

With Eclipse and the CDT you can even have a reasonable GUI! :)

But I personally don't think these are too good reasons to switch to Linux - once gcc and ld work for you under Windows ;)
*post*
trey_monty
Member
Member
Posts: 44
Joined: Thu Mar 10, 2005 12:00 am

Re: PASCAl or C

Post by trey_monty »

k. i think i get it. Also why do all of you people not think PASCAL is good for osdev? I run an os(RS3) that was witen in PASCAL.
ZOSdever
Member
Member
Posts: 79
Joined: Thu Mar 31, 2005 12:00 am
Contact:

Re: PASCAl or C

Post by ZOSdever »

Hey its trey_monty, I changed my user name to ZOSdever
ZOSdever
Member
Member
Posts: 79
Joined: Thu Mar 31, 2005 12:00 am
Contact:

Re: PASCAl or C

Post by ZOSdever »

Hey if any of yas people have a kernel I can use as my kernel( i hope it is in PASCAL) please say so and ill give ya my email addresess so ya can send it to me.
User avatar
carbonBased
Member
Member
Posts: 389
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Re: PASCAl or C

Post by carbonBased »

bubach wrote: Come on, what makes you say that "code maintaining herder" ? I think that it's easier then GCC stupid syntax (esp. inline asm) which makes many C hobby OS'es source unreadable.
You're assuming it's one or the other -- the alternative to assembly isn't inline assembly.

Granted, any OS will require *some* ammount of assembly, but those of us concerned with portability keep that to a minimum, and, if you're smart, you never use inline assembly because that isn't portable either (I try to use strict ansi c so that I'm not tied to GCC).

This is an anchient battle but, as a proficient asm and C coder, I still fail to see the argument; well written C is more maintainable then well written asm. Asm can certainly be maintainable... and if done really well, it will not be *too* difficult. But that requires quite a lot of extra thought on the asm developer when writting the code, as well.

When one line of C can compile into as many as 20 lines of asm, I find it hard to believe that 20x the source code can be just as easily maintained as the C equivalent -- again, only from the perspective of someone proficient in both. Obviously if you only know asm, C will look strange, and vise versa... but neither are difficult to learn.
bubach wrote: "also, if you code your OS in assembly it will not be portable" - So how portable is your OS? I think that it's a load of **** to say something like that about asm, how many of you even plan to support more platforms then x86? And even if you do, you will problably never reach that state. Even if you have reach that point it'll be much to do before your OS compiles for another platform.
That's hardly a reason not to write portable code. Just because the majority of people on this list will never support more then one platform doesn't mean their code shouldn't facilitate it.

The fact of the matter is, to port to a new OS in C, you have to rewrite some files. To port to a new OS in ASM, you have to rewrite everything. This is what C was build for, and it does it well... we all know how many platforms Unix runs on.

Personally, I *do* intend to support multiple platforms, and have recently restructured my entire OS path to reflect this. Because I used mostly C, I'm able to keep my entire mini-libc implementation, and various other parts of the kernel that I've made portably:
queue, expandingQueue, semaphore, mutex, messageQueue, list, much of my multitasking code, runTime object linking, etc, etc, etc.

Truely, their really isn't a whole lot to support a new OS using my current system. As long as you keep that platform dependant interfaces consistent and minimal, you will only ever have to implement these functions (and truely, not even all of them... many of them can be stubbed out for the purpose of getting the OS up and running quickly).

This is something I do for a living -- porting OS layers to various different platforms -- so I at least have some experience and am not speaking blindly. I can also say that I've never encountered an asm OS that was easy to port to a different platform...

Just my views...
Jeff
ZOSdever
Member
Member
Posts: 79
Joined: Thu Mar 31, 2005 12:00 am
Contact:

Re: PASCAl or C

Post by ZOSdever »

Ok. I try.
Crazed123
Member
Member
Posts: 248
Joined: Thu Oct 21, 2004 11:00 pm

Re: PASCAl or C

Post by Crazed123 »

Just one itty bitty problem: FreePascal, and Pascal in general, along with most variants of C, don't allow accessing the data placed on the stack by the processor when running an interrupt, IE: saved registers.
rexlunae
Member
Member
Posts: 134
Joined: Sun Oct 24, 2004 11:00 pm
Location: North Dakota, where the buffalo roam

Re: PASCAl or C

Post by rexlunae »

Crazed123 wrote:Just one itty bitty problem: FreePascal, and Pascal in general, along with most variants of C, don't allow accessing the data placed on the stack by the processor when running an interrupt, IE: saved registers.
Well, that's what you need inline assembly for. Although, you can access the data placed on the stack if you do some weird things with C. Function parameters are just stack data, specifically formatted, so you could have an assembly stub call a C function with parameters constructed to coincide with the things the processor put on the stack.
ZOSdever
Member
Member
Posts: 79
Joined: Thu Mar 31, 2005 12:00 am
Contact:

Re: PASCAl or C

Post by ZOSdever »

OOOOOOOOOOOOOkkkkkkkkkkkkkkkkk. Thanks.
ZOSdever
Member
Member
Posts: 79
Joined: Thu Mar 31, 2005 12:00 am
Contact:

Re: PASCAl or C

Post by ZOSdever »

For the time being I going to ditch pascal and stick to C.
Post Reply