PPT Slide
Notes:
Comparing coding techniques, if in C code we wanted to do a product, we can do Y is equal to A times B, and that’s what the C code looks like.
C code using intrinsics is different in syntax. We write this as Y equals underscore MPY, so the MPY instruction we saw before, is the assembly instruction to do the multiple. The underscore MPY is making this an intrinsic so it can be used from C but still use the assembly multiply. Also, the intrinsic is being called on A and B, so still in the C environment and using variables instead of registers. However, we are now getting the power of the assembly language statement.
For in-line assembly, within C code, simply write ASM and then bracket, quote, MPY A0 A1 A2, close quote, close bracket, semicolon. In-line assembly is ignored by the compiler. It disrupts the C environment. The compiler ignores it and will move code around it, which is not always desirable.
Using C code with intrinsics allows us to remain in the C environment, yet get the power of using almost an in-line assembly call.