Linked by Thom Holwerda on Thu 21st Nov 2013 18:48 UTC, submitted by Rohan Pearce
OSNews, Generic OSes

MenuetOS sits in an interesting nexus between astonishing technical achievement and computerised work of art. The super-speedy, pre-emptive multitasking operating system is still, despite adding more driver support, more included applications, an improved GUI and digital TV support over the years, capable of fitting on a floppy disk (assuming you can find one).

MenuetOS is a technical marvel. Not only is it written entirely in assembly, it also shoves a fully capable multitasking operating system on a single floppy disk.

Thread beginning with comment 577321
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: Comment by MOS6510
by twitterfire on Fri 22nd Nov 2013 19:33 UTC in reply to "RE: Comment by MOS6510"
twitterfire
Member since:
2008-09-11

And I have to ad that modern compilers optimize better than a programmer can optimize the ASM by hand.

There's really no reason why you should use ASM instead of C or C++ on a PC.

Long time ago compilers weren't as good at optimizing the code as today and you could do interesting stuff under DOS in ASM. That's why I learned and wrote a bit of x86 assembly many years ago. But I can be much more productive in C, C++.

As I understand, this is a hobby OS, so the guys who are wroting this do it for fun. The choice of the language doesn't matter if you do it for fun.

Reply Parent Score: 3

RE[3]: Comment by MOS6510
by Alfman on Fri 22nd Nov 2013 23:29 in reply to "RE[2]: Comment by MOS6510"
Alfman Member since:
2011-01-28

twitterfire,

"And I have to ad that modern compilers optimize better than a programmer can optimize the ASM by hand."

"There's really no reason why you should use ASM instead of C or C++ on a PC."

Sounds like something a C programmer would say ;) Joking aside, it depends. The compilers might do better in a great many cases with average programmers, however it's still possible to find edge cases where they still do worse.

I absolutely prefer using C over Asm for all the usual reasons, I wince when I think about maintaining and porting large amounts of assembly code. However code that benefits from direct access to special CPU features like arithmetic flags will be at a disadvantage in C because they are completely unrecognized in the C language.

It's complicated to fix this aspect of C in any kind of portable way because some architectures do not have the same semantics or even implement flags. Rather than define a C standard for flags (and force all architectures to emulate them), the C language just ignores that flags exist, which forces programmers to use more complex flagless algorithms instead. In some cases the compiler can reverse engineer these algorithms and optimize them to use flags, other times it cannot.

Unfortunately it's not always just a matter of making the compiler more intelligent. Even if it could recognize that flag based algorithm A (which cannot be expressed directly in C) is similar to algorithm B (which can be expressed in C), it still doesn't necessarily imply algorithm B can be converted back to algorithm A. For example, B might produce different results for certain numerical boundary conditions that aren't important to the programmer, but the compiler cannot make the assumption that the algorithms boundary conditions were unintentional. It's forced to generate machine code with equivalent semantics as algorithm B was expressed.


So, while I'd agree with you in general that developing at a higher level is preferable, there are still times when C code can be more difficult to optimize because the optimal code for the platform cannot be expressed in it. Although I think it would be hard for inexperienced assembly developers to be able to recognize these cases.

Reply Parent Score: 3

RE[4]: Comment by MOS6510
by gass on Sun 24th Nov 2013 17:44 in reply to "RE[3]: Comment by MOS6510"
gass Member since:
2006-11-29

For general OS: Just forget scripting and middle frameworks and use something like vala, that compile to C code.

The main issue in general OSses, mainly windows and linux (distributions), is that they abuse of scripting (or java, or C#, or javascript) to get the feature X and Y.
So ... instead of moving to the low level ASM ... maybe, we could just pass it to the less lower level C to get them improved.
Writting ASM code is only worth it in base OS or ultra complex optimized application (one in millions).

Reply Parent Score: 1