Charlie Dickman wrote: > FUNCTION PBDTGetIcon(paramBlock: DTPBPtr; asynch: Boolean): OSErr > > The problem I am having is that I get a bus error when I call the function > I have defined (in FBII) as > > LOCAL FN PBDTGetIcon(@DTPBlock&, asynch%) > DIM osErr% > ` > ` SUBQ.L #2,sp ;clear space for osErr > ` MOVE.L ^DTPBlock&,-(sp) ;push DTPBlock ptr on stack > ` MOVE.B ^asynch%,-(SP) ;push BOOLEAN asynch on stack > ` MOVE.L A0,-(sp) ;put A0 onto stack > ` CLR.W (A0) ;make sure result = zero > ` MOVE.W #$0020,D0 ;selector on stack > ` DC.W $A260 ;_HFSDispatch trap > ` MOVE.W (sp)+,^osErr% ;D0 = osErr > END FN = osErr% >From looking at Apple's header files, my impression is that: 1. Nothing should be pushed onto nor pulled off of the stack. This looks like a register-based routine which expects the block pointer to be in A0 and the selector in D0. Finally, it returns the result into D0. 2. You have to call one of two different traps, depending on whether the async parameter is set or not. You should use $A660 if async is true, or $A260 if it's false 3. The selector is #$0023, not #$0020. Try this: LOCAL FN PBDTGetIcon(@DTPBlock&, asynch%) DIM osErr% LONG IF asynch% ` MOVE.L ^DTPBlock&,A0 ` MOVE.W #$0023,D0 ` DC.W $A660 ` MOVE.W D0,^osErr% XELSE ` MOVE.L ^DTPBlock&,A0 ` MOVE.W #$0023,D0 ` DC.W $A260 ` MOVE.W D0,^osErr% END IF END FN = osErr% - Rick