Assembly language. Write 3 pro and 3 con. Why should I learn it? Why shouldn't I...

Assembly language. Write 3 pro and 3 con. Why should I learn it? Why shouldn't I? Is it the best program language or is it obsolete?

Pros:
You can crack software
You can write better software
You can optimize software
It gives you understanding how everything works
Its the lowest programmable abstraction level

Cons:
There is multiple assembly architectures.
Intel x86 manual is 4k pages long
You need to read at least 10k pages to learn it

how similar are the assembly architectures? I know they're different, but how different?
also
>10k pages
how is this even possible

>pro
in 2017 none
>cons
have to know a lot of repetitive bs
too simple
different for each cpu

Which is the best book to learn assembly?

x86? None.

ARM assembly might have some minimal usage if you're doing embedded dev.

The Art of Assembly Language - 1.4k
Intel x86 manual - 4.1k
Windows Internals Part 1/Part 2 - 1.2k
Reversing : The secrets of reverse engineering - 600
Partical reverse engineering - 400
Hacking - The art of exploitation - 500
RE4BN - 1050
Modern x86 assembly - 700

Pros:
1. If you want to understand a program without the source code, assembly is useful (but probably still won't help for anything particularly large).
2. Learning the basics of assembly may help you to write more optimal code in higher level languages such as C.
3. You can show off to your friends that you know assembly - If you have any friends left by the time you've finished learning it...

Cons:
1. C can do everything assembly can do, and it's often faster because of compiler optimisations.
2. Very hard to keep track of what's going on in a reasonable sized codebase (though I'm sure there's ways you can organise your code to mitigate this)
3. It won't land you a job

Don't ever *write* code in assembly - At best, you should use knowledge of assembly for reverse-engineering and small modifications to existing code. Compiling C code and using the assembler output in some way is preferable to writing the assembly yourself.

C is not faster than ASM. Fastest MemMem is written entirely in ASM and beats C by 3X

>There is multiple assembly architectures.
In reality there are only two you deal with - x86-like and bunch of RISC ones (mips, arm, sh4). The RISC ones are more or less similiar.

Thing is, if you're proficient in x86, mips and arm, you're pretty much set for life and not much else can (in terms of concepts) really surprise you. Addressing modes or load/store, link registers, delay slots or not, status flags or not, bunch of classes of weird optional operand modes catering to C compiler, and thats basically it.

There are really cool and difficult things at times (and awkward as hell) such as register windows, but for now, those are pretty much all dead architectures.

>You need to read at least 10k pages to learn it
Nah, you learn it as you go.

Now as for real disadvantages:

Even though the code can be fast, writing and debugging assembly code is painfuly slow, tedious process. Unless there's a good reason not to, simply use a C compiler.

>Its the lowest programmable abstraction level
you still can get one lvl lower and go full retard and type the code in binary mode, that would be the most autistic thing to do and I never seen someone memeing about it so that tell the grade of pure mental abstraction

How much time do I need to learn it?

You don't need to read all that to learn assembly. Just decompile some software and read the relevant entries in the Intel or AMD software development manuals. Most of the intel manual is useless to reading and writing assembly anyway, as it deals with opcode encodings and rarely used instructions.

Who knows? The weird thing is that assembly as such isn't hard - it is already broken down to basic building blocks which are easy to grasp.

The problem is not understanding, but having the ability to take building blocks and arrange it into something useful. And the more you can express in less, the more it tends to be faster ... to a point.

To get more out of it (and generally beat the C compiler), you then need to truly understand the CPU architecture, not just the ISA you did until now. That's where the part of reading 10k manual and googling around and reading foreign code steps in. Superscalar CPUs can be somewhat tricky to get used to before you adopt the attitude of avoiding data hazards.

tl;dr: A newcomer can learn asm pretty fast, but will write terrible, shitty assembly because he ignores various hidden CPU performance constraints. This is fine, if you need assembly for low level control, and not performance.

But writing *fast* asm code is much more of an art these days, truly mastered only by compiler and JIT writers - you know, the people who teach computers to write asm for you.

I made this LED blinker program in Assembly:

; toggle port b bits

.INCLUDE "/usr/share/avra/2313def.inc"

;-----------initialise Stack Pointer
.EQU sph = 0x3e

LDI r16, low(RAMEND)
OUT spl, r16
LDI r16, high(RAMEND)
OUT sph, r16

;--------------- main program
;.ORG 0
LDI r16, 0xff ; all bits on 0b1111 1111
OUT ddrb, r16 ; port b output

begin:
LDI r16, 0x55 ; 0x55 = 0b0101 0101
OUT portb, r16 ; put 0x55 to port b

RCALL delay ; call delay subroutine
;NOP

LDI r16, 0xaa ; 0xaa = 0b1010 1010
OUT portb, r16 ; put 0xaa to port b

RCALL delay ; call delay subroutine
;NOP

rjmp begin ; jump back to l1!


;-----------delay subroutine
;.ORG 0x60

delay:
LDI r17, 20 ; outer loop counter

again:
LDI r18, 100 ; inner loop counter

yetmore:
LDI r19, 10 ; inner inner loop counter

here:
NOP
NOP

DEC r19
BRNE here

DEC r18 ; decrement inner by one
BRNE here ; go to here if not zero

DEC r17 ; decrement OUTer by one
BRNE again ; go to again if not zero
RET ; return to main program

I hope for 2017 to be year when avr finally dies in a fire.

Tks for the complet answer.

use C

assembly is like trying to drive a nail with your bare hands

Good to know, I'll think I'll stick to c for a bit as I only really want to make Vidya. Maybe I'll learn it someday for NES homebrew.

Why

yes but the point was usually you won't be good enough at ASM to write code that is better than what the compiler is going to spew out

>I only really want to make Vidya
and you non-ironically considered asembly?