flat assembler
Message board for the users of flat assembler.

Index > Heap > why assembly?

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
Bob++



Joined: 12 Feb 2013
Posts: 92
Bob++
TmX wrote:
Turbo Lover wrote:

compiler? haven't seen any compiler written in asm
Kernel? Tell me the kernel of modern OS isn't 80% C.


Ah, it seems that I misunderstood your question. Apologies.
Most people don't write compilers/kernels in 100% asm anymore,
because being cross platform/portable is a hot thing nowadays, and using assembly will defeat the goal. But still the asm knowledge is relevant.

I think you'd better ask BogdanOntanu (haven't visit this forum for a long time).
He writes his self-hosting assembler, Sol_Asm, and his OS, Solar_OS (which is built using Sol_Asm).


I know this project(from another forum). Very very cool. I think that assembly is your single language. Surprised :p
Post 22 Feb 2013, 20:21
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1607
Location: Ukraine
shoorick
*****
if you do not wish assembly - try disassembly Wink
Post 24 Feb 2013, 18:34
View user's profile Send private message Visit poster's website Reply with quote
pabloreda



Joined: 24 Jan 2007
Posts: 103
Location: Argentina
pabloreda
assembly not need this question..
it the real thing in the cpu..
all the others languajes NEED this question...
Post 24 Feb 2013, 20:19
View user's profile Send private message Visit poster's website Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
Assembly is useful for writing small libraries. You also need to know assembly if you debug or do reverse engineering, write compilers, involved in anti virus programs you need to understand assembly. If you write operating systems you also need to know assembly, critical parts of windows is still being written in assembly. If you take regular advantage of optimizing critical code in your hll project, knowing asm here is good as well. You don't need portable languages for everything in the world, if you write server software to maintain clients, you don't need portable languages for that, so assembly works well for server apps, if it isn't too big.

There are loads of other areas you either need to know or will benefit from knowing assembly, encryption schemes for executables is one area.

But one area I find good is the tremendous speed gains you can get by using assembly over, let's say python or even c++. Python is a script language so it doesn't stand close in speed comparisons, but you can beat c++ code if you have the experience. In many cases you don't even need experience for that.

But then again, assembly is not primarily a tool for those who want to make quick bucks, it is a tool for those who want to specialize their code, make fast programs or just have some fun. Smile

When I write a library in asm, I spend tremendous amount of time doing what normally would be done in just a few minutes. Sometimes the amount of time I spend is crazy relative to a nearby hll language that I use. But when the lib is finished, it is usually much faster and smarter implemented (and smaller).

If you spend 10 days writing what you could write in 1 day and you can re-use the library for 4 years, it's worth it to me.

10 days, runs at a factor of 1.5-8 perhaps.
1 day, runs at a factor of 1.0

You can re-use the library for 4 years. 8 times the performance is worth it.
Post 24 Feb 2013, 21:06
View user's profile Send private message Reply with quote
Turbo Lover



Joined: 22 Feb 2013
Posts: 32
Turbo Lover
Quote:

Assembly is useful for writing small libraries.

I've heard that building .so in asm is a pain in ass, isn't it?
Post 25 Feb 2013, 10:39
View user's profile Send private message Reply with quote
Turbo Lover



Joined: 22 Feb 2013
Posts: 32
Turbo Lover
Шурик, I've tried it and I loved it)))
Post 25 Feb 2013, 10:40
View user's profile Send private message Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
Never tried it, I do mostly dll libraries for my own pleasure, I can share them from time to time.
Post 25 Feb 2013, 16:53
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2936
Location: vpcmipstrm
bitRAKE
Assembly is used in the V8 javascript engine. There are many Chrome browser users. Smile Also, compiler intrinsics are just another way to program in assembly. Smile Personally, I just enjoy assembly, but I use HLLs too. Luckily, I never had to program for money - that might change some things.

_________________
¯\(°_o)/¯ unlicense.org
Post 26 Feb 2013, 07:53
View user's profile Send private message Visit poster's website Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 822
Location: Jakarta, Indonesia
TmX
bitRAKE wrote:
Luckily, I never had to program for money - that might change some things.


I don't see any valid reason not to be able to charge some cash for programming in assembly... but it's not a niche market for sure.

Bogdan is an antivirus developer, if I'm not mistaken, and I guess he earns money due to his assembly skill Smile .
Post 26 Feb 2013, 14:34
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2936
Location: vpcmipstrm
bitRAKE
It was not my intent to suggest some inferior economic position for assembly language coding. My own situation is that I have never worked in the software business. To me programming is a process separate from the language. Some ideas are easier to represent in one language over another, but the underlying process is the same. Modern tools continually close the gap between languages. Unfortunately, us humans are more limited lest we be masters of all languages. So, the choice of language becomes more of a human problem than one of the machine.

