Computing - Languages - Assembly


Assembly



1. Introduction

I did a little assembly-language around 1990, using Borland's Turbo-Assembler, and books by Dunteman and Abrash. This was theoretically interesting, and a good counterpart to some more theoretical knowledge that I had, e.g. from Minsky's "Finite and infinite machines".

Assembly showed best what in fact is going on and required to make a machine do things (apart from the hardware) and it clarified quite a lot for me in principle and practice about computers, since one really must learn the fundaments of processing, and it also clarified quite a few things  about higher level programming languages.

For it also made clear that it takes a lot of coding to get something useful done by Assembly, at least then and there: with Turbo-Assembler, for the 8088, using only Assembly; that much of this coding is in the nature of administrative work (putting the right things in the right registers at the right time to be computed by the processor's routines); and that higher level languages make a lot of practical sense - and can be very sensibly regarded as syntactic sugar of assembly (or of C, like the Prolog I used, which was translated to C to be compiled by a compiler for C).

After that, having no special interest in making something run really fast on an 8088-processor, I didn't do much about Assembly, although I found out that modern machines have more registers than the 8088 I coded some Assembly for, and that I better not use the Turbo Assembler I had on Windows XP.

2. Recommended

Recently I decided to delve a little deeper into the innards of computing, and was very pleasantly surprised to find Masm32, which is a free version of the Microsoft compiler for Assembly, that comes with a nice code-editor for it called qeditor, and for which there also is a really fine IDE called MasmEd. To me it seems Masm32 is a considerable improvement over the Turbo-Assembler I knew.

If one really wants to learn about the fundamentals of programming and of computers, this seems the way to go.

And given sufficient health, I will certainly walk at least part of this road myself, simply because I want to know about programming and computers on a fundamental level.

3. Other assemblers

Indeed - after some two years of incidental fiddling with various assemblers other than Masm32 - it seems to me that for anyone who does not know assembly well to start with, Masm32 + MasmEd + Iczelion's Tutorials is by far the best way to proceed, in my experience.

My reason to say so with some confidence is that I have - hampered by ill health - tried most available free assemblers between 2007 and 2009, and these do not work for me: I got stuck at some point, usually because of lacking or unclear documentation.

Here is a brief review of my experiences with some of them, written in november 2009, where I refer you for background to the Wikipedia-article on Assembly Language (at nov 6, 2009) and also to its List of assemblers that lists most of them.

Fasm: This is a nice small assembler that seems to work well and to be able to do quite a lot, with some decent documentation. For the beginner it is hard because the documentation is not complete, and the available IDE for Fasm is very simple indeed. But for people who know assembly well this may be a very good choice.

GoAsm: More or less as for Fasm, with a somewhat better IDE than Fasm.

HLA: This is a complete rewrite of assembly-language to a Pascal-like syntax. There is an IDE for it, called HIDE, and a lot of documentation in pdf or in book form, but as is, it is very hard to get, and also in constant development, including massive changes, and with very few users.

Nasm: This seems to be a serious assembler, that has been developed over quite a few years (off and on), and that comes with extensive documentation for it, but it also seems fit - as is - only for users who know assembly well already.

RosAsm: This is a development of Spasm and embodied a new conception of doing assembly, basically all-in-one (no include-files, no resource-files, not even code-files if one doesn't want to: everything in one executable that is written and editable by RosAsm). It has a very fine IDE and is very easy to install, but quite difficult to get far with, since it is not well  documented, and rather unlike other assemblers in quite a few ways, that are mostly not well or not at all documented.

4. Personal experiences with assemblers

I have some experience with the above 5 but can not recommend any of them if you don't know assembly well to start with - and by "well" I mean especially that you need to know rather a lot about the WinApi in relation to assembly, and also rather a lot of assembly itself.

Specifically, I got almost nowhere with Nasm: it is difficult to install with a working IDE and difficult to get it to compile anything, and I soon gave up on it. I do not think anybody new to assembly should try to learn with Nasm as I found it.

HLA was a mess to get installed and working, though eventually - after many failed attempts with the RadAsm IDE - I got it working, sort of, with HIDE, that's an IDE especially written for it. I got no further than writing and compiling DOS-console-stuff. I do not think anybody new to assembly should try to learn with HLA as I found it, also since its maker changes it all the time, and its documentation (and there is a lot of it, fairly well-written also) is always out of date and not well organized.

Both Nasm and HLA seem to me to be (as they are) fit for assembly-specialists only, and both need a lot of development in several respects by real experts to start being useful for those who want to learn assembly. I disrecommend them to newbies to assembly: It's almost certainly just loss of your time.

With Fasm I got rather a lot further than with Nasm or HLA, and indeed wrote some simple Windows-stuff in it, but then bumped into problems how to get further and how to have proper documentation to get further. There is a fairly extensive and interesting Fasm-forum where one could ask, and probably get some sort of useful answer, but this is not how I like to work, which is basically by myself and with good documentation.

The same goes for GoAsm, which I liked a bit better than Fasm, probably because it's IDE is better and I also liked it's coding style, but I soon got into the same problem as with Fasm after having written basic Windows-programs with it: To go further, more documentation is needed, and also a  better IDE and debugger as well. Also, it has a minimalistic free debugger, and a less minimalistic debugger for it which one must buy, which I didn't do, for I don't buy stuff by way of the internet.

Initially I thought - as a newbie in assembly, being much impressed by RosAsm's ease of installation and its very fine IDE - that RosAsm was the way to go for me with assembly, but not so: Again I didn't get beyond very basic Windows-programming, fundamentally for lack of proper documentation - besides which RosAsm embodies a new approach to coding in assembly, and notably to macros, that is not well explained at all.

In my experience then, the above three assemblers allow one to learn some basics of assembly, and to write and compile some simple programs, but one can not get far with them without learning considerably more about the Windows Api and programming in assembly - for which they lack the requisite documentation fit for their own compilers and their own styles of coding in assembly.

Also, while Fasm and GoAsm are still being developed by their original makers and have active userforums (that for GoAsm is part of the Masm32-forum), RosAsm's original developer has given up on it and declared it dead, and this also seems the wisest decision for this assembler.

So... having recently returned from these journeys, I turned back to Masm32 + MasmEd + Iczelion's Tutorials (Masm32 I had briefly played with in 2007, but I had found it to be both huge and of somewhat doubtful legal status, which made me then skip it ) and found them a lot better and also a lot more tractable and easier to understand than the other assemblers I have tried.

This is my main reason to recommend the above trio for newbies to assembly, and this seems by far the best way at present to try to learn assembly - and indeed only the Iczelion Tutorials for Masm32 told me the things I wanted to know and learn about real basics, such as PE-files, and the meanings of many small but important words and related concepts, that the other assemblers either did not document at all, or did not document clearly, and which then are very difficult to understand or see the point of.

5. Debuggers

 Incidentally, another tool that serves the purpose of learning about programming and computers on a fundamental levelvery well is this

that is a great free debugger, that allows one to peep into many executables, and see - in principle - what makes them tick.

So... it seems to me Assembly is not at all dead, and to be a lot more practical than it used to be when I first played with it. Whether it can be a language in which one can be as productive for Windows as in Delphi remains to be seen, but the above is great stuff to help one understand computers on a deep level.

Another free debugger that works rather well (once it works) is

  • MicroSoft's WinDbg

that's freely available from MS, of which the main setback I saw so far is that it comes with a ton of information one seems to need to work through for a considerable part to get the hang of it all, and to understand what's really possible with it.

last update: Nov 6, 2009