earleh@dartvax.UUCP (Sparafucile) (05/04/87)
The following code example works fine with 128k ROMs in my 512KE, but causes a 64k ROM 512 at work to die. I am calling SFGetFile with the usual parameters, including a file filter which I have written in 68000 assembly language (MDS). The calling language is C, but I have had the same problem when calling SFGetFile from MDS. On the 128k ROM machine, the filter does exactly what I want, in fact I have used this filter for months in various programs with no ill effect. On the 64k ROM machine I get a bomb box with ID #02 indicated every time. Why? This is the only 64k ROM machine I have access to. Is it perhaps broken? All of my globals used in the filter routine are aligned on long boundaries, as are all of my stack frame offsets. "#filtervars" is 240. Just what is going on here? xgetfile (reply) char reply[]; { Point where; SFReply frommac; extern setthebutton(); where.v = 80; where.h = 80; buttonset = 1; SFGetFile (where, 0L, setthebutton, 1, mytypelist, 0L, &frommac); if (frommac.good) { _iovrefnum = frommac.vRefNum; PtoCstr(frommac.fName); strcpy(reply,frommac.fName); return (TRUE); } else return (FALSE); } xdef setthebutton .ALIGN 4 setthebutton: ;This is not a file filter. It is just a procedure to ;change the title of the SFGetFile box's open button. ;Why do I want to do it this way? Simple, I don't want to use ;a special dialog box or template, but I would like the title ;in the open button to reflect the consequences of pressing it. ;Calling sequence is to set the global variable message ;to point to some meaningful Pascal string, such as "View", ;then call SFGetFile with setthebutton as the filterproc. tst.w buttonset(a5) ;do we need to do this? ;buttonset is a word "ds.w 1" elsewhere beq filterdone ;no, done link a6,#filtervars ;yes, get a stack frame pea saveport(a6) ;push saveport address _GetPort ;get a handle to SFGetFile box port push.l saveport(a6) ;push the port push.w #1 ;item #1, the Open button pea thetype(a6) ;address of item type pea itemhandle(a6) ;address of item handle (I want this) pea thebox(a6) ;address of item's rect _GetDItem ;get the item push.l itemhandle(a6) ;push the item handle move.l message(a5),-(sp) ;slip in our message ;message points to a Pascal string _SetCTitle ;set it clr.w buttonset(a5) ;don't need to do it again unlk a6 filterdone: move.w #0,8(sp) ;display OK move.l (sp)+,(sp) ;move return -> parameter rts ;exit