zlacker

MenuetOS - An OS written entirely in assembly

submitted by raheem+(OP) on 2010-07-07 18:38:35 | 62 points 26 comments
[view article] [source] [links] [go to bottom]
replies(9): >>makman+92 >>yason+W3 >>wazoox+V4 >>varjag+a5 >>teilo+o5 >>sabj+vi >>jeberl+or >>Locke1+uu >>dnswor+tQ
1. makman+92[view] [source] 2010-07-07 19:25:37
>>raheem+(OP)
Years ago, I booted this off a floppy drive and was impressed by how feature rich it was given that it was written from scratch in assembly language. Looks like it's prettier now.
2. yason+W3[view] [source] 2010-07-07 20:03:40
>>raheem+(OP)
Writing this in C would be how much slower? Not much.

Modern bloat comes from the software footprint, not so much about performance gains anymore. Compare the UI of MenuetOS with the latest GTK and the 100 shared libraries involved.

It's not so much that C would be slow but that with C and high-level languages it's very easy to do lots of the wrong kind of work.

replies(4): >>jasong+Y3 >>moomba+a4 >>mfukar+95 >>DrJoke+R7
◧◩
3. jasong+Y3[view] [source] [discussion] 2010-07-07 20:04:58
>>yason+W3
"Writing this in C would be how much slower? Not much."

Source?

replies(1): >>Locke1+V91
◧◩
4. moomba+a4[view] [source] [discussion] 2010-07-07 20:08:31
>>yason+W3
I remember when I was taking an assembly class in college we always joked about how ridiculous it would be to write an OS in assembly. I'm surprised someone actually did it.

C is so close to assembly that these seems quite unnecessary. Although I do agree with one of the developer's points that Assembly has a kind of beauty about it.

replies(3): >>philwe+I7 >>tekham+ti >>watmou+hp
5. wazoox+V4[view] [source] 2010-07-07 20:25:21
>>raheem+(OP)
Be sure to check Triangle OS: http://www.wcools.nl/

It's even more impressive because it's a one-man effort, IMO.

replies(2): >>tekham+pi >>Joeboy+Jr
◧◩
6. mfukar+95[view] [source] [discussion] 2010-07-07 20:29:18
>>yason+W3
Let's not turn this into C vs assembly again. People are free to choose their favourite language to develop a hobbyist OS - and do a pretty good job in the process.
7. varjag+a5[view] [source] 2010-07-07 20:29:21
>>raheem+(OP)
Cool! Now, is there a HOWTO for re-building it to my ARM phone? ;)
replies(1): >>oliveo+m5
◧◩
8. oliveo+m5[view] [source] [discussion] 2010-07-07 20:32:32
>>varjag+a5
that's the thing with assembly, you can't port it that easily.
replies(2): >>varjag+b8 >>Hoff+J9
9. teilo+o5[view] [source] 2010-07-07 20:33:25
>>raheem+(OP)
Assembly gives you the ability to write finely tuned, lightweight, fast software. It also gives you the ability to write poorly designed, bloated, slow software.

Replace the word "Assembly" with "C" in the above sentence, and it remains true.

Good on them for doing it Assembly. I don't have the patience for Assembly or C, so I appreciate those who do.

replies(1): >>albert+rj
◧◩◪
10. philwe+I7[view] [source] [discussion] 2010-07-07 21:07:02
>>moomba+a4
Back in the day, every OS was written in assembly. Writing Unix in C rather than assembly was actually a controversial innovation at the time.
replies(1): >>mahmud+Hb
◧◩
11. DrJoke+R7[view] [source] [discussion] 2010-07-07 21:08:44
>>yason+W3
The point of writing software in assembly is exactly the same as writing an OS (or even a kernel): fun and self-education. I mean, they probably don't mean to take over the current mainstream x86 operating system with MenuetOS, I believe it's more about fun and learning. The same is true for writing code in assembly; it is a lot of fun (at least for me) and you learn a lot about how the underlying architecture of your chosen platform really works.
replies(1): >>CUVipe+No
◧◩◪
12. varjag+b8[view] [source] [discussion] 2010-07-07 21:16:27
>>oliveo+m5
well, exactly
◧◩◪
13. Hoff+J9[view] [source] [discussion] 2010-07-07 21:44:35
>>oliveo+m5
You use a compiler that accepts the assembly code, and produces output for the target architecture.

This was how DEC VMS was ported from VAX to Alpha and later to Itanium, as a substantial part of that operating system is written in VAX Macro32 assembler.

