Re: PASCAl or C
Posted: Wed Mar 30, 2005 12:00 am
I also just got a new OS writen in PASCAL.
The only "real" reason not to code in Assembly should be that you don't want to.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
You're assuming it's one or the other -- the alternative to assembly isn't inline assembly.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.
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.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.
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.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.