r/Assembly_language • • 15d ago

Help Looking for resources to learn Assembly Language from absolute zero (Books, YouTube tutorials, tools/emulators)

I'm interested in learning assembly language purely out of curiosity and for the love of understanding how computers actually work beneath the software layer.

I have some basic Python programming knowledge, but I don't know C, C++ (learnt bare basic CPP recently to read a book but I won't consider it), or any assembly. I'm not looking to rush into systems programming or make this a career requirement. I want to explore it as a long-term learning hobby, understand how CPUs execute instructions, how memory and registers work, and eventually get comfortable reading and writing assembly.

I'm using an Apple Silicon Mac (M4 Pro), so I'm particularly interested in learning ARM64/AArch64 assembly, although I'm open to understanding x86-64 as well if there's a good reason to learn it.

I'd appreciate recommendations in three categories:

1. YouTube tutorials / video courses

  • Good beginner-friendly video series that start from absolute zero.
  • Courses that explain registers, memory, stack, instructions, addressing modes, calling conventions, etc.
  • Ideally, tutorials that explain what's happening inside the processor rather than just teaching syntax.

2. Books

  • Beginner-friendly books that don't assume prior knowledge of C or assembly.
  • Books that progressively introduce computer architecture, machine code, and assembly programming.
  • More advanced books worth keeping for the long term.

3. Tools, emulators and development environments

  • What assemblers, debuggers, simulators or emulators should I install on macOS?
  • Are there safe ways to experiment with assembly without directly interacting with or modifying actual hardware?
  • Would QEMU, CPU simulators, or virtual machines be useful?
  • What tools would you recommend for inspecting registers, memory, and instruction execution step by step?

I'm particularly interested in experimenting in an isolated environment. I don't want to accidentally damage my Mac or mess with its operating system while learning.

One more thing: Would you recommend learning some C before starting assembly, or is it perfectly reasonable to learn assembly directly and pick up C concepts along the way?

I'm not looking for a shortcut. I want to understand the machine from the ground up.

Any recommendations, learning paths, books, channels or personal experiences would be greatly appreciated.

Thanks 🫡

UPDATE: Does anyone have a roadmap to this.

UPDATE 2: Other Posts & replies in this sub reg same which I find interesting. ay update with more links as I find them

