Glad to help...

..of course, if this is all your function is doing, then you can simplify
it quite a bit...

1. The MOVEM's are unnecessary, since the only registers you touch is A0,
   which is caller-saved (if I remember right, D0-D2 and A0-A1 are caller
   saved).
2. The LINK is semi-unnecessary (it's nice for the debugger, but not 
   technically required).  In any case, you certainly don't need the "-4",
   since you don't use the space allocated.  LINK A6, #0 would be better.
3. The LEA is unnecessary.  You should be able to just use direct
   addressing:  BCLR #2, 0xFFFFF305


Actually though, I would suggest going with C, which is a heck-of-a-lot
more readable and more portable:

void foo (void)
{
        Char *p = (Char*)(0xFFFFF305);
        
        *p = *p & 0xFB;
}

..which for me compiled to...

Hunk:   Kind=HUNK_GLOBAL_CODE  Name="foo"(2)  Size=26
00000000: 4E56 0000          link      a6,#0
00000004: 1038 F305          move.b    0xfffff305,d0
00000008: 0240 00FB          andi.w    #0xfb,d0
0000000C: 11C0 F305          move.b    d0,0xfffff305
00000010: 4E5E               unlk      a6
00000012: 4E75               rts

..a little inefficient compared to the using BCLR, but it doesn't seem
like speed is all that key for you (what with the MOVEM of all the
registers at the beginning and end of your function).

---

--On Thu, Dec 30, 1999 10:51 AM +0900 Kazushige Matsui <[EMAIL PROTECTED]>
wrote:

> 
> 
> Hi Douglas-san,
> 
> Thanks for the information.
> I could clean up my code on CW5.
> 
> Finally following code could be compiled successfully.
> 
> asm void
> foo ( void )
> {
> 
>      MOVEM.L D0-D7/A0-A7, -(SP)
>      LINK         A6, #-4
>      LEA          0xFFFFF305, A0
>      BCLR    #2, (a0)
>      UNLK       A6
>      MOVEM.L (SP)+, D0-D7/A0-A7
>      RTS
> }
> 
> "Douglas>I think your assembly is a bit buggy (though it's true that
> codewarrior
> "Douglas>doesn't always report the error messages on the right line)
> "Douglas>
> "Douglas>>      link.w    a6, +0x04
> "Douglas>--------------------------
> "Douglas>Problems:
> "Douglas>- The
> "Douglas>.w
> "Douglas>isn't needed (and I think codewarrior doesn't like it)
> "Douglas>- You need a
> "Douglas>before the 0x04
> "Douglas>- You likely want the displacement to be negative, since right
> now you're
> "Douglas>Putting a6 on the stack and immediately popping it off.
> "Douglas>Suggested fix:
> "Douglas>link a6, #-4
> "Douglas>
> "Douglas>>      lea.l     0xfffff305, a0      // Here illegal addressing
> mode error
> "Douglas>----------------------------------------------------------------
> ------- ---
> "Douglas>Problems:
> "Douglas>- The
> "Douglas>.l
> "Douglas>isn't needed
> "Douglas>Suggested fix:
> "Douglas>lea 0xfffff305, a0
> "Douglas>>      bclr 0x0002, a0          // Here    illegal addressing
> mode error
> "Douglas>----------------------------------------------------------------
> ------- -
> "Douglas>Problems:
> "Douglas>- You need a # before the displacement
> "Douglas>- bclr doesn't work on address registers (see the 68K manual)
> "Douglas>Suggested fix:
> "Douglas>bclr 2, d0
> "Douglas>
> "Douglas>
> 
> 
> Thanks, Ciao!
> 
> Kazushige Matsui
> -------------------------------------------------------
> Network Product Development, Application Design, Yasu IBM-Japan
> Tie     :  1617-8374
> TEL    :  077-587-8374
> FAX    :  077-587-8484
> e-mail :  [EMAIL PROTECTED]
> $B!z!z!z!z!!$*CN$i$;!'!!EEOCHV9f!&#F#A#XHV9f!&Fb@~$,$+$o$j$^$7$?!*!!!z!z
> !z!z(B
> 
> 




Reply via email to