Bryan Burman

Coldfire MCF 5208 trap exceptions

Discussion created by Bryan Burman on Mar 5, 2006
Latest reply on Mar 8, 2006 by Peter Highton
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.

----

jmp main
pit_handle:
link %A6,#0
move.l %D0,-(%A7)
move.l %D1,-(%A7)
move.l %A0,-(%A7)
movea.l #0x40040000,%A0
move.l (%A0),%D1
move.l #0x13,%d0
trap #15
move.l #0x13,%d0
move.l #13,%D1
trap #15
add.l #1,(%A0)
move.l (%A0),%D0
cmpi.l #0x3A,%D0
blt exit
move.l #0x30,(%A0)

exit: move.l -4(%A6),%D0
move.l -8(%A6),%D1
move.l -12(%A6),%A0
unlk %a6
rts

main:
movea.l #0x80003FF0,%A7
movea.l %A7,%A6

movea.l #0x40040000,%A0
move.l #0x30,(%A0)


movea.l #0xFC080000,%A0
move.l #0x0D1F,%D0
move.W %D0,(%A0)
movea.l #0xFC080002,%A0
move.l #0xFFFF,%D0
move.l %D0,(%A0)

move.l #0x40,%D0
move.l #0x44,%D1
lea pit_handle,%A0
move.l %A0,%D2
move.l #0,%D3
move.l #0,%D4
trap #15

move.l #0xFC048044,%A0
move.l #3,%D0
move.b %D0,(%A0)
move.l #0xFC04800C,%A0
move.l (%A0),%D0
andi.l #0xFFFFFFEF,%D0
move.l %D0,(%A0)


loop:
nop
jmp loop

Outcomes