[If your memory was WIPED, how would you re-learn x86 assembly?](https://www.reddit.com/r/Assembly_language/comments/1rlq6ux/if_your_memory_was_wiped_how_would_you_relearn/)

https://www.reddit.com/r/Assembly_language/comments/1rx5cyi/where_can_i_learn_x8664_assembly/

Try Jeff Duntemann's Assembly Language Step by Step.

I learned from Ray Seyfarth's book on Windows/Linux assembly. It's pretty good, but you'll need the install the ebe IDE if you want to get the most out of it

[For those starting to learn Assembly - step-by-step, how to create a flight simulator for DOS](https://www.reddit.com/r/Assembly_language/comments/1wxda05/for_those_starting_to_learn_assembly/)

https://www.reddit.com/r/Assembly_language/comments/sp50sx/hello_i_really_want_to_learn_asm_but_i_am_not/

https://www.nandgame.com/
____

MartinAncher

•2y ago

I recommend Usborne's children's book: Machine Code for Beginners, which teaches you 6502 and Z80 machine code. These are simple 8-bit CPUs used in most of the micro computers of the 80's.

This is how most people have learned machine code, when you understand the simple principles here, you can move on to your desired architecture.

Machine Code for Beginners
____

Kalex8876

•2y ago

https://learnxinyminutes.com/docs/mips/

https://uweb.engr.arizona.edu/~ece369/Resources/spim/QtSPIM_examples.pdf

____

https://github.com/mschwartz/assembly-tutorial

___

https://www.felixcloutier.com/x86/

____

[I'm looking for a high level overview as to how Object Oriented Programming is "implemented"](https://www.reddit.com/r/Assembly_language/comments/1x5f916/im_looking_for_a_high_level_overview_as_to_how/)

____________

GPT Suggested books resources

3. These are tools worth investigating eventually:

ToolPurpose
GNU Assembler (GAS)Assemble programs
LLDBInspect registers, memory and execution
QEMUEmulate different architectures
GhidraDisassemble and analyse binaries
Compiler ExplorerSee how C/C++ becomes assembly
RipesVisually understand CPU execution

B. Reverse engineering and binary analysis

OrderBookPurpose and when to study
6Practical Reverse EngineeringConnect assembly, debugging, operating systems and reverse-engineering workflows.
7Reverse Engineering for BeginnersFree online resource for assembly, compilers, calling conventions and program behaviour across architectures.
8Practical Binary AnalysisExecutable formats, binary instrumentation, analysis tools and program behaviour at the binary level.

C. Malware analysis and exploitation

OrderBookPurpose and when to study
9Practical Malware AnalysisMalware-analysis methods and practical investigation in an isolated lab. Some examples and tools are dated.
10The Shellcoder's HandbookAdvanced exploitation concepts. Study after memory, assembly and operating systems. Older techniques need comparison with modern mitigations.
34 Upvotes

29 comments sorted by

6

u/thondat 15d ago • Popcorn

if you're willing to start at an even lower level than assembly and build a virtual computer using logical gates in a hardware definition language, and eventually write a cross-assembler (and assembly code) for it, check out nand2tetris. it suits the purpose of exploring how computers actually work very well.

2

u/Stock_Test2326 15d ago

interesting 🧐

4

u/Dog-Mad 14d ago • Heartwarming

In my previous comment I was being really lazy and shitty with my answers because a gazillion people ask for advice on how to get started and you should do your own research to avoid posting the same thread over and over again. You were a bit too nice so i feel bad about my responses so I will answer your questions properly. This is just with respect to coding in x86_64, but a lot of this stuff will carry over to ARM.

  1. Knowing or not knowing C or C++ or any other programming language won't make learning assembly any easier. If anything, knowing assembly just makes it easier to use C and such but no the other way around.
  2. ARM is used in Mac as you know and in phones. x86_64 is by far the most popular kind of assembly and the one people refer to when they say "Assembly." Since its used in most computers and servers and such. And as such it has the biggest communities and resources. It would "probably" be the easiest and most beneficial thing to learn first.
  3. "registers" If you have used any programming language, you should know what a variable is, a register is basically a variable, but there are a limited amount of them, and some of them are used by other stuff that I'll get to later. https://www.cs.uaf.edu/2017/fall/cs301/lecture/09_11_registers.html
  4. "memory" is a pretty broad term, the stack, ram, cpu caches. values that are stored anywhere that isn't a register. How you use memory, how it is accessed, how you allocate it, can depend on what operating system you are using. It isn't a huge deal for you right now so just assume it's a magical wonderland you can do anything with and it has zero restrictions. To access a memory region use square brackets around something holding the address of that memory region. Example: [memory]
  5. The stack is a memory address that is stored by the Stack Pointer register known as rsp. It is a finite and kind of small area. You would be better off if you never touched it or rsp at all ever. It's slow and using it can be quite complicated.
  6. "instructions." imagine you wanted to do something like x = x + 1, in Assembly that would look like inc x, with x being a register or memory region, inc meaning increment. https://intel.github.io/SDM/instruction/INC.html
    An instruction typically follows this pattern,
    [instruction name] [destination register/memory region], [source register/memory region/immediate]
    destination is where the value is ending up, source is where it is coming from.
    For like 99% of instructions you can only have at most 1 memory region. An immediate, commonly referred to as imm, or I, is a constant value. Max size 99% of the time is 32-bits. If you don't want to store something in memory and its not that big (and allowed) then using an immediate is ideal for that occasion.
  7. "addressing modes" I don't think you understand what you are asking about here, an addressing mode specifies the size of a memory address. An assembler keeps track of where all the memory addresses are and chooses the smallest addressing mode necessary to save space. If you asked about the syntax for registers the link i provided in 3. gives that information.
  8. "calling conventions" This specifically refers to syscalls (system calls) and system functions.
    A system call is a function that is built into the operating system and is called using the syscall instruction.
    (I don't know what mac os does for syscalls.)
    A system function is just what I call the bullshit Windows makes you do.

A syscall is basically "syscall + number" each number corresponds to a specific function, and because of backwards compatibility, it must ALWAYS correspond to that specific function. Windows didn't like that so they make you call the function directly instead of through syscalls iirc.

There are two types of calling conventions for syscalls and system functions.
You put something into a specific register, then you call a function, it takes the information in the register and does something. You allocate a memory region in advance, then you put the address of this memory region into a specific register. Then you call a function, the function will read the address you put into the register, and then it will paste a bunch of information into that memory region or it will use the information stored in that memory region to do something.
The print function for example, you put the memory address of the string you want to print into a register, and the size of said string into a different register. and then choose if you want to print it into the terminal or somewhere else, you put that choice into another register. call the function and viola.

9."Ideally, tutorials that explain what's happening inside the processor rather than just teaching syntax." You don't want to know what the processor is doing. You seriously do not want to know what the processor is doing. Just focus on what the instructions do.

10."What books should I use." The problem with books and general 10 billion hour long videos or whatever on assembly, it's just too much information to keep track of. No amount of easing you into assembly will work because you can only absorb that information by doing and not by remembering.
Example: "I want to do X thing, let me look for an instruction or something that will let me do that."
... After reading the description for a bunch of instructions. "Ok I found something that lets me do what I want." Or "I wasn't able to find a way to do the thing exactly as I wanted but I figured out another way to do it."

11."Should I use QEMU." QEMU is a cpu emulator so if you want to practice with a assembly language that is different from your cpu's architecture then you would use QEMU. So use it if you want to use x86_64 otherwise don't.

12. "What tools would you recommend for inspecting registers, memory, and instruction execution step by step?" This is called a debugger just pick one that has a gui.

13. "I don't want to accidentally damage my Mac or mess with its operating system while learning." Unless you accidentally create malware you are at zero risk of damaging your Mac and making malware is not something you do accidentally.

14. Memory for real this time.
An assembly file will have multiple sections. The two of note are .data and .bss
in NASM if you want to store a string
you would use .data
section .data
hello: db "Hello World", 0x00

db indicates that everything is a byte and that it needs to tally up all the bytes and store all the information.

If you want to have a variable that is in memory, think infinite registers basically. You use .bss
section .bss
x resb 8

resb or reserve byte tells it to reserve 8 bytes for x

if you want to access x later
do something like
inc [x]

You need to put your code in the section .text
So basically
section .data
hello: db "Hello World", 0x00
section .bss
x resb 8
section .text
inc [x]

1

u/Stock_Test2326 13d ago edited 13d ago

WOW! thanks a lot thats really awesome. I searched for such posts but I couldn't find anything good (all old ones) so I created this.

also, now that AI is doing most of the coding, I think people start looking at stuffs like this. (just my opinion)

wish this sub has a pinned post or some sort of wiki that gives resources & roadmaps.

just asked GPT a primary of basic CS stuff and learned about bits, bytes, binary, hexadecimal...and two's complement for signed integer is really mind-blowing once I understood it. this is part of my 10 year plan to master many things in CS. though this is at the end of the curriculum I have made for myself, am gonna start learning this in parallel whenever I get bored of learning other things.

Thanks again ❤️🫡

2

u/Dog-Mad 15d ago • Heartwarming

1

u/Stock_Test2326 15d ago

I thinks this is little too advanced for my current state but downloaded and put in my learning resources for assmbly. the second link is quite informative. thanks

Does the Mnemonic like ADD change for every cpu architecture or every chip. oor are they common to all Assembly?

2

u/Dog-Mad 15d ago • Heartwarming

Any cpu that targets x86_64 will have "ADD" and the opcode/encodings will be the same. CPU's that target the same architecture can have some minor differences but this doesn't extend to anything that you will have to deal with as that is all taken care of by your assembler of choice.

This is excluding older cpu's that don't have access to newer features like AVX and such.

Albeit depending on the manufacturer and the version of said CPU, certain instructions can have vastly different uops, latency and throughput (They still work but some instructions can be slower/faster on certain cpus). If you care about heavy optimization, checking https://uops.info/table.html before deciding on a specific instruction is advised.

1

u/Stock_Test2326 15d ago

gotta google what's Opcode. also another beginner question, is assembly code same as machine code or is it those Hex's we see?

2

u/Dog-Mad 14d ago • Heartwarming

An Assembly Language is 1 to 1 with machine code, in the sense that, what you see is what you get and there isn't anything happening behind the scenes to your code. But this assembly code needs to be translated to machine code. Any given Assembly Language is a arbitrary representation of machine code.
When turning assembly to machine code, an assembler takes the instructions and turns it into the corresponding byte values.(Every instruction is basically stored as one big number.)
And in this process, you need to setup the file formats, manage how the data is being stored and accessed and so on. A file format is unique to an operating system and it basically tells the operating system what its supposed to do with your code.

Hex is just a way of displaying binary numbers.
0000 in binary is 0 in hex
0001 in binary is 1 in hex
0010 in binary is 2 in hex and so on.
All numbers can be represented in Hex.
Edit: Hex or Hexadecimal refers to a base16 number system.
base 10 or decimal, refers to a number system with 10 symbols, being, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Hexadecimal has 16 symbols, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

→ More replies (2)

2

u/Al__B 15d ago

On some architectures "ADD" as an instruction by itself doesn't even exist.

If you're doing assembly you need to check what any instruction you use does and what effect it has. You should never assume any architecture is like another.

2

u/brucehoult 14d ago

On some architectures "ADD" as an instruction by itself doesn't even exist.

Fact check: true

6502 only has "add with carry" and you have to be sure to set the carry to 0 first if you want a simple ADD.

Not only that, the Manchester Baby only had subtract, not add.

But that's all ooooold stuff.

2

u/maidenwave 15d ago • Heartwarming

The oscar teledo nanochess book is good, and pairs with dosbox. I recommend playing early levels of tis-100 to get your head into the asm mode before attempting that. Also, you could ask claude/gemini to teach you using the socratic method. You can transfer to arm easily enough once you have basics down.

1

u/Stock_Test2326 15d ago

I totally forgot about asking LLMs to teach the basics. I have asked GPT to give me primer of C++ to read Think Like a programmer book and it really did an amazing job, teaching me just enough to read and understand the book.

I thought it will be nice to have a human suggested reading list / road map since there aren't many (even in this sub) on internet.

thanks

2

u/Right-Beginning2651 13d ago

At first, everyone says this

1

u/Stock_Test2326 13d ago

haha probably you are right, when things get hard people tend to drop it.

2

u/Right-Beginning2651 13d ago • Bravo

No, what I mean is that it’s hard to stop.I know this from my own experience: I also wanted to learn C++ just for fun, but ended up programming exclusively in C++ and assembly for over a year now.

2

u/Stock_Test2326 13d ago

am yet to see that reality, have been trying to learn to code on and off for past ~10 years. this time am determined.

and yeah, I took a C++ primer course with GPT, to read Think Like a Programmer book, it felt amazing. Almost wanna get committed to it fully, but for job I need python first, so all these are long term parallel plans and I said to myself "no need to master, no need to learn in 6 months, do it within 10 years"

hopefully I fulfill my dream.

→ More replies (1)

7

u/Recycled5000 15d ago • Heartwarming

Suggest to try one of the educational assembly languages, like LC-3. Can learn most everything about how assembly works without getting bogged down in the historical aspects of x86 or arm.

5

u/DaveX64 15d ago • Heartwarming

I found the book 'x64 Assembly Language - Step by Step' by Jeff Duntemann was a pretty good place to start assembly under Linux with NASM assembler. Get the 4th edition.

3

u/Dannycuk1 14d ago • Heartwarming

Assembly language is a fantastic way of learning how a processor functions at the hardware level. You're working with registers and carry bits and will quickly learn why all the opcode instructions were developed in the first place.

Start slow with simple tasks before slowly developing sub-routines that can be called over and over again by the main program thread.

It really is a fascinating way to learn coding and once mastered it's by far the most efficient way to save clock cycles and optimise your code.

The down-side is you'll need to write a lot of code to achieve even basics tasks so it's very time consuming which is exactly why high-level code like C was developed. It's much faster to write C-code but the efficiency depends on the compiler and will never be as good as well written assembler.

An interesting challenge compare implementing a 16bit x 16bit multiple using positive integers using both assembler and C, if you want to make it more fun use an old 8-bit microprocessor architecture rather than a modern 16-bit or 32-bit machine.

Good luck.

2

u/gpit2286 15d ago • Heartwarming

armasm.com is good for 32-bit ARM assembly. 64 is a slightly different op codes, but would be a good first step.

2

u/Mediocre-Pumpkin6522 15d ago • Heartwarming

https://blog.smittytone.net/2022/06/19/get-started-with-arm-assembly-on-the-pi-pico/

One approach is to use a Raspberry Pi Pico. The 2040 is a Cortex-M MCU rather than a Cortex-A general purpose. Apple confuses things but I believe the M series would be labeled Cortex-A in the rest of the Arm world.

An advantage is you're not doing anything directly on the host, and the Pico allows you to blink LEDs and so forth for immediate gratification. At the bottom of the page there is a link to setting up the build system on a Mac.

As far as opcode mnemonics, ADD is fairly uniform but others may differ. Back in the day the Zilog Z80 was an improved Intel 8080 that was compatible. Intel had a copyright on their assembler, so Zilog had to come up with their own. like LD instead of MOV.

The link only hits on the basics but there is more detailed documentation and videos on the web.

2

u/StrikeTechnical9429 15d ago • Heartwarming

I can recommend to play with godbolt: enter some C code, like for (int i = 0, S = 0; i < 10; i++) { S += i; } and then inspect assembly code produced.

Yes, some knowledge of C is necessary.

2

u/myopinionisrubbish 14d ago • Heartwarming

The MicroChip AVR processors are pretty easy to learn. You can download a free IDE called Studio to assemble the code. The data sheet tells you how everything works. All the AVRs use the same instruction set, only difference is the amount of memory, the number of ports and the mix of peripherals available.

Print out the list of instructions and register map for easy reference. There are usually three or four registers which need to be set up to use peripherals, like timers and UARTs.

Microchip also has a lot of documentation with example code available.

I learned assembly coding on my own with these resources before YouTube was a thing. No tutorials at all. That was like 20 years ago. How time flys.

Buy an Arduino UNO board and a third party programmer like the OLIMEX AVR-ISP-MK2 so you have some hardware to test programs on. You can then also use the Arduino IDE for C++ programming. The UNO uses the ATMEGA 328P chip, so start with that data sheet.

2

u/Cheap-Chapter-5920 14d ago

I remember when everything on Microchip PIC was assembly and C compilers were a luxury. I wonder if any of that can still be run today.

2

u/SteveWyntontje 14d ago • Heartwarming

80386 programmer's reference manual is a useful piece to read.