d83_sven_a@tekn01.chalmers.se (Sven (Sciz) Axelsson) (08/27/88)
I am trying to write a simple desc acessory using MPW Pascal 2.0.2. It compiled and runned just fine on the Mac II I have at work, so I assumed it would work om my own SE too. Did it? Nah... It bombs in the Open routine with ID=03 (Illegal Instruction). This is what the generated code looks like (from the DRVROpen routine, some stuff deleted): 000036: MOVEA.L $0014(A3),A0 00003A: MOVEA.L (A0),A0 00003C: MOVE.B (A0),D0 00003E: EXT.W D0 000040: EXT.L D0 000042: EXTB.L D0 ; ILLEGAL INSTRUCTION ; FOR THE 68000!! 000044: CLR.L -(A7) 000046: CLR.W -(A7) 000048: MOVE.L A3,-(A7) 00004A: CLR.W -(A7) What is this?? I am definitely not telling the compiler to generate 68020 specific code. I don't in fact specify any compiler flags at all. This is what the source looks like: FUNCTION DRVROpen(ctlPB: ParmBlkPtr; dCtl: DCtlPtr): OSErr; BEGIN dCtl^.dCtlMenu := RsrcID(dCtl, rMENU); IF dCtl^.dCtlStorage = NIL THEN BEGIN dCtl^.dCtlStorage := NewHandle(SizeOf(TMyData)); HLock(dCtl^.dCtlStorage); with TMyData(dCtl^.dCtlStorage^^) do BEGIN myMenu := GetMenu(RsrcID(dCtl, rMENU)); InsertMenu(myMenu, 0); END; HUnLock(dCtl^.dCtlStorage); DrawMenuBar; END; DRVROpen := NOErr; END; Nothing strange with this - or is it? I can patch out the offending instruction with TMON (put in a NOP that is) when it bombs, and then everything works all right. Can anyone tell me what's happening, or is it just an "ordinary" bug? Thanks for any advice on this one. d83_sven_a@tekn01.chalmers.se -- Sven (Sciz) Axelsson