<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>assembly while loop Archives - NeuralLantern.com</title>
	<atom:link href="https://www.NeuralLantern.com/tag/assembly-while-loop/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.NeuralLantern.com/tag/assembly-while-loop/</link>
	<description></description>
	<lastBuildDate>Sun, 08 Feb 2026 01:59:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://www.NeuralLantern.com/wp-content/uploads/2025/04/cropped-2025-04-04-Lantern-03-32x32.png</url>
	<title>assembly while loop Archives - NeuralLantern.com</title>
	<link>https://www.NeuralLantern.com/tag/assembly-while-loop/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Implement strlen for Null-Terminated Strings in x86-64 Assembly (YASM)</title>
		<link>https://www.NeuralLantern.com/implement-strlen-for-null-terminated-strings-in-x86-64-assembly-yasm/</link>
					<comments>https://www.NeuralLantern.com/implement-strlen-for-null-terminated-strings-in-x86-64-assembly-yasm/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Sun, 08 Feb 2026 01:59:27 +0000</pubDate>
				<category><![CDATA[Assembly Language]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[abi register preservation]]></category>
		<category><![CDATA[assembly language tutorial]]></category>
		<category><![CDATA[assembly length function]]></category>
		<category><![CDATA[assembly string handling]]></category>
		<category><![CDATA[assembly while loop]]></category>
		<category><![CDATA[c strings assembly]]></category>
		<category><![CDATA[callee saved registers]]></category>
		<category><![CDATA[learn assembly 2025]]></category>
		<category><![CDATA[low level programming]]></category>
		<category><![CDATA[NASM vs YASM]]></category>
		<category><![CDATA[null terminated string]]></category>
		<category><![CDATA[reverse engineering]]></category>
		<category><![CDATA[strlen assembly]]></category>
		<category><![CDATA[sys_write tutorial]]></category>
		<category><![CDATA[systems programming]]></category>
		<category><![CDATA[write syscall assembly]]></category>
		<category><![CDATA[x86 assembly linux]]></category>
		<category><![CDATA[x86-64 assembly]]></category>
		<category><![CDATA[x86-64 linux assembly]]></category>
		<category><![CDATA[Yasm tutorial]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=298</guid>

					<description><![CDATA[<p>Learn to implement strlen from scratch in x86-64 assembly using YASM. We walk through building a null-terminated string length function with a while loop, proper register preservation, and ABI compliance, then use the length to print the string efficiently via sys_write.</p>
<p>The post <a href="https://www.NeuralLantern.com/implement-strlen-for-null-terminated-strings-in-x86-64-assembly-yasm/">Implement strlen for Null-Terminated Strings in x86-64 Assembly (YASM)</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="Implement strlen for Null-Terminated Strings in x86-64 Assembly (YASM)" width="1380" height="776" src="https://www.youtube.com/embed/KQaIEBP6Qp4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">Learn how to write your own strlen function in x86-64 assembly (YASM) that finds the length of a null-terminated string using a simple while loop.</p>



<p class="wp-block-paragraph">We preserve the proper registers, follow the ABI, compute the length safely, and then use that length to print the full string efficiently with a single sys_write call.</p>



<p class="wp-block-paragraph">Great for anyone studying low-level programming, operating systems, or wanting to understand C strings at the assembly level.</p>



<p class="wp-block-paragraph">00:00:00 Introduction to implementing string length in assembly<br>00:00:25 What are null-terminated strings and why they exist<br>00:01:59 Pre-computing length vs using null terminators<br>00:02:53 How the null byte (0) actually works in memory<br>00:04:14 Naive approach: printing one character at a time<br>00:05:20 Goal: efficient printing using computed length<br>00:06:00 Program structure overview – two main functions<br>00:06:32 Data section: defining null-terminated strings<br>00:08:19 Additional strings for output (prefix, CRLF)<br>00:09:15 Text section start and global looper function<br>00:10:44 Preserving callee-saved registers (ABI prologue)<br>00:11:28 Calling print_null_terminated_string<br>00:12:43 Simple crlf printing helper function<br>00:13:10 print_null_terminated_string function signature<br>00:14:31 Prologue for print_null_terminated_string<br>00:15:44 Saving arguments and calling strlen<br>00:17:12 Using sys_write with computed length<br>00:18:19 string_length (strlen) function begins<br>00:19:20 Prologue and fake return value testing<br>00:20:44 Planning the while loop in C-like pseudocode<br>00:21:33 While loop initialization (pointer and counter)<br>00:24:23 Loop top: check for null terminator<br>00:26:23 Loop body: increment pointer and counter<br>00:27:37 Done label and return length in RAX<br>00:28:29 First successful run – full string printed<br>00:29:30 Adding direct strlen call and length printing<br>00:31:02 Final run showing both string and its length (54)<br>00:31:53 Summary – benefits of computed length printing<br>00:32:59 Improving loop structure (better jump pattern)<br>00:34:07 Final improved loop verification<br>00:35:03 Closing thoughts and thanks<br>00:35:27 Outro, call to subscribe, website mention</p>



<p class="wp-block-paragraph">=-=-=-=-=-=-=-=-=</p>



<p class="wp-block-paragraph">Thanks for watching!</p>



<p class="wp-block-paragraph">Find us on other social media here:</p>



<ul class="wp-block-list">
<li>https://www.NeuralLantern.com/social</li>



<li>Twitter / X: https://x.com/NeuralLantern</li>



<li>Rumble: https://rumble.com/c/c-3696939</li>



<li>BitChute: https://www.bitchute.com/channel/pg1Pvv5dN4Gt</li>



<li>Daily Motion: https://www.dailymotion.com/neurallantern</li>



<li>Minds: https://www.minds.com/neurallantern/</li>



<li>Odysee: https://odysee.com/@NeuralLantern:5</li>
</ul>



<p class="wp-block-paragraph">Please show your support!</p>



<ul class="wp-block-list">
<li>Buy me a coffee: https://ko-fi.com/neurallantern</li>



<li>Subscribe + Sharing on Social Media</li>



<li>Leave a comment or suggestion</li>



<li>Subscribe to Blog: https://www.NeuralLantern.com</li>



<li>Watching the main &#8220;pinned&#8221; video of this channel for offers and extras</li>
</ul>



<p class="wp-block-paragraph">Hey there, in this video, I&#8217;m going to show you how to implement the function string length.</p>



<p class="wp-block-paragraph">So you can find the length of a null terminated string in a Yasm x86-64 assembly program.</p>



<p class="wp-block-paragraph">Although if you&#8217;re using a different assembly language or different architecture, this video</p>



<p class="wp-block-paragraph">will probably still be useful to you because the concepts are going to be the same.</p>



<p class="wp-block-paragraph">So what am I talking about?</p>



<p class="wp-block-paragraph">I&#8217;m not going to be around here with this.</p>



<p class="wp-block-paragraph">So in a previous video, I discussed null terminated strings.</p>



<p class="wp-block-paragraph">I should also point out that a lot of basic knowledge is going to be skipped in this video</p>



<p class="wp-block-paragraph">because I&#8217;ve explained it in other videos.</p>



<p class="wp-block-paragraph">For example, if you don&#8217;t know how to compile, link, assemble, write a basic assembly program,</p>



<p class="wp-block-paragraph">write a make file and so forth, then you should see my other videos first.</p>



<p class="wp-block-paragraph">I&#8217;ve also already published a video about null terminated strings, but I&#8217;ll just do</p>



<p class="wp-block-paragraph">it again here since that&#8217;s in the title of the video.</p>



<p class="wp-block-paragraph">of the video so imagine you have a string and it&#8217;s hello right so under the hood uh the string is</p>



<p class="wp-block-paragraph">probably a collection of characters on some level so we&#8217;ll just say this is h e uh l</p>



<p class="wp-block-paragraph">l o right um when you&#8217;re printing</p>



<p class="wp-block-paragraph">it&#8217;s unlikely that your entire memory stick is just done like it just you&#8217;re at the very end of your memory by the time that O hits</p>



<p class="wp-block-paragraph">So that means you need some way of understanding when the string ends because if the memory is not over at that point</p>



<p class="wp-block-paragraph">There could probably be some junk data at the end of it</p>



<p class="wp-block-paragraph">You know like a bunch of other random letters or you can even imagine these as just you know</p>



<p class="wp-block-paragraph">One byte that&#8217;s not one byte one byte numbers that just go on and on and on forever for the entirety of your RAM stick</p>



<p class="wp-block-paragraph">of your RAM stick and you have to know how do we actually stop at the O. One thing that you can do</p>



<p class="wp-block-paragraph">is just pre-compute the length of the string so we do that in assembly a lot before we know how</p>



<p class="wp-block-paragraph">to scan for null terminators. We&#8217;ll say all right well that string is just five long so I&#8217;ll tell</p>



<p class="wp-block-paragraph">the system I want you to print five characters starting at that memory location wherever the H is</p>



<p class="wp-block-paragraph">and then the system knows okay I&#8217;ll just you know print the H-E-L-L-O and just stop after that.</p>



<p class="wp-block-paragraph">null terminated strings are a lot more convenient because you don&#8217;t have to pre-compute the strings.</p>



<p class="wp-block-paragraph">I mean, maybe your user entered a string.</p>



<p class="wp-block-paragraph">Maybe you have a lot of strings or they change quite often.</p>



<p class="wp-block-paragraph">Maybe you have like a multinational program that has tons of translations,</p>



<p class="wp-block-paragraph">or I think multilingual is probably the better word for that.</p>



<p class="wp-block-paragraph">But it can be a pain in the butt to constantly compute the length of strings in advance.</p>



<p class="wp-block-paragraph">So with a null terminated string, you basically just say,</p>



<p class="wp-block-paragraph">that I want to print and I&#8217;m just going to stick actually the number zero at the end of the string.</p>



<p class="wp-block-paragraph">I&#8217;ll leave the junk data there just to let you know that there is some stuff happening in memory.</p>



<p class="wp-block-paragraph">Notice how this zero, it is not actually the character that looks like a zero to a human.</p>



<p class="wp-block-paragraph">That&#8217;s actually a totally different code than just zero. So you can imagine just an actual zero here.</p>



<p class="wp-block-paragraph">You know, each of these characters that a human would look at has a number underneath it.</p>



<p class="wp-block-paragraph">You know, this H is not really an H.</p>



<p class="wp-block-paragraph">It&#8217;s just some number between 0 and 255 if we&#8217;re talking about ASCII.</p>



<p class="wp-block-paragraph">The E is a different number and so forth.</p>



<p class="wp-block-paragraph">So if we just put the literal number 0 in our data,</p>



<p class="wp-block-paragraph">or if you want to quote this inside of a single quote,</p>



<p class="wp-block-paragraph">you can do, I think, slash 0 just to let the compiler know</p>



<p class="wp-block-paragraph">that you intend to have the number 0 there</p>



<p class="wp-block-paragraph">instead of something that looks like the number 0, you know, the character.</p>



<p class="wp-block-paragraph">you know the character but anyways the point is we just have to stick a zero at the end</p>



<p class="wp-block-paragraph">of the string we call it a null terminator because zero is also you know an alias for null</p>



<p class="wp-block-paragraph">whenever you have a null pointer or you assign null to a memory location or a pointer or something</p>



<p class="wp-block-paragraph">you know it&#8217;s zero basically under the hood so a zero will terminate it&#8217;ll be like a token to let</p>



<p class="wp-block-paragraph">us know that the string is finished and so since zero is also considered null we&#8217;ll say it&#8217;s a</p>



<p class="wp-block-paragraph">we&#8217;ll say it&#8217;s a null terminator.</p>



<p class="wp-block-paragraph">It&#8217;s a basic idea for null terminators.</p>



<p class="wp-block-paragraph">Now the question is, how do we actually know when to stop?</p>



<p class="wp-block-paragraph">Well, the first thing that you could do if you&#8217;re trying to write a program that is highly inefficient,</p>



<p class="wp-block-paragraph">which I&#8217;ve definitely done before, is you could just print one character at a time.</p>



<p class="wp-block-paragraph">You use a for loop.</p>



<p class="wp-block-paragraph">You start at the very beginning of your string, you know, a pointer,</p>



<p class="wp-block-paragraph">whatever the user gave you as like this is the first character.</p>



<p class="wp-block-paragraph">We&#8217;ll just print that letter, and then we&#8217;ll go on to the next letter.</p>



<p class="wp-block-paragraph">the next letter and before we print it actually before we print the first letter even before we</p>



<p class="wp-block-paragraph">print this letter we&#8217;ll uh we&#8217;ll say is this like a regular character or is this a null terminator</p>



<p class="wp-block-paragraph">is this a zero if it&#8217;s not a zero we print that character if it is a zero we terminate the loop</p>



<p class="wp-block-paragraph">and then we go through every character one by one just you know checking and printing checking and</p>



<p class="wp-block-paragraph">printing checking and printing unfortunately that&#8217;s kind of inefficient because every time</p>



<p class="wp-block-paragraph">you call a print you know you&#8217;re you&#8217;re calling on a function you&#8217;re asking the system to do some</p>



<p class="wp-block-paragraph">for you and it would be a lot better if we could just flush the whole string at</p>



<p class="wp-block-paragraph">the same time but but know how long the string was that would increase our</p>



<p class="wp-block-paragraph">efficiency so the program that we&#8217;re going to write together is basically</p>



<p class="wp-block-paragraph">going to use our knowledge of a while loop which I&#8217;ve explained in other</p>



<p class="wp-block-paragraph">videos already so see those other videos if you don&#8217;t know how to do while loops</p>



<p class="wp-block-paragraph">in Yasm we&#8217;re going to use our knowledge of a while loop to sort of scan the</p>



<p class="wp-block-paragraph">string real fast just you know kind of scan it and figure out how far into the</p>



<p class="wp-block-paragraph">far into the string until we see a null terminator and use that to determine what is the length of</p>



<p class="wp-block-paragraph">the string. At that point, we can use a system call in YASM, in assembly, to just say, I want you to</p>



<p class="wp-block-paragraph">print this sequence of characters and here&#8217;s the length and then let the system worry about</p>



<p class="wp-block-paragraph">efficiency. So with that said, let&#8217;s look at some code. Okay, it&#8217;s just going to be a simple while</p>



<p class="wp-block-paragraph">loop. What we&#8217;re going to need to do is break this up into two parts. The first part is going to be</p>



<p class="wp-block-paragraph">the first part is going to be a function called string length which you&#8217;ve probably already seen</p>



<p class="wp-block-paragraph">in c if you program in c or c plus plus the second function is going to be called print null terminated</p>



<p class="wp-block-paragraph">string which will just ask string length what the length of the string is first and then actually</p>



<p class="wp-block-paragraph">print it with the system call so let me uh i guess let me start off with my data section here</p>



<p class="wp-block-paragraph">to print I&#8217;m gonna copy paste that for my solution again this is not a not an</p>



<p class="wp-block-paragraph">assembly basics video so if you don&#8217;t understand what I&#8217;m doing you should</p>



<p class="wp-block-paragraph">watch my other videos first I&#8217;m assuming you know how to make a data section by</p>



<p class="wp-block-paragraph">now we&#8217;ll put some C strings I&#8217;m just gonna make one null terminated string</p>



<p class="wp-block-paragraph">actually I guess I&#8217;m making two but the focus of this program is just the first</p>



<p class="wp-block-paragraph">one I&#8217;m calling it null terminated string and in assembly it&#8217;s pretty easy</p>



<p class="wp-block-paragraph">you just make it a you know a character array just like a sequence of bytes with</p>



<p class="wp-block-paragraph">a sequence of bytes with this DB meaning data bytes.</p>



<p class="wp-block-paragraph">And I can just put a quoted string like this.</p>



<p class="wp-block-paragraph">No problem.</p>



<p class="wp-block-paragraph">As many characters as I want.</p>



<p class="wp-block-paragraph">I can start injecting specific ASCII values if I wanted to</p>



<p class="wp-block-paragraph">or byte values if I wanted to just by putting a comma</p>



<p class="wp-block-paragraph">and then a number.</p>



<p class="wp-block-paragraph">So I could do something like this.</p>



<p class="wp-block-paragraph">I could do like, you know, 47, you know, 49, you know, 50, whatever.</p>



<p class="wp-block-paragraph">If I knew the ASCII codes for the characters,</p>



<p class="wp-block-paragraph">fortunately, I don&#8217;t need to.</p>



<p class="wp-block-paragraph">normally into the double quoted area but then i need to be able to put a null terminator at the</p>



<p class="wp-block-paragraph">end of my string because it&#8217;s not going to happen automatically so then i am going to do comma zero</p>



<p class="wp-block-paragraph">and you&#8217;ll end up with something like this like if i guess if we look at the previous example real</p>



<p class="wp-block-paragraph">fast i&#8217;ll call this a hello string just so that you see some similarity from what we just looked</p>



<p class="wp-block-paragraph">a notepad thing would just be typing the word hello and then putting comma zero.</p>



<p class="wp-block-paragraph">So it is now a null terminated string and it looks just like this inside of system memory.</p>



<p class="wp-block-paragraph">Well, not just like that.</p>



<p class="wp-block-paragraph">There would be numbers where the letters are, but you know, that&#8217;s basically what we have created.</p>



<p class="wp-block-paragraph">And then of course there&#8217;s junk data afterwards, but we don&#8217;t really care about that.</p>



<p class="wp-block-paragraph">You know, we&#8217;re just going to ignore it with the null terminator.</p>



<p class="wp-block-paragraph">So I&#8217;m going to erase that since we&#8217;re not just going to print the word hello.</p>



<p class="wp-block-paragraph">We have a null terminated string here and then after we print the null terminated string</p>



<p class="wp-block-paragraph">I&#8217;m just going to print out what was the length of the string.</p>



<p class="wp-block-paragraph">So this is a prefix string where it&#8217;s just, you know, it&#8217;s a prettier program.</p>



<p class="wp-block-paragraph">The program is going to say the null terminated string&#8217;s length was something.</p>



<p class="wp-block-paragraph">And then we&#8217;re going to use the null terminated string printer to print that also.</p>



<p class="wp-block-paragraph">Convenient, right?</p>



<p class="wp-block-paragraph">And then I&#8217;m going to actually print the number.</p>



<p class="wp-block-paragraph">Then we have this down here, crlf, which is just printing a new line in the terminal.</p>



<p class="wp-block-paragraph">That&#8217;s character code 13 and then 10 and then a null terminator so that we can use the null terminated string printer again.</p>



<p class="wp-block-paragraph">And then we&#8217;re going to use system call code 1 to print a standard output right here.</p>



<p class="wp-block-paragraph">If you don&#8217;t understand that, then see my other videos.</p>



<p class="wp-block-paragraph">But let&#8217;s move on to the text section where all our instructions will go.</p>



<p class="wp-block-paragraph">Okay, so now the instructions begin in our text section right here.</p>



<p class="wp-block-paragraph">section.text and I&#8217;m using an external symbol this video is not about this</p>



<p class="wp-block-paragraph">library here but basically I have a library that will help me print integers</p>



<p class="wp-block-paragraph">you don&#8217;t need to worry about that you could imagine well I guess in your</p>



<p class="wp-block-paragraph">example when you&#8217;re practicing if you don&#8217;t have this library you could just</p>



<p class="wp-block-paragraph">not print the length of the string and just use it only and it all should still</p>



<p class="wp-block-paragraph">work or you could hard code the thing that you&#8217;re printing if you really</p>



<p class="wp-block-paragraph">wanted to. Okay, so I&#8217;m just going to continue on here. Now let&#8217;s do our entry point. So again,</p>



<p class="wp-block-paragraph">this is not a video about hybrid programs. Just assume that there is another module in my program.</p>



<p class="wp-block-paragraph">It&#8217;s a C++ module. It&#8217;s got the main function, you know, for the entry point for a hybrid program,</p>



<p class="wp-block-paragraph">and it&#8217;ll just call on my looper function. So that&#8217;s why I&#8217;m marking a looper as global.</p>



<p class="wp-block-paragraph">So my other module can call it. And well, it is a function that needs to return. So I&#8217;m going to</p>



<p class="wp-block-paragraph">to return so i&#8217;m going to put ret at the end of it and you can see here i left myself a note saying</p>



<p class="wp-block-paragraph">i&#8217;m going to use r12 to remember the length of the string so that i can print it back to the user</p>



<p class="wp-block-paragraph">so that means i have to preserve r12 for the caller because the abi or the application binary</p>



<p class="wp-block-paragraph">interface says that r12 is a callie saved register and if you don&#8217;t respect the abi</p>



<p class="wp-block-paragraph">the abi is not going to respect you your program is going to end up crashing eventually</p>



<p class="wp-block-paragraph">So I&#8217;m just going to do a push pop pair to preserve R12.</p>



<p class="wp-block-paragraph">Oops, prologue and call that epilogue.</p>



<p class="wp-block-paragraph">Okay. So we got a push pop pair. We got a return statement.</p>



<p class="wp-block-paragraph">This program should probably do nothing so far. So let&#8217;s run it and see,</p>



<p class="wp-block-paragraph">just make sure that it at least compiles.</p>



<p class="wp-block-paragraph">So I&#8217;m going to say clear and make run running the program.</p>



<p class="wp-block-paragraph">Hello from the driver. You don&#8217;t know that the driver has that.</p>



<p class="wp-block-paragraph">that the driver has that. This is not a driver video. And then the driver regains control because</p>



<p class="wp-block-paragraph">nothing happened inside of the assembly module. We just basically looper got called and then we</p>



<p class="wp-block-paragraph">preserved R12 and then restored it and then we did nothing. Okay, so now let&#8217;s make a call to</p>



<p class="wp-block-paragraph">print null terminated string. We have to make another function for this, but right now this is</p>



<p class="wp-block-paragraph">just the call. So the name of the function that we&#8217;re going to write is called print null terminated</p>



<p class="wp-block-paragraph">it it will call on the string length function to figure out how long the string is then it will use</p>



<p class="wp-block-paragraph">a simple system call to print the whole string giving the length to the system call it also takes</p>



<p class="wp-block-paragraph">two arguments the first argument is a pointer to the null terminated string so that&#8217;s just that</p>



<p class="wp-block-paragraph">symbol we defined up above remember when you define variables up in the data section then</p>



<p class="wp-block-paragraph">these symbols tend to be pointers so that symbol is a pointer to the h basically or just the memory</p>



<p class="wp-block-paragraph">that h is sitting in ram then the second argument that it wants is uh is where we&#8217;re going to print</p>



<p class="wp-block-paragraph">it so we&#8217;re just going to print it to standard output um which is just file descriptor number one</p>



<p class="wp-block-paragraph">so again if you don&#8217;t understand arguments or you know file descriptors or function calls</p>



<p class="wp-block-paragraph">see my other videos because i&#8217;ve explained those already anyway so we&#8217;re going to call</p>



<p class="wp-block-paragraph">print null terminated string then we&#8217;re going to call on crlf which will just print a new line</p>



<p class="wp-block-paragraph">So now maybe we should implement, well, let&#8217;s copy paste crlf so that I can implement the</p>



<p class="wp-block-paragraph">other function a little bit more slowly.</p>



<p class="wp-block-paragraph">What does crlf do?</p>



<p class="wp-block-paragraph">It literally just asks the print null terminated string function to just print a crlf for us.</p>



<p class="wp-block-paragraph">So it&#8217;s very, very simple.</p>



<p class="wp-block-paragraph">Here&#8217;s the signature.</p>



<p class="wp-block-paragraph">Nothing much to it.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">Now, a little bit more complicated is the print null terminated string function.</p>



<p class="wp-block-paragraph">So in our looper, we&#8217;re going to print the null terminated string.</p>



<p class="wp-block-paragraph">We have to have a function that actually does that.</p>



<p class="wp-block-paragraph">So that&#8217;s going to be this one right here.</p>



<p class="wp-block-paragraph">Here&#8217;s the signature that I&#8217;ve chosen for my print null terminated string function.</p>



<p class="wp-block-paragraph">Basically, I want to receive a character pointer to the first character in the string that we&#8217;re going to print.</p>



<p class="wp-block-paragraph">And then a file handle designating where we&#8217;re going to print it.</p>



<p class="wp-block-paragraph">The reason I want to receive the file handle is so I could print a standard output or standard error.</p>



<p class="wp-block-paragraph">or standard error, or I could print to a file,</p>



<p class="wp-block-paragraph">like whatever I want to do.</p>



<p class="wp-block-paragraph">You don&#8217;t have to have that in there, but it&#8217;s nice.</p>



<p class="wp-block-paragraph">Anyway, so we have this function set up.</p>



<p class="wp-block-paragraph">Notice how my notes that I left for myself</p>



<p class="wp-block-paragraph">is that I&#8217;m gonna use R12</p>



<p class="wp-block-paragraph">to remember the incoming C string pointer argument,</p>



<p class="wp-block-paragraph">and I&#8217;m gonna use R13 to remember the file handle.</p>



<p class="wp-block-paragraph">Remember, it&#8217;s probably not a good idea</p>



<p class="wp-block-paragraph">to just let the incoming arguments</p>



<p class="wp-block-paragraph">stay in their original registers,</p>



<p class="wp-block-paragraph">original registers because those registers tend to get overwritten as you do system calls or</p>



<p class="wp-block-paragraph">calls to any other function. So I&#8217;m just going to grab them real fast into R12 and R13. And then R14</p>



<p class="wp-block-paragraph">is the string&#8217;s length, which I&#8217;m going to compute with a call to the function called string length.</p>



<p class="wp-block-paragraph">So just three things to remember. And that&#8217;s it. So that means I&#8217;m going to have to preserve those</p>



<p class="wp-block-paragraph">Okay, so we&#8217;re going to do a prologue to preserve those registers.</p>



<p class="wp-block-paragraph">And then at the very end, we&#8217;re going to do an epilogue where we restore those registers.</p>



<p class="wp-block-paragraph">Oh, I think I already overwrote my return statement from the previous function.</p>



<p class="wp-block-paragraph">I think I did that in the last video and I was a little confused as to what was wrong.</p>



<p class="wp-block-paragraph">So make sure you don&#8217;t accidentally overwrite or push down your return instructions.</p>



<p class="wp-block-paragraph">Let me just double check here.</p>



<p class="wp-block-paragraph">Looper&#8217;s got return.</p>



<p class="wp-block-paragraph">Print and alternated string has got a return.</p>



<p class="wp-block-paragraph">string has got a return.</p>



<p class="wp-block-paragraph">CRLF has a return.</p>



<p class="wp-block-paragraph">What the heck did I do?</p>



<p class="wp-block-paragraph">Oh, I think I copy pasted in a bizarre place.</p>



<p class="wp-block-paragraph">That&#8217;s probably what happened because the epilog for for print null terminated</p>



<p class="wp-block-paragraph">string is like down in CRLF already.</p>



<p class="wp-block-paragraph">That&#8217;s not good.</p>



<p class="wp-block-paragraph">Okay, that would have been a crashing program.</p>



<p class="wp-block-paragraph">Although sometimes if you omit the return statements, execution will just fall</p>



<p class="wp-block-paragraph">through down to the next label and maybe your program will survive accidentally.</p>



<p class="wp-block-paragraph">accidentally but for now it&#8217;s just crlf is supposed to be very simple it doesn&#8217;t preserve</p>



<p class="wp-block-paragraph">any registers so we&#8217;ve got a prologue and an epilogue here notice how the push and pops are</p>



<p class="wp-block-paragraph">in reverse order you want to know more about that see my other videos but now that we are preserving</p>



<p class="wp-block-paragraph">the appropriate registers we can actually grab our incoming arguments so first thing i&#8217;m going to do</p>



<p class="wp-block-paragraph">is i&#8217;m going to say r12 is going to be the first argument that i received and then r13 is going to</p>



<p class="wp-block-paragraph">okay no problem then let&#8217;s rely on the string length function to compute the actual length of</p>



<p class="wp-block-paragraph">the string i didn&#8217;t feel like having print null terminated string compute the length of the</p>



<p class="wp-block-paragraph">string it&#8217;s a good idea especially in assembly or any language when you have multiple distinct</p>



<p class="wp-block-paragraph">jobs happening within the same function you probably want to break that function up into</p>



<p class="wp-block-paragraph">multiple functions just to reduce you know strain on your brain right cognitive load</p>



<p class="wp-block-paragraph">So I&#8217;m going to use this function strlen string length to compute the length of the string.</p>



<p class="wp-block-paragraph">It&#8217;s only going to take one argument and it&#8217;s going to take the pointer to the null terminated</p>



<p class="wp-block-paragraph">string which is now in R12. It&#8217;s going to take that as its first argument so that&#8217;s why I&#8217;m loading</p>



<p class="wp-block-paragraph">that up into RDI. When string length returns it&#8217;s going to give me the length of the string in the</p>



<p class="wp-block-paragraph">RAX register which is the usual return register for integer or pointer return types. So I&#8217;m just</p>



<p class="wp-block-paragraph">So I&#8217;m just going to save that in R14.</p>



<p class="wp-block-paragraph">And that&#8217;s the usage of all those registers R12, 13, and 14.</p>



<p class="wp-block-paragraph">We still have to implement string length.</p>



<p class="wp-block-paragraph">Don&#8217;t worry.</p>



<p class="wp-block-paragraph">Although if you were linking a hybrid program, you could probably just call</p>



<p class="wp-block-paragraph">STRLEN in the C libraries and be fine.</p>



<p class="wp-block-paragraph">But this is an assembly video.</p>



<p class="wp-block-paragraph">We want to do everything in assembly if we can, or at least more of it.</p>



<p class="wp-block-paragraph">So then finally, when we know what the strings length is, we can just use a</p>



<p class="wp-block-paragraph">system call to actually print the string we&#8217;re going to say load up call code one to say you</p>



<p class="wp-block-paragraph">know mr. system I want you to print a string and then r13 is going to be the file handle so we&#8217;re</p>



<p class="wp-block-paragraph">going to basically say wherever the caller of print null terminated string said to print which</p>



<p class="wp-block-paragraph">is probably going to be standard output we&#8217;ll just tell the system we want to print to the same place</p>



<p class="wp-block-paragraph">and then r12 is a pointer to the c string so we just give that to the system call as well</p>



<p class="wp-block-paragraph">system call wants to know how long the string is that&#8217;s r14 now now that we have used strlen</p>



<p class="wp-block-paragraph">to determine the length of the string so not really that complicated of a function we just</p>



<p class="wp-block-paragraph">kind of like grab some arguments preserve those registers and we ask another function to compute</p>



<p class="wp-block-paragraph">the length of the string and then we actually just print it once we have the length this is still not</p>



<p class="wp-block-paragraph">getting to the point where we&#8217;re going to use our while loop knowledge to compute the length so i</p>



<p class="wp-block-paragraph">That&#8217;s probably all I need right now.</p>



<p class="wp-block-paragraph">And I think we&#8217;re ready to use or to start the string length function.</p>



<p class="wp-block-paragraph">Okay, so now let&#8217;s make another function called string length.</p>



<p class="wp-block-paragraph">Hopefully I&#8217;ll paste in the right spot this time.</p>



<p class="wp-block-paragraph">You&#8217;re cringing at home.</p>



<p class="wp-block-paragraph">That just tells me that you care.</p>



<p class="wp-block-paragraph">So the string length function, at least the version that I&#8217;m making right now,</p>



<p class="wp-block-paragraph">just is going to take one argument.</p>



<p class="wp-block-paragraph">It&#8217;s going to be a character pointer to the string that you want to compute.</p>



<p class="wp-block-paragraph">It will expect that the string has a null terminator at the end.</p>



<p class="wp-block-paragraph">the end if you accidentally didn&#8217;t put a null terminator at the end of the string then this</p>



<p class="wp-block-paragraph">function definitely won&#8217;t work it&#8217;ll probably give you some huge number because it&#8217;ll go through ram</p>



<p class="wp-block-paragraph">until it accidentally finds a zero um and then it&#8217;s going to return to you as its return value</p>



<p class="wp-block-paragraph">and uh assigned a 64-bit integer actually this should be unsigned but i&#8217;m just putting long for</p>



<p class="wp-block-paragraph">now um to indicate the length of the string okay inside the notes we&#8217;re going to use r12 and r13</p>



<p class="wp-block-paragraph">So that means I should probably preserve those registers first before I do anything else.</p>



<p class="wp-block-paragraph">So in the prolog, we&#8217;re going to push R12 and R13 so that we don&#8217;t break this program</p>



<p class="wp-block-paragraph">for others.</p>



<p class="wp-block-paragraph">And then we&#8217;re going to do an epilog.</p>



<p class="wp-block-paragraph">Whoops.</p>



<p class="wp-block-paragraph">Then we&#8217;re going to do an epilog to restore the registers.</p>



<p class="wp-block-paragraph">And this is a function.</p>



<p class="wp-block-paragraph">So it&#8217;s got to return to the caller.</p>



<p class="wp-block-paragraph">If I didn&#8217;t put a return statement here, then execution is going to just go all the way</p>



<p class="wp-block-paragraph">down to CRLF.</p>



<p class="wp-block-paragraph">And this will be an infinite loop.</p>



<p class="wp-block-paragraph">and this will be an infinite loop because crlf will end up calling null terminated string,</p>



<p class="wp-block-paragraph">which we&#8217;ll then call string length, which will then fall through to crlf,</p>



<p class="wp-block-paragraph">so the whole program won&#8217;t even work if we don&#8217;t have return.</p>



<p class="wp-block-paragraph">And, you know, you don&#8217;t want to omit return statements anyways,</p>



<p class="wp-block-paragraph">because that&#8217;s always a bad idea.</p>



<p class="wp-block-paragraph">So now string length will just not do anything right now.</p>



<p class="wp-block-paragraph">Maybe we could return a fake value for a second before we start implementing the loop.</p>



<p class="wp-block-paragraph">the number five into RAX so that string length will always trick the caller into thinking that</p>



<p class="wp-block-paragraph">the length of the string is five let&#8217;s see if that actually works we should get a portion</p>



<p class="wp-block-paragraph">of the null terminated string unless I screwed something up</p>



<p class="wp-block-paragraph">hello from the main driver notice how it just says hello here that&#8217;s kind of confusing let&#8217;s</p>



<p class="wp-block-paragraph">let&#8217;s hard code the five to like a nine we should see more of that null terminated string</p>



<p class="wp-block-paragraph">I sound when I wake up sometimes hello okay so let&#8217;s finish the str len function so again you</p>



<p class="wp-block-paragraph">should know how while loops work if you don&#8217;t see my other videos but we&#8217;re going to use a while</p>



<p class="wp-block-paragraph">loop to count the length of the string so we&#8217;re going to start with a little portion up here</p>



<p class="wp-block-paragraph">think the string is and a running pointer so rdi is already supposed to come in as a pointer to the</p>



<p class="wp-block-paragraph">string that we&#8217;re measuring so i&#8217;m going to save um the pointer into r12 so that we can have a</p>



<p class="wp-block-paragraph">pointer that points to a character we&#8217;re going to use this as a running pointer so it&#8217;s going to like</p>



<p class="wp-block-paragraph">sweep through the whole entire string until it hits a null terminator and then r13 is going to</p>



<p class="wp-block-paragraph">keep track of uh how big we think the string is so when we first start we&#8217;re just looking at the</p>



<p class="wp-block-paragraph">first start we&#8217;re just looking at the first letter and then we think the string has zero length.</p>



<p class="wp-block-paragraph">So that&#8217;s the initialization part which will not be repeated as we continue looping. Now we&#8217;re</p>



<p class="wp-block-paragraph">going to implement the top of the loop. I don&#8217;t know should I should I write this out as c code</p>



<p class="wp-block-paragraph">for you? I don&#8217;t know if I should maybe let me do it. I didn&#8217;t prepare this so if it&#8217;s slow sorry</p>



<p class="wp-block-paragraph">Maybe this is like a long strln, something like that.</p>



<p class="wp-block-paragraph">And then we&#8217;ll do if my code is wrong or doesn&#8217;t compile, I&#8217;m so sorry.</p>



<p class="wp-block-paragraph">I did not, I did not prepare this.</p>



<p class="wp-block-paragraph">We&#8217;ll say character pointer s and then we&#8217;ll say, uh, maybe we can actually just leave</p>



<p class="wp-block-paragraph">s alone because it&#8217;s coming in as an argument and in C plus plus you can just continue to</p>



<p class="wp-block-paragraph">use that symbol.</p>



<p class="wp-block-paragraph">It&#8217;s not going to get destroyed.</p>



<p class="wp-block-paragraph">So imagine we&#8217;ve saved it already into R 12 and then we just keep using it.</p>



<p class="wp-block-paragraph">using it so we&#8217;ll say while a let&#8217;s say a dereferencing of s is not equal to zero meaning</p>



<p class="wp-block-paragraph">if we look at the value that the pointer is currently pointing to if we assume it&#8217;s just</p>



<p class="wp-block-paragraph">pointing to one byte is we&#8217;ll keep going as long as that value is not a zero so that means</p>



<p class="wp-block-paragraph">if the user called this function and gave us a pointer that was already looking at a zero</p>



<p class="wp-block-paragraph">we would just return whoops we would just return that the length was zero so</p>



<p class="wp-block-paragraph">that means I should probably keep track of the length here size type actually</p>



<p class="wp-block-paragraph">long just to just to match the return signature long we&#8217;ll put size equals zero</p>



<p class="wp-block-paragraph">and then at the very end we&#8217;ll just return the size and so again if the user</p>



<p class="wp-block-paragraph">gave us a pointer that pointed to a zero already nothing would happen inside the</p>



<p class="wp-block-paragraph">while loop we&#8217;d break through it right away and we would just return the number</p>



<p class="wp-block-paragraph">the number zero that makes sense so then as long as it is not pointing at a zero</p>



<p class="wp-block-paragraph">we&#8217;ll just increase what we think the size is and then we will increase the</p>



<p class="wp-block-paragraph">pointer we can use s plus plus in C++ that&#8217;s just pointer arithmetic that&#8217;s</p>



<p class="wp-block-paragraph">just going to tell the pointer to advance you know one memory location</p>



<p class="wp-block-paragraph">further or whatever the data type is but in this case the data type is a</p>



<p class="wp-block-paragraph">character so it really is going to be one memory location one byte so we&#8217;re</p>



<p class="wp-block-paragraph">going to sweep through the string until we see a zero and then we stop and every time we see a</p>



<p class="wp-block-paragraph">character that&#8217;s not a zero we increase our our measured length of the string by one and then</p>



<p class="wp-block-paragraph">advance the pointer. So I haven&#8217;t tested this I don&#8217;t know if there&#8217;s an error in it but I hope</p>



<p class="wp-block-paragraph">you get the basic idea of what we&#8217;re going to do. So that means up here you know this is the</p>



<p class="wp-block-paragraph">initialization part that we were just talking about so we just set the running pointer to look</p>



<p class="wp-block-paragraph">okay so then after we do that we are going to make the top of the while loop</p>



<p class="wp-block-paragraph">so at the top of the while loop where we evaluate you know like right here this</p>



<p class="wp-block-paragraph">is the top of the while loop it has to have its own label just like we explained</p>



<p class="wp-block-paragraph">in the other videos and it is basically where we decide if we&#8217;re going to keep</p>



<p class="wp-block-paragraph">looping or not are we going to jump into the body the loop or are we going to do</p>



<p class="wp-block-paragraph">a long jump after the body to say that we&#8217;re done so the top of the loop is a</p>



<p class="wp-block-paragraph">label. We compare the value that R12 is currently pointing at. We say that we only want to look at</p>



<p class="wp-block-paragraph">one byte. We dereference R12 because remember R12 is supposed to be a pointer. You put the</p>



<p class="wp-block-paragraph">brackets around it, it&#8217;s going to go to the memory location and then check what the value is that</p>



<p class="wp-block-paragraph">the pointer is pointing to. That&#8217;s what dereferencing is, right? So we&#8217;re just going to</p>



<p class="wp-block-paragraph">compare the byte that we&#8217;re looking at with a zero and we&#8217;ll say if it is equal to a zero,</p>



<p class="wp-block-paragraph">jump to the done this is actually kind of a poor design pattern on my part usually we should jump</p>



<p class="wp-block-paragraph">if it&#8217;s not equal into the body meaning we&#8217;ll always take a short jump into the body and then</p>



<p class="wp-block-paragraph">execution will fall through on the next line to a long jump which has the ability to jump further</p>



<p class="wp-block-paragraph">out of the body i&#8217;ve said in other videos that the conditional branch instructions they can only jump</p>



<p class="wp-block-paragraph">about 128 bytes so if your if your loop body is too big then they won&#8217;t work but it&#8217;ll work for</p>



<p class="wp-block-paragraph">But it&#8217;ll work for this example.</p>



<p class="wp-block-paragraph">I don&#8217;t know, maybe if I have the gumption, I will fix up the loop for you if you want</p>



<p class="wp-block-paragraph">me to after I copy paste my existing solution.</p>



<p class="wp-block-paragraph">So for now we&#8217;re going to say, all right, I&#8217;m not going to do it.</p>



<p class="wp-block-paragraph">I&#8217;m not going to do that.</p>



<p class="wp-block-paragraph">Maybe in another video, if somebody requested, I might post another video in like five years.</p>



<p class="wp-block-paragraph">Anyway, so we&#8217;re going to jump if it is a null terminator to the done label.</p>



<p class="wp-block-paragraph">Otherwise we will fall through to the loop&#8217;s body where we&#8217;re just literally going to increase the pointer and also increase our idea of how big the string is.</p>



<p class="wp-block-paragraph">So remember R12 is the pointer.</p>



<p class="wp-block-paragraph">Integer arithmetic doesn&#8217;t, sorry, pointer arithmetic doesn&#8217;t really work here, but it accidentally works here because we&#8217;re looking at a byte array.</p>



<p class="wp-block-paragraph">So if we just increase by one memory location, it will literally just increase by one memory location and we&#8217;ll be fine.</p>



<p class="wp-block-paragraph">Just keep in mind that if you were sweeping through an array of, you know, quad words or some larger data type,</p>



<p class="wp-block-paragraph">then just a simple ink wouldn&#8217;t actually work.</p>



<p class="wp-block-paragraph">You&#8217;d have to increase by the appropriate number of bytes.</p>



<p class="wp-block-paragraph">But hey, the number of bytes in one item is just one byte, so it&#8217;s easy.</p>



<p class="wp-block-paragraph">So we&#8217;re making the pointer go forward by one on line 134 and then in line 135.</p>



<p class="wp-block-paragraph">line 135 we&#8217;re increasing our idea of how big the string is and then we will unconditionally jump</p>



<p class="wp-block-paragraph">to the top of our loop and so if you just kind of look at this what did i do i pasted that twice</p>



<p class="wp-block-paragraph">oh god okay sorry guess i lost track of what i was doing so then we will unconditionally jump</p>



<p class="wp-block-paragraph">to the top of the loop so basically you can imagine this loop is gonna it&#8217;s just gonna</p>



<p class="wp-block-paragraph">continue forever just moving the pointer and increasing the counter and moving the pointer</p>



<p class="wp-block-paragraph">finally when it sees a zero a null terminator then it actually breaks to</p>



<p class="wp-block-paragraph">the done label and the done label is just doesn&#8217;t really do much it&#8217;s just a</p>



<p class="wp-block-paragraph">label to get us out of the loop so the top of the loop says if we are done then</p>



<p class="wp-block-paragraph">just jump to the done area notice how that skips over the the top jump and then</p>



<p class="wp-block-paragraph">of course under that is going to be the epilog and then we can we can take the</p>



<p class="wp-block-paragraph">we can take the return value and set that up now because at this point R13 should contain</p>



<p class="wp-block-paragraph">the actual length of the string. So if we move that into RAX respecting the ABI for return values,</p>



<p class="wp-block-paragraph">then the caller should be able to get the string length just at that point by itself.</p>



<p class="wp-block-paragraph">So let&#8217;s see, that might actually be the whole entire program already. Let me</p>



<p class="wp-block-paragraph">double check here. All right, let&#8217;s run it and see if it actually works.</p>



<p class="wp-block-paragraph">and then do a make run.</p>



<p class="wp-block-paragraph">What&#8217;s up with those asterisks?</p>



<p class="wp-block-paragraph">Did I put that in there?</p>



<p class="wp-block-paragraph">Oh, I wonder.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">So the driver comes in,</p>



<p class="wp-block-paragraph">it calls on our function,</p>



<p class="wp-block-paragraph">and the whole null terminated string gets printed out.</p>



<p class="wp-block-paragraph">It says, hello, this is an example</p>



<p class="wp-block-paragraph">of our null terminated string.</p>



<p class="wp-block-paragraph">Notice how it printed the full length of the string,</p>



<p class="wp-block-paragraph">not any less,</p>



<p class="wp-block-paragraph">and it also didn&#8217;t print more than the length of the string,</p>



<p class="wp-block-paragraph">i.e. junk data,</p>



<p class="wp-block-paragraph">because it knew exactly how long the string was.</p>



<p class="wp-block-paragraph">was and this is way better than printing one character at a time in terms of efficiency we</p>



<p class="wp-block-paragraph">just pre-compute the length and then print exactly that length and then we&#8217;re done i think there is</p>



<p class="wp-block-paragraph">one more thing i wanted to do here let me see up at the top yeah okay let me go back up to the top</p>



<p class="wp-block-paragraph">of the program here so in the looper function we called on print null terminated string and we</p>



<p class="wp-block-paragraph">didn&#8217;t do anything else so what i would like to do is just make an explicit call to string length</p>



<p class="wp-block-paragraph">explicit call to string length inside of the lubr function just to get the length of the</p>



<p class="wp-block-paragraph">null terminated string so we can just print it to the caller or print it to the user</p>



<p class="wp-block-paragraph">and then I&#8217;m going to use my special library function here actually just just for your</p>



<p class="wp-block-paragraph">information notice how I&#8217;m calling string length just like the the print null terminated string</p>



<p class="wp-block-paragraph">function did and I&#8217;m just giving it as an argument a pointer to that null terminated string so then</p>



<p class="wp-block-paragraph">So now I can just print r12</p>



<p class="wp-block-paragraph">Well not yet, I&#8217;m gonna print a prefix if you look at the prefix here, it&#8217;s just</p>



<p class="wp-block-paragraph">The null terminated strings length was and then I&#8217;ll print a number after that</p>



<p class="wp-block-paragraph">You do it this way, you know your program is more pretty it&#8217;s more</p>



<p class="wp-block-paragraph">It&#8217;s more nice to the user and so forth so I&#8217;m going to do this</p>



<p class="wp-block-paragraph">we&#8217;re printing a nice prefix, a hard-coded string to the user to let them know that I&#8217;m about to</p>



<p class="wp-block-paragraph">show them the length of the string. And then I use my external function that just prints a number to</p>



<p class="wp-block-paragraph">the user. Again, this video is not about this library. You can use some other library if you</p>



<p class="wp-block-paragraph">want to print something, or you can omit that part if you don&#8217;t have one set up yet. But</p>



<p class="wp-block-paragraph">so I&#8217;m going to tell, I&#8217;m going to do first argument is R12, which was the length of the</p>



<p class="wp-block-paragraph">I&#8217;m going to call this function and say I would like you to print r12 which is the length of the string so</p>



<p class="wp-block-paragraph">After that we&#8217;ll print a new line to make things a little bit tidier and then I think this program is actually finished</p>



<p class="wp-block-paragraph">Run it again now it says here&#8217;s the null terminated string and then on the next line it just says</p>



<p class="wp-block-paragraph">The null terminated strings length was that was the prefix and then when I called my library</p>



<p class="wp-block-paragraph">the number it says 54. so i don&#8217;t know was it 54? let&#8217;s just double check to make sure that it</p>



<p class="wp-block-paragraph">actually was 54. 54 should not include the null terminator so i&#8217;m going to go 1 2 3 4 5 6 7 8 9 10</p>



<p class="wp-block-paragraph">1 2 3 4 5 6 7 9 20 1 2 3 5 6 7 9 30 1 2 3 5 6 7 9 9 30 1 2 3 5 6 7 9 9 50 51 52 53 54 was it 54? i can&#8217;t even remember anymore.</p>



<p class="wp-block-paragraph">So we have basically proved that this works.</p>



<p class="wp-block-paragraph">We have leveraged our knowledge of while loops to implement a string length function, which</p>



<p class="wp-block-paragraph">will let us have a printing function that is very smart.</p>



<p class="wp-block-paragraph">So we don&#8217;t have to hard code string lengths up at the top anymore.</p>



<p class="wp-block-paragraph">As long as we&#8217;re working with null terminated strings, everything will just work out now</p>



<p class="wp-block-paragraph">with less variables or less defines.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">Let&#8217;s see.</p>



<p class="wp-block-paragraph">I think that&#8217;s pretty much everything that I wanted to talk to you about.</p>



<p class="wp-block-paragraph">I don&#8217;t know. Could I do,</p>



<p class="wp-block-paragraph">could I do this easy, easily?</p>



<p class="wp-block-paragraph">Loop top.</p>



<p class="wp-block-paragraph">Okay. Yeah. I think I could probably do this reasonably.</p>



<p class="wp-block-paragraph">So at this point,</p>



<p class="wp-block-paragraph">you are satisfied that you understand how to implement this and you&#8217;re happy just cut the</p>



<p class="wp-block-paragraph">video the rest of this video is going to be me sort of like improvising trying to figure out if</p>



<p class="wp-block-paragraph">i can rearrange the logic in a fast enough time for a video uh just to show you that you know you</p>



<p class="wp-block-paragraph">should you should probably write your loops a little bit better than i did so here we go but</p>



<p class="wp-block-paragraph">this is this is just redundant stuff so we have our loop here and we have our initialization</p>



<p class="wp-block-paragraph">The loop top, it should compare R12 to 0 and it should break the loop if it is a 0.</p>



<p class="wp-block-paragraph">So that means I&#8217;m going to comment out this.</p>



<p class="wp-block-paragraph">And I&#8217;m going to do jump not equal to 0 to the body.</p>



<p class="wp-block-paragraph">And I just need to make a label for the body here.</p>



<p class="wp-block-paragraph">So I&#8217;m going to say str lane loop bottom.</p>



<p class="wp-block-paragraph">So there&#8217;s a label, which is the body.</p>



<p class="wp-block-paragraph">Maybe I&#8217;ll do a comment here just to remind us that this is actually the body.</p>



<p class="wp-block-paragraph">I guess I&#8217;ll do another comment right here.</p>



<p class="wp-block-paragraph">So that&#8217;s the loop&#8217;s body.</p>



<p class="wp-block-paragraph">So I&#8217;m going to say if R12 is not a null terminator, jump into the loop&#8217;s body.</p>



<p class="wp-block-paragraph">Otherwise, we fall through to the next instruction,</p>



<p class="wp-block-paragraph">and that will just be an unconditional jump to the done area.</p>



<p class="wp-block-paragraph">Okay, and then when we&#8217;re inside the loop&#8217;s body, we&#8217;ll jump back up to the top.</p>



<p class="wp-block-paragraph">I don&#8217;t know why I thought this was going to be hard.</p>



<p class="wp-block-paragraph">Let me run this to make sure I didn&#8217;t break the program.</p>



<p class="wp-block-paragraph">Yeah, it still works.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">I guess I overestimated the difficulty there.</p>



<p class="wp-block-paragraph">The point being, the body is a lot closer to the top of the loop.</p>



<p class="wp-block-paragraph">So that should be the thing that does a conditional branch.</p>



<p class="wp-block-paragraph">You should conditionally branch to the body because it&#8217;s a shorter jump and therefore</p>



<p class="wp-block-paragraph">much less likely to be out of bounds of that 128 conditional jump bite restriction.</p>



<p class="wp-block-paragraph">And then when we fall through to the next line, because we did not do that jump,</p>



<p class="wp-block-paragraph">because we did not do that jump then we&#8217;ll do an unconditional jump to the done area and you know</p>



<p class="wp-block-paragraph">our loop is small so it didn&#8217;t really matter the first time we did this but um again imagine your</p>



<p class="wp-block-paragraph">loop is huge that you definitely want an unconditional jump that goes to the done area</p>



<p class="wp-block-paragraph">at that point and that&#8217;s also what we&#8217;re doing an unconditional jump to the top here when we get to</p>



<p class="wp-block-paragraph">the end of the body so when you&#8217;re jumping large uh you know spans you want to use unconditional</p>



<p class="wp-block-paragraph">Alright, so I guess that&#8217;s it.</p>



<p class="wp-block-paragraph">I&#8217;m going to erase maybe this comment.</p>



<p class="wp-block-paragraph">Well, I&#8217;ll leave that in there just for posterity.</p>



<p class="wp-block-paragraph">And now I will officially say that I hope you had a good time watching this video.</p>



<p class="wp-block-paragraph">I hope you learned a little bit of stuff and I hope you had a little bit of fun.</p>



<p class="wp-block-paragraph">I will see you in the next video.</p>



<p class="wp-block-paragraph">I&#8217;m going to go play some video games.</p>



<p class="wp-block-paragraph">Maybe I&#8217;m going to eat some soup first.</p>



<p class="wp-block-paragraph">Hey everybody.</p>



<p class="wp-block-paragraph">Hey everybody, thanks for watching this video again from the bottom of my heart. I really</p>



<p class="wp-block-paragraph">appreciate it. I do hope you did learn something and have some fun. If you could do me a please,</p>



<p class="wp-block-paragraph">a small little favor, could you please subscribe and follow this channel or these videos or</p>



<p class="wp-block-paragraph">whatever it is you do on the current social media website that you&#8217;re looking at right now.</p>



<p class="wp-block-paragraph">It would really mean the world to me and it&#8217;ll help make more videos and grow this community.</p>



<p class="wp-block-paragraph">So we&#8217;ll be able to do more videos, longer videos, better videos, or just I&#8217;ll be able to keep making</p>



<p class="wp-block-paragraph">to keep making videos in general. So please do me a kindness and subscribe. You know, sometimes</p>



<p class="wp-block-paragraph">I&#8217;m sleeping in the middle of the night and I just wake up because I know somebody subscribed</p>



<p class="wp-block-paragraph">or followed. It just wakes me up and I get filled with joy. That&#8217;s exactly what happens every single</p>



<p class="wp-block-paragraph">time. So you could do it as a nice favor to me or you could troll me if you want to just wake me up</p>



<p class="wp-block-paragraph">in the middle of the night, just subscribe and then I&#8217;ll just wake up. I promise that&#8217;s what</p>



<p class="wp-block-paragraph">will happen. Also, if you look at the middle of the screen right now, you should see a QR code,</p>



<p class="wp-block-paragraph">you should see a QR code which you can scan in order to go to the website which I think is also</p>



<p class="wp-block-paragraph">named somewhere at the bottom of this video and it&#8217;ll take you to my main website where you can</p>



<p class="wp-block-paragraph">just kind of like see all the videos I published and the services and tutorials and things that I</p>



<p class="wp-block-paragraph">offer and all that good stuff and if you have a suggestion for clarifications or errata or just</p>



<p class="wp-block-paragraph">future videos that you want to see please leave a comment or if you just want to say hey what&#8217;s up</p>



<p class="wp-block-paragraph">what&#8217;s going on? You know, just send me a comment, whatever. I also wake up for those in the middle</p>



<p class="wp-block-paragraph">of the night. I get, I wake up in a cold sweat and I&#8217;m like, it would really, it would really mean</p>



<p class="wp-block-paragraph">the world to me. I would really appreciate it. So again, thank you so much for watching this video</p>



<p class="wp-block-paragraph">and enjoy the cool music as, as I fade into the darkness, which is coming for us all.</p>



<p class="wp-block-paragraph">Thank you.</p>
<p>The post <a href="https://www.NeuralLantern.com/implement-strlen-for-null-terminated-strings-in-x86-64-assembly-yasm/">Implement strlen for Null-Terminated Strings in x86-64 Assembly (YASM)</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/implement-strlen-for-null-terminated-strings-in-x86-64-assembly-yasm/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>x86-64 Assembly For Loops Explained &#8211; YASM Tutorial</title>
		<link>https://www.NeuralLantern.com/x86-64-assembly-for-loops-explained-yasm-tutorial/</link>
					<comments>https://www.NeuralLantern.com/x86-64-assembly-for-loops-explained-yasm-tutorial/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Sun, 01 Feb 2026 02:49:29 +0000</pubDate>
				<category><![CDATA[Assembly Language]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[asm tutorial 2025]]></category>
		<category><![CDATA[assembly for loop]]></category>
		<category><![CDATA[assembly language tutorial]]></category>
		<category><![CDATA[assembly while loop]]></category>
		<category><![CDATA[computer architecture]]></category>
		<category><![CDATA[conditional jump assembly]]></category>
		<category><![CDATA[implementing for loop in assembly]]></category>
		<category><![CDATA[inc instruction assembly]]></category>
		<category><![CDATA[learning assembly language]]></category>
		<category><![CDATA[loop in assembly]]></category>
		<category><![CDATA[low level programming]]></category>
		<category><![CDATA[NASM vs YASM]]></category>
		<category><![CDATA[reverse engineering basics]]></category>
		<category><![CDATA[systems programming]]></category>
		<category><![CDATA[x86 assembly loops]]></category>
		<category><![CDATA[x86-64 assembly]]></category>
		<category><![CDATA[x86-64 linux assembly]]></category>
		<category><![CDATA[Yasm tutorial]]></category>
		<category><![CDATA[yasm x86-64]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=295</guid>

					<description><![CDATA[<p>This tutorial explains how to implement a C-style for loop in x86-64 assembly using YASM by converting it to while-loop logic with initialization, conditional jump (jl), increment (inc), and unconditional jump back to the loop top. Demonstrates register usage (r12/r13), loop structure, and printing numbers inside the body.</p>
<p>The post <a href="https://www.NeuralLantern.com/x86-64-assembly-for-loops-explained-yasm-tutorial/">x86-64 Assembly For Loops Explained &#8211; YASM Tutorial</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="x86-64 Assembly For Loops Explained - YASM Tutorial" width="1380" height="776" src="https://www.youtube.com/embed/pftzv5lIPso?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">Quick practical guide showing how to implement a classic for loop (i=0; i&lt;n; i++) in x86-64 assembly with YASM. We break the for loop into init/check/update parts, convert it to while-style logic, then build it with compares, conditional jumps, inc, and unconditional jumps back to the top. Includes real working code, user input, and printed output.</p>



<p class="wp-block-paragraph">Great for students learning assembly after C/C++, OSdev hobbyists, or reverse engineering beginners.</p>



<p class="wp-block-paragraph">Introduction to For Loops in Assembly 00:00:00<br>For Loop Structure in High-Level Languages 00:00:28<br>Breaking Down For Loop Parts: Init, Check, Update 00:01:04<br>Converting For Loop to While Loop 00:01:52<br>Why While Loop Style Helps in Assembly 00:03:16<br>Program Overview and Setup 00:04:12<br>Data Section &#8211; Strings and Messages 00:04:40<br>External Functions and Hybrid Program 00:06:11<br>Entry Point &#8211; Looper Function 00:07:12<br>For Test Function and Register Usage 00:07:42<br>Preserving Callee-Saved Registers 00:08:05<br>Printing Welcome Message 00:09:00<br>Prompting User for Number 00:09:48<br>Getting User Input 00:10:25<br>For Loop Structure in Assembly &#8211; Comments 00:11:12<br>Initialization &#8211; Setting Counter to Zero 00:12:50<br>Loop Top Label and Condition Check 00:14:28<br>Conditional Jump Setup (jl) 00:15:07<br>Handling Jump Distances 00:15:34<br>Loop Body &#8211; Printing Current Number 00:16:58<br>Update Part &#8211; Increment Counter 00:18:40<br>Unconditional Jump Back to Loop Top 00:19:14<br>Loop Done Label and Exit 00:19:55<br>Printing Goodbye Message 00:20:23<br>Testing the Program 00:22:08<br>Final Results and Demo 00:22:24<br>Outro and Call to Action 00:23:25<br>Thanks and Subscribe Request 00:23:45<br>Website and QR Code Mention 00:24:38<br>Closing Thanks 00:25:16</p>



<p class="wp-block-paragraph">=-=-=-=-=-=-=-=-=</p>



<p class="wp-block-paragraph">Thanks for watching!</p>



<p class="wp-block-paragraph">Find us on other social media here:</p>



<ul class="wp-block-list">
<li>https://www.NeuralLantern.com/social</li>



<li>Twitter / X: https://x.com/NeuralLantern</li>



<li>Rumble: https://rumble.com/c/c-3696939</li>



<li>BitChute: https://www.bitchute.com/channel/pg1Pvv5dN4Gt</li>



<li>Daily Motion: https://www.dailymotion.com/neurallantern</li>



<li>Minds: https://www.minds.com/neurallantern/</li>



<li>Odysee: https://odysee.com/@NeuralLantern:5</li>
</ul>



<p class="wp-block-paragraph">Please show your support!</p>



<ul class="wp-block-list">
<li>Buy me a coffee: https://ko-fi.com/neurallantern</li>



<li>Subscribe + Sharing on Social Media</li>



<li>Leave a comment or suggestion</li>



<li>Subscribe to Blog: https://www.NeuralLantern.com</li>



<li>Watching the main &#8220;pinned&#8221; video of this channel for offers and extras</li>
</ul>



<p class="wp-block-paragraph">Hey there! In this video I&#8217;m going to teach you how to implement for loops in YASM x86-64 assembly.</p>



<p class="wp-block-paragraph">Although if you&#8217;re using a different type of machine or a different assembler,</p>



<p class="wp-block-paragraph">this video should still be useful to you because it&#8217;s mostly about the concepts involved in implementing a for loop.</p>



<p class="wp-block-paragraph">Okay, so for starters here, what am I even talking about? Let&#8217;s do…</p>



<p class="wp-block-paragraph">are you even talking about dude imagine in a higher level language we have a for loop here</p>



<p class="wp-block-paragraph">and so we have like four size type i equals zero i is less than 99 i plus plus right probably most</p>



<p class="wp-block-paragraph">programmers looking up assembly uh on the internet probably are interested in uh or probably already</p>



<p class="wp-block-paragraph">know how to implement for loops in c plus plus so let&#8217;s just pretend that you do and so inside of</p>



<p class="wp-block-paragraph">your for loop we&#8217;ll do stuff and what happens here is uh well you know this for loop is going to run</p>



<p class="wp-block-paragraph">Well, you know, this for loop is going to run 99 times.</p>



<p class="wp-block-paragraph">It&#8217;s going to start at zero.</p>



<p class="wp-block-paragraph">And, you know, so we have like an initialization part right here.</p>



<p class="wp-block-paragraph">Maybe I should copy paste this and kind of break down the parts.</p>



<p class="wp-block-paragraph">We have an init part here for the for loop.</p>



<p class="wp-block-paragraph">We&#8217;ll say init part.</p>



<p class="wp-block-paragraph">And then here we have a check part.</p>



<p class="wp-block-paragraph">We&#8217;ll continue to loop as long as this expression is true.</p>



<p class="wp-block-paragraph">You can make a big complicated expression if you want to,</p>



<p class="wp-block-paragraph">but we&#8217;ll just keep it simple for this video.</p>



<p class="wp-block-paragraph">So I&#8217;ll call this the check part.</p>



<p class="wp-block-paragraph">And then we have sort of an update or a maintenance part.</p>



<p class="wp-block-paragraph">an update or a maintenance part. So I&#8217;m going to call this the update part where we increment our</p>



<p class="wp-block-paragraph">counter variable, move pointers, even call functions, do whatever it is you think you need</p>



<p class="wp-block-paragraph">to do to update the loop so that it runs it, you know, so that the loops don&#8217;t actually have to be</p>



<p class="wp-block-paragraph">integers. But in this case, I think it&#8217;s better, it&#8217;s easier to understand what the loop is doing</p>



<p class="wp-block-paragraph">if we just kind of break down these parts. Anyway, so what is really a while loop? Sorry,</p>



<p class="wp-block-paragraph">but a while loop that breaks and has break has like a nit logic and breaking logic and checking logic just in specific places.</p>



<p class="wp-block-paragraph">Imagine this. What if I said before the loop starts, I&#8217;ll let&#8217;s let&#8217;s say we&#8217;re going to do a while loop before the loop starts.</p>



<p class="wp-block-paragraph">I&#8217;m going to initialize a variable size type I equals zero, right?</p>



<p class="wp-block-paragraph">That&#8217;s the initialization part that&#8217;ll only happen one time.</p>



<p class="wp-block-paragraph">And then when you have a while loop and it checks to see if it should keep going, that&#8217;s</p>



<p class="wp-block-paragraph">the check part of the for loop.</p>



<p class="wp-block-paragraph">So I&#8217;ll just say while i is less than 99.</p>



<p class="wp-block-paragraph">And then for the update part, we just have to stick that inside of the while loop somewhere.</p>



<p class="wp-block-paragraph">Depending on your logic, you might want to put it at the top or the middle or the bottom.</p>



<p class="wp-block-paragraph">I&#8217;m going to put it at the bottom because I&#8217;m going to expect that it happens right</p>



<p class="wp-block-paragraph">before we do the next check.</p>



<p class="wp-block-paragraph">So I&#8217;m going to maybe do a comment here and call it the update part and I&#8217;m just going</p>



<p class="wp-block-paragraph">So maybe if I update this code to print something, it&#8217;ll seem a little bit more clear.</p>



<p class="wp-block-paragraph">Value of I is, and then I&#8217;ll just say I end L, and then I&#8217;ll copy paste that to here.</p>



<p class="wp-block-paragraph">And then I can also put this inside of the while loop.</p>



<p class="wp-block-paragraph">And now we have transformed our for loop into a while loop.</p>



<p class="wp-block-paragraph">transform your for loop into a while loop it&#8217;s pretty easy to implement in assembly if you</p>



<p class="wp-block-paragraph">already know how to implement while loops so i should again say that there are lots of parts</p>



<p class="wp-block-paragraph">i don&#8217;t know if i said that during this video but there are lots of things in this video that i&#8217;m</p>



<p class="wp-block-paragraph">not going to that i&#8217;m not going to explain specifically because i&#8217;ve already explained</p>



<p class="wp-block-paragraph">them in other videos so for example implementing a while loop is in another video so if you don&#8217;t</p>



<p class="wp-block-paragraph">already know how to implement while loops if you don&#8217;t know how to use conditional branching or</p>



<p class="wp-block-paragraph">If you don&#8217;t know the basics of assembly, hybrid programs, make files, all the basic stuff that I&#8217;m going to skim over in this video,</p>



<p class="wp-block-paragraph">then you should probably check out my other videos first.</p>



<p class="wp-block-paragraph">But for now, I&#8217;m just going to assume that you know how to implement a while loop.</p>



<p class="wp-block-paragraph">And really the lesson is, hey, just take your for loop and convert it into a while loop.</p>



<p class="wp-block-paragraph">And then you can implement the while loop pretty easily.</p>



<p class="wp-block-paragraph">That&#8217;s the secret as far as I&#8217;m concerned.</p>



<p class="wp-block-paragraph">So imagine this now. Let&#8217;s do some assembly code.</p>



<p class="wp-block-paragraph">I have a source code file here called looper.asm for assembly.</p>



<p class="wp-block-paragraph">And you can imagine that I have a hybrid program running under the hood.</p>



<p class="wp-block-paragraph">I&#8217;m not going to show you all the code involved.</p>



<p class="wp-block-paragraph">I&#8217;m not going to show you the make file or the C++ driver that calls on this module.</p>



<p class="wp-block-paragraph">We&#8217;re just going to write the assembly here.</p>



<p class="wp-block-paragraph">So, you know, if you&#8217;re writing pure assembly at home to practice, that&#8217;s fine.</p>



<p class="wp-block-paragraph">Just keep in mind, there&#8217;s like a few things under the hood that I&#8217;m not showing in this specific video.</p>



<p class="wp-block-paragraph">So first off, I&#8217;m going to copy paste my data section.</p>



<p class="wp-block-paragraph">paste my data section of my assembly program. The first thing to note is we have a bunch of</p>



<p class="wp-block-paragraph">C strings here. We&#8217;re basically going to be telling the user, hey, we&#8217;re going to begin</p>



<p class="wp-block-paragraph">the four tests. Maybe I should have capitalized for, I&#8217;ll leave it. And then we&#8217;re going to prompt</p>



<p class="wp-block-paragraph">the user for a number. We&#8217;re going to say, please enter a number. The loop will print from zero to</p>



<p class="wp-block-paragraph">the number minus one, which is like the typical four loop that you usually write in the most</p>



<p class="wp-block-paragraph">and then we&#8217;re going to have a little prefix we&#8217;re going to say you know like an arrow and then we&#8217;re</p>



<p class="wp-block-paragraph">going to print the number back to the user that we&#8217;re looping through so if the user enters a</p>



<p class="wp-block-paragraph">10 it&#8217;s going to print the arrow 0 and then arrow 1 arrow 2 all the way up to arrow 9</p>



<p class="wp-block-paragraph">and then when we&#8217;re done we&#8217;re going to print an ending message so this is nothing new if you know</p>



<p class="wp-block-paragraph">assembly already just c strings that will print with system calls see my other videos if you don&#8217;t</p>



<p class="wp-block-paragraph">And then a CRLF string, just basically doing a new line, a carriage return new line feed</p>



<p class="wp-block-paragraph">on the system.</p>



<p class="wp-block-paragraph">And then we&#8217;re going to output using system call code one.</p>



<p class="wp-block-paragraph">And we&#8217;re going to use file descriptor one so we can print to standard output.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">So now the real fun begins.</p>



<p class="wp-block-paragraph">Let&#8217;s start our text section, which is where the instructions of our assembly program go.</p>



<p class="wp-block-paragraph">So I&#8217;m going to do text section, section text right there.</p>



<p class="wp-block-paragraph">And I&#8217;m going to use two external functions to just help me input and output numbers to the user.</p>



<p class="wp-block-paragraph">If you wanted to, you could use a system call that just inputted a character.</p>



<p class="wp-block-paragraph">And then you could just kind of like loop printing various characters.</p>



<p class="wp-block-paragraph">And like, let&#8217;s say if the user typed A, maybe you could imagine doing a loop that increases the character that they typed all the way until it hits Z.</p>



<p class="wp-block-paragraph">Or if they hit, you know, F, it&#8217;ll just print F all the way to Z.</p>



<p class="wp-block-paragraph">to z you could do that without using an external library for printing integers this video is not</p>



<p class="wp-block-paragraph">about this library right here so i&#8217;m not really going to go over it but uh you know you could</p>



<p class="wp-block-paragraph">hard code the start and end points when you&#8217;re practicing um you could you could use a different</p>



<p class="wp-block-paragraph">library or a different function call to get the inputs you could use a system call just to input</p>



<p class="wp-block-paragraph">one character um or you could you know use a hybrid program to to utilize printf and scanf</p>



<p class="wp-block-paragraph">f. Either way I&#8217;m just going to be using these two functions just to like get input and output.</p>



<p class="wp-block-paragraph">It&#8217;s not really part of the idea of looping. So now let&#8217;s start our entry point.</p>



<p class="wp-block-paragraph">Our function is called looper. Since this is a hybrid program you can imagine there&#8217;s a C++</p>



<p class="wp-block-paragraph">module elsewhere calling on the looper function and so that&#8217;s why I mark it as global so it can</p>



<p class="wp-block-paragraph">be called upon. And then I have another function called for test. I don&#8217;t really know why I chose</p>



<p class="wp-block-paragraph">it this way but i wanted to make another function that was called upon by our entry point here</p>



<p class="wp-block-paragraph">so the looper function really doesn&#8217;t do anything except recall the for test function</p>



<p class="wp-block-paragraph">so now let&#8217;s start the for test function actually maybe this is where the fun begins</p>



<p class="wp-block-paragraph">so i&#8217;m gonna put it down here and so you can see the signature it doesn&#8217;t take any arguments it</p>



<p class="wp-block-paragraph">doesn&#8217;t return anything it just does stuff and then i have a note to myself this is how we&#8217;re</p>



<p class="wp-block-paragraph">going to use the registers we&#8217;re going to use r12 for the user&#8217;s number and then we&#8217;re going to use</p>



<p class="wp-block-paragraph">And then we&#8217;re going to use R13 to keep track of where we&#8217;re going.</p>



<p class="wp-block-paragraph">So let&#8217;s see.</p>



<p class="wp-block-paragraph">I&#8217;m going to start by saying let&#8217;s preserve R12 and R13</p>



<p class="wp-block-paragraph">because you have to respect the application binary interface, the ABI,</p>



<p class="wp-block-paragraph">and that designates R12 and R13 as Kali saved registers.</p>



<p class="wp-block-paragraph">If I don&#8217;t preserve those and my program is even a little bit complicated,</p>



<p class="wp-block-paragraph">I&#8217;m probably going to be debugging forever</p>



<p class="wp-block-paragraph">debugging forever or I&#8217;m going to just crash my program for no reason. So I&#8217;m going to just</p>



<p class="wp-block-paragraph">do a push pop pair. Notice how the pops are in reverse order. This is not a push pop video,</p>



<p class="wp-block-paragraph">but just so you know, I guess while I&#8217;m here, I&#8217;m going to copy paste my crlf function,</p>



<p class="wp-block-paragraph">which really does nothing. It just prints out the crlf string with a system call. That&#8217;s all</p>



<p class="wp-block-paragraph">Okay, so do I even need CRLF in this program?</p>



<p class="wp-block-paragraph">I think I just modified this.</p>



<p class="wp-block-paragraph">Maybe I don&#8217;t even need it anymore.</p>



<p class="wp-block-paragraph">No, I guess I do.</p>



<p class="wp-block-paragraph">The first thing we&#8217;ll do is we&#8217;ll print an introduction message to the user.</p>



<p class="wp-block-paragraph">So inside of the for test, we&#8217;ll just use a system call to print out, you know, a welcome</p>



<p class="wp-block-paragraph">message to the user.</p>



<p class="wp-block-paragraph">And then I&#8217;m going to call CRLF, which will just give us a new line.</p>



<p class="wp-block-paragraph">And yeah, you can hard code, you know, the 13, 10 at the end of these strings, but I</p>



<p class="wp-block-paragraph">don&#8217;t really like doing that.</p>



<p class="wp-block-paragraph">doing that. Okay, so we should have a working program at this point. Let me see if it actually</p>



<p class="wp-block-paragraph">does work. Clear and make run. Okay, so the driver prints a little welcome message. You don&#8217;t see the</p>



<p class="wp-block-paragraph">driver code, but that&#8217;s what it&#8217;s doing. And then the for test prints the welcome message that we</p>



<p class="wp-block-paragraph">just added. And then the driver lets us know it&#8217;s retained control. And then it&#8217;s responsible for</p>



<p class="wp-block-paragraph">returning to the operating system for us. Okay, so then the next thing we&#8217;re going to do is we&#8217;re</p>



<p class="wp-block-paragraph">we&#8217;re going to ask the user for a number so that we know how many times to loop.</p>



<p class="wp-block-paragraph">And again, you could hard code this number if you don&#8217;t want to do IO right now.</p>



<p class="wp-block-paragraph">You could even print a character a certain number of times</p>



<p class="wp-block-paragraph">if you don&#8217;t want to even deal with printing an integer.</p>



<p class="wp-block-paragraph">But I&#8217;m going to ask the user for a number.</p>



<p class="wp-block-paragraph">That&#8217;s going to be the prompt string.</p>



<p class="wp-block-paragraph">And if we run it again, now you should see it asks the user for a number.</p>



<p class="wp-block-paragraph">So it&#8217;s going to say, please enter a number.</p>



<p class="wp-block-paragraph">The loop will print from zero to N minus one.</p>



<p class="wp-block-paragraph">print from 0 to n minus 1. It doesn&#8217;t actually ask for the number though. It doesn&#8217;t actually</p>



<p class="wp-block-paragraph">I guess take the number so that&#8217;s going to be my external library that this video is not about</p>



<p class="wp-block-paragraph">where I just call a function called input assigned 64 integer and I&#8217;m going to receive that back in</p>



<p class="wp-block-paragraph">rax and I&#8217;m just going to save rax into r12. So r12 is now going to be the number that the user</p>



<p class="wp-block-paragraph">inputted and that&#8217;s why up here I have it designated as the user&#8217;s number. So really not a big deal but</p>



<p class="wp-block-paragraph">a big deal but uh you know if we run it again it&#8217;ll ask for a number and then it won&#8217;t do</p>



<p class="wp-block-paragraph">anything else it&#8217;ll just kind of quit okay so now we can implement our for loop this is going to be</p>



<p class="wp-block-paragraph">a little tricky so we&#8217;re going to start off with the initialization part remember we had several</p>



<p class="wp-block-paragraph">parts here if i just kind of drag this off to the side maybe pin it up to the top so we can see it</p>



<p class="wp-block-paragraph">aren&#8217;t we? If I move it a little bit to the side. So remember that for loop, it&#8217;s got an init part</p>



<p class="wp-block-paragraph">and a check part and an update part. And I&#8217;ve kind of added that as a comment just to remind myself</p>



<p class="wp-block-paragraph">of the way my mind is supposed to be wrapped around this concept. And so I made another comment</p>



<p class="wp-block-paragraph">here with four and then empty parentheses just to denote that some comments that come below</p>



<p class="wp-block-paragraph">I guess the top of the for loop</p>



<p class="wp-block-paragraph">So now I&#8217;m going to make a label here and what I like to do with my labels is I like to</p>



<p class="wp-block-paragraph">prefix them with the name of the function that I&#8217;m currently in and then an underscore and that kind of helps me keep track of</p>



<p class="wp-block-paragraph">My symbols a little bit more easily, especially if I have a large module the symbols are less likely to overlap if I prefix them with the</p>



<p class="wp-block-paragraph">The function names</p>



<p class="wp-block-paragraph">to be Fortest underscore something and since I&#8217;m only doing one thing inside of the Fortest function</p>



<p class="wp-block-paragraph">I&#8217;m just going to have a suffix only for the most part but you can imagine if you had more</p>



<p class="wp-block-paragraph">parts inside of your function and it started getting a little cluttered you might want to have</p>



<p class="wp-block-paragraph">you know another label you know that just sort of another I guess like part to your label that names</p>



<p class="wp-block-paragraph">the part of your function you&#8217;re in although this is assembly it gets really hard really fast so</p>



<p class="wp-block-paragraph">really hard really fast so if your function is even a little bit complicated you should probably</p>



<p class="wp-block-paragraph">consider breaking it up into multiple functions if you can. We can&#8217;t really do that at this point</p>



<p class="wp-block-paragraph">because it&#8217;s just a for loop but keep that in mind. Okay so we&#8217;re going to initialize. Remember</p>



<p class="wp-block-paragraph">the first thing we had to do to initialize was you know setting i to zero or you know whatever</p>



<p class="wp-block-paragraph">it is that we&#8217;re going to set up in the init part so I&#8217;m just going to do that here. I&#8217;m going to say</p>



<p class="wp-block-paragraph">That&#8217;s the first part, the update part where we set size type i equals zero.</p>



<p class="wp-block-paragraph">In fact, maybe I could do another copy paste of this.</p>



<p class="wp-block-paragraph">Where instead of using a size type, we&#8217;ll just say that the register r13 equals zero.</p>



<p class="wp-block-paragraph">I know that&#8217;s not going to make sense in a higher level language right now,</p>



<p class="wp-block-paragraph">but just so that the for loop looks a little bit more like assembly.</p>



<p class="wp-block-paragraph">We&#8217;ll keep going as long as r13 is less than r12.</p>



<p class="wp-block-paragraph">and then we increase R13.</p>



<p class="wp-block-paragraph">So I&#8217;m just going to put ink R13</p>



<p class="wp-block-paragraph">so it looks more assembly-like,</p>



<p class="wp-block-paragraph">even though this completely and totally</p>



<p class="wp-block-paragraph">would not compile in C++.</p>



<p class="wp-block-paragraph">I hope that this helps your understanding a little bit.</p>



<p class="wp-block-paragraph">So yeah, we can do everything</p>



<p class="wp-block-paragraph">except for just the increase part at the very top.</p>



<p class="wp-block-paragraph">I&#8217;m going to choose to increase it at the bottom.</p>



<p class="wp-block-paragraph">If you wanted to, I guess you could start off R13</p>



<p class="wp-block-paragraph">as a negative number and then increase it at the top.</p>



<p class="wp-block-paragraph">But I personally don&#8217;t feel that&#8217;s like very clean.</p>



<p class="wp-block-paragraph">feel that&#8217;s like very clean it also forces you to use signed integers maybe you wanted to use an</p>



<p class="wp-block-paragraph">unsigned integer so you could get like a gigantic um maximum number that you looped up to i don&#8217;t</p>



<p class="wp-block-paragraph">know so we&#8217;ll just initialize here and we&#8217;ll say r13 is equal to zero the init part should not be</p>



<p class="wp-block-paragraph">part of the actual like looping like every time you loop up to the top of the for loop you should</p>



<p class="wp-block-paragraph">not repeat that part again it should only happen once so the next label that i have is called loop</p>



<p class="wp-block-paragraph">have is called loop top and that&#8217;s just going to be the top of the loop that I</p>



<p class="wp-block-paragraph">continue to go back up to every time I want to see if we&#8217;re supposed to</p>



<p class="wp-block-paragraph">continue looping and then go into the loops body so maybe I should say that&#8217;s</p>



<p class="wp-block-paragraph">why this is named to underscore loop top and I don&#8217;t know you don&#8217;t have to do</p>



<p class="wp-block-paragraph">camel casing and your labels you know you could just do loop in it or whatever</p>



<p class="wp-block-paragraph">but I&#8217;m just choosing to do it this way so at the top of our loop we&#8217;ll be</p>



<p class="wp-block-paragraph">Remember that was the check part, right?</p>



<p class="wp-block-paragraph">So we&#8217;re going to check to see that R13 is still less than R12.</p>



<p class="wp-block-paragraph">If it is, we&#8217;ll continue with the for loop.</p>



<p class="wp-block-paragraph">If it&#8217;s not, then we jump out of the for loop.</p>



<p class="wp-block-paragraph">So that means probably the true case where R13 is indeed less than R12,</p>



<p class="wp-block-paragraph">that&#8217;s going to be a short jump just into the loop&#8217;s body.</p>



<p class="wp-block-paragraph">And the false case where R13 is not less than R12,</p>



<p class="wp-block-paragraph">that should probably end up being a much longer jump.</p>



<p class="wp-block-paragraph">on how big your your loop is maybe that jump is too long too far away for a conditional branching</p>



<p class="wp-block-paragraph">instruction to reach if you&#8217;ve watched my previous videos you should know already that</p>



<p class="wp-block-paragraph">the conditional branching instructions like jl like jump less than they can only reach about 128</p>



<p class="wp-block-paragraph">bytes away if you try to go further than that the assembler will actually stop and block you from</p>



<p class="wp-block-paragraph">finishing your compilation it&#8217;ll say i think it&#8217;s like jump out of range or something like that</p>



<p class="wp-block-paragraph">So you want to try to keep the short jump points with your conditional branches.</p>



<p class="wp-block-paragraph">And then in the false case, where the conditional branch doesn&#8217;t actually do anything,</p>



<p class="wp-block-paragraph">then it falls through to the next instruction where you will have an unconditional jump.</p>



<p class="wp-block-paragraph">And remember, the unconditional jumps, they don&#8217;t have a limitation of 128 bytes.</p>



<p class="wp-block-paragraph">They can jump like all over the place.</p>



<p class="wp-block-paragraph">Like they can jump anywhere, basically.</p>



<p class="wp-block-paragraph">that means if you think about it, we come in to the loop top right here.</p>



<p class="wp-block-paragraph">We immediately do a compare instruction and a conditional branch.</p>



<p class="wp-block-paragraph">So if R13 is less than R12, meaning we should continue to for loop,</p>



<p class="wp-block-paragraph">then we&#8217;ll just do a short jump into the loop&#8217;s body and actually execute its body.</p>



<p class="wp-block-paragraph">And if not, we will end up falling through to line 92,</p>



<p class="wp-block-paragraph">where there&#8217;s just an unconditional jump instruction that just says,</p>



<p class="wp-block-paragraph">all right, let&#8217;s jump all the way down to being done.</p>



<p class="wp-block-paragraph">Let&#8217;s jump all the way down to being done, which could be very far away for all we know.</p>



<p class="wp-block-paragraph">Okay, so we&#8217;ve done that.</p>



<p class="wp-block-paragraph">Now let&#8217;s implement the loops body because the first thing that we did is we wanted to</p>



<p class="wp-block-paragraph">jump into the loop body to actually execute our instructions, which in this case, we&#8217;ll</p>



<p class="wp-block-paragraph">just be, you know, printing a number every time we loop and then increasing that number.</p>



<p class="wp-block-paragraph">So I&#8217;m going to do a little like new line there.</p>



<p class="wp-block-paragraph">I&#8217;m going to paste the loop body.</p>



<p class="wp-block-paragraph">little comments to help remind myself that this is actually the loop&#8217;s body. So for test loop body</p>



<p class="wp-block-paragraph">that takes care of the branching instruction, hitting on that and actually going into the body.</p>



<p class="wp-block-paragraph">And then later we&#8217;re going to have to implement a label for the loop being done. But for now,</p>



<p class="wp-block-paragraph">we&#8217;ll just say the body. What does it do? It just prints a little message to the user.</p>



<p class="wp-block-paragraph">If you look at the message for current number string, if I go up real fast,</p>



<p class="wp-block-paragraph">message for current number, it&#8217;s just an arrow. So the user&#8217;s going to see an arrow and then</p>



<p class="wp-block-paragraph">So the user is going to see an arrow and then their current number, I guess of the loop&#8217;s</p>



<p class="wp-block-paragraph">current number.</p>



<p class="wp-block-paragraph">And then every time it loops, it&#8217;s just going to continue printing that arrow with a number</p>



<p class="wp-block-paragraph">on it.</p>



<p class="wp-block-paragraph">So we&#8217;re doing that.</p>



<p class="wp-block-paragraph">And then we&#8217;re going to say R13, which is the current counter variable, which started</p>



<p class="wp-block-paragraph">at zero is going to get loaded into RDI, which if you watched my other videos, it&#8217;s just</p>



<p class="wp-block-paragraph">the first integer argument for a function call.</p>



<p class="wp-block-paragraph">So I&#8217;m just going to call this other function here, which is not part of the video to just</p>



<p class="wp-block-paragraph">which is not part of the video to just say hey please print this number for me so the first</p>



<p class="wp-block-paragraph">time this iterates it&#8217;s going to print zero because it&#8217;s going to print r13 and then it&#8217;s</p>



<p class="wp-block-paragraph">going to print a new line so that the cursor goes to the next you know line of the terminal</p>



<p class="wp-block-paragraph">so that&#8217;s all the body does it just kind of like prints the current number with an arrow and does</p>



<p class="wp-block-paragraph">a new line and then at the very bottom of the loop body we just sort of maintain the for loop this is</p>



<p class="wp-block-paragraph">for loop this is going to be the update part so like let&#8217;s see maybe scooch this up a little bit</p>



<p class="wp-block-paragraph">the update part where we have let&#8217;s see on the very right side of the for loop which is like i</p>



<p class="wp-block-paragraph">plus plus or in more assembly speak increasing the counter variable so i&#8217;m just going to increase r13</p>



<p class="wp-block-paragraph">and then that way the loop can progress you know we&#8217;re always looking at r13</p>



<p class="wp-block-paragraph">to decide if we need to stop or not you know we&#8217;re comparing r13 to r12</p>



<p class="wp-block-paragraph">So we&#8217;re just increasing at the very bottom of the loop and then we unconditionally jump back up to the top.</p>



<p class="wp-block-paragraph">Probably a better idea to unconditionally jump back up to the top because maybe the jump to the top is very very far and if it&#8217;s greater than 128 bytes it won&#8217;t work.</p>



<p class="wp-block-paragraph">So the regular jump instruction doesn&#8217;t have that limitation. So now we&#8217;re jumping up to the loop top.</p>



<p class="wp-block-paragraph">So you can imagine now that you know we&#8217;re not going to the initialization part. That would be bad.</p>



<p class="wp-block-paragraph">We&#8217;re just jumping up to the top here where we immediately ask you know are we done?</p>



<p class="wp-block-paragraph">If we&#8217;re not done, we jump into the loop body and print another number.</p>



<p class="wp-block-paragraph">And then at the very bottom of the body, we say, all right, increase the counter and then jump back up to the top.</p>



<p class="wp-block-paragraph">So this is a simple for loop, but you can see what it&#8217;s doing, right?</p>



<p class="wp-block-paragraph">It&#8217;s just going to be printing a number over and over again as the number increases.</p>



<p class="wp-block-paragraph">And then eventually it&#8217;ll stop when it hits the correct number.</p>



<p class="wp-block-paragraph">The last thing we need is the loop done label.</p>



<p class="wp-block-paragraph">If you look back up at the top here on line 92, if R13 was not less than R12,</p>



<p class="wp-block-paragraph">less than r12 then execution would fall through to line 92 and there is our unconditional jump</p>



<p class="wp-block-paragraph">instruction basically saying if r13 is not less than r12 then we&#8217;ll jump to the loop done label</p>



<p class="wp-block-paragraph">which means we&#8217;re just totally finished with this loop so we have to make that real fast</p>



<p class="wp-block-paragraph">and all it&#8217;s going to do is just basically say goodbye it&#8217;s just going to print a message to</p>



<p class="wp-block-paragraph">to the restoration functions.</p>



<p class="wp-block-paragraph">Oh, did I ruin my return somewhere?</p>



<p class="wp-block-paragraph">Uh-oh, what did I do wrong?</p>



<p class="wp-block-paragraph">I lost my return statement.</p>



<p class="wp-block-paragraph">Did I accidentally delete that somehow?</p>



<p class="wp-block-paragraph">That&#8217;s a bad program.</p>



<p class="wp-block-paragraph">Or did I not even…</p>



<p class="wp-block-paragraph">Hmm, I wonder if it like…</p>



<p class="wp-block-paragraph">I wonder if I didn&#8217;t have my return statement</p>



<p class="wp-block-paragraph">and it fell through into the CRLF function</p>



<p class="wp-block-paragraph">and then the CRLF function returned to the caller</p>



<p class="wp-block-paragraph">to the caller on behalf of the for test function I don&#8217;t even know only all only</p>



<p class="wp-block-paragraph">the spirits know at this point I don&#8217;t know leave a comment or something if</p>



<p class="wp-block-paragraph">you know what happened but every function has to have its own return for</p>



<p class="wp-block-paragraph">sure so you know the loop done label is usually where you want to jump to when</p>



<p class="wp-block-paragraph">you know the for loop is finished or the while loop is finished when it comes to</p>



<p class="wp-block-paragraph">saying goodbye it probably would be a little bit more clear of me to add an</p>



<p class="wp-block-paragraph">you know for test you know say goodbye just so that I that I remember that this</p>



<p class="wp-block-paragraph">is this is the place where we&#8217;re done and this other place this is just</p>



<p class="wp-block-paragraph">something else that&#8217;s happening maybe I&#8217;m doing more instructions or more</p>



<p class="wp-block-paragraph">operations or calling a function or whatever so obviously if I did it this</p>



<p class="wp-block-paragraph">way then the loop done label would just end up falling through to the goodbye</p>



<p class="wp-block-paragraph">label and it would be fine but it&#8217;s just more visually clear I&#8217;m gonna take it</p>



<p class="wp-block-paragraph">Anyway, so at this point we might have a program that actually works.</p>



<p class="wp-block-paragraph">Let&#8217;s see if it does.</p>



<p class="wp-block-paragraph">What else do I need to add?</p>



<p class="wp-block-paragraph">No, I think we&#8217;re done with that.</p>



<p class="wp-block-paragraph">Okay, let&#8217;s try it.</p>



<p class="wp-block-paragraph">So we&#8217;ll do a make run and we&#8217;ll enter the number five and let&#8217;s see if it works or it</p>



<p class="wp-block-paragraph">crashes.</p>



<p class="wp-block-paragraph">It worked on the first try.</p>



<p class="wp-block-paragraph">So I had a solution though.</p>



<p class="wp-block-paragraph">Not fair, but I could have typoed.</p>



<p class="wp-block-paragraph">Anyway, so it says we entered a five, the loop will print from zero to N minus one.</p>



<p class="wp-block-paragraph">print from zero to n minus one so we should see from zero to four and so then every iteration of</p>



<p class="wp-block-paragraph">the loop it&#8217;s just that little message we&#8217;re just printing a zero printing one printing a two you</p>



<p class="wp-block-paragraph">know the number increases because we did did that little inc instruction the increase instruction</p>



<p class="wp-block-paragraph">we unconditionally jump to the top of the loop where we decide if we&#8217;re supposed to uh finish</p>



<p class="wp-block-paragraph">you know be done with the loop by jumping to the done label eventually after we uh let&#8217;s see</p>



<p class="wp-block-paragraph">it prints this four here it&#8217;ll do the increase instruction at the bottom of the loop&#8217;s body</p>



<p class="wp-block-paragraph">and then it&#8217;ll jump to the loop&#8217;s top then the loop&#8217;s top will see that it&#8217;s a five because we</p>



<p class="wp-block-paragraph">just increased the four it will see that five is definitely not less than five so that&#8217;s a false</p>



<p class="wp-block-paragraph">which means execution will you know fall through where the heck is that it&#8217;ll fall through to the</p>



<p class="wp-block-paragraph">line 92 jump instruction which is just the loop being done so that&#8217;s here where it says goodbye</p>



<p class="wp-block-paragraph">says goodbye and then we have successfully implemented a basic for loop</p>



<p class="wp-block-paragraph">all right so thank you so much for watching this video I hope you learned</p>



<p class="wp-block-paragraph">a little bit and had a little bit of fun I will see you in the next video happy</p>



<p class="wp-block-paragraph">coding and happy studying hey everybody thanks for watching this video again</p>



<p class="wp-block-paragraph">from the bottom of my heart I really appreciate it I do hope you did learn</p>



<p class="wp-block-paragraph">hope you did learn something and have some fun. If you could do me a please, a small little favor,</p>



<p class="wp-block-paragraph">could you please subscribe and follow this channel or these videos or whatever it is you do on the</p>



<p class="wp-block-paragraph">current social media website that you&#8217;re looking at right now. It would really mean the world to</p>



<p class="wp-block-paragraph">me and it&#8217;ll help make more videos and grow this community. So we&#8217;ll be able to do more videos,</p>



<p class="wp-block-paragraph">longer videos, better videos, or just I&#8217;ll be able to keep making videos in general. So please</p>



<p class="wp-block-paragraph">and subscribe. You know sometimes I&#8217;m sleeping in the middle of the night and I just wake up because</p>



<p class="wp-block-paragraph">I know somebody subscribed or followed. It just wakes me up and I get filled with joy. That&#8217;s</p>



<p class="wp-block-paragraph">exactly what happens every single time. So you could do it as a nice favor to me or you could</p>



<p class="wp-block-paragraph">you could troll me if you want to just wake me up in the middle of the night just subscribe</p>



<p class="wp-block-paragraph">and then I&#8217;ll just wake up. I promise that&#8217;s what will happen. Also if you look at the middle of the</p>



<p class="wp-block-paragraph">screen right now you should see a QR code which you can scan in order to go to the website which</p>



<p class="wp-block-paragraph">at the bottom of this video and it&#8217;ll take you to my main website where you can just kind of like</p>



<p class="wp-block-paragraph">see all the videos I published and the services and tutorials and things that I offer and all</p>



<p class="wp-block-paragraph">that good stuff and if you have a suggestion for clarifications or errata or just future videos</p>



<p class="wp-block-paragraph">that you want to see please leave a comment or if you just want to say hey what&#8217;s up what&#8217;s going on</p>



<p class="wp-block-paragraph">you know just send me a comment whatever I also wake up for those in the middle of the night I get</p>



<p class="wp-block-paragraph">I wake up in a cold sweat and I&#8217;m like,</p>



<p class="wp-block-paragraph">it would really mean the world to me.</p>



<p class="wp-block-paragraph">I would really appreciate it.</p>



<p class="wp-block-paragraph">So again, thank you so much for watching this video</p>



<p class="wp-block-paragraph">and enjoy the cool music as I fade into the darkness,</p>



<p class="wp-block-paragraph">which is coming for us all.</p>



<p class="wp-block-paragraph">Thank you.</p>
<p>The post <a href="https://www.NeuralLantern.com/x86-64-assembly-for-loops-explained-yasm-tutorial/">x86-64 Assembly For Loops Explained &#8211; YASM Tutorial</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/x86-64-assembly-for-loops-explained-yasm-tutorial/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
