Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!bloom-beacon!usc!orion.cf.uci.edu!uci-ics!zardoz!dhw68k!thecloud From: thecloud@dhw68k.cts.com (Ken McLeod) Newsgroups: comp.sys.mac.programmer Subject: Re: HELP with _OpenResFile Message-ID: <23197@dhw68k.cts.com> Date: 25 May 89 08:36:56 GMT References: <863@umecs.cs.umu.se> Reply-To: thecloud@dhw68k.cts.com (Ken McLeod) Organization: Wolfskill & Dowling residence; Anaheim, CA (USA) Lines: 45 In article <863@umecs.cs.umu.se> dvlmfs@zeus.umu.se () writes: >I've got a big problem with an INIT I'm writing so I thought that maybe someone >out on the net could help me with this problem or explain why it doesn't work. >All I'm trying to do is to open my files' resources from the patch >code so I can use the resources that I've made, but this doesn't work >and I dont know why! It's written in LSC 3.0 and looks like this: > > [previous lines of code deleted...] > jmp @exit ;jmp over error >@error > move.w #0x000A,-(sp) ;push 0x000A for _SysBeep > _SysBeep ;trap call >@exit movem.l (sp)+,a0-a1/d0-d3 ;restore registers >@fileName > dc.b 0x0006 ;length byte of Str255 > dc.b 'M','y','F','i','l','e' ;the file name >@patchend > > } /* end asm */ >} /* end main */ Your code, as posted, will get real confused after it reaches the @exit label, and falls through to your data! Hopefully, you actually did this: @exit movem.l (sp)+,a0-a1/d0-d3 ;restore registers bra.s @patchend ;skip following data! @fileName . (inline data here) . @patchend Another potential problem is that you define the length "byte" inline as 0x0006 (word-length), not 0x06 (char-length). This *may* be generating two bytes, 00 and 06. If so, then OpenResFile would think you were passing a zero-length string, and would definitely signal an error. -ken -- ========== ....... ============================================= Ken McLeod :. .: UUCP: ...{spsd,zardoz,felix}!dhw68k!thecloud ========== :::.. ..::: INTERNET: thecloud@dhw68k.cts.com //// =============================================