Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
104 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Introduction
 Why Assembly
 Language?

 Win32 ASM Basics
 The Design
 Document

 Code Framework
 Until Next Time

 Printable version

 


  The Series

 Part 1
 Part 2
 Part 3
 Part 4
 Part 5
 Part 6

 

Why Assembly Language?

Many of you are probably wondering why anybody in their right mind would write in pure assembly language. Especially in the present, when optimizing compilers are the "in" thing and everybody knows that VC++ is bug free, right? Okay I think I answered that argument ... but what about assembly language being hard to read, non-portable, and extremely difficult to learn. In the days of DOS these arguments were very valid ones. In Windows though, they are simply myths left over from the good old days of DOS. I might as well approach these one at a time.

First, assembly language is hard to read. But for that matter so is C, or even VB. The readability results from the skill of the programmer and his/her thoroughness at commenting the code. This is especially true of C++. Which is easier to read: Assembly code which progress one step at a time ( e.g. move variable into a register, move a different variable into another register, multiply ), or C++ code which can go through multiple layers of Virtual Functions that were inherited? No matter what language you are in, commenting is essential ... use it and you won't have any troubles reading source code. Remember just because you know what it means doesn't mean that everybody else does also.

Second, the issue of portability. Granted assembly language is not portable to other platforms. There is a way around this, which allows you to write for any x86 platform, but that is way beyond the scope of this article series. A good 80-90% of the games written are for Windows. This means that the majority of your code is specific to DirectX or the Win32 API, therefore ... you won't be porting without a huge amount of work anyway. So, if you want a truly portable game, then don't bother with writing for DirectX at all ... go get a multi-platform development library.

Finally, there comes the issue of Assembly Language being extremely difficult to learn. Although there is no real way for me to prove to you that it is easy, I can offer you the basics, in a few pages, which have helped many people, who never saw a line of assembly language before, learn it. Writing Windows assembly code, especially with MASM, is very easy. It is almost like writing some C code. Give it a chance and I am certain that you won't be disappointed.





Next : Win32 ASM Basics