News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

I love Assembly but.......

Started by Robert Collins, December 23, 2004, 12:58:28 AM

Previous topic - Next topic

MANT

Hi Statix:

I'm not sure what point you're making in your latest post, but there are a lot of good reasons to use C (I mean ANSI C, not C++), and not very many reasons to use HLA (though I'm sure Randy would beg to differ). One of the main reasons C is so useful is that there's so damn much code out there already. If you want to write a program that figures out when sunrise & sunset on Mars will be, chances are someone's written code that will help you, and the odds are decent that it's in C. If not that, it'll be either C++ or Java, both of which translate fairly easily to C. There are tons of tools for C, including editors that recognize C syntax, and tools that can help you organize and analyze your code. Plus, C is such a well-known language, compilers are quite good at optimizing it.

IMHO, for "professional" programming (stuff you do that's on any kind of a deadline, or that you might sell), your best bet is to use C or C++. Let it optimize all your code the best it can, and then run a profiler on it to see where the bottlenecks are. Optimize the biggest bottleneck, but try to do it in your HLL. Often, the best optimizations come at the higher, conceptual level. Finally, if nothing helps, rewrite the function in assembly. Use any assembler you want, though most compilers support inline assembly. For small stuff, inline is perfectly fine. Redo one function at a time, then re-profile and see how it affects things.

As I said, for professional programming, I think that's about the only sane way to do it. You can probably substitute other HLL's instead of C or C++, but the idea is to stay away from assembler as much as you can. For personal programming, assembly is a lot of fun, and I've enjoyed writing several programs in 100% assembler. For me, using HLA defeats the purpose of using assembly in the first place: when I'm doing assembly, I don't want to do high-level coding! :) For personal programming, it's all a matter of taste, and there really is no wrong opinion -- whatever you enjoy, you enjoy. For professional programming, I have a very hard time imagining being able to justify using HLA.

BTW, the syntax you described is only for C++. The C version would be printf("Hello World!\n");.

donkey

I agree with MANT here. I have much less time to dedicate to programming than I used to and find myself a bit frustrated at times that I have to manually code every last little detail in assembler. Every time I need to do even the simplest thing it requires that I do the research, code the function, test it, build it into yet another lib then finally I can move onto the next line of the program. I now have a collection of about 400 library functions, many of which I have uploaded to my website. But the more I add them the less I am coding in assembler and the more in some lib driven behemoth of my own making. This is how I also see HLA, as a set of extensions for assembler that at some point got out of control and now bares little in common with assembly language. That is ofcourse a personal opinion, I am a great fan of the low level stuff and even find MASM a bit high level for my liking. I find the elegance and simplicity of low level assembly is what attracts me to it the most, by obscuring this to make it more high level seems to take away it's greatest advantage for me.

But I am not a professional programmer so if it takes me 2 months to finish what someone might do in a weekend in C, well that's OK and you can bet that I will come out understanding it alot more. Professional programmers however are under a deadline, either real or imposed by economics. Every day that a programmer takes to write a program is another day that he must be paid and the product is not ready to generate revenue and that is where his pay is coming from. As with Mark, there are exceptions to every rule but in the vast scheme of things, C is the better choice from a professional standpoint.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

hutch--

As with any language, the more you have available, the faster you get at producing it. I am a library man in that I HATE writing the same code over and over again. Start off with a bare assembler and you work for a long time to get anything up but have years of libraries and other code available and it gets LOTS faster. For fast coding languages, I find it hard to go past the PB I use for so many things, my C is off the pace as I write MASM instead but it is usually the case that you crank out code faster in a high level language.

Where you close the gap with assembler is in having as much of the same facilities as a high level language, enough libraries, API calls and the like and you are not giving away much in development speed terms.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Statix Star

I agree with the C stuff. As a matter of fact, if I were able to build up a compiler for the High-Level Language, I would use instead
of the print, stdout.put. The marketing is what annoys me, is it easy to be contract it by Intel or M$?