home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / dev / rkrm.lha / RKRM / Printer / hp / init.asm < prev    next >
Assembly Source File  |  1992-09-03  |  5KB  |  161 lines

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