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