home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 377b.lha / devices / printer / xerox / init.asm < prev    next >
Encoding:
Assembly Source File  |  1980-02-03  |  3.4 KB  |  159 lines

  1. * Copyright (c) 1990 Commodore-Amiga, Inc.
  2. *
  3. * This example is provided in electronic form by Commodore-Amiga, Inc. for
  4. * use with the 1.3 revisions of the Addison-Wesley Amiga reference manuals. 
  5. * The 1.3 Addison-Wesley Amiga Reference Manual series contains additional
  6. * information on the correct usage of the techniques and operating system
  7. * functions presented in this example.  The source and executable code of
  8. * this example may only be distributed in free electronic form, via bulletin
  9. * board or as part of a fully non-commercial and freely redistributable
  10. * diskette.  Both the source and executable code (including comments) must
  11. * be included, without modification, in any copy.  This example may not be
  12. * published in printed form or distributed with any commercial product.
  13. * However, the programming techniques and support routines set forth in
  14. * this example may be used in the development of original executable
  15. * software products for Commodore Amiga computers.
  16. * All other rights reserved.
  17. * This example is provided "as-is" and is subject to change; no warranties
  18. * are made.  All use is at your own risk.  No liability or responsibility
  19. * is assumed.
  20. *
  21.  
  22.     SECTION        printer
  23.  
  24. *------ Included Files -----------------------------------------------
  25.  
  26.     INCLUDE        "exec/types.i"
  27.     INCLUDE        "exec/nodes.i"
  28.     INCLUDE        "exec/lists.i"
  29.     INCLUDE        "exec/memory.i"
  30.     INCLUDE        "exec/ports.i"
  31.     INCLUDE        "exec/libraries.i"
  32.  
  33.     INCLUDE        "macros.i"
  34.  
  35. *------ Imported Functions -------------------------------------------
  36.  
  37.     XREF_EXE    CloseLibrary
  38.     XREF_EXE    OpenLibrary
  39.     XREF        _AbsExecBase
  40.  
  41.  
  42.     XREF        _PEDData
  43.  
  44.  
  45. *------ Exported Globals ---------------------------------------------
  46.  
  47.     XDEF        _Init
  48.     XDEF        _Expunge
  49.     XDEF        _Open
  50.     XDEF        _Close
  51.     XDEF        _PD
  52.     XDEF        _PED
  53.     XDEF        _SysBase
  54.     XDEF        _DOSBase
  55.     XDEF        _GfxBase
  56.     XDEF        _IntuitionBase
  57.  
  58.  
  59. **********************************************************************
  60.     SECTION        printer,DATA
  61. _PD        DC.L    0
  62. _PED        DC.L    0
  63. _SysBase    DC.L    0
  64. _DOSBase    DC.L    0
  65. _GfxBase    DC.L    0
  66. _IntuitionBase    DC.L    0
  67.  
  68.  
  69. **********************************************************************
  70.     SECTION        printer,CODE
  71. _Init:
  72.         MOVE.L    4(A7),_PD
  73.         LEA    _PEDData(PC),A0
  74.         MOVE.L    A0,_PED
  75.         MOVE.L    A6,-(A7)
  76.         MOVE.L    _AbsExecBase,A6
  77.         MOVE.L    A6,_SysBase
  78.  
  79. *        ;------ open the dos library
  80.         LEA    DLName(PC),A1
  81.         MOVEQ    #0,D0
  82.         CALLEXE OpenLibrary
  83.         MOVE.L    D0,_DOSBase
  84.         BEQ    initDLErr
  85.  
  86.  
  87. *        ;------ open the graphics library
  88.         LEA    GLName(PC),A1
  89.         MOVEQ    #0,D0
  90.         CALLEXE OpenLibrary
  91.         MOVE.L    D0,_GfxBase
  92.         BEQ    initGLErr
  93.  
  94. *        ;------ open the intuition library
  95.         LEA    ILName(PC),A1
  96.         MOVEQ    #0,D0
  97.         CALLEXE OpenLibrary
  98.         MOVE.L    D0,_IntuitionBase
  99.         BEQ    initILErr
  100.  
  101.         MOVEQ    #0,D0
  102. pdiRts:
  103.         MOVE.L    (A7)+,A6
  104.         RTS
  105.  
  106. initPAErr:
  107.         MOVE.L    _IntuitionBase,A1
  108.         LINKEXE    CloseLibrary
  109.  
  110. initILErr:
  111.         MOVE.L    _GfxBase,A1
  112.         LINKEXE    CloseLibrary
  113.  
  114. initGLErr:
  115.         MOVE.L    _DOSBase,A1
  116.         LINKEXE    CloseLibrary
  117.  
  118. initDLErr:
  119.         MOVEQ    #-1,D0
  120.         BRA.S    pdiRts
  121.  
  122. ILName:
  123.         DC.B    'intuition.library'
  124.         DC.B    0
  125. DLName:
  126.         DC.B    'dos.library'
  127.         DC.B    0
  128. GLName:
  129.         DC.B    'graphics.library'
  130.         DC.B    0
  131.         DS.W    0
  132.  
  133.  
  134. *---------------------------------------------------------------------
  135. _Expunge:
  136.         MOVE.L    _IntuitionBase,A1
  137.         LINKEXE    CloseLibrary
  138.  
  139.         MOVE.L    _GfxBase,A1
  140.         LINKEXE    CloseLibrary
  141.  
  142.         MOVE.L    _DOSBase,A1
  143.         LINKEXE    CloseLibrary
  144.  
  145.  
  146. *---------------------------------------------------------------------
  147. _Open:
  148.         MOVEQ    #0,D0
  149.         RTS
  150.  
  151.  
  152.  
  153. *---------------------------------------------------------------------
  154. _Close:
  155.         MOVEQ    #0,D0
  156.         RTS
  157.  
  158.         END
  159.