replies(1): >>varjag+db
◧◩◪◨
14. varjag+db[view] [source] [discussion] 2010-07-07 22:14:29
>>Hoff+J9
That however is very much one-way street. Porting native Itanium assembly (I know, I know..) to VAX would be substantially more challenging task.

Similarly, if you attempt to port this (admittedly neat) system to ARM using such approach there'd be a lot of bumps. Beginning with all those clever SSE2 hacks not being able to expand automatically, through deficiency of caching and optimization assumptions made for original architecture in new circumstances, to conceptual mismatch of certain parts. E.g. what if you want to handle a case when system has to boot up in ARM Thumb mode? You just can't abstract that away with assembly.

◧◩◪◨
15. mahmud+Hb[view] [source] [discussion] 2010-07-07 22:22:44
>>philwe+I7
Unix was written in PDP-7 assembly and then ported to C.

The porting to C also cemented C's winning of the systems programming race, and fully liberated systems programmers from the underlying machine. C made the machine-word obselete by standardizing on a few types with relative widths.

If that wasn't the case, something like BLISS would have caught on, and BLISS didn't look the same on different platforms; its data types mapped 1:1 to underlying machine words and you had to deal with explicit alignment, allocation, and linkage. Explicit addressing modes and explicit heap and stack allocation modes. IOW, a royal pain in the butt, even though bliss was expression-based and well thought out (read all about Olin Shivers' praises for Bliss, though personally I don't see why: http://www.paulgraham.com/thist.html)

C is good.

◧◩
16. tekham+pi[view] [source] [discussion] 2010-07-08 01:31:10
>>wazoox+V4
Last updated in 2003. I think he got a job. Pity.
◧◩◪
17. tekham+ti[view] [source] [discussion] 2010-07-08 01:36:24
>>moomba+a4
As pointed out, this was normal. My favourite was RiscOS on the Acorn Archimedes. The GUI OS would boot (off ROM) quicker than the CRT monitor would take to warm up. And that was 20 years ago.
18. sabj+vi[view] [source] 2010-07-08 01:38:28
>>raheem+(OP)
Hearing stories like this makes me think about how things 'used to be done' - what was once common practice now seems like an impressive parlor trick, cool hack, or marathon of hacker cool!
◧◩
19. albert+rj[view] [source] [discussion] 2010-07-08 02:00:56
>>teilo+o5
Replace that with most other languages.
◧◩◪
20. CUVipe+No[view] [source] [discussion] 2010-07-08 05:04:32
>>DrJoke+R7
In fact this is exactly how Linux got its start -- check out Torvalds' "Just For Fun".
◧◩◪
21. watmou+hp[view] [source] [discussion] 2010-07-08 05:22:25
>>moomba+a4
What about writing a dtp package in arm assembler? My first job, check out:

http://www.cconcepts.co.uk/products/publish.htm

Lol. Looking at those dialogs brings it back. I probably laid most of those suckers out.

22. jeberl+or[view] [source] 2010-07-08 07:02:30
>>raheem+(OP)
Kids stuff. Try doing that on a Z80. http://en.wikipedia.org/wiki/SymbOS
◧◩
23. Joeboy+Jr[view] [source] [discussion] 2010-07-08 07:18:08
>>wazoox+V4
I think Ville Turjanmaa wrote almost all of Menuet.
24. Locke1+uu[view] [source] 2010-07-08 09:19:17
>>raheem+(OP)
If they wrote this in pure assembly as a personal project: congratulations and good on them. However, if they actually believe that this is a performance benefit I have to say that they know just enough about hardware optimization to be dangerous.

One of the great things about writing the core in C and then either optimizing for the compiler or writing the inner loop in the target ISA is that one can adapt with the CPU architecture. Anyone who has done development for true high performance architectures knows that you need to optimize for memory architecture as much as CPU architecture. When the new Xeons come out with double the L2 and a larger cache line and X cores in NUMA layout, writing everything in the Pentium 3 ISA is going to look pretty stupid.

25. dnswor+tQ[view] [source] 2010-07-08 18:17:52
>>raheem+(OP)
This reminds me of a guy I knew who wrote an ASM based OS for the m68k called Synthesis or Synthetix or something like that. It even had it's own window manager, and was apparently blazingly fast. It was especially as a developer station as they'd written their own C compiler in assembly that for it's time was (allegedly) the fastest compiler out there. I think his name was Henry Massalin.
◧◩◪
26. Locke1+V91[view] [source] [discussion] 2010-07-09 02:07:01
>>jasong+Y3
C wouldn't be slower, it would be faster. See my other comment.
[go to top]