Hi all,
I'm learning to program in assembly language. I would like to learn programing ASM in pure form, no calling c functions (functions like printf, scanf and others), win32 library, etc. So can someone suggest any books which teach the x86 asm in its "purest" form.
Thanks
I'm learning to program in assembly language. I would like to learn programing ASM in pure form, no calling c functions (functions like printf, scanf and others), win32 library, etc. So can someone suggest any books which teach the x86 asm in its "purest" form.
Thanks
You won't get very far without calling win32 library functions, as Windows, like all modern OSes, runs your applications in a protected environment, where direct hardware access is prohibited. Even device drivers can't just do what they want, they will still need to call some kernel functions in order to work correctly.
So even basic operations such as opening files, or even just terminating your program (ExitProcess()) will require you to call win32 libraries.
So even basic operations such as opening files, or even just terminating your program (ExitProcess()) will require you to call win32 libraries.
So we have to use win32 to do useful stuff?
And what books do you suggest using, first to learn asm. And what linker has to be used along with NASM?
Thanks.
And what books do you suggest using, first to learn asm. And what linker has to be used along with NASM?
Thanks.
You can always write your own OS - this way you can write "pure asm". I don't see any reason in doing that, though. You'll spend like a year or two before you write anything visibly useful.
So we have to use win32 to do useful stuff?
Well, that's why they call it an operating system.
The OS supplies all the basic functionality like filesystems, network sockets, audio/video drivers etc so you don't have to do all that stuff yourself. Which in a way is not possible anymore anyway. People who experienced the DOS era, will know what I'm talking about.
DOS was not really much of an OS apart from basic disk operations and console IO. If you wanted to do something 'fancy', such as graphics, audio, printing or yes, even networking, you had to write your own code, since DOS didn't provide any hardware support... it didn't even have a driver model, you just used a terminate-and-stay-resident hack to handle interrupts with your own code at the lowest level.
Especially with games this became very problematic. When the first soundcard arrived, it was easy to support it. Then when a competitor came along, it was still doable to support two cards in your game... but pretty soon there were tons of different soundcards, and supporting them all was no longer an option.
Likewise for videocards... supporting standard CGA, EGA, VGA was doable, but SVGA or 3d acceleration... not really an option. And it became harder for end-users as well. They had to know what hardware their system had, and configure all their games to use the correct IRQs, DMA channels and base addresses.
Windows offers DirectX to take care of all that, so things just work, regardless of what underlying hardware you have. People no longer even think about what brand of videocard or soundcard they buy, because it's not an issue anymore. You know that any product on the market will be supported in Windows and just work.
Really, you don't want to avoid using an OS, if you actually want to write a piece of software that works.
They had to know what hardware their system had, and configure all their games to use the correct IRQs, DMA channels and base addresses.
Amen! Whoever tells those stories of how great it was when we were younger never had to fiddle for hours with autoexec.bat and config.sys to get their game not just to start but also play with music. :)
Best Story I have is "Eric the Unready" - a masterpiece of textadventurism - and I didn't know that it had sound until I was almost done playing it.
Not only the .bat files, but didn't we have to fiddle with the bios at times also!?! BUT when we DID get sound in our games or the display to show correctly, it was such a great moment and feeling ;)
Not only the .bat files, but didn't we have to fiddle with the bios at times also!?! BUT when we DID get sound in our games or the display to show correctly, it was such a great moment and feeling ;)
True, there was a certain charm to it.
I always think back to the DOS days when I hear linux people boasting about how they are tweaking their system with all sorts of obscure scripts and tools, so they can run all sorts of applications and get the best possible performance.
Linux never quite appealed to me in that way, but perhaps that is because I 'went through that phase' already, back in the DOS days.
I suppose most of us had trouble accepting Windows in the early days... but once I had written my first DirectDraw application and found out that it was pretty much the same speed as the DOS version I made, with raw mode 13h stuff, on my trusty old 486, I was convinced: Windows actually works. The stories of Windows being bloated and slow weren't all true. You could get virtually the same performance as raw DOS applications, but without all the hassle. I haven't looked back since.