An 'invalid opcode' simply means that the opcode doesn't fit any of the
pre-defined instructions in the opcode table in the disassembler i.e. it's not
being recognized by the disassembler. This can be, but is not always a Bad
Thing. Depending on which version of CodeWarrior you are using, you may be using
an older version of the disassembler which doesn't recognize a few of the traps
and instructions. Some of these have been fixed in CW Palm 7, others internally.
You may want to disassemble in these two ways:

a) use the linker - while in non-debugging mode, select Disassemble from the
Project menu.
b) use the disassembler - while debugging, in the debugger window, select View
As Assembly or Mixed.

Do a compare of both. If both don't match up, can you send the code to us at
[EMAIL PROTECTED]? This would be a bug and I'd like get this fixed.

-- jkl

----- Original Message -----
From: "S S" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, April 16, 2001 11:51 AM
Subject: What is "Invalid opcode"?


> Hello!
>
> I have this piece of code:
> int myint;
> Handle  h_str;
> CharPtr progn_string;
>
> switch (myint){
> case 1:
> h_str = DmGetResource('tSTR', 1010);
> progn_string = MemHandleLock(h_str);
> /* .......blablabla.......... */
> break;
> case 2:
> h_str = DmGetResource('tSTR', 1020);
> progn_string = MemHandleLock(h_str);
> /* .......blablabla.......... */
> break;
>
> Then I disassembled this code and get:
>
> switch (myint){
> case 1:
> 00000156: 4FEF 0016          lea       22(a7),a7
> 0000015A: 3004               move.w    d4,d0
> 0000015C: 0C40 000C          cmpi.w    #12,d0
> 00000160: 6200 0548          bhi.w     *+1354
> ; 0x000006aa
> 00000164: D040               add.w     d0,d0
> 00000166: 303B 0006          move.w    (6,pc,d0.w),d0
> 0000016A: 4EFB 0002          jmp       (2,pc,d0.w)
> 0000016E: 053C 001A 0088     btst      d2,#1704072
> 00000174: 00F6 0164          dc.w      0x00f6
> ; Invalid opcode
> 00000178: 01D2               bset      d0,(a2)
> 0000017A: 0240 02AE          andi.w    #0x2ae,d0
> 0000017E: 031C               btst      d1,(a4)+
> 00000180: 038A               bclr      d1,a2
> 00000182: 03F8 0466          bset      d1,0x00000466
> h_str = DmGetResource('tSTR', 1010);
> 00000186: 04D2 3F3C          dc.w      0x04d2
> ; Invalid opcode
> 0000018A: 03F2 2F3C 7453     bset
> d1,([1951618130,a2],d2.l*8)
>           5452
> 00000192: 4E4F               trap      #15
> 00000194: A05F               sysTrapDmGetResource
> 00000196: 2448               movea.l   a0,a2
> progn_string = MemHandleLock(h_str);
> 00000198: 2F0A               move.l    a2,-(a7)
> 0000019A: 4E4F               trap      #15
> 0000019C: A021               sysTrapMemHandleLock
>
>
> I wonder, what does "Invalid opcode" mean. My
> application work fine, but I have two "Invalid opcode"
> in "case 1" and I have NO "Invalid opcode" in "case 2"
>
> case 2:
> 000001EE: 4FEF 003A          lea       58(a7),a7
> 000001F2: 6000 04B6          bra.w     *+1208
> ; 0x000006aa
> h_str = DmGetResource('tSTR', 1020);
> 000001F6: 3F3C 03FC          move.w    #1020,-(a7)
> 000001FA: 2F3C 7453 5452     move.l
> #1951618130,-(a7)
> 00000200: 4E4F               trap      #15
> 00000202: A05F               sysTrapDmGetResource
> 00000204: 2448               movea.l   a0,a2
> progn_string = MemHandleLock(h_str);
> 00000206: 2F0A               move.l    a2,-(a7)
> 00000208: 4E4F               trap      #15
> 0000020A: A021               sysTrapMemHandleLock
> 0000020C: 2648               movea.l   a0,a3
>
> Thanks,
> Soj
>
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/tech/support/forums/
>
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to