Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!gatech!ncar!ames!oliveb!tymix!antares!jms
From: jms@antares.UUCP (joe smith)
Newsgroups: comp.sys.amiga
Subject: Re: Assembly Blues
Summary: Must set up D0 to OpenLibrary
Keywords: OpenLibrary in assembler
Message-ID: <124@antares.UUCP>
Date: 13 Aug 88 17:55:32 GMT
References: <3295@crash.cts.com>
Reply-To: jms@antares.UUCP (joe smith)
Organization: Tymnet QSATS, San Jose CA
Lines: 33

In article <3295@crash.cts.com> steelie@pro-charlotte.cts.com (Jim Howard) writes:
>        movea.l 4,a6                    ;directly load exec base
>        lea     intname,a1              ;get intuition.library
>        jsr     _LVOOpenLibrary(a6)     ;open it
>        move.l  d0,intbase              ;save pointer 
>        lea     grpname,a1              ;get graphics.library
>        jsr     _LVOOpenLibrary(a6)     ;open it
>        move.l  d0,grpbase              ;save pointer

The OpenLibrary call requires 2 arguments; a pointer to the name of the
library on A0 and the library version number in D0.  If Intuition is
openned OK, then the large positive number left over in D0 is guarenteed
to make the call to open Graphics to fail.

        movea.l 4,a6
        lea     intname,a1
        moveq.l #0,d0                  ;Zero means to accept any version
        jsr     _LVOOpenLibraray(a6)
        move.l  d0,intbase
        beq     Abort_No_Intuition     ;Give up if OpenLibrary failed
        lea     grpname,a1
        moveq.l #0,d0                  ;Zero means to accept any version
        jsr     _LVOOpenLibraray(a6)
        move.l  d0,grpbase
        beq     Abort_No_Graphics      ;Give up if OpenLibrary failed

It is absolutely mandatory to test the result returned by OpenLibrary if
you want to avoid the Guru.
-- 
+-----------------------------------------------------------------------------+
|  TYMNET:   JMS@F29            UUCP: {ames|pyramid}oliveb!tymix!antares!jms  |
|  INTERNET: JMS%F29.Tymnet@Office-1.ARPA   PHONE: Joe Smith @ (408)922-6220  |
+-----------------------------------------------------------------------------+