<?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>nasm yasm floating point Archives - NeuralLantern.com</title>
	<atom:link href="https://www.NeuralLantern.com/tag/nasm-yasm-floating-point/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.NeuralLantern.com/tag/nasm-yasm-floating-point/</link>
	<description></description>
	<lastBuildDate>Sun, 15 Feb 2026 03:15:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://www.NeuralLantern.com/wp-content/uploads/2025/04/cropped-2025-04-04-Lantern-03-32x32.png</url>
	<title>nasm yasm floating point Archives - NeuralLantern.com</title>
	<link>https://www.NeuralLantern.com/tag/nasm-yasm-floating-point/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>x86-64 Assembly: Floating Point Registers Basics with YASM (MOVSD, MULSD, CVTSI2SD)</title>
		<link>https://www.NeuralLantern.com/x86-64-assembly-floating-point-registers-basics-with-yasm-movsd-mulsd-cvtsi2sd/</link>
					<comments>https://www.NeuralLantern.com/x86-64-assembly-floating-point-registers-basics-with-yasm-movsd-mulsd-cvtsi2sd/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Sun, 15 Feb 2026 03:15:33 +0000</pubDate>
				<category><![CDATA[Assembly Language]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[assembly language tutorial]]></category>
		<category><![CDATA[convert integer to float assembly]]></category>
		<category><![CDATA[cvtsi2sd]]></category>
		<category><![CDATA[double precision assembly]]></category>
		<category><![CDATA[ed jorgensen x86 book]]></category>
		<category><![CDATA[floating point registers]]></category>
		<category><![CDATA[movsd]]></category>
		<category><![CDATA[mulsd]]></category>
		<category><![CDATA[nasm yasm floating point]]></category>
		<category><![CDATA[stack alignment assembly]]></category>
		<category><![CDATA[system v abi xmm]]></category>
		<category><![CDATA[x86 assembly floating point]]></category>
		<category><![CDATA[x86-64 assembly]]></category>
		<category><![CDATA[x86-64 linux assembly]]></category>
		<category><![CDATA[xmm registers]]></category>
		<category><![CDATA[xmm0]]></category>
		<category><![CDATA[Yasm tutorial]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=302</guid>

					<description><![CDATA[<p>Learn the basics of floating-point registers (XMM0–XMM15) in x86-64 assembly with YASM. Covers MOVSD, MULSD, CVTSI2SD, ABI rules, why floats return in XMM0 instead of RAX, saving/restoring around calls, and common stack alignment crashes when using printf.</p>
<p>The post <a href="https://www.NeuralLantern.com/x86-64-assembly-floating-point-registers-basics-with-yasm-movsd-mulsd-cvtsi2sd/">x86-64 Assembly: Floating Point Registers Basics with YASM (MOVSD, MULSD, CVTSI2SD)</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: Floating Point Registers Basics with YASM (MOVSD, MULSD, CVTSI2SD)" width="1380" height="776" src="https://www.youtube.com/embed/0Wcu_7LDw_w?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 but thorough introduction to floating-point registers in x86-64 assembly using YASM.</p>



<p class="wp-block-paragraph">Learn why XMM0 is special, how to use MOVSD / MULSD / CVTSI2SD, why you must save floats around function calls, and how easy (or sneaky) stack alignment bugs can crash your program.</p>



<p class="wp-block-paragraph">Live coding + real examples converting integers to doubles and multiplying them.</p>



<p class="wp-block-paragraph">Great next step after basic integer assembly tutorials.</p>



<p class="wp-block-paragraph">00:00 Introduction to Floating Point Registers<br>00:28 Why Floating Point Uses Special Registers<br>01:35 Floating Point Return Value in XMM0<br>02:17 XMM Registers Overview XMM0 to XMM15<br>02:48 ABI Rules No Callee-Saved XMM Registers<br>03:16 128-bit XMM Registers Purpose and Size<br>04:00 Ed Jorgensen x86-64 Textbook Reference<br>05:03 Locating XMM Documentation in Textbook<br>05:20 Earthquake &#8211; I am going to die<br>06:24 Chapter 18 Floating Point Instructions<br>07:34 MOVSS vs MOVSD Single vs Double Precision<br>09:11 Understanding SS and SD Instruction Suffixes<br>10:58 MOVSD Example Register to Register<br>11:03 Conversion Instructions CVT Family<br>13:02 Floating Point Arithmetic ADDSD MULSD SUBSD<br>25:48 Program Demo User Input Section<br>26:01 Converting Integer to Double CVTSI2SD<br>26:29 Multiplying by Constant Float MULSD<br>28:56 Saving Result Printing Modified Float<br>31:38 Multiplying User Integer by User Float<br>33:54 Final Result Display Program Summary<br>35:19 Stack Alignment Crash Demonstration<br>36:24 Conclusion Key Takeaways<br>36:52 Outro Subscribe and Thanks</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 we&#8217;re going to talk about pointers and dereferencing in a YASM x8664</p>



<p class="wp-block-paragraph">assembly program, also as a hybrid program so that assembly and C++ can talk to each other</p>



<p class="wp-block-paragraph">and send each other pointers and send each other data and things like that.</p>



<p class="wp-block-paragraph">for what pointers are.</p>



<p class="wp-block-paragraph">I&#8217;m going to write in C++ for a second.</p>



<p class="wp-block-paragraph">Suppose you have a pointer for an integer.</p>



<p class="wp-block-paragraph">We&#8217;ll call it P.</p>



<p class="wp-block-paragraph">Suppose you have an integer by itself.</p>



<p class="wp-block-paragraph">We&#8217;ll call it A.</p>



<p class="wp-block-paragraph">Let&#8217;s say that the value of A is 5.</p>



<p class="wp-block-paragraph">And if you wanted to say that P points to A,</p>



<p class="wp-block-paragraph">you could say P equals the address of A.</p>



<p class="wp-block-paragraph">I&#8217;ll put C++ at the top here.</p>



<p class="wp-block-paragraph">And so now if I set A to 6</p>



<p class="wp-block-paragraph">then I print P a dereference of P this is not like a full pointers tutorial</p>



<p class="wp-block-paragraph">but basically by changing a I&#8217;m changing what P thinks it sees as a value</p>



<p class="wp-block-paragraph">assuming ID reference it I could also let me do a print 6 here I could also</p>



<p class="wp-block-paragraph">just change the value through P I could say dereference P and I could say equals</p>



<p class="wp-block-paragraph">would actually print a seven right so you know you can have regular variables global variables</p>



<p class="wp-block-paragraph">whatever kind of you know memory stuff on the stack and to get a pointer to it you really just</p>



<p class="wp-block-paragraph">need to get its memory location in c++ it&#8217;s kind of easy syntactically you can see what&#8217;s happening</p>



<p class="wp-block-paragraph">in assembly you really just need the memory location stored somewhere you could store that</p>



<p class="wp-block-paragraph">variable that just simply stored the memory location of some other variable.</p>



<p class="wp-block-paragraph">You could have a 64-bit register store the value of a variable.</p>



<p class="wp-block-paragraph">Let&#8217;s say we have like a, I don&#8217;t know, my whatever, my number let&#8217;s say inside of assembly.</p>



<p class="wp-block-paragraph">I&#8217;ll do ASM here and we say it&#8217;s a quad word and it starts off as this number or whatever.</p>



<p class="wp-block-paragraph">So if you haven&#8217;t seen my previous videos, go see them for the basics of assembly and</p>



<p class="wp-block-paragraph">of assembly and linking and make files and all that stuff but you know if you</p>



<p class="wp-block-paragraph">have an assembly program and you have a data section and you define a global</p>



<p class="wp-block-paragraph">variable like this what you&#8217;re basically saying is I want to take this giant</p>



<p class="wp-block-paragraph">number and I want to write it into eight bytes that&#8217;s the DQ it says data quad</p>



<p class="wp-block-paragraph">word I want to write that giant number across eight bytes and then I want to</p>



<p class="wp-block-paragraph">get a pointer to it stored in the my number symbol so my number is not</p>



<p class="wp-block-paragraph">actually the value it&#8217;s a pointer to the value so you know later if you want to</p>



<p class="wp-block-paragraph">you know later if you want to move you know something into a register if you did this</p>



<p class="wp-block-paragraph">that would move the pointer into rax but if you did this</p>



<p class="wp-block-paragraph">with deref symbols after it or around it then you would move</p>



<p class="wp-block-paragraph">maybe i&#8217;ll put that into rex you&#8217;d move that actual number that we specified into rex</p>



<p class="wp-block-paragraph">into Rx. It&#8217;s important to understand also that pointers are integers even when we&#8217;re pointing to</p>



<p class="wp-block-paragraph">doubles. So for example sometimes people make this mistake they&#8217;ll say you know my double</p>



<p class="wp-block-paragraph">and they&#8217;ll say it&#8217;s a quad word meaning this is going to be a 64-bit double precision floating</p>



<p class="wp-block-paragraph">point number and they&#8217;ll do like 44.55 or whatever. So that is a double and it is in memory</p>



<p class="wp-block-paragraph">you know what is the symbol of my double remember it&#8217;s supposed to be just a</p>



<p class="wp-block-paragraph">pointer right it can&#8217;t be an actual double because a memory location is not</p>



<p class="wp-block-paragraph">a double a memory location is an integer so that means if you wanted to move a</p>



<p class="wp-block-paragraph">pointer into a register you would only be able to move the pointer into a</p>



<p class="wp-block-paragraph">regular general purpose register not a floating point register and you should</p>



<p class="wp-block-paragraph">use the regular movement instructions for just regular general purpose</p>



<p class="wp-block-paragraph">So keep that in mind if you see a signature like this like let&#8217;s say function F and we have</p>



<p class="wp-block-paragraph">You know, let&#8217;s say long a and long B and actually let&#8217;s do pointers</p>



<p class="wp-block-paragraph">Let&#8217;s say long pointer a and long pointer</p>



<p class="wp-block-paragraph">B and double pointer C all three of those arguments are actually 64 bit integers</p>



<p class="wp-block-paragraph">Because they&#8217;re all pointers even if one of the pointers points to adult a double</p>



<p class="wp-block-paragraph">double why did I say dull pointers aren&#8217;t dull they&#8217;re exciting okay so I&#8217;m gonna open up some</p>



<p class="wp-block-paragraph">code here real fast so usually I don&#8217;t explain my uh my driver I&#8217;m gonna explain it to you this time</p>



<p class="wp-block-paragraph">because it&#8217;s kind of doing a little bit more than my other videos um again if you don&#8217;t have uh the</p>



<p class="wp-block-paragraph">knowledge of how to make a make file see my other videos because that&#8217;s explained there for now I&#8217;m</p>



<p class="wp-block-paragraph">what we really need to do is write a driver and an assembly module for a</p>



<p class="wp-block-paragraph">hybrid program again hybrid programs covered in other videos so the driver is</p>



<p class="wp-block-paragraph">pretty easy I&#8217;m just going to copy paste it honestly here and then just kind of</p>



<p class="wp-block-paragraph">explain it to you the driver is pretty easy we&#8217;re going to do I O stream so we</p>



<p class="wp-block-paragraph">can print stuff we&#8217;re going to mark an external function called point as extern</p>



<p class="wp-block-paragraph">C so that just disables name mangling which means the C++ module will be able</p>



<p class="wp-block-paragraph">will be able to call on this function called point and it won&#8217;t expect that</p>



<p class="wp-block-paragraph">the point function has its name mangled like C++ does the reason being is that</p>



<p class="wp-block-paragraph">point is actually going to be in a side it&#8217;s going to be inside assembly where</p>



<p class="wp-block-paragraph">its name will not be mangled this disables the ability to overload but</p>



<p class="wp-block-paragraph">that&#8217;s okay we don&#8217;t care it&#8217;s going to take two pointers a pointer to a character</p>



<p class="wp-block-paragraph">and a pointer to a long since both of those are pointers they&#8217;re both</p>



<p class="wp-block-paragraph">64-bit integers even the character pointer and then we have a function that is internal to this</p>



<p class="wp-block-paragraph">module called hey driver print this remember we&#8217;re inside of the driver program right now</p>



<p class="wp-block-paragraph">so if you look at the bottom it&#8217;s just a function that takes in some pointers</p>



<p class="wp-block-paragraph">and then prints some stuff so it&#8217;s going to print like it&#8217;s going to print what the string is</p>



<p class="wp-block-paragraph">it&#8217;s going to print what the long is my dog&#8217;s growling at me i&#8217;m going to ignore him because</p>



<p class="wp-block-paragraph">i literally just let him pee and poop at this point now he&#8217;s harassing me for treats</p>



<p class="wp-block-paragraph">now he&#8217;s harassing me for treats he always does this okay so uh the string the long the double</p>



<p class="wp-block-paragraph">this function expects to receive three pointers to different data types it&#8217;s just going to print</p>



<p class="wp-block-paragraph">all of them and the point get it the point of this function is we&#8217;re going to go inside of</p>



<p class="wp-block-paragraph">the assembly module and then have the assembly module call on this function so that we can we</p>



<p class="wp-block-paragraph">can prove that we can have stuff sent from assembly to c plus plus or c using pointers</p>



<p class="wp-block-paragraph">using pointers we can have data sent over so anyway that&#8217;s why both of these</p>



<p class="wp-block-paragraph">are in here the point needs to be marked as no name mangling because point is</p>



<p class="wp-block-paragraph">inside of assembly which will not name mangle and then hey driver print this</p>



<p class="wp-block-paragraph">that needs to have name mangling disabled also so that the assembly</p>



<p class="wp-block-paragraph">module can call on this other than that we&#8217;re just basically inside of a main</p>



<p class="wp-block-paragraph">saying hey this is the c string we&#8217;re making a c string inside of the main function notice how</p>



<p class="wp-block-paragraph">this is a local variable so that c string is going to show up on the stack it&#8217;s going to show up in</p>



<p class="wp-block-paragraph">the area that is owned by main for main stack area same thing for my long that&#8217;s a local variable on</p>



<p class="wp-block-paragraph">the stack um and but then we can actually send pointers to those pieces of data to another</p>



<p class="wp-block-paragraph">function in another module you don&#8217;t have to only transport globals or stuff on the heap</p>



<p class="wp-block-paragraph">or stuff on the heap, you can transport pointers to local variables. Just make sure that by the</p>



<p class="wp-block-paragraph">time this function finishes, then nowhere else is actually using that data because,</p>



<p class="wp-block-paragraph">well, being on the stack, once main function or once any function finishes, then its portion of</p>



<p class="wp-block-paragraph">the stack will be cleaned up and removed and it&#8217;ll be junk data. You&#8217;ll probably get a seg fault.</p>



<p class="wp-block-paragraph">But for now, we&#8217;re not going to use anything on the stack. We&#8217;re not going to use these local</p>



<p class="wp-block-paragraph">just going to use them quickly on this call to point and then we&#8217;re going to return to the</p>



<p class="wp-block-paragraph">operating system and finish the program. So that&#8217;s the driver. Now the hard part. Let&#8217;s do this in</p>



<p class="wp-block-paragraph">assembly. So for starters, I&#8217;m going to make a data section and just explain it to you very,</p>



<p class="wp-block-paragraph">very quickly. Again, if you don&#8217;t understand the basics of YASM x86-64 assembly, did I mention</p>



<p class="wp-block-paragraph">that that&#8217;s what this language is at the beginning of the video? I guess I should put that in the</p>



<p class="wp-block-paragraph">put that in the description or record an announcement that I can tack on at the beginning</p>



<p class="wp-block-paragraph">or something. Anyway, so if you don&#8217;t understand how to do this, see my other videos, but basically</p>



<p class="wp-block-paragraph">we&#8217;re going to make a data section. We&#8217;re going to define some strings. Here&#8217;s like an announcement.</p>



<p class="wp-block-paragraph">Oh, we&#8217;re inside of, you know, the module now, the assembly module. And now we&#8217;re going to print</p>



<p class="wp-block-paragraph">the received string. And then we&#8217;re going to make a string that is owned by assembly, which we can</p>



<p class="wp-block-paragraph">into C++ when we call the function inside of the driver.</p>



<p class="wp-block-paragraph">So this string is owned by the assembly module.</p>



<p class="wp-block-paragraph">Notice how these are null terminated strings.</p>



<p class="wp-block-paragraph">I just have like a comma zero there,</p>



<p class="wp-block-paragraph">which means I have some extra functions</p>



<p class="wp-block-paragraph">I&#8217;m gonna paste in that we&#8217;re not really gonna talk about</p>



<p class="wp-block-paragraph">because they&#8217;ve been discussed in other videos</p>



<p class="wp-block-paragraph">just so that we can print null terminated strings.</p>



<p class="wp-block-paragraph">Then I&#8217;ve got a new line here,</p>



<p class="wp-block-paragraph">you know, carriage return line feed.</p>



<p class="wp-block-paragraph">And then I&#8217;ve just got some numbers</p>



<p class="wp-block-paragraph">that are owned by the assembly module.</p>



<p class="wp-block-paragraph">Then I&#8217;ve got a system write call,</p>



<p class="wp-block-paragraph">call code one for the system call writes and file descriptor standard output so I</p>



<p class="wp-block-paragraph">can print just to the terminal again if you don&#8217;t understand this see my other</p>



<p class="wp-block-paragraph">videos so now let&#8217;s start the actual text section so this is where our</p>



<p class="wp-block-paragraph">instructions start so we got the text section here and we&#8217;re going to use some</p>



<p class="wp-block-paragraph">external symbols don&#8217;t worry about these I&#8217;m just using my own little library to</p>



<p class="wp-block-paragraph">and input integers if you have access to this library use it if you don&#8217;t if you&#8217;re watching</p>



<p class="wp-block-paragraph">at home and you don&#8217;t have this library then that&#8217;s fine you can use you know printf or</p>



<p class="wp-block-paragraph">scanf or something like that to get and print floats from and to the user</p>



<p class="wp-block-paragraph">but yeah I&#8217;m just using that and then I&#8217;m marking an external function here called hey driver print</p>



<p class="wp-block-paragraph">this if you recall the driver module has a function called hey driver print this so</p>



<p class="wp-block-paragraph">just allows my assembly code to call on that external function. Okay now next</p>



<p class="wp-block-paragraph">piece of code. This is going to be… actually I&#8217;m going to paste the print</p>



<p class="wp-block-paragraph">null terminated string function and related code because it&#8217;s just like a</p>



<p class="wp-block-paragraph">big giant mess and we&#8217;re mostly going to ignore it. So just to show you what I&#8217;m</p>



<p class="wp-block-paragraph">doing here I have a function called print null terminated string so that I</p>



<p class="wp-block-paragraph">can print these strings up here and then I have it rely on a function called</p>



<p class="wp-block-paragraph">string length that I have implemented up here and all it does is just</p>
<p>The post <a href="https://www.NeuralLantern.com/x86-64-assembly-floating-point-registers-basics-with-yasm-movsd-mulsd-cvtsi2sd/">x86-64 Assembly: Floating Point Registers Basics with YASM (MOVSD, MULSD, CVTSI2SD)</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-floating-point-registers-basics-with-yasm-movsd-mulsd-cvtsi2sd/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