If we tried to remove all languages from programming we are still left with the following forms of software:
Code:
idea
prototype
machine code
microcode    
Some things to note: No one programs modern x86 hardware directly. Each of these layers often include caching and additional complexities (sub-languages, run-time self-modification, etc.). Yet, they are distinct domains all software must transcend to perform some function. Programming in assembly can reduce the prototype to a mirror of machine code. (Respecting the masochism of the small group of people that program in machine code - they know how exclusive their club is. Smile) Any complex software will have a prototype that is much more vertical, and it's translation to machine code will be equally complex.

_________________
¯\(°_o)/¯ unlicense.org
Post 26 Feb 2013, 21:32
View user's profile Send private message Visit poster's website Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
cod3b453
On readability, this can be better/worse in any language. Appropriate naming and comments are always a good idea as well as writing without ambiguity - did they mean "(a + b) * (c + d)" or "a + (b * c) + d". Large/long statements invariably occur in any language and can be equally difficult to decipher.

If no sane person optimises better than an existing compiler, who does the optimisation in the compiler in the first place? If it is the insane guy then, yes, they can can optimize better writing assembly than gcc -O3 -march=native because they do know every little thing about processor arch they're writing for. Otherwise, they're not insane and don't know every little thing about processor arch they're writing for, which would explain why any time something would greatly benefit from SIMD instructions it produces such poor code. Razz

In general, HLLs are sufficient for most things simply because most things don't have the limitations/constraints that people use ASM for. A lot of the ease of use for HLLs also comes from IDEs. The key is to know enough about both to know when to use or not use them or even how to use them together.
Post 27 Feb 2013, 01:24
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2936
Location: vpcmipstrm
bitRAKE
Compiler optimizations are the result of general rules and do not necessarily mimic the processes of a human (insane or otherwise). There are very few compilers which use an accurate machine representation -- usually they optimize for a subset of instructions in a reduced execution environment.

The processor itself follows the same pattern by having some instructions in microcode and micro-ops for more common instructions. Iteratively, the processor and compiler have evolved this co-dependent relationship. Chips designed to execute existing code faster, compilers designed to generate faster code, ...

Is this a conspiracy though? Instead we could view it as a product of the complexity of software - arbitrary of the language one chooses. Or is there another model without this pattern?
Post 27 Feb 2013, 02:54
View user's profile Send private message Visit poster's website Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
the compiler is good at what it does, it will work tirelessly for minutes at the speed of your cpu and memory to try to find all the tricks it knows about. What this means in practice is that if you have an assembly program on your local hard drive, and you haven't optimized it, you spent 1 year coding it, then you have a big disfavoring problem. You have to spend crazy amount of time optimizing your code. The compiler will spend only seconds to optimize what could take an assembly programmer a month to do manually.

Things to love about compilers is the extremely simple use, you click a few flags, add a few parameters, or add a few operators in your source and the compiler will obey your flagging, implement proper optimizations and all you have to do is pick up a cup of coffee and wait for it to be done, you don't have to lift a finger, except for pressing CTRL + F9 and all known optimizations for that compiler will be applied in a complete and 100% tireless order.

Things to hate about compilers is that a compiler sometimes make too big generalizations/assumption and it just won't beat a good assembly program, it's as simple as that, until there one day comes a super-protocol between compiler, programmer and hardware, it's not going to produce the best code. I am active in c++ discussions and I'm still not impressed by the speed of c++ programs. But the most disbelieving thing about the whole c++ community that I am active in, is that they just don't understand how hardware works, I don't know if they have forgotten it or if they are just ignorant, but they just don't know much about it, so they can't make good plans how to utilize it. There seems to be a tendency, that the further away from hardware layer you are and don't have to be, the less likely you are to know much technical details about a computer. The trend is moving away from knowing how a computer works. If you don't have to understand hardware in order to code, then you won't invest much time there, so the art of knowing is being lost, and when I make faster asm programs than a c++ program, to show people that understanding hardware is extremely relevant, then they become angry for not knowing, at first, angry with me and then angry with themselves they can only blame themselves.

Some assembly programmers make pseudo code in c++, put it through the compiler at full optimization, then hand plucks it out to optimize/remove bad signature, and get it even better and put in your fasm code. One thing I've learned over the years of coding asm is, never assume your asm program is fast, it is not fast. You have to work hard to get it fast and constantly timing it.
Post 27 Feb 2013, 13:47
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1412
Location: Toronto, Canada
AsmGuru62
Compilers are awesome sometimes!
I just did a big C++ GUI project with NODEFAULTLIB and it takes about 30Kb (EXE file)
and it has a big feature set.

Looked at the optimized code in debugger -- very cool!
Post 27 Feb 2013, 14:39
View user's profile Send private message Send e-mail Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2936
Location: vpcmipstrm
bitRAKE
It seems odd that computer can be beat at simple games:
http://www.codeproject.com/Articles/162721/AI-for-Target-Number-Game-Using-Genetic-Algorithm

Even at such a basic level the computer doesn't know any properties of numbers to reduce the combinatorial complexity. Whereas a human uses local domain knowledge to generate/prune the solution space.
Post 21 Mar 2013, 02:37
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.