You may have noticed that certain math functions are notably "missing" from Magic Cap, e.g. sin(), cos(), etc. That's because Magic Cap has a 68881 FPU emulator built-in that you can take advantage of. This page tells you how to do it.
|
|
|
|
__MC68881__ is defined by the Magic Cap {MagicCOptions} variable in your make file, so you don't have to worry about this one. Now you just have to define _INLINE_FPU_CALLS_. You can do this by either putting a #define at the start of all of your .c files, or by defining it in your make file. The latter option is the easiest, and it applies to all of your .c files, so that's the one we'll use as an example.
##### Default Rules ##### .c.o f .c {C} {DepDir}{Default}.c -o {Targ} {COptions} {ExtraCOptions}Now add "-d _INLINE_FPU_CALLS" to this line along with the options. The resulting make file code should look like this:
##### Default Rules ##### .c.o f .c {C} {DepDir}{Default}.c -o {Targ} -d _INLINE_FPU_CALLS_ {COptions} {ExtraCOptions}Now you should be able to use the standard math functions in the 68881 instruction set. For an example of using this functionality, see the fixed Calculator sample from the "Random Code" folder. The above archive is approximately 40K in size (stuffed and binhexed).