Although it can be fun to reinvent the wheel, its often a lopsided wheel you end up with. Hopefully some of these functions can save you time and headache. Its also good to copy and paste from a single source, to reduce bugs and typos. This listing will be added to as we do more useful things. Let us know if you have a better method for any of the functions below.
A complete file of these functions is here: useful_functions.asm
- reading and writing to the codec.
- reading from the sram - 16b
- reading from the sram - 18b
- writing to the sram - 16b
- writing to the sram - 18b
- sampling the switch to change functions - no initialization
- sampling the switch to change functions - with initialization
- initialization routine
- 16b signed x 16b signed to (16b or 32b) signed number
- 16b signed x 8b unsigned to (16b or 24b) signed number
- 16b signed x 16b unsigned to (16b or 32b) signed number
- two's complement of 16b number
- two's complement of 24b number
- adding signed numbers of different lengths