Handmade Hero»Forums»Code
ambiguous panda
11 posts
asm development environment
Edited by ambiguous panda on
can anyone recommend an asm tool chain for building from windows, i am currently using the GNU Assembler from MinGW with emacs, with no debugging, the default debugger that comes with MinGW is ridiculous.

also, how realistic is asm for games, i have manage to port 50% of handmade hero but am wondering how practical will this be when the code becomes more complex

i am not a fan of emacs, but its the best tool i can find for asm with fancy things like syntax highlighting.

Visual Studios has an asm plugin, but it cant be used with the express version. the usertype.dat solution just plain dont work anymore, and it can only compile masm which is not cross platform.
Patrick Lahey
67 posts
asm development environment
I'm not a professional game developer so I can't speak specifically to games but I can tell you in other domains where performance and careful control over resources is important (like scientific computing and simulation) asm is not used extensively. Assembly tends to take longer to write and to be harder to modify than code in C or C++. The trade off is just not worth it for the vast majority of the code base. In many cases the CPU is not even the primary bottle neck - it is feeding it the data that it needs to crunch.

As an educational exercise, learning assembly is great and it can help you even when you are writing C and C++. I would not call writing everything in assembly a practical choice these days, however.
70 posts
innovation through irritation™
asm development environment
Edited by d7samurai on
You don't need to use the Express version anymore:

November 12, 2014

Visual Studio Community 2013 is a new (FREE) edition that enables you to unleash the full power of Visual Studio to develop cross-platform solutions. Create apps in one unified IDE. Get Visual Studio extensions that incorporate new languages, features, and development tools into this IDE. (These extensions are available from the Visual Studio Gallery.)

There are two main differences between Visual Studio Community Edition and the Express Editions:

1) Visual Studio Express Editions do not allow users to use extensions (aka. plugins). There are over 5000 great plugins for Visual Studio in Visual Studio Gallery. Plugins such as Developer Assistant can boost developers’ productivity. Unfortunately, they are not available to Visual Studio Express users. With Visual Studio Community Edition, you can access and use All of them!

2) Visual Studio Express Editions are targeting specific platforms: Express for Web allows you to develop Web apps; Express for Windows allows you to develop Windows apps; Express for Windows Desktop allows you to develop desktop apps. But with Visual Studio Community Edition, you can develop projects targeting cross-platforms.

http://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx
Mārtiņš Možeiko
2559 posts / 2 projects
asm development environment
I recommend using yasm: http://yasm.tortall.net/ It can be used also on Linux and OSX, so you can write your assembly code only once using one syntax. It accepts both Intel and GNU assembly style syntax. And it can generate debug info either for gdb or for Visual Studio. And a lot more useful stuff.

And it integrates into Visual Studio IDE pretty well, if that's your thing: https://github.com/yasm/yasm/wiki/Visualstudio2005 (yasm.rules file)
16 posts
asm development environment
Maybe someone knows good(or best) learning resources for assembly language? (I think best NASM OR MASM). Books?
I need to get practical and educational exercise
11 posts
asm development environment
I've used (long time ago) MASM32 (http://www.masm32.com) and FASM (http://flatassembler.net/). I don't think there is any need for writing stuff in assembly nowadays. Snippet here and there - yes, whole program - no.
As for tutorials: Iczellion's (http://win32assembly.programminghorizon.com/tutorials.html) are pretty popular, but I'm unsure of their quality.
More information could be found on software reverse engineering and demoscene sites.
Patrick Lahey
67 posts
asm development environment
#AltDevBlog had some good stuff. It died some time ago but you can still browse using the way back machine:

C/C++ Low Level Curriculum (linked to last article I am aware of, has links to previous)

Some of the stuff from #AltDevBlog also made its way to Gamasutra:

x64 ABI: Intro to the Windows x64 calling convention

Finally, this has a lot of material and links to more:

Software optimization resources
16 posts
asm development environment
itsuart thank you for response.
Livet Ersomen Strøm
163 posts
asm development environment
I wonder what would happen on the yearly "physicist-convention", if someone raised their hand and introduced Boson++, the high level standardized particle program. That just was this Donald Duck book, with pictures of elementary atoms. - This is much easier than to study particles! Now we can study them without actually knowing anything much about them! Instead, let's just become very good at guessing what happens when particles interact, inside of the atoms. Fuck particles! Who the fuck needs them? Let's just do atoms from now on!
Patrick Lahey
67 posts
asm development environment
You may find this useful. The (free) source code download for this book:

Modern X86 Assembly Language Programming 32-bit, 64-bit, SSE, and AVX

includes appendix A which shows how to get up and running with assembly in visual studio 2013.
70 posts
innovation through irritation™
asm development environment
Edited by d7samurai on
@kladdehelvete:

there's a difference between our academic understanding of a system and the most practical level on which to interact with it.

do you think there is anything to gain by relating to everyday objects, like a bicycle or a carton of milk, as a collection of subatomic particle interactions?

it's commonly useful to simplify certain things for the sake of accessibility - without that implying we are sacrificing our ultimate knowledge of them.
Andrew Bromage
183 posts / 1 project
Research engineer, resident maths nerd (Erdős number 3).
asm development environment
Kladdehelvete
Fuck particles! Who the fuck needs them? Let's just do atoms from now on!

I used to work in nanotech, with lots of very smart physicists and physical chemists. Not once during that time did I hear the word "quark" uttered. When you're working at the level of crystals, or fluids, or semiconductors, or magnets, it just never comes up.

