Reputation: 51
I want to try to write an operating system in assembly. PLEASE, don't just say "Idiot, you have to get a lot better at %s, %s, %s, %s, etc to even think about that." I know it's normally not a learn-by-doing thing and it will take months of work, but I want to try and if I don't get an answer here, I'll just ask somewhere else. Could you please either link me to a getting started tutorial with nasm, or a way to, in assembly, write to the screen without using C functions? I know pretty much all the main assembly instructions and I have coded for a long time. Edit: I want to use nasm and win32
Upvotes: 5
Views: 758
Reputation: 25268
If you're tageting Win32, there's classical Win32 Assembly Tutorials by Iczelion: http://win32assembly.online.fr/tutorials.html
Upvotes: 0
Reputation: 25781
To cite Nick Morgan, with whom I agree:
Well, I don’t think learning x86 is useful. I don’t think you’ll ever have to write assembly language in your day job – this [learning assembler] is purely an academic exercise, something to expand your mind and your thinking. 6502 [an assembly language] was written in a different age, a time when the majority of developers were writing assembly directly, rather than in these new-fangled high-level programming languages. So, it was designed to be written by humans. More modern assembly languages are meant to written by compilers, so let’s leave it to them. Plus, 6502 is fun. Nobody ever called x86 fun.
I am currently also writing an "operating system" for fun, in the DCPU-16 assembly language (you might have heard of it). It's fun because I can use one of many available in-browser "IDEs", such as this one , and I guess that the same principles you'd need to understand for x86 assembly apply.
Upvotes: 0
Reputation: 1452
Besides the other excellent suggestions above, there's a Nasm Forum ( and you can get recent versions of Nasm and the Friendly Manual) at:
It may seem strange that the "Netwide" assembler has a country-code in it's homepage. Don't think of it as "United States", think of it as "Like, Nasm us, dude!" :)
Since BIOS interrupts won't be available once you switch to pmode, it makes sense to learn how to access hardware directly. Writing to the screen is an easy one to start with. You need to know that "the screen" is normally at 0xB800000 (B800:0000 in segment:offset form - which you will probably need). You'll need to know the layout is one (even numbered) byte for the character and one (odd numbered) byte for the "attribute" (color, mostly). Even though you're not using interrupts, RBIL also includes "ports.lst" which you might find helpful. And as noted above, osdev.org is your new best friend!
Happy Bootin',
Frank
Upvotes: 2
Reputation: 6575
The only way to do it without using C functions or system calls is to have your assembly code run without any other operating system, or run inside an emulator like Bochs or QEMU.
Here is a simple tutorial for nasm that writes to the screen and does not use C functions, and at that level, is not dependent on Win32. If you want to write something that does such things while running in windows, then I am afraid that C function are about the only way unless you can learn some software interrupt interface for doing such.
As an aside, osdev.org contains many good articles and tutorials, including many on how to write code in assembly, for many different aspects of operating system development.
Upvotes: 1