r/Assembly_language • u/idkilikephilosophy • 7d ago
Solved! Should i learn assembly?
Im learning assembly because of shits and giggles, i have no serious background and im a beginner.
Heres some questions:
- What am i getting myself into?
- Is it actually worth it? (I dont think ill use assembly much)
78
Upvotes
20
u/Personal-Ad-487 7d ago
Which assembly? I only do 6502 which is very fun. Z80 and 65C816 looks really cool too. The last one is playing with power. Super Power!
4
u/ItsSkyWasTaken 7d ago
I think even if you don't actually end up using assembly in your career, it's still useful to learn so that you're more familiar with how a computer works under the hood. It can be a really cool exercise to write a project entirely in assembly.
You mentioned you're using Windows x64 [1], which is a nice assembly to learn. Do you plan on using the CRT ( the C Runtime, which provides C functions like
printfandscanf) or low-level Windows API calls (ReadFile,WriteFile, etc.)?If you're interested in going completely low-level and bypassing the CRT, you can also install WSL (the Windows Subsystem for Linux) and learn Linux x64. It's mostly the same in terms of registers and program structure, but you use direct
syscallinstructions rather than calling low-level wrapper functions as you would in Windows.2
u/OutrageousCrab9224 5d ago
Assembly of what?
12
u/popraxret 7d ago
Well, I'm a reverse engineer and low level developer. I do cool stuff with x86. I would definitely recommend it to everybody who is willing to go down into this path.
11
u/pskocik 7d ago
Do. It's not all that much harder than C and you'll be see what's actually possible rather than just what C exposes. C exposes quite a lot of fundamental asm capabilities it doesn't do well when dealing with interrupts, context switches, variadic functions, or SIMD, not to mention OS-level stuff, and in asm all of that is quite straightforward. Being able to understand ASM also helps a great deal in debugging and tuning C (or whatever highlevel system language you otherwise prefer).
Learning ASM isn't some crazy quest. In a way it's just like any other programming language. You deal with a given abstract machine. Except in the case of ASM that abstract machine happens to be more or less the real machine or at least the real machine's lowest-level API.
In a hosted environment, just like for C, you get a process, i.e., a sandbox to play with, so you don't need to worry all that much about messing up too badly.
6
u/Beginning-Junket8979 7d ago
Learn assembly if you want to understand how computers really work at a much deeper level than the average programmer understands.
Don't learn assembly expecting hand writing it to land you a job.
4
u/DaveX64 7d ago
You're better off learning X86_64 assembly under Linux with NASM. If you have a half decent Windows box, you can install Virtualbox and create a Linux virtual machine to learn in...that's the route I went. "x64 Assembly Language - Step-by-Step, 4th Edition" by Jeff Duntemann is a good book to start with.
I've been toying with the idea of trying Risk-V, myself. I'm basically a hobbyist so don't have any real goals aside from tinkering. You can set up a Risk-V in emulation with QEMU, apparently...looks pretty complicated to get that going though :)
Learning Assembly will definitely help you understand C a lot better.
1
u/easedownripley 4d ago
one thing you can try is to play zachtronic games like Shenzhen IO. It's basically a gamified version of writing assembly language. It's just a game of course, but I played it (coincidentally) right before I had to take a class on MIPS assembly. Because I was already good at the game, which actually limits you in lines of code and memory a lot more than the real thing, the class was trivial to me where everyone else struggled.
3
u/Recycled5000 7d ago
You don’t need to learn assembly per se. Plus, there’s so many different ones.
You should learn about assembly to get a better understanding of the machine:
* how it works (machine code, registers, memory, program counter),
* the address space (and how a process works with the os), pointers,
* structures for the flow of control (if then, if then else, loops, function calls, if-goto).
* performance (caches, )
3
u/NewSchoolBoxer 7d ago
No. People in this sub will say yes but with the same amount of time, you could learn much more about AWS, GCP or Azure, or a useful programming language like C# or Python or Rust and do useful work.
Have a goal to accomplish if you want to get into this mess. I wanted to know exactly how SNES games worked on the hardware level. I had an electrical engineering degree so I needed no prep to understand binary or computer architecture or the way computer memory works with zero abstraction. We started with 8-bit, 6502-like CPUs.
No part of assembly knowledge ever helped me in my CS career that's middleware business code and backend databases. If you want to code drivers for x64 then that's different.
3
u/VadumSemantics 7d ago
https://nandgame.com/
To answer your questions:
Yes. Because learning things is fun.
Bonus: Even if you don't use assembly much, knowing what a CPU does & how memory really works is like a superpower when you're using other computer languages.
Nothing?
Nandgame is free.
If it stops being fun, you can go do something else.
I stalled out on nandgame around the time it got into graphics displays. If you like it I'd recommend the book "From Nand to Tetris" or a class based on the same (udemy or whatever).
3
u/FransFaase 6d ago
Maybe you to have a look at the Compiler Explorer which lets you see how fragments of C(++) code are compiled to assembly. There is a large range of compilers and targets to select from.
2
u/Vagetarian42069 7d ago
Do what you want.
2
u/vancha113 7d ago
I'm currently doing the same thing, 6502 assembly. So far it's just been a lot of fun, so I can definitely say it's been more than worth getting in to :)
3
u/Hot_Technology8777 7d ago
You won't get far. I see billions of these questions and they never follow through. You'll try for half an hour then go watch anime or tiktok for 6 hours. Don't announce it to the world, just try it and see if you can stick with it. Trust me you'll know exactly what you're getting into, and there's an extremely high chance you won't like it.
2
u/DryComment6387 7d ago
just make sure you’re learning x86, do NOT, under any circumstances, try learning ARM
1
u/Dog-Mad 7d ago
Assembly is a tool, you have to ask yourself if you have anything you want that tool to do. I can't tell you if it is worth it because I don't know what your plans are. But, if you are learning it for the sake of learning it, i suggest you don't.
1
u/theNbomr 7d ago
You'll only be learning something useful if you also learn about the basic architecture of the computer and how things like memory, IO, the CPU itself and ancillary systems such as interrupts work. To learn about these things starting with the x86-64 platform will be very complicated, since you can't access much of anything directly because of OS imposed limits, and because it's overall very complex.
If you're serious about learning, start first on an older 8-bit CPU using a trainer board that exposes everything and allows you to exercise and experiment with it. Z80, 8085, and 6502 CPUs are your easiest route. x86 real mode (DOS) is another option that may transition into 64 bit x86 later.
1
u/meowcatmeownow 7d ago
No! You are not allowed to learn assembly until you know how to create a cpu and memmory out of NAND gates. The book is called Elements of computer systems or something... But there are better books, like Digital design and computer architecture by Harris and Harris. The course is called From nand to tetris on Coursers.
1
u/sirflatpipe 7d ago
I personally have written stuff in x86, some minor exercise stuff in MIPS and some RISC-V.
1
u/IDatedSuccubi 7d ago
It's not actually complicated (IMO). It's mostly just tedious as hell. There's like a thousand instructions, but they all come in sets of 2-8 very similar ones, and there's a few tricks with stack, system calls, interrupts etc
It's worth it because if you ever need to do something very specific and at the speed limit of hardware that's your best bet
1
u/podule-games 7d ago
Assembly languages can be worth learning just as a bit of an insight into how processors work at the user level (it still won't teach you about microcode and stuff), but it's probably worth looking at a simpler architecture than x86-64 or AArch64. They're both massively complex and very hard to learn, neither was designed with the idea that people other than compiler writers would be touching the assembly language.
Other architectures like MIPS, ARM32, 6502, 680000, or Z80 are far, far simpler and much easier to get going with.
You almost certainly won't use it in a job. Even the tiny little chips we use at work with 1KB of RAM, we code them in C, not assembly language (other than a tiny little bit).
I think it can be useful though, even if you just learn for a month or something, you'll get a much better idea of how computers work.
1
u/SchemeWestern3388 7d ago
A basic knowledge of assembly is extremely helpful as a programmer.
A deep knowledge of modern assembly is some kind of mental disorder, maybe? I dunno. I’m glad someone is paying attention.
1
u/Potential_Let_2307 7d ago
Tbh nowadays with the pervasiveness of AI and its ability to write code, maybe one day it will write ones and zeros directly and completely bypass the need to use abstractions like programming languages. Thus, assembly (which is essentially just the 1’s and 0’s in human readable form) would be highly useful at that point.
1
u/gm310509 7d ago
You might want to have a look at this post to which I replied - it is more of a "how to go about it".
1
u/recursion_is_love 7d ago
If you decide to do it . Learn RISC not CISC
1
u/bluedevilSCT 7d ago
Yes
1
u/Left_Ad132 7d ago
Assembly is fun if you do enough of it. If you don’t have a specific goal or plan, use one of the simulator programs for 6502 or MIPS.
1
u/dld2517 6d ago
I think it is “worth it”. Here is why, you can learn what goes into creating a system call. What is the minimum amount of information required to do something on the machine successfully? What is required to move that information and save its state. What the data structure looks like and how to leverage it. You won’t go wrong by learning at least basic programming constructs in ASM. You can learn how to process something and get the right thing back out. For example, is the data big endian or little? Etc. you won’t waste your time you will learn a lot.
1
u/Dazzling_Music_2411 4d ago
Do the Nand2Tetris course first, then decide.
It will act as a map of sorts, into what to expect.
-1
u/Thereal_Mistake 7d ago
You cant just "learn assembly" on its own. First you need to determine what hardware you want to write assembly for. Then you need to learn computer architecture fundamentals to understand how the hardware works, then you need to learn advanced computer architecture to understand how to use fully manipulate the hardware. Then you can start to learn assembly. If your goal is to have fun, dont learn assembly.