Tom-H-PIC
Joined: 08 Sep 2003 Posts: 105 Location: New Castle, DE
|
PIC24 Address Exception ASM Help! |
Posted: Sun Jul 29, 2012 6:40 pm |
|
|
Hello All
I need help.
I'm just starting to work with the PIC24.
I have worked with the PIC18 and smaller for the last 10 years.
But the bigger PIC are a whole new animal!
Also I'm not good at ASM at all!
I have learned about exceptions and trapping them but when I get it trapped it does me no good.
I'm working with the PIC24HJ128GP502 and CCS Version 4.135.
This is the data displayed on the debug terminal.
Code: | A.F. 0x24D2
D7FF D D801 D7FC 3 D7FF D700 2A
0 0 0 0 0 0 0 1F96
0xF1C=ED8 0xF20=40 0xF1A=ED8 |
As you can see the problem address is 0x24D2
Here is the list output from that area
Code: |
.............................. int FindFirst (const char * fileName, unsigned int attr, SearchRec * rec)
.............................. {
*
0247E 781F85 MOV W5,[W15++] : Push W5 to TOS
02480 781F86 MOV W6,[W15++] : Push W6 to TOS
02482 781F87 MOV W7,[W15++] : Push W7 to TOS
02484 20FF24 MOV #FF2,W4 : W4 = FF2
02486 888144 MOV W4,1028 : [1028] = W4
.............................. FSFILE f;
.............................. FILEOBJ fo = &f;
.............................. CETYPE result;
.............................. WORD fHandle;
.............................. BYTE j;
.............................. BYTE Index;
..............................
.............................. DEBUG_FS_STR("FindFirst()", 0);
..............................
.............................. FSerrno = CE_GOOD;
02488 EF685A CLR.B 85A : [85A] = 0
..............................
.............................. if( !FormatFileName(fileName, fo->name, 1) )
0248A 2001C0 MOV #1C,W0 : W0 = 1C
0248C B41028 ADD 1028,W0 : W0 = [1028]+W0
0248E 780280 MOV W0,W5 : W5 = W0
02490 B3C010 MOV.B #1,W0L : W0L = 1
02492 B7F037 MOV.B W0L,1037 : [1037] = W0L
02494 F80FEC PUSH FEC : PUSH FEC to TOS
02496 F91038 POP 1038 : POP TOS to [1038]
02498 8881D5 MOV W5,103A : [103A] = W5
0249A 021396 000000 CALL 1396 :
0249E E00400 CP0.B W0L : Status set for W0L - 0
024A0 3A0004 BRA NZ,24AA : if W0L!=0 GoTo 24AA
.............................. {
.............................. FSerrno = CE_INVALID_FILENAME;
024A2 B3C120 MOV.B #12,W0L : W0L = 12
024A4 B7E85A MOV.B W0L,85A : [85A] = W0L
.............................. return -1;
024A6 EFA000 SETM 0 : W0 = FFFF
024A8 37014C BRA 2742 : GoTo 2742
.............................. }
..............................
.............................. DEBUG_FS_STR("FindFirst()", 2);
..............................
.............................. rec->initialized = FALSE;
024AA 2002A0 MOV #2A,W0 : W0 = 2A
024AC B40FF0 ADD FF0,W0 : W0 = FF0+W0
024AE 780280 MOV W0,W5 : W5 = W0
024B0 EB4A80 CLR.B [W5] : [W5] = 0
..............................
.............................. DEBUG_FS_STR2("FindFirst() start_copy", fileName);
.............................. for (Index = 0; (Index < 12) && (fileName[Index] != 0); Index++)
024B2 EF702D CLR.B 102D : [102D] = 0
024B4 808164 MOV 102C,W4 : W4 = [102C]
024B6 DE2248 LSR W4,#8,W4 : W4 = W4 >> 8
024B8 E1246C CP.B W4L,#C : Status set for W4L - C
024BA 310024 BRA C,2504 : if W4L>=C GoTo 2504
024BC 808164 MOV 102C,W4 : W4 = [102C]
024BE DE2248 LSR W4,#8,W4 : W4 = W4 >> 8
024C0 807F63 MOV FEC,W3 : W3 = FEC
024C2 418004 ADD W3,W4,W0 : W0 = W3+W4
024C4 200001 MOV #0,W1 : W1 = 0
024C6 400060 ADD W0,#0,W0 : W0 = 0+W0
024C8 780280 MOV W0,W5 : W5 = W0
024CA A0F005 BSET W5.F : W5.bit = 1
024CC 2000C1 MOV #C,W1 : W1 = C
024CE 780105 MOV W5,W2 : W2 = W5
024D0 090001 REPEAT #1 : Repeat next instruction (1 + 1) times
024D2 7858B2 MOV.B [W2++],[W1++] : [W1++] = [W2++]
024D4 E00006 CP0 W6 : Status set for W6 - 0
024D6 320016 BRA Z,2504 : if W6=0 GoTo 2504
.............................. {
.............................. DEBUG_FS_STR("FindFirst() 2.5", Index);
.............................. rec->searchname[Index] = fileName[Index];
024D8 808164 MOV 102C,W4 : W4 = [102C]
024DA DE2248 LSR W4,#8,W4 : W4 = W4 >> 8
024DC 200183 MOV #18,W3 : W3 = 18
024DE 418004 ADD W3,W4,W0 : W0 = W3+W4
024E0 807F84 MOV FF0,W4 : W4 = FF0
024E2 400284 ADD W0,W4,W5 : W5 = W0+W4
024E4 808164 MOV 102C,W4 : W4 = [102C]
024E6 DE2248 LSR W4,#8,W4 : W4 = W4 >> 8
024E8 807F63 MOV FEC,W3 : W3 = FEC
024EA 418004 ADD W3,W4,W0 : W0 = W3+W4
024EC 200001 MOV #0,W1 : W1 = 0
024EE 400060 ADD W0,#0,W0 : W0 = 0+W0
024F0 780300 MOV W0,W6 : W6 = W0
024F2 A0F006 BSET W6.F : W6.bit = 1
024F4 2000E1 MOV #E,W1 : W1 = E
024F6 780106 MOV W6,W2 : W2 = W6
024F8 090001 REPEAT #1 : Repeat next instruction (1 + 1) times
024FA 7858B2 MOV.B [W2++],[W1++] : [W1++] = [W2++]
024FC 784A87 MOV.B W7L,[W5] : [W5] = W7L
.............................. }
|
Would you guys look at it and give me some idea of what is going on?
Thanks
Tom |
|