5 ms·
Assembly language is actually simple stuff. You just need to read the datasheet. No difficult type systems to deal with. In the old days programming assembly l
by amelius 4y ago
Assembly language is actually simple stuff. You just need to read the datasheet. No difficult type systems to deal with.
In the old days programming assembly language was nasty because one mistake could mean your computer had to be rebooted and you lost your work. Not anymore.
- weinzierl 4y agoThis is like saying chess is simple stuff because you can learn how the pieces move in five minutes. If all you want is a basic understanding of how things work, that level is ok. If you want to play/program, it is a completely different story. I'd even go so far to say: Why do assembly if your goal is not to be better than the compiler, at least in some respect? Beating the compiler, now tell me that it's simple stuff.
- astrange 4y agoA compiler’s main virtue is patience, not smarts. That’s because there’s no value in smarts; the systems like Itanium designed to need them turned out to be unusable.
- djmips 4y agoBut chess is approachable because you can learn how the pieces move in five minutes. Contrast that with some German board games where going over the instructions is the first hour and even then you aren't sure if you understand. Why learn assembly?, well for one, the non-abstract aspect of assembly is less abstract, and arguably easier to understand than even the simplest high level languages. Secondly, learning assembly is also learning how computers work and that paradigm will help you even as you largely work in a high level language. And beating the compiler isn't as hard as you might think if that becomes necessary some day.
- galangalalgol 4y agoI only read assembly these days, not write it. Usually when looking at profiling outputs for my hot path. So knowing assembly is still very valuable when you routinely find your code isn't keeping up with your data, and scaling isn't an option.
- khalladay 4y agoAnother use case for assembly is reverse engineering, even if you aren't better than the compiler, being able to understand what the compiler spit out is really handy.
- nsxwolf 4y agoThe big hurdle for me was always understanding where assembly language ends and the assembler directives begin. That and the “now what?”, not knowing how to make a program do something interesting - needing to learn about the ROMs, the OS, etc.
- ryanjshaw 4y agoI taught myself x86 assembly from a book as a pre-internet teenager. My first .COM printed exactly what it was supposed to on the screen. Then it printed a bunch of random junk and my computer rebooted. This happened every single time I ran the executable. Eventually I actually read the first chapter properly and added MOV AH,4CH / MOV AL,0 / INT 21H. When my executable returned to the DOS prompt this time after running it, I felt like my mind had just expanded 10-fold as I realised what had been happening.
- olddustytrail 4y agoDid you get that "This machine does whatever I can tell it to do!" feeling? And then you wonder what can you think to tell it to do. The wonder of computers.
- ddingus 4y agoThat is an amazing feeling! Then it hits: that crash, bug, unexpected behavior is definitely my fault! Lol, good times when one works on a routine that executes, crashes and burns long before that finger loses contact with the "return" key!
- throwaway_dcnt 4y agoOr? MOV DX, 200 / INT 27H
- raxxorraxor 4y agoWhat did cause the reboot? Is this some kind of DOS watchdog that reboots the system because your program didn't exit gracefully?
- pizza234 4y agoAssembly is simple if all one does is printing hello world (even that is actually not trivial, because one needs to know/read the syscall and the ABI). Anything beyond that gets complex quickly, in one way or another. On simple architectures, like the 6502, even doing a simple division is complex (heck, even additions are verbose, since 8 bits are too few for a lot of operations). On more complex architectures, like x64, there is a monstrous ISA full of inconsistencies. Learning assembly as in learning an instruction set also doesn't include a lot of details of computer architecture, although at least some modern assembly books mix both domains.
- Salgat 4y agoIt's simple in the same way C is simple. Sure it's a very small language with pretty straight forward commands, but once you try doing anything of significance it becomes extremely complicated and it's easy to do nasty things with it.
- davidhbolton 4y agoIt may be simple but that simplicity is its downfall. How many databases, compilers, modern games. OOP classes or even file handling routines do you see in assembler? Few or none at all. Writing assembly language is slow and painstaking work. You can easily get 10x the productivity by switching to C or even better in higher languages. Games were written in assembler back then because Basic was too slow. And C compilers were only starting to appear on personal computers from the late 1980s. Writing an assembler for 8-bit CPUS like 6502/Z80 was doable; I wrote a 6502 cross assembler (in Z80) so a Z80 development machine could output 6502 in 1985. It got harder with 8086 and 68000 chips.
- wk_end 4y agoJust read the data sheet! googles Intel CPU data sheet Ah, here we go. https://www.intel.com/content/www/us/en/products/docs/processors/core/core-technical-resources.html https://www.intel.com/content/www/us/en/products/docs/proces... Just two volumes and 1000 pages of reading. Simple!
- pid-1 4y agoIntel assembly is complex due backwards compatibility and extensions. I've found working with a simpler, smaller processor can be an absolute joy.
- tengwar2 4y agoI may be very out of date, as my last assembly language programming was in 80386 days - but types are important in x86. You definitely need to know your words from your bytes, and your index from your offset.
- raxxorraxor 4y agoYou still need to learn a lot of stuff. Problem is that it isn't portable. You have differences in architectures but most are quite similar if your goal is to make a program work instead of it being efficient for which you need deep knowledge about an architecture and its quirks. A few different mnemonic and register names is the far smaller problem. But you also need to know about calling conventions of your operating system if you want to do any form of system call, which you very likely want to. Which registers supply arguments, which registers have to be saved, addresses of system functions which can change with OS or kernel version. You also need to learn what these function do. How would anyone know that writing a 48 into your accumulator and calling interrupt at address 80 opens a socket on Linux? Thinking about this again makes assembly seem like a terrible, terrible idea... To start with I would either recommend x86_64 for either Windows and Linux. I would prefer Linux here but I believe UEFI for example uses the Windows calling conventions, so taking a look at that might be practical. But these combinations usually offer the most learning helpers. Usually you should only cause general protection faults at worst if you have something newer than a 386. But no guarantee...