High energy physics has been in the news a lot lately and for good reason, but most physicists work with what they call "condensed matter". If it helps, translate that as "everyday matter".
Livet Ersomen Strøm
163 posts
asm development environment
Pseudonym73

I used to work in nanotech, with lots of very smart physicists and physical chemists. Not once during that time did I hear the word "quark" uttered. When you're working at the level of crystals, or fluids, or semiconductors, or magnets, it just never comes up.

High energy physics has been in the news a lot lately and for good reason, but most physicists work with what they call "condensed matter". If it helps, translate that as "everyday matter".


I agree it may be a bad example. Physicists these days sound more like priests. They cannot know that much about their own field, can they? When you're unsure about whether real choice is possible or not. And then you fail towards the world being "magic"? And they are not in consensus, either? The default view would imo of course be that if we had choice, all hell would have broken loose. And that a free choice actually *requires* determinism. And that any other idea would fail occams razor for the same reason that religion does. Maybe that's why Sean Carroll are debating in churches these days? =))

If you haven't seen it, I would recommend this interview with Michio Kaku, which is one of the more interesting interview I can recall to have seen.

https://www.youtube.com/watch?v=AAEB-5GOCJ4

and maybe also this one, for background:

https://www.youtube.com/watch?v=SuukrcJuHXw

(the last one is an interview with Gordie Rose, a guy working at D-Wave Systems, Inc. at trying to make quantum computers work. In the first interview, Michio strongly doubts Gordie Rose's work. But Google is funding this guy with like 100 millions or something.

I think these two interviews are beautiful if you watch them together and pay close attention to the details.

Not everything is about details. But I would say, especially at a time like ours, where a graphicscard bought 4 years ago, still is worth about the same amount of money as you paid for it then..and soon do double duty as electric radiator, that there has never been a time where intimate knowledge of assembly could possibly pay better off.

And I mean that on multiple levels. First of all, once trained well in assembly, it becomes easier to work with than any other language. But more important is the process that this leaves behind in your mind. Can you really know music, without working with notes? Who is smarter? Your conscience, or your subconscious? In my view the subconcious does 99% of the work. What matters is what you feed it.

I would make a qualified guess, that unless you feed your sub-conscious the tiniest details, as often as possible, it will not be able to do half as much good work as if you do. It will lift your potential, dramatically, relative to your talent. How could any serious coder want to work with anything less then the best?

I am now of the view, that unless you make assembly your first choise in languages, you will find it 10 times harder to make new ideas and discoveries in this field, and have a 100 times a harder time to implement them.
Andrew Bromage
183 posts / 1 project
Research engineer, resident maths nerd (Erdős number 3).
asm development environment
Kladdehelvete
[...] there has never been a time where intimate knowledge of assembly could possibly pay better off.

I don't think that anyone in this thread has disputed the idea that thorough knowledge of assembly knowledge pays off for a programmer.

First of all, once trained well in assembly, it becomes easier to work with than any other language.
According to my CV, I know over 60 programming languages to varying levels of fluency. In my (admittedly biassed) experience, every language you learn makes programming easier. The more different a new languages is from what you already know, the better.

But more important is the process that this leaves behind in your mind. Can you really know music, without working with notes?
Obviously. You can't know music without knowing something about waveforms, harmonics, and acoustics. Good orchestrators pay attention to things like not scoring a note that would clash with an overtone from another instrument. You also don't know music without knowing about counterpoint, harmony, form, history, and culture.

(You may find that last point a little hard to believe. Consider that Elvis Presley's music sounded shocking in the 1950s, but today it just sounds old. How an audience responds to music partly depends on how it has been culturally conditioned. I've observed this effect in my lifetime; I remember how aggressive and edgy Def Leppard, KISS, Billy Idol, etc sounded. Now that stuff seems almost twee.)

I would make a qualified guess, that unless you feed your sub-conscious the tiniest details, as often as possible, it will not be able to do half as much good work as if you do. It will lift your potential, dramatically, relative to your talent.
I think that if the industry thought this way, we would have learned nothing from the Software Crisis. Software engineering is fundamentally about taming complexity. Part of the job is to know which details matter and when. Most of the job is to understand what the central problem at hand is at any given moment.

Good programmers think at multiple levels, often simultaneously. The best programmers know how to spend time on important details, while keeping large-scale structure in mind, while ignoring unnecessary details. Detail for detail's sake is not a virtue.

Chances are close to guaranteed that your favourite pieces of software, the ones you use every day, were written by programmers who know assembly, but choose not to use it the vast majority of the time.
Patrick Lahey
67 posts
asm development environment
Absolutely this:

Software engineering is fundamentally about taming complexity. Part of the job is to know which details matter and when. Most of the job is to understand what the central problem at hand is at any given moment.

One source of complexity is simply code volume - the more code there is the harder it is to get your mind around. I'm reminded of Steve Yegge's story of a large system written entirely in assembly that was too big to really understand anymore:

...we were writing this giant assembly-language system.

...we couldn't see how the system worked anymore!

Small systems are not only easier to optimize, they're possible to optimize. And I mean globally optimize.

Yegge uses this to argue for higher level dynamic languages and that is certainly a solution for certain kinds of systems. I think that you can still use lower-level languages like C to build large understandable systems, but it requires focusing on APIs to raise the level of abstraction in a way that fits the system you are trying to build.