I am an engineering student doing a project on interrupt handlers and have a question on trap instructions for the Coldfire MCF5208 microcontroller. How do they pass parameters to address and data registers? I have code that I am able to understand except for the trap instructions. It looks like the data registers are being used in coordination with the traps somehow. My resources are very limited. The only classbooks that we have are the technical manuals and they mention nothing of trap functionality. I have included a copy of the code if anyone can add any insight. It is an interrupt handler for counting from 0 to 9 with screen display of the digit. Thanks for any help that anyone can offer.
You should reference the ColdFire Family Programmers Reference Manual (http://www.freescale.com/files/dsp/doc/ref_manual/CFPRM.pdf) for more details on the instruction set including the TRAP instruction.
The register contents will be retained after the TRAP exception is taken. Therefore, any values loaded into the data or address registers will be available to the TRAP interrupt handler. It looks like this code is calling the system call routines in the dBUG ROM monitor that is programmed as the bootable image in most ColdFire evaluation boards. The dBUG system calls are as follows:
_dbug_sc_handler: lea -12(sp),sp /* room for used regs */ movem.l d2/a0-a1,(sp) ext.l d0