Premium Only Content
x86-64 Assembly While Loops Explained Step by Step in YASM - From Concept to Working Program
In this detailed tutorial I walk you through exactly how to implement while loops in x86-64 assembly language using YASM. We start with the basic concept of a while loop as it exists in higher-level languages like C/C++, then break it down into labels, conditional jumps, and unconditional jumps so you can see exactly how the control flow works at the assembly level.
I explain why we usually put the condition check at the top, how to handle the jump distances (especially the ~128-byte limit of conditional branches), why unconditional jumps are preferred for the loop-back, and how to structure init / top / body / done sections clearly.
We then build a complete, runnable hybrid program (assembly + tiny C++ driver) that:
- prints an intro message
- repeatedly asks the user to enter numbers
- echoes each number back
- continues until the user enters 99
- prints a goodbye message when finished
Lots of practical tips about label naming conventions, register preservation (R12 in this case), and debugging flow are included along the way.
Assumed knowledge: basic x86-64 assembly, how to use a makefile, simple system calls, and calling external functions. If you're new to those topics, check my earlier videos first.
Hope this helps someone finally "get" while loops in assembly!
Thanks for watching - subscribe if these kinds of low-level explanations are useful to you.
Introduction to While Loops in x86-64 YASM 00:00:00
While Loop Concept in High-Level Languages 00:00:56
Breaking Down While Loop Structure 00:02:00
Labeling Key Sections Top Body Done 00:02:40
Conditional and Unconditional Jumps Explained 00:03:26
Why Prefer Shorter Conditional Jumps 00:04:40
Diagram of While Loop Flow 00:06:52
Alternative While True with Internal Break 00:08:08
Do-While vs Regular While Difference 00:09:32
Program Setup and Data Section Overview 00:09:53
Hybrid Program Structure and External Functions 00:10:56
Main Function and While Test Call 00:12:56
While Test Function Prologue 00:13:21
CRLF Helper Function 00:14:00
Intro Message and Loop Initialization 00:14:50
While Top Comparison with 99 00:16:57
Entering the Loop Body 00:19:08
User Input and Echo Output 00:19:38
Jump Back to While Top 00:20:29
Exit to While Done Section 00:21:39
Goodbye Message and Function Epilogue 00:22:14
Live Demo Running the Program 00:22:30
Summary and Closing Remarks 00:23:12
Call to Subscribe and Website Mention 00:23:46
=-=-=-=-=-=-=-=-=
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/pg1Pvv5dN4Gt
- Daily Motion: https://www.dailymotion.com/neurallantern
- 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
-
LIVE
Plan â‚¿ Forum
8 days agoPlan ₿ Forum El Salvador 2026 – Day 1 Live from the WAGMI Stage
1,533 watching -
LIVE
Laura Loomer
1 hour agoEP168: STAGED?! Ilhan Omar Uses Fake "Attack" To Cover Up Somali Fraud
379 watching -
LIVE
Nerdrotic
3 hours ago $1.60 earnedHollywood STRIKES Again?! | Star Trek Crash and Burn | Cancel Disney Plus - Friday Night Tights 391
1,746 watching -
LIVE
Candace Owens
1 hour agoAND ANOTHER ONE: Charlie's Text On September 9th. | Candace Ep 299
5,984 watching -
LIVE
Kim Iversen
2 hours agoDon Lemon ARRESTED: Who Could Be Next?
545 watching -
TheGuySwann
2 hours agoLive From Plan-B El Salvador - Guest Giacomo Zucco
5.39K -
32:01
Stephan Livera
21 hours agoStephan Livera hosts Plan B Podcast in El Salvador
1.46K2 -
1:05:27
Russell Brand
5 hours agoMedia Manipulation and the Manufacturing of Reality — SF676
147K55 -
38:31
Stephan Livera
21 hours ago $1.03 earnedStephan Livera hosts Plan B Podcast in El Salvador
22.6K -
32:52
vivafrei
8 hours agoLive from Plan B Conference in El Salvador with Erick Brimen on Prospera & Charter Cities!
74.5K1