YASM x86-64 Assembly Functions Tutorial - Integers, Floats, Pointers, ABI, C++ Interoperability

Quick but complete guide to writing proper functions in YASM x86-64 assembly on Linux. See how to pass integers, pointers & floats, return values, follow the ABI, disable C++ name mangling with extern "C", and call back and forth between C++ and assembly in a real working example. Great for people moving from NASM/GAS or trying to mix assembly with higher-level code. 00:00 Introduction and Video Overview 00:28 What Are Functions in Programming 00:56 Why Functions Are Harder in Assembly 01:24 Topics Covered in This Video 01:59 About the Makefile and Prerequisites 02:28 Hybrid C++ and Assembly Program Plan 03:01 Using extern "C" to Disable Name Mangling 04:03 Main Driver Function in C++ 05:00 Adding a Callable C++ Function for Assembly 05:42 Explaining extern "C" Placement 06:16 Assembly File Skeleton and Data Section 06:41 Creating Null-Terminated Strings 07:49 Section .text and External Symbols 08:52 Declaring my_cpp_function as extern 09:20 Defining my_assembly_function 09:40 Labels vs Real Functions 10:31 The call Instruction and Return Address 11:16 Why Jumping Instead of Calling Crashes 11:47 Global Directive for Exporting Functions 12:32 Basic Function Structure 13:20 Implementing my_assembly_function Prologue 14:50 Receiving Arguments in ABI Registers 16:30 Printing Received Integer Arguments 18:10 Handling Pointer Arguments (C Strings) 19:40 Passing Floating-Point Arguments in XMM 21:15 Printing Floats from Assembly 23:00 Calling Back to C++ Function 25:40 Preparing Arguments for my_cpp_function 27:20 Loading XMM0 and XMM1 for Floats 29:10 Making the Call to C++ Function 30:50 Receiving Double Return Value in XMM0 32:30 Saving Returned Float to Memory 34:10 Printing the Returned Value 36:00 Final Messages and Program Flow 38:20 Fixing String Pointer Crash Issue 40:00 Correcting Argument Loading 42:10 Passing String Owned by Assembly 44:00 Observing Successful Output 45:47 Saving and Restoring XMM0 Safely 47:14 Printing Final Returned Float 48:32 Importance of Following the ABI 50:29 Summary of Covered Topics 51:03 Closing Remarks and Call to Subscribe =-=-=-=-=-=-=-=-= Thanks for watching! Find us on other social media here: https://www.NeuralLantern.com/social Twitter / X: https://x.com/NeuralLantern Rumble: https://rumble.com/c/c-3696939 BitChute: https://www.bitchute.com/channel/pg1P... Daily Motion: https://www.dailymotion.com/neurallan... Minds: https://www.minds.com/neurallantern/ Odysee: https://odysee.com/@NeuralLantern:5 Please show your support! Buy me a coffee: https://ko-fi.com/neurallantern Subscribe + Sharing on Social Media Leave a comment or suggestion Subscribe to the Blog: https://www.NeuralLantern.com Watch the main "pinned" video of this channel for offers and extras