Week 4 Day 2 - Embedded ASM and Name Mangling
The main learning point for today is that you can embed assembly inside C++ code with the asm() function in C++, which will copy lines of assembly code directly inside of a C++ function. The only tricky bit is how to connect variables in C++ with specific registers in ARM32 assembly. There is a specific syntax (just look at my examples) that will tie together the registers in ARM32 with variables in C++.
C++ changes the names of its functions behind the scenes to include the parameter list in the name of the function. So if you have a function named foo in C++ you can't just "BL foo" in assembly to call it. (This would work if foo was in C, but not C++.) That's because the actual name will be like _Z9fooi or something like that. C++ does this so you can have two functions with the same name, which is otherwise not allowed. If you want to disable name mangling (and hence lose the ability to overload function names), then you can put your C++ code into an extern "C" scope.
We also reviewed the following:
Loading and Storing to Strings
Caching and the Memory Hierarchy
Int sizes (shorts, longs)
Random numbers (and why C++'s random header is not newbie-friendly)
Other Videos By Bill Kerney
2021-02-11 | Week 4 Day 2 - Fallacies Part 1 |
2021-02-10 | Week 5 Day 2 - Linked List II |
2021-02-10 | Week 5 Day 1 - Dynamic Materials and Water |
2021-02-09 | Week 5 Day 1 - GDB and 2D Arrays with ARM32 |
2021-02-08 | Week 4 Day 1 - Scratch Part 2 |
2021-02-08 | Week 5 Day 1 - Linked Lists |
2021-02-06 | Week 3 Day 3 - Scratch |
2021-02-05 | Week 4 - Tracelines and Bounding Boxes |
2021-02-05 | Week 4 Day 3 - TDD and Linked Lists |
2021-02-04 | Week 4 Day 2 - UE4 Materials |
2021-02-04 | Week 4 Day 2 - Embedded ASM and Name Mangling |
2021-02-04 | CSCI 1 Week 3 Day 2 - Moral Frameworks |
2021-02-03 | Week 4 Day 2 - Big O Notation |
2021-02-02 | Week 4 Day 1 - Landscape and Foliage |
2021-02-02 | Week 4 Day 1 - Strings and Memory Access |
2021-02-02 | CSCI 1 Week 3 Day 1 - Conditionals and Lying |
2021-02-01 | Week 4 Day 1 - The Standard Library & Ranges |
2021-01-29 | Week 3 - Edgelord Detection and review of creating Convex Hulls |
2021-01-29 | Week 3 Lecture 3 - The Rule of 3 |
2021-01-29 | CSCI 1 Week 2 Day 3 - Truth and Circuits |
2021-01-28 | Week 2 Lecture 2 - Lighting and Fog |