In this case (pardon the pun), it is not a Bad Thing.  All Soj is 
seeing is the embedded offset table that manages the switch 
statement.  The table from 16E to 188 contains 2-byte entries, which 
are offsets from some location to the start of the various case 
statements.  It's just data, which the disassembler is trying to 
treat as machine code.

-- Keith Rollin

>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"
>>  Thanks,
>  > Soj
-- 

-- Keith Rollin
-- Palm OS Emulator engineer

P.S. Check out the new e-mail address.  [EMAIL PROTECTED] will work 
for a while, but anyone mailing me needs to update to the new one 
eventually.

-- 
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