News:

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

Assembly programming and Windows

Started by TmX, May 30, 2009, 04:40:21 PM

Previous topic - Next topic

TmX

After visiting several assembly programming forums, I got an impression that most of the assembly programmers are using Windows.
Indeed there are lots of assembler available for Windows: MASM32, GoAsm, FASM, NASM, YASM, POASM, TASM, LZASM, etc.

While on non-Windows OSes (Linux, BSD, whatever), you're probably expected to use "C" (and a few assembly).

Is this just because Windows is still the most popular OS (and therefor lots of different assemblers are available) ?
Any other reasons?

::)

dedndave

unix-based OS's are written in C, for C programmers
a few of them write assembler also - but they have what they need
(i think the Gnu Assembler, aka "Gas", is somehwat common)
also, their C compilers allow inline assembler - that is enough to make them happy
but, you are right - windows is on the majority of computers - more demand for a variety
i dunno about the mac - mac's used to have motorola 68K based CPU's (not sure if that is still true)

BlackVortex

Haha, dedndave, you information is a "little" outdated.  :green2

Nowadays Macs use Intel (for many years they used PowerPC)

EDIT: yeah, I hate Macs with a passion too

dedndave

that doesn't surprise me at all - lol
if i start to read something and see the word "mac" i usually close the window   :snooty:

EDIT - kind of a shame, though - the 68K was easy code

ToutEnMasm


Quote
Is this just because Windows is still the most popular OS (and therefor lots of different assemblers are available) ?
Any other reasons?

Is there another system ? .At the last news,personnal computers selled without windows was numbered ...none.

PBrennick

Dave,

Quote
EDIT - kind of a shame, though - the 68K was easy code

The 6809e was even better. I still miss it. Imagine a processor with tons of undocumented opcodes (because the specs were stolen, they say) and some that would allow direct interaction of different size registers.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

mitchi

Portable code is highly regarded in the GNU/Linux culture. C is very portable so it's really the language of choice on these platforms.
I know that GNOME is entirely in C while KDE is QT C++.

If I was to program for Linux, I would just use agner fog's objconv and a good assembler like sol_asm or fasm.

dedndave

yes Paul - i have written some code for the 6805 microcontrollers - very easy and fun
i think i prefer it over 8051 or PICs (do they even make PICs anymore ? - lol)

it is good to see we have a wide variety of favorite assemblers right here in our group
once i have learned my way around the API a little more, i might give GoAsm a try
although, Fasm and Nasm looked easy to use also (easy is not really what i look for)
there are so many toys out there - a lot to choose from

raymond

The Z-80 was also fun to program. It only had about 800 opcodes (quite easy to write your own assembler). The feature I liked the most was that it had two sets of data registers and you could switch at will between the two sets without loosing the data in them.
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

dedndave

yes - programming those liitle ones was an interesting challenge - especially if you had to do some math
math on those chips will quickly seperate the real coders from the script-kiddies - no fpu, here, folks

Neo

Quote from: dedndave on May 30, 2009, 04:47:22 PM
unix-based OS's are written in C, for C programmers
a few of them write assembler also - but they have what they need
(i think the Gnu Assembler, aka "Gas", is somehwat common)
also, their C compilers allow inline assembler - that is enough to make them happy
but, you are right - windows is on the majority of computers - more demand for a variety
i dunno about the mac - mac's used to have motorola 68K based CPU's (not sure if that is still true)

I've thought quite a bit about why there are so few unix/linux assembly programmers, and upon looking into it, it seems almost like linux and the Gnu Assembler are intended as a punch to the gut of anyone thinking of writing assembly for them.

<rant>The linux kernel has the problem that it tries to avoid assembly at all costs, resulting in massively-complicated chunks of C code to try to avoid just a couple of lines of assembly, and honestly, with the horrible non-standard syntax that Gas uses (made by AT&T, not any company that makes x86 chips), I don't blame them.  For examples of this paranoid avoidance of assembly, just look at anything to do with thread scheduling, like sched.c.  You can write a full thread scheduler in under 400 lines of assembly; why do they use almost 10,000 lines of C for just the thread scheduler abstraction layer?

Then, there's the added problem of system calls still being implemented with int 80h; it's a throwback to the days of DOS, where you had to put values into registers to indicate what functions you actually wanted to call instead of just calling a function.  They could at least have something equivalent to the insertion of jump tables (instead inserting code that puts the constant into a register and does int 80h), but no, they want to make assembly programming as difficult as possible.  Apparently linux now supports doing system calls with the syscall/sysret or sysenter/sysexit instructions, but it's still the same issue of hardcoding register values, plus who knows if they even let applications use them directly?</rant>

*sigh* oh well  :'(

MichaelW

QuoteThe linux kernel has the problem that it tries to avoid assembly at all costs, resulting in massively-complicated chunks of C code to try to avoid just a couple of lines of assembly

I see a lot of this, complex C code that compared to equivalent assembly code is harder to understand, harder to code, and more likely to contain errors. But it is portable, and it impresses other like-minded C programmers.

I agree that AT&T syntax is horrible, but GAS has supported Intel syntax for years:

http://sourceware.org/binutils/docs-2.19/as/i386_002dSyntax.html#i386_002dSyntax

There is nothing resembling a high-level syntax and compared to MASM the macro system is very weak, but all of the essentials are there, even for creating applications completely in assembly.

eschew obfuscation

Neil

Wow! Paul, 6809e processor, that brings back memories. What a fantastic processor, it was used in a 'Dragon' computer in this country (UK) & in Tandy computers in the USA. I 've looked on my bookshelf & I've still got '6809 Assembly Language Programming' by Lance Leventhal, but as you say it was the undocumented stuff that was such great fun.

Neo

Quote from: MichaelW on May 31, 2009, 07:47:42 AM
I agree that AT&T syntax is horrible, but GAS has supported Intel syntax for years
Hmm... That begs the question why on earth people still use AT&T syntax... Compatibility, I suppose.

mitchi

Good points Neo. I think just like you on this matter. Hehe, at least they haven't lost all their sanity.
Here, we can see Linus Torvalds defending the use of the goto (jmp) against a typical second-rate coder straight out of the schools.
http://kerneltrap.org/node/553/2131