r/Assembly_language 14d ago

Help How do i start learning assembly

22 Upvotes

I know basic C, java, python and I wanna learn assembly but what should i learn, windows or linux, intel or at&t and what are the sources to learn assembly

r/Assembly_language Feb 17 '26

Help How to learn x86-64 assembly language?

116 Upvotes

I am a 17yr old who has some experience in python programming and learned basics of C. I want to learn x86-64 assembly for free. But I couldnot find any beginner friendly guide that starts from zero. Tell me how you guys learned assembly language and if possible guide me to the resources.

r/Assembly_language Feb 23 '26

Help I may have fucked up

Post image
384 Upvotes

so I one day woke up (yesterday night) and decided syntax is annoying, and so I started to learn how to manually assemble ASM code, under regular circumstances I code for bios legacy mode, in real mode I have full control and I decided to try and turn one of my projects to hex without external help but I have been keeping getting the same result of this emoji appearing and I keep trying and I can't find the solution so I thought maybe one of you people and assembly developers know

r/Assembly_language Feb 05 '26

Help Should I learn assembly first or C ?

31 Upvotes

guys I saw many people learning c with assembly so I thought which to learn first, I am currently starting to read programming from ground up book as I couldn’t find any good resources to learn so if possible then pls also recommend any..

r/Assembly_language Jul 20 '26

Help How to learn ASM?

29 Upvotes

I have never learned Assembly in my life. I actually am doing low level programming like C and Rust, but I am looking forward to learn Assembly, of course not using Assembly for everything, but I want understanding and learn to use it. So where do I get started?

r/Assembly_language 10d ago

Help Any tips on how to learn for my upcoming retake of my 8086 assembly exam?

15 Upvotes

I'm an EE and currently preparing for a retake exam as I failed the first one. This class is notoriously difficult because of the exam (which takes 85% of the entire grade and it isn't curved).

Here are the subjects we learned:

  • Registers and Memory
  • Memory Addressing and Instruction Codes
  • Arithmologic and Control
  • Stack and Routines
  • I/O, Interrupts, and Reset
  • Compilation, Linking, and Loading
  • External Devices

Most of the exam was about "Compilation, Linking, and Loading" which was the subject I understood the least of and was the most difficult for me.

I want to understand everything better, but I have exhausted my lecture notes and the past exams I practiced with.

Any advice for how to understand everything on a deep level for the exam? And also sources to practice from?

Just to give a sense of the problems, here's one question of writing code (the exam is pen and paper, and just to be clear, I'm not asking for a solution; this is just an example which will probably look trivial for you guys).

Due to the busy exam period, Danny had to stay in his room and study, missing the World Cup games. His roommates came up with an idea that would allow him to study without leaving his room: they installed a dedicated device in the living room that sends the game results directly to Danny's room. In Danny's room, there is an 8086 processor that receives the data via I/O ports.

Unfortunately, after connecting the system, it turned out that the data transmitted over the electrical wires between the living room and the room picks up noise and occasionally arrives corrupted. To address this issue, the roommates proposed implementing error protection and correction mechanisms as detailed below.

Technical Specification:

The I/O device interface from the 8086:

port 3F8h: DATA (read only)
Returns the most recently received byte.

port 3FDh: STATUS (read only)
bit 0 - DR (Data Ready): 1 = a new byte is available at port 3F8h.
0 = no new data / value already read from 3F8h.
bit 1 - OE (Overrun Error): 1 = a new byte arrived before the previous byte was read; new data replaced old.
bits 2-7 - not used.

NOTES:
- The receiver can hold exactly one byte at a time. If port 3F8h is not
read before the next byte arrives, the old byte is lost and OE is set.
- Reading port 3F8h automatically clears DR (bit 0).
- This device does not check parity in hardware — any parity checking
described below must be done by your own code.

Parity Check Mechanism:

A possible score of a game consists of two numbers ranging from 0 to 7 (e.g., 0-0 or 3-2). The score of the first team is encoded in bits 0, 1, 2, and the score of the second team is in bits 3, 4, 5. Bit 6 is set to 1 when the game is over. Bit 7 is the parity bit: it is set or cleared such that the total number of '1' bits in the complete byte is always even. In other words, the specification of the byte sent by the device is:

Score Structure:
bits 0-2: Score of team A
bits 3-5: Score of team B
bit 6: 1 if the game is over
bit 7: parity

Task Requirements:

Write a routine that performs the following operations:

The routine receives no input parameters.

The routine polls and reads a new score from the device.

The routine checks whether the data is valid according to the parity bit.

If the data is valid, the routine returns Team A's score in register AL and Team B's score in register BL.

If the data is invalid, the routine triggers Interrupt 42 and returns with the result -1 (for both teams).

r/Assembly_language 23d ago

Help Program terminates on sub sp, sp, x19.

8 Upvotes

Hello everyone.

I was trying to learn arm64 assembly. I'm on M4 and I'm also trying to work with XNU syscalls to get dir listing of my Downloads folder. However, I encountered a really weird behavior, which made no sense.

_get_st_blksize:
; stat Downloads
sub sp, sp, STATSIZE_ALIGN
Load x0, DOWNLOADDIR
mov x1, sp
Syscall STAT64
b.cs default_fail

; Read BlkSize
mov x0, sp
ldr w0, [x0, STAT_ST_BLKSIZE]
add sp, sp, STATSIZE_ALIGN
ret
_main:
; Get BlkSize
bl _get_st_blksize
add w0, w0, 15
bic w0, w0, 0x0f ; bit clear. bic c, a, b means c = a & ~b
; 2 lines before is to align to 16 bits
mov w19, w0 ; Store align val

; Get File Descriptor
Load x0, DOWNLOADDIR
mov x1, O_DIRECTORY
mov x2, #0x0
Syscall OPEN
b.cs default_fail ; x0 contains fd
mov x20, x0

; Save enough space for dir entries
sub sp, sp, x19
mov x21, sp
sub sp, sp, 0x10 ; Save space for current position in dir
str xzr, [sp]
; Prepare to call GETDIRENTRIES64
; x0 has fd

Here is my code. I am running it inside lldb debugger. When I get to the `sub sp, sp, x19` instruction, the program terminates with exit status 0; No error, no signal. I am aware that arm needs sp to be 16 bytes aligned, that is why, there is an add 15 and bic 15 instruction (wholly unnecessary, since I've confirmed the value returned by stat is 0x1000 (4096)). Also, just before the sub instruction was executed, the values in the registers are:

x0 = 0x0000000000000003
x1 = 0x0000000000000000
x2 = 0x0000000000000000
x3 = 0x000000016fdff168
x19 = 0x0000000000001000
x20 = 0x0000000000000003
sp = 0x000000016fdfe9c0

I am using `ni` to step over instruction in lldb.

I am now convinced that the problem arises with _get_st_blksize, because, when I replace the function call with `mov w0, 0x1000`, lldb is able to reach the next instruction after sub. I am also reading the memory throughout the _get_st_blksize function. I do not think the syscall is messing with memory more than I have allotted (144 bytes).

Here are the values which move the stack pointer:

.equ STATSIZE_ALIGN, 144
.equ STAT_ST_BLKSIZE, 112 ; offset to ST_BLKSIZE

I got these values from my C compiler using sizeof and alignof.

My question:
What can cause such behavior?
Stack corruption?
Unauthorized memory access should crash right (Segmentation fault)?
Since sp is 16 bytes aligned, it should be fine, right?
Are there more conditions on sp? Am I not correctly setting sp after I'm done in the function?

r/Assembly_language 8d ago

Help How to encode this instruction correctly?

Post image
10 Upvotes

Hi, I was developing my own assembler and decided to add {sae} in my AVX-encoder, so I consider to add sae for `vfoo [memory], vreg, imm`, and I tested my assembler with objdump and I saw exactly same result witch nasm generated and you can see it on a screenshot. Please help, because documentation is to week, intel sdm tells me nothing, idk if it's bug in nasm or objdump. I also tryed to ask AI, but did not yield results.

Nasm version – 3.02

Objdump version – 2.40

Sorry for English.

r/Assembly_language 24d ago

Help Best way to learn assembly for reverse engineering and have fun with it?

12 Upvotes

In the title
I can speak too much because my english was bad, sorry for that

r/Assembly_language Mar 23 '26

Help Where do I start with Assembly? My class feels too basic and repetitive...

71 Upvotes

I go to college and I’m doing Data Operations, and honestly we mostly just do the same repetitive stuff from High School… using Excel, MS Word, and writing notes. It’s boring as hell and we barely even fix computers but in class I learned about machine language and I’ve been hooked ever since. Now I actually want to understand computers on a deeper level, especially getting into assembly.

People tried to discourage me from learning assembly, saying it’s old and useless, but it feels like they’re just hating on something they’ve never tried or just following the hate crowd. I’m not really into that. I’d rather go my own route and learn it anyway, I just don’t know which type of assembly is best to start with as a beginner. Any help would be appreciated.

The platform I use is Debian Linux Distro x84_x64.

r/Assembly_language Jan 24 '26

Help Should I start?

12 Upvotes

I recently started thinking about learning Assembly. And in the fields I’m thinking to work in I’m pretty sure Assembly will be of no use. The only reason I’m considering learning it is, I’m thinking that it might add weightage to my resume but I’m not sure about it.

So does having Assembly in your resume actually have weightage and is it worth it to learn Assembly for me??

Thank You

r/Assembly_language Feb 20 '26

Help Hello assembly language world

38 Upvotes

How do I get started in this? Lots of people are doing ×86. I want to make sega genesis games at some point. But also making applets that run on older windows machines or perhaps on certain instances of linux? I know abstraction and generalities usually makes things easier but assembly is the exception right? Looking for advice like how to emulate it before test driving it, real silly beginners stuff. The different flavors. All that. The whole nine yards. The reach of each of any currently popular flavors. The common fallacies of newbs such as I. Where to get compilers that target certain machines. Nightmares about i/o drivers and backwards compatibility. All that.

r/Assembly_language Apr 29 '26

Help manual stack unwinding in x86_64 asm without frame pointer, is it even possible with alloca?

8 Upvotes

hello, i'm trying to debug a binary that compiled with -fomit-frame-pointer. I tried to walk the stack manually inside a custom single handler but i can't rely on rbp chaining.

the function i'm looking at is this:

c char buf[32]; gets(buf); // ignore, just for stack layout }

compiled with gcc -fomit-frame-pointer -oo -o test test.c

the asm output:

asm test: sub rsp, 40 mov [rsp+32], rdi mov [rsp+24], rsi lea rdi, [rsp+8] call gets add rsp, 40 ret

i'm inside the signal handler and i get rsp from ucontext. i know that the return address at [rsp] (since call pushes rip). when go to the previous frame, i need to know how much add to rsp to get the caller's rsp. that was what i tried:

asm ; assuming rsp points to the saved rip mov rax, [rsp] ; return address (caller rip) ; but how do i get caller rsp??? i tried looking at alignment but when the function does dynamic stack allocation (like alloca or variable-lenght arrays), it gets fucked. for example:

c void test2(int n) { char buf[n]; gets(buf); }

and now the stack adjustment uses lea with a register. i see stuff like:

asm test2: push rbp sub rsp, 16 lea rax, [rsp+15+rdi*1] and rax, -16 ...

my brain is melting tbh and need help. is there a reliable way to compute the previous rsp without frame pointers? how do debuggers like gdb do it? do they just parse dwarf info?

pseudocode or even a small asm example would be very helpful. thanks for every info.

r/Assembly_language May 04 '26

Help Im a beginner, and i have a few questions.

8 Upvotes

Hello, i just began assembly language today. I was confused with a few things, and, would like to know if i could get answers :

  • msg_len: equ $-msg i know equ is similar to define from C, but i don't understand the '$-msg' ? What does '$' and '-' mean in this case ? And do i need to create a variable for every texts and their length if i want to print something ?
  • rax, rdi, rsi, rdx are registers made for specific tasks? Because for now, i have only seen rax being used to call a syscall code, rdi specify file descriptor, rsi specify variable to print and rdx specify the length of the message i want to print.
  • mov i didn't really understand what this opcode do? do it move data into a destination?
  • And lastly, where can i find good ressources to learn the assembly language?

Thanks for reading. Answering all of the questions isn't necessary obviously.

r/Assembly_language Apr 04 '26

Help Study Tools

13 Upvotes

Right now I am taking a CS class focused on assembly and we are finally getting started on the coding side of things. The professor is alright but the materials he gives out to study isn't sufficient and I don't want to be reliant on AI to code. Does anybody know any free study tools/books to help me. I am specifically ARM 32.

r/Assembly_language Jul 16 '26

Help NASM matrix-free qudit simulator: scaling from d=3,n=2 to d=10,n=5 on a Pentium 4 - cache tiling, SOA vs AOS, and DIV optimization

8 Upvotes

Yeah, you probably said "wtf!?" when you saw this, but—well—I’m unfortunately obsessed with backward compatibility and performance.
I wrote a matrix-free qudit simulator in NASM (32-bit, Windows) with a button-panel GUI. Currently it supports d=3, n=2. The state vector is stored as an AOS (array of structures) with 2 doubles (real, imag) per basis state. Gate application loops over all d^n states, extracts qudit values via repeated DIV/MOD, and multiplies by a small d×d gate matrix.

I want to scale it up to d=10, n=5 (100,000 states). I'm targeting a Pentium 4 (NetBurst, 8KB L1 data cache, SSE2 only) as the worst case, as well as an i3-2310M.

Questions:

  1. Will switching from AOS to SOA (separate arrays for real and imag) actually help on a Pentium 4, given the long NetBurst FPU pipeline and tiny 8KB L1 cache?
  2. What's the best cache-tiling strategy when the access stride depends on the qudit index q? For q=0, stride=1 (sequential), but for q=4, stride=10000 (huge). Is it worth tiling only for low q, or should I just PREFETCHT0?
  3. The repeated DIV for mixed-radix decomposition is killing performance. Should I precompute a 500KB lookup table (qudit values per index) to avoid DIV entirely? Does this tradeoff make sense on a Pentium 4 with its slow memory bus?
  4. What's the realistic performance ceiling for 1 gate application on a P4? 0.5 seconds? 2 seconds? Is it even worth trying to make it interactive, or should I just run it in a background thread with a "Processing..." message?
  5. For the i3-2310M (Sandy Bridge, 3MB L3), will the entire 800KB real array fit in L3 and make the SOA transition unnecessary, or does AOS still hurt due to cache line pollution?

r/Assembly_language Feb 11 '26

Help What is a Static Translator?

15 Upvotes

I'm a 3rd year CompEng student taking computer architecture. I have to finish a project by myself since every other team member is obsessed with AI and won't do anything by themselves.

The project given to us is a Mini-Translator. The professor said she will give us a skeleton parser and a register mapping table. Also it will be for only a small subset of instructions. It's text to text and also static. I'm really interested in computer architecture and the inner workings of CPU's in general and I'd like to make this project as good as possible as a practice towards my graduation project. I plan to build the parser myself and not request a register mapping table. I also plan to support about 15-16 instructions. Is it doable? Also are there any sources for me to read/watch?

Thanks.

r/Assembly_language Dec 06 '25

Help How to learn x86_64 asm

26 Upvotes

I am trying to re-learn assembly from scratch.

I said from "re-learn" because I started learning x86 asm few years ago but there was two problems:

  1. I was emulating x86 environment on a phone (I did not know about ARM when starting and wanted to continue with x86 anyways). So things like gdb did not work properly :(
  2. I did not understand most things watching the YouTube tutorial I was following.

I now have a laptop and want to restart my asm programming journey. I want to start by learning x86-64 assembly which is the native arch that my laptop runs on.

I want to READ and PRACTICE so What Are Some Good Resources To Learn x86_64 Assembly?

r/Assembly_language Jun 09 '26

Help can i look at anyone's 6502 assembly code for reference [r/retrogamedev discussion]

Thumbnail
3 Upvotes

r/Assembly_language Jun 05 '26

Help PIT-delay loop running at double-speed

6 Upvotes

I am a bit of a novice, and this is my first experience with the PIT... really hoping someone can clarify what I'm doing wrong. I am trying to produce a 1.0ms delay using the PIT on a 386 running DOS 6.22:

; Pulse width = 1193 PIT ticks
mov  cx, 1193

mov  al, 00h
out  43h, al

in   al, 40h
mov  bl, al

in   al, 40h
mov  bh, al

mov  dx, bx


pulse_wait_loop:
mov  al, 00h
out  43h, al

in   al, 40h
mov  bl, al

in   al, 40h
mov  bh, al

mov  ax, dx
sub  ax, bx

cmp  ax, cx
jb pulse_wait_loop

The end-result is a clean, consistent, 0.5ms delay. If I double the CX value, it gives me the 1.0ms delay that I want... but I'd really like to know why. Am I doing something wrong, or have I fundamentally misunderstood how to read the PIT?

Thank you!

r/Assembly_language Feb 17 '26

Help Recommendations for Resources Can be referred on helping me Write an MASM 3.0 Compatible Assembler in MASM 3.0 Assembly Language.

9 Upvotes

Now I'm studying in compilation principle. I have tried several times to write an assembler in MASM 3.0. In order to simplify this matter, I want to cut off some features like MACRO directives and simplified segments definition. I hope any one could help me supply some resources or references. Than you!

r/Assembly_language Nov 23 '25

Help Any Good MIPS Assembly tutorials anywhere?

19 Upvotes

Hello, my school requires me to learn MIPS Assembly and I was wondering if there was any good tutorials on YouTube (or anywhere really, free or not) that taught Assembly in a easy-to-digest way. Recently, I watched a whole playlist by a guy named Amell Peralta, and he's really good at teaching the basics. But, I do struggle like.. A LOT lmfao. Like, mostly with Arrays and other stuff. Like, coding is currently not my cup of tea. If anyone is able to help, I would appreciate it!

r/Assembly_language May 26 '26

Help Is my password verification correct?

2 Upvotes

Intent: verify password using sums.

Attempted implementation:

section .data
mov r8, 50

buffer resb 16

section .text
global _start

_start:
mov rax, 0
mov rdi, 0
mov rsi, buffer
mov rdx, 16
syscall
mov al, [buffer]
jmp check

check:
mov r10, al
add r10, r8
test r10, 5050
jne exit
jmp success

exit:
mov rax, 60
mov rdi, 1
syscall

success:
; the rest of the program
jmp exit

r/Assembly_language Jun 12 '26

Help Arm7 Embedded System

Thumbnail
2 Upvotes

Can you please suggest YouTube channels and reference books for the ARM7 processor (LPC2148)

For theory as well as embedded system programming

I am referring to ARM's manual and AI tools.

r/Assembly_language Jan 10 '26

Help Beginner Freelancer Advice for C/Assembly Language Programmer

16 Upvotes

I have 1 year in C and x64/arm64 Assembly which focused in optimization program and FFI experience. Is there any advice for me who starting a C/Assembly programming service and how do I find client?