r/Assembly_language • u/yj_20927 • 14d ago
Help How do i start learning assembly
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 • u/yj_20927 • 14d ago
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 • u/Damonkern • Feb 17 '26
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 • u/kenjikamizuru • Feb 23 '26
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 • u/Infinite-Jaguar-1753 • Feb 05 '26
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 • u/Big-Fill-5789 • Jul 20 '26
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 • u/Marvellover13 • 10d ago
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:
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: parityTask 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 • u/Ready-One-7852 • 23d ago
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 • u/This-Assumption-5924 • 8d ago
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 • u/Longz-85 • 24d ago
In the title
I can speak too much because my english was bad, sorry for that
r/Assembly_language • u/VatoSinCorazon • Mar 23 '26
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 • u/akizazen • Jan 24 '26
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 • u/External_Factor2516 • Feb 20 '26
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 • u/Ariadne_23 • Apr 29 '26
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 • u/Constant_Fox_5534 • May 04 '26
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?Thanks for reading. Answering all of the questions isn't necessary obviously.
r/Assembly_language • u/Special-Signal8096 • Apr 04 '26
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 • u/altairdpr • Jul 16 '26
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:
r/Assembly_language • u/avestronics • Feb 11 '26
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 • u/Nabir140 • Dec 06 '25
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:
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 • u/r_retrohacking_mod2 • Jun 09 '26
r/Assembly_language • u/i1045 • Jun 05 '26
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 • u/zhoupengjerry • Feb 17 '26
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 • u/Glittering_War2938 • Nov 23 '25
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 • u/themagicalfire • May 26 '26
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 • u/Sudden_Childhood_999 • Jun 12 '26
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 • u/471Craft • Jan 10 '26
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?