x86-64 Assembly For Loops Explained - YASM Tutorial
In this step-by-step tutorial I walk you through exactly how to turn a simple C-style for loop into working x86-64 assembly code using YASM. We start by understanding the three classic parts of a for loop (initialization, condition check, update/increment), then show why converting it to an equivalent while loop makes the assembly version much easier to write. We cover: Choosing and preserving callee-saved registers (r12 & r13) Loop initialization (setting counter to 0) Comparison + conditional jump (jl) for the check Handling short vs long jump distances Unconditional jump back to loop top after increment (inc) Printing numbers inside the loop body using an external helper Exit condition and jumping to the done label All demonstrated with real code inside a hybrid C++/assembly program. Perfect for beginners moving from C/C++ into low-level programming or anyone preparing for university computer architecture / systems programming courses. If you're new to assembly, check my playlist for basics first (conditional jumps, system calls, calling C functions from asm, etc.). Thanks for watching - drop a like if this helped, subscribe for more low-level programming content, and leave a comment for what you want to see next! Introduction to For Loops in Assembly 00:00:00 For Loop Structure in High-Level Languages 00:00:28 Breaking Down For Loop Parts: Init, Check, Update 00:01:04 Converting For Loop to While Loop 00:01:52 Why While Loop Style Helps in Assembly 00:03:16 Program Overview and Setup 00:04:12 Data Section - Strings and Messages 00:04:40 External Functions and Hybrid Program 00:06:11 Entry Point - Looper Function 00:07:12 For Test Function and Register Usage 00:07:42 Preserving Callee-Saved Registers 00:08:05 Printing Welcome Message 00:09:00 Prompting User for Number 00:09:48 Getting User Input 00:10:25 For Loop Structure in Assembly - Comments 00:11:12 Initialization - Setting Counter to Zero 00:12:50 Loop Top Label and Condition Check 00:14:28 Conditional Jump Setup (jl) 00:15:07 Handling Jump Distances 00:15:34 Loop Body - Printing Current Number 00:16:58 Update Part - Increment Counter 00:18:40 Unconditional Jump Back to Loop Top 00:19:14 Loop Done Label and Exit 00:19:55 Printing Goodbye Message 00:20:23 Testing the Program 00:22:08 Final Results and Demo 00:22:24 Outro and Call to Action 00:23:25 Thanks and Subscribe Request 00:23:45 Website and QR Code Mention 00:24:38 Closing Thanks 00:25:16 =-=-=-=-=-=-=-=-= Thanks for watching! Find us on other social media here: https://www.NeuralLantern.com/social Twitter / X: https://x.com/NeuralLantern Rumble: https://rumble.com/c/c-3696939 BitChute: https://www.bitchute.com/channel/pg1P... Daily Motion: https://www.dailymotion.com/neurallan... Minds: https://www.minds.com/neurallantern/ Odysee: https://odysee.com/@NeuralLantern:5 Please show your support! Buy me a coffee: https://ko-fi.com/neurallantern Subscribe + Sharing on Social Media Leave a comment or suggestion Subscribe to Blog: https://www.NeuralLantern.com Watching the main "pinned" video of this channel for offers and extras

x86-64 Assembly While Loops Explained Step by Step in YASM - From Concept to Working Program

Hello, Assembly! Retrocoding the World's Smallest Windows App in x86 ASM

Smallctl - Can Qwen 3.5 4b code, how good are local models?!

you can learn assembly in 10 minutes (try it RIGHT NOW)

I Don't Think I Can Go Back To Windows...

Why The Russian Accent Terrifies Everyone

Tips for C Programming

One second to find the BILLIONth PRIME

8 Worst C++ Fails of all time

Implement strlen for Null-Terminated Strings in x86-64 Assembly (YASM)

The Insane Genius of a Formula 1 Gearbox

I Designed My Own 16-bit CPU

Pointer Tricks that Leveled Up my Programming

Something is jamming GPS over Europe. Here's what we found

Why AI Has Failed to Take Your Job Since 1976

how to start programming c

Touching things at the atomic level (I love microscopes)

The Computer That Was Too Advanced for Its Own Good.

Why C and C++ Still Matter — And Why Most People Struggle to Learn Them

