home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 377b.lha / devices / printer / hp / init.asm < prev    next >
Encoding:
Assembly Source File  |  1980-02-03  |  3.3 KB  |  151 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        _PD
  51.     XDEF        _PED
  52.     XDEF        _SysBase
  53.     XDEF        _DOSBase
  54.     XDEF        _GfxBase
  55.     XDEF        _IntuitionBase
  56.  
  57.  
  58. **********************************************************************
  59.     SECTION        printer,DATA
  60. _PD        DC.L    0
  61. _PED        DC.L    0
  62. _SysBase    DC.L    0
  63. _DOSBase    DC.L    0
  64. _GfxBase    DC.L    0
  65. _IntuitionBase    DC.L    0
  66.  
  67.  
  68. **********************************************************************
  69.     SECTION        printer,CODE
  70. _Init:
  71.         MOVE.L    4(A7),_PD
  72.         LEA    _PEDData(PC),A0
  73.         MOVE.L    A0,_PED
  74.         MOVE.L    A6,-(A7)
  75.         MOVE.L    _AbsExecBase,A6
  76.         MOVE.L    A6,_SysBase
  77.  
  78. *        ;------ open the dos library
  79.         LEA    DLName(PC),A1
  80.         MOVEQ    #0,D0
  81.         CALLEXE OpenLibrary
  82.         MOVE.L    D0,_DOSBase
  83.         BEQ    initDLErr
  84.  
  85.  
  86. *        ;------ open the graphics library
  87.         LEA    GLName(PC),A1
  88.         MOVEQ    #0,D0
  89.         CALLEXE OpenLibrary
  90.         MOVE.L    D0,_GfxBase
  91.         BEQ    initGLErr
  92.  
  93. *        ;------ open the intuition library
  94.         LEA    ILName(PC),A1
  95.         MOVEQ    #0,D0
  96.         CALLEXE OpenLibrary
  97.         MOVE.L    D0,_IntuitionBase
  98.         BEQ    initILErr
  99.  
  100.         MOVEQ    #0,D0
  101. pdiRts:
  102.         MOVE.L    (A7)+,A6
  103.         RTS
  104.  
  105. initPAErr:
  106.         MOVE.L    _IntuitionBase,A1
  107.         LINKEXE    CloseLibrary
  108.  
  109. initILErr:
  110.         MOVE.L    _GfxBase,A1
  111.         LINKEXE    CloseLibrary
  112.  
  113. initGLErr:
  114.         MOVE.L    _DOSBase,A1
  115.         LINKEXE    CloseLibrary
  116.  
  117. initDLErr:
  118.         MOVEQ    #-1,D0
  119.         BRA.S    pdiRts
  120.  
  121. ILName:
  122.         DC.B    'intuition.library'
  123.         DC.B    0
  124. DLName:
  125.         DC.B    'dos.library'
  126.         DC.B    0
  127. GLName:
  128.         DC.B    'graphics.library'
  129.         DC.B    0
  130.         DS.W    0
  131.  
  132.  
  133. *---------------------------------------------------------------------
  134. _Expunge:
  135.         MOVE.L    _IntuitionBase,A1
  136.         LINKEXE    CloseLibrary
  137.  
  138.         MOVE.L    _GfxBase,A1
  139.         LINKEXE    CloseLibrary
  140.  
  141.         MOVE.L    _DOSBase,A1
  142.         LINKEXE    CloseLibrary
  143.  
  144.  
  145. *---------------------------------------------------------------------
  146. _Open:
  147.         MOVEQ    #0,D0
  148.         RTS
  149.  
  150.         END
  151.