Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Why use Assembly language

the182guy

New member
Joined
Nov 13, 2005
Messages
1,473
if you code the project that your boss gives you aswell as VB.NET or whatever, you will probably get a BIG FAT ass bonus. Anyway the reward of just being able to program in the lowest level is good enough for me.
 

Al42

PowerPoster
Joined
Feb 4, 2006
Messages
5,692
Everyone's forgetting a very huge world market - most small embedded systems are written in assembly. There's really not much need for listboxes in the controller for a microwave oven.

Anyone in Hong Kong can see a nice little assembly-language system that's been running for decades - the Hong Kong Space Museum Planetarium is run on 3 Z-80 CPUs, and all the code was written in assembler - back in the Dark Ages.
 

reloader81

New member
Joined
May 14, 2006
Messages
15
I think, that u shouldn't comapre Assembly with High Level languages.
There are a lot of different structures, extened assembler use mnenomics and so on...

Althought I don't use assembly, but as I remember it's extremely fast, because you can communicate with the machine in its languages(binary, hex etc.) directly, and it don't need to waste time translating this one to understandable methods, functions.

Th other side, that it's a very complicate and hard-to-learned language, but don't try to write i.e. a whole kernel in HLPL.

My last oppinion, that always must a Low level language, and it not depends on the year where we currently live in:)
 

Al42

PowerPoster
Joined
Feb 4, 2006
Messages
5,692
reloader81 said:
Th other side, that it's a very complicate and hard-to-learned language, but don't try to write i.e. a whole kernel in HLPL.
Why not? The entire PCDOS was written in assembly. So was CP/M, ISIS, SOLOS, TRSDOS, the Mac OS, the Apple OS ... whole entire operating systems. Windows and Linux could be written entirely in assembly, it's just more efficient to write graphic operating systems in a higher level language. (All of CP/M was around 4k of 8 bit code.)

(BTW, assembler is a lot simpler than, say, VB - it's not complicated at all.)
 

Raedwulf

New member
Joined
Aug 26, 2005
Messages
197
Once you understand the fundamentals - say registers, instructions and how they work - basically how a computer works, assembly language is easier than any other language - because what you see is what you get.(unless the model of processor has bugs - which it sometimes has ;) )

The difficult part of assembly is maintenance - it needs to be well commented because unless your fellow programmers understand assembly really well, understanding other people's assembly code is a real *****. Another small issue is implementing - its easier to work out algos in HLL and then port them to assembly.

But all in all - knowledge of assembly is essential for any HLL - as it helps optimise code and create decisions in efficiency. This may not apply for Java/.NET unless you want to learn the ILDASM and Java byte codes assembly - this might be useful - but maybe less so.

Major games, somewhere along the line make use of assembly language - especially when using newer instruction sets on the processor e.g. SSE2, SSE3 because compilers find difficulty optimising parallelisation. However, some compilers (I think MSVC and Intel?) now have methods like loading 4 floating pt stuff into a xmm register etc. so it hints to the compiler what to do :)
Alternatively, just using inline assembly is sufficient.

Another rant on assembly from me :).

Cheers.

Raedwulf
 

penagate

New member
Joined
Jan 14, 2005
Messages
13,651
nemaroller said:
You could fill the all the currently employed assembly OS developers in the world onto 1 -maybe 2 - Boeing 757's. The rest use C.
I dare you to write an OS that boots, in C. The bootstrapper must be written in ASM. Usually speed intenstive parts of the kernel too. The non-intensive areas are written in C - some in C++.

MS researchers have been developing an OS - I think it was called "Singularity" or something - which is largely written in C#. This gives it type safety and garbage collection and all those wonderful things you get in a managed environment. Still, it was considered quite a feat that they managed to write even parts of the kernel in .NET - the rest in C and of course ASM to get the whole thing working.

If you were referring to the whole OS the yes of course you'd never write the whole thing in ASM. But you can't run the thing without it, so it's essential knowledge for anyone trying to get their own OS working. And to say you'd never use it for any PC job is quite clearly wrong as examples have been shown in this thread.

ASM is most definitely not a high level language. It is the lowest level of anything that could be reasonably called a "language" - one step above raw machine code. A higher level language, but still not a complete HLL, would be something like MASM - which incorporates macros to give something along the lines of C: it has structures etc. with simple syntax so you don't have to write every line in pure assembly.

There are "generations" that languages can be classified into - look them up on Wikipedia:
en.wikipedia.org/wiki/First-generation_programming_language
en.wikipedia.org/wiki/Second-generation_programming_language
en.wikipedia.org/wiki/Third-generation_programming_language
en.wikipedia.org/wiki/Fourth-generation_programming_language
en.wikipedia.org/wiki/Fifth-generation_programming_language

The vast majority of us, most of the time, would be using 3rd-generation languages - C, C++, VB, .NET, etc.; and 4th gen to a lesser extent (SQL etc.)


Also, agree 100% with Raedwulf here:
Raedwulf said:
But all in all - knowledge of assembly is essential for any HLL - as it helps optimise code and create decisions in efficiency.


Side note: I often see people use the word "assembler" to refer to the language - "assembler" refers to the the tool which converts assembly language into machine code.
 

Raedwulf

New member
Joined
Aug 26, 2005
Messages
197
Side note: I often see people use the word "assembler" to refer to the language - "assembler" refers to the the tool which converts assembly language into machine code.

Yes, I see that problem a lot - but I guess we can forgive them because a lot of programmers' native language isn't english. Mine is Visual Basic :D.
 

damasterjo

New member
Joined
Nov 11, 2005
Messages
827
I just wanted to honestly say that I really enjoyed reading this thread and will probably learn some ASM sometime now. Thanks for the detialed discusion.

(PS Im glad the character counter thing is gone now, that thing lagged like a beast!)
 

Raedwulf

New member
Joined
Aug 26, 2005
Messages
197
Welcome aboard the asm train :)

I recommend you to start with either MASM or FASM.
They have slightly different syntaxes, but otherwise if you know one, its easyto pick up the other.

Advantage of MASM:
- Better tutorials
- Can assemble asm listings from MS compilers more easily(but some can't be reassembled)
- Supports debugging information

Advantage of FASM:
- Faster assembling than MASM
- Supports linking within the assembler (so you don't generate obj -> then link them like a compiler, but gen exe files straight from asm)
- Better code generation (Generates smallest instructions/optimised assembly codes)
- Actively developed (updates 4/5 times a month!) / bug fixes come very quickly

HLA:
- Not tried it but it sounds good(slow though/bascially a syntax translator from HLA to other assembly languages.)

Advantage of these over other assemblers:
- Very good support (FASM forums are very friendly - so are the masm ones)
- Good Macro Support

I've posted links to tutorials elsewhere on this forum- and i don'thave time now to list out the links again...cheers anyway.
 
Last edited:

wossname

type Woss is new Grumpy;
Joined
Aug 28, 2002
Messages
5,683
I started writing ASM for intel chips last year and I've done almost none this year.
But I've recently started playing with PIC chip programming in GPASM (Gnu PIC Assembler).

Basically the only way to write good programs that run on PIC chips is to write them in ASM. There simply isn't enough ROM space to allow things like C libs to reside on the chips themselves so you end up writing everything the low level way.

Its great though because these little chips are pretty fast (4MHz - 20 MHz depending on your oscillator) and you can do a hell of a lot with them with hardly any complex electronics knowledge.

Intel ASM is a joy to use because it has a lot of registers and HUGE amounts of ram on modern machines. PIC asm is a joy because the instruction set is small and there is a great challenge in getting your code small and fast enough to run on a PIC.

I recommend PIC programming to any hobbyist programmer.

useful resources...
www.microchip.com (downloads, datasheets)
forum.microchip.com (decent forums for beginners and pro's alike)
www.maplin.co.uk

GPASM is for linux, for windows use MPLab (free download from microchip.com)
 

Al42

PowerPoster
Joined
Feb 4, 2006
Messages
5,692
wossname said:
Intel ASM is a joy to use because it has a lot of registers and HUGE amounts of ram on modern machines. PIC asm is a joy because the instruction set is small and there is a great challenge in getting your code small and fast enough to run on a PIC.
Hello World. Intel? Probably 32k, at the very least, until we get to Vista. PIC? Depending on the display, maybe 20-30 bytes. Slight difference. :)
 

wossname

type Woss is new Grumpy;
Joined
Aug 28, 2002
Messages
5,683
I never said PIC == intel.

I was merely saying that they are both good. However most of the rest of your reply made no sense at all.
 

Al42

PowerPoster
Joined
Feb 4, 2006
Messages
5,692
I wasn't trying to contradict you - just pointing out that you can do an awful lot in a little PIC, while HLL programming in Windows is bloatware even for the smallest function. I did a little binary counter in a PIC, outputting to a 10-LED display, in about 25 bytes. Even writing a .com program for a PC takes at least that much just to start and end the program if you want to interact with the OS at all. (Unless you use something like FORTH :eek2: )
 

GTAvb

New member
Joined
Aug 23, 2011
Messages
3
Machine language = Binary (0,1)
Assembly language = machine language but summarised
C = Summarised Assembly language
VB = compiled from C

Got it? Its the lowest form of language. If you have problems in high level language and it cannot be solved you should try debugging with ASM. If again problem in ASM then try 0,1 :p
 
Top