Article View: comp.sys.amiga.tech
Article #351Assembler Help
From: Bruce_Eric_Bowers
Date: Tue, 04 Jul 1989 20:16
Date: Tue, 04 Jul 1989 20:16
61 lines
3165 bytes
3165 bytes
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. Note that the library is opened successfully, as I can open and
play with windows. I've stepped through this code with the MetaScope
debugger. What happens is that the code executes as it should, and calls
CloseLibrary. However, the call to CloseLibrary does NOT return to the next
instruction; it sometimes returns several words back up into the program,
and sometimes returns to an address which is not even in my load module.
Either of these events causes a Guru.
I realize I could bypass this whole problem by simply not closing the
library, but I'd prefer to find out why the close is acting so oddly. What
mistake am I making? I may be blind to my own mistakes, but I think the
code should work as written. Any chance an old Amiga.lib could cause this
kind of problem? My CloseLibrary is resolving to -$19E(A6). By the way, this
is executing under 1.3, on a 2500, if that makes any difference. Any help
or advice would be appreciated!
---------------------------------------------------------------------------
* 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
* 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
Technical Details
Message-ID:
<20123@cup.portal.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!sol.ctr.columbia.edu!ginosko!uunet!portal!cup.portal.com!Bruce_Eric_BowersShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!sol.ctr.columbia.edu!ginosko!uunet!portal!cup.portal.com!Bruce_Eric_Bowers From: Bruce_Eric_Bowers@cup.portal.com Newsgroups: comp.sys.amiga.tech Subject: Assembler Help Message-ID: <20123@cup.portal.com> Date: 4 Jul 89 20:16:50 GMT Organization: The Portal System (TM) Lines: 61