Hi,
The routine is quite long, so I cannot place it here. But registers d0-d2/a0-a1 are stored in the interrupt routines only, no other function stores them.
"The compilers actually get this right, so if registers get clobbered, it may be due to assembly code which breaks the rules."
Thanks for advice. When it comes to assembler I will have to investigate all the subroutines which could be called from interrupt. There should be no assembler at all but I might have overlooked something.
I have found one C function which uses registers otside scratch registers without storing them and restoring at the end. Registers are not used before/after calling of the function - so no parameters are passed to/from them. The assembler code looks a bit strange, there is a jump somewhere before these instructions and I have no idea what it means.
; 307: void FilterLength( const unsigned char typ, int* lA, int* lB )
; 308: {
0x00000000 0x4E560000 link a6,#0
; 310: switch ( typ )
; 311: {
; 312: case IIR_FILTER_ACCELERATION_p0063:
; 313: {
0x00000004 0x7400 moveq #0,d2
0x00000006 0x142E0008 move.b 8(a6),d2
0x0000000A 0x7204 moveq #4,d1
0x0000000C 0xB481 cmp.l d1,d2
0x0000000E 0x6E62 bgt.s *+100 ; 0x00000072
0x00000010 0x7000 moveq #0,d0
0x00000012 0xB480 cmp.l d0,d2
0x00000014 0x6D5C blt.s *+94 ; 0x00000072
0x00000016 0x343B2A08 move.w (8,pc,d2.l*2),d2
0x0000001A 0x48C2 ext.l d2
0x0000001C 0x4EFB2A00 jmp (pc,d2.l*2)
0x00000020 0x0006000D ori.b #0xd,d6 ; '.'
0x00000024 0x0014001B ori.b #0x1b,(a4) ; '.'
0x00000028 0x0022206E ori.b #0x6e,-(a2) ; 'n'
; 314: *lA = IIR_FILTER_ACCELRATION_LENp0063;
0x0000002C 0x000A2081 ori.b #0x81,a2 ; '.'
; 315: *lB = IIR_FILTER_ACCELRATION_LENp0063;
0x00000030 0x206E0010 movea.l 16(a6),a0
0x00000034 0x2081 move.l d1,(a0)
; 316: break;
; 317: }
; 318: case IIR_FILTER_ACCELERATION_p0125:
; 319: {
0x00000036 0x6046 bra.s *+72 ; 0x0000007e
; 320: *lA = IIR_FILTER_ACCELRATION_LENp0125;
0x00000038 0x206E000A movea.l 10(a6),a0
0x0000003C 0x2081 move.l d1,(a0)
; 321: *lB = IIR_FILTER_ACCELRATION_LENp0125;
0x0000003E 0x206E0010 movea.l 16(a6),a0
0x00000042 0x2081 move.l d1,(a0)
; 322: break;
; 323: }
; 324: case IIR_FILTER_ACCELERATION_p025:
; 325: {
0x00000044 0x6038 bra.s *+58 ; 0x0000007e
; 326: *lA = IIR_FILTER_ACCELRATION_LENp025;
0x00000046 0x206E000A movea.l 10(a6),a0
0x0000004A 0x2081 move.l d1,(a0)
; 327: *lB = IIR_FILTER_ACCELRATION_LENp025;
0x0000004C 0x206E0010 movea.l 16(a6),a0
0x00000050 0x2081 move.l d1,(a0)
; 328: break;
; 329: }
; 331: case IIR_FILTER_ACCELERATION_p05:
; 332: {
0x00000052 0x602A bra.s *+44 ; 0x0000007e
; 333: *lA = IIR_FILTER_ACCELRATION_LENp05;
0x00000054 0x206E000A movea.l 10(a6),a0
0x00000058 0x2081 move.l d1,(a0)
; 334: *lB = IIR_FILTER_ACCELRATION_LENp05;
0x0000005A 0x206E0010 movea.l 16(a6),a0
0x0000005E 0x2081 move.l d1,(a0)
; 335: break;
; 336: }
; 337: case IIR_FILTER_ACCELERATION_p1HI:
; 338: {
0x00000060 0x601C bra.s *+30 ; 0x0000007e
; 339: *lA = IIR_FILTER_ACCELRATION_LENp1HI;
0x00000062 0x206E000A movea.l 10(a6),a0
0x00000066 0x7007 moveq #7,d0
0x00000068 0x2080 move.l d0,(a0)
; 340: *lB = IIR_FILTER_ACCELRATION_LENp1HI;
; 341: break;
; 342: }
; 343: default:
; 344: {
0x0000006A 0x206E0010 movea.l 16(a6),a0
0x0000006E 0x2080 move.l d0,(a0)
; 350: }
0x00000070 0x600C bra.s *+14 ; 0x0000007e
; 345: *lA = 0;
0x00000072 0x206E000A movea.l 10(a6),a0
0x00000076 0x4290 clr.l (a0)
; 346: *lB = 0;
; 347: return;
; 348: }
; 349: }
0x00000078 0x206E0010 movea.l 16(a6),a0
0x0000007C 0x4290 clr.l (a0)
; 350: }
0x0000007E 0x4E5E unlk a6
0x00000080 0x4E75 rts