Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!usc!hacgate!gryphon!pnet02!rickf From: rickf@pnet02.cts.com (Rick Flower) Newsgroups: comp.sys.amiga.tech Subject: Re: Assembler Help Message-ID: <17409@gryphon.COM> Date: 6 Jul 89 01:40:16 GMT Sender: root@gryphon.COM Organization: People-Net [pnet02], Redondo Beach, CA. Lines: 64 Bruce_Eric_Bowers@cup.portal.com writes: >For the first time, I'm writing an entire program in assembly language. I've >written a number of assembler subroutines before, but this is the first >time I've written all the startup and interface code in assembler. I'm >having a small problem cleaning up. What am I doing wrong? > >I'm including below a small assembly program which simply opens, then closes, >the intuition library the same way I do it in my program. This small program >exhibits the same problem as my program: it gurus when closing the intuition >library... > >--------------------------------------------------------------------------- >* External References > > XREF _AbsExecBase > XREF _LVOOpenLibrary > XREF _LVOCloseLibrary > >* Processing Begins > >Test MOVE.L A6,-(SP) ;Store A6 On The Stack > >* Open the Intuition Library > > MOVEA.L _AbsExecBase,A6 ;Load A6 With Address Of LVO Table > LEA IntuitLibName(PC),A1 ;Set A1 To Point To Library Name > CLR.L D0 ;Set Library Version to "Any" > JSR _LVOOpenLibrary(A6) ;Open The Intuition Library > MOVEA.L D0,A6 ;Move Library Address to A6 > BEQ Exit ;If Addr Was 0, OpenLibrary Failed > >* Close The Intuition Library > > MOVEA.L _AbsExecBase,A6 ;Load A6 With Address Of LVO Table > LEA IntuitLibName(PC),A1 ;Set A1 To Point To Library Name > JSR _LVOCloseLibrary(A6) ;Close The Intuition Library > Well, it looks like the above code that you've got to close your Intuition library is the suspect! In order to close a library, you need to pass a pointer to the CloseLibrary function that was originally given to you by the OpenLibrary function, NOT a library name.. >* Restore Registers And Exit > >Exit MOVE.L (SP)+,A6 ;Restore A6 From Stack > RTS > >IntuitLibName DC.B 'intuition.library' > DC.B 0 > > END >--------------------------------------------------------------------------- >Thanks! Bruce Bowers No Problem! +-----------------------------------------------------------------------------+ | Caution, Assembly Language Programmer at Play! | | | | UUCP: {ames!elroy, }!gryphon!pnet02!rickf | | INET: rickf@pnet02.cts.com | +=============================================================================+