Author Topic: Windows assembly language?  (Read 14775 times)

Offline flatcircuit

  • Jr. Member
  • *
  • Posts: 4
Windows assembly language?
« on: October 10, 2015, 09:52:29 PM »
I looked around a little and found some information on Windows assembly language, specifically Win32 asm. I have a couple of questions, as I have still not been able to get started with asm.

DOS is 16 bit, so there is asm using a large list of interrupts. This is very straightforward, so it's pretty much how you would use asm with DOS. However, with Win32 there is a lot of information on using C calls and basically making use of the Win32 api, also straightforward, but a little confusing for me. If I don't want to program using the windows api and would prefer to more so make console mode programs, is there another way to go about using NASM to write DOS/like programs or console mode programs for Windows. Since Windows does not support com files without an emulator, is there anything else available.

In other words, anything post DOS/Windows, are we simply forced to use the Win32 api. I'm already guessing the answer is yes, so I have another question, but please correct me if necessary.

The other question is a relationship between DOS interrupts and Win32. Is there some kind of comparison or translation document, that maps what can be compared to what between DOS and Windows? The reason I ask is, that there is a ton of information for DOS such as the Ralf Brown interrupt list, and personally, it seems like I might have better luck learning asm using FreeDOS. I also heard that it's much better to simply program in C/C++ using the Win32 api, but my whole point is for wanting to correctly learn assembly language.

What do you guys suggest. PS: Linux is not out of the question. It's more DOS like, but Windows is much more useful to me!

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: Windows assembly language?
« Reply #1 on: October 11, 2015, 01:50:45 AM »
First, please realize that when you use assembly your targeting a specific brand, or class, of CPU.  Linux, Windows, etc., are simply the operating systems that run on top of that.  Thus there is no Windows assembly language - only the specific way that you call the api of the OS when programming with assembly.  What you understand of assembly for that class of CPU is applicable to all operating systems running on it.  When you get to the point that you understand the C calling convention from an assembler point of view the light-bulb moment will happen for you.

Second, my personal opinion is that learning the intricacies of DOS is a waste of time.  DOS has been dead for over a decade.  Pick a modern OS (Linux, Windows, BSD, etc.) and learn with that.  The learning curve is nearly identical.  From an applications programmer point of view it's actually easier since you don't have to worry about interrupts or IO ports (the OS won't let you touch them anyways unless your writing kernel drivers).

Finally, Linux is nothing like DOS.  While it's true that both have a command line (so does Windows) Linux is a multi-user, multi-tasking, operating system suitable for running on your desktop, server, various hardware devices (such as Android cell phones) or even NASA space probes.

In a nutshell: when starting out pick an OS you're comfortable using and start there.  I recommend using C library calls when obtaining input or printing out strings simply because you avoid having to learn OS-specific APIs and the knowledge you gain from that is easily transferable to just about any other OS.

Offline flatcircuit

  • Jr. Member
  • *
  • Posts: 4
Re: Windows assembly language?
« Reply #2 on: October 12, 2015, 11:04:58 PM »
Thank you for the info.

If you could, please tell me more about what you are referring to when you mean C Calling convention from an assembler point of view? Even if it's a little advanced, I would be interested in searching or looking up additional info.

Also, you mentioned C library calls for strings and input? Do you mean the standard c library?

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: Windows assembly language?
« Reply #3 on: October 13, 2015, 03:43:37 PM »
Thank you for the info.

If you could, please tell me more about what you are referring to when you mean C Calling convention from an assembler point of view? Even if it's a little advanced, I would be interested in searching or looking up additional info.

Start here: https://en.wikipedia.org/wiki/X86_calling_conventions

Also, you mentioned C library calls for strings and input? Do you mean the standard c library?

Yes.  Since you mentioned you have experience with C in another thread then you should learn how to call those same methods when coding with assembler.  You'll gain much knowledge by writing little assembly programs that take input and produce output using that library.  Once you understand how it's done then you'll be happy to know it's just as easy when developing more advanced programs since the setup is nearly identical.