home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / useful / dev / c / rkrm / printer / epsonx / init.asm < prev    next >
Assembly Source File  |  1992-09-03  |  5KB  |  169 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            _Close
  57.         XDEF            _PD
  58.         XDEF            _PED
  59.         XDEF            _SysBase
  60.         XDEF            _DOSBase
  61.         XDEF            _GfxBase
  62.         XDEF            _IntuitionBase
  63.  
  64.  
  65. **********************************************************************
  66.         SECTION         printer,DATA
  67. _PD             DC.L    0
  68. _PED            DC.L    0
  69. _SysBase        DC.L    0
  70. _DOSBase        DC.L    0
  71. _GfxBase        DC.L    0
  72. _IntuitionBase  DC.L    0
  73.  
  74.  
  75. **********************************************************************
  76.         SECTION         printer,CODE
  77. _Init:
  78.                 MOVE.L  4(A7),_PD
  79.                 LEA     _PEDData(PC),A0
  80.                 MOVE.L  A0,_PED
  81.                 MOVE.L  A6,-(A7)
  82.                 MOVE.L  _AbsExecBase,A6
  83.                 MOVE.L  A6,_SysBase
  84.  
  85. *           ;------ open the dos library
  86.                 LEA     DLName(PC),A1
  87.                 MOVEQ   #0,D0
  88.                 CALLEXE OpenLibrary
  89.                 MOVE.L  D0,_DOSBase
  90.                 BEQ     initDLErr
  91.  
  92.  
  93. *           ;------ open the graphics library
  94.                 LEA     GLName(PC),A1
  95.                 MOVEQ   #0,D0
  96.                 CALLEXE OpenLibrary
  97.                 MOVE.L  D0,_GfxBase
  98.                 BEQ     initGLErr
  99.  
  100. *           ;------ open the intuition library
  101.                 LEA     ILName(PC),A1
  102.                 MOVEQ   #0,D0
  103.                 CALLEXE OpenLibrary
  104.                 MOVE.L  D0,_IntuitionBase
  105.                 BEQ     initILErr
  106.  
  107.                 MOVEQ   #0,D0
  108. pdiRts:
  109.                 MOVE.L  (A7)+,A6
  110.                 RTS
  111.  
  112. initPAErr:
  113.                 MOVE.L  _IntuitionBase,A1
  114.                 LINKEXE CloseLibrary
  115.  
  116. initILErr:
  117.                 MOVE.L  _GfxBase,A1
  118.                 LINKEXE CloseLibrary
  119.  
  120. initGLErr:
  121.                 MOVE.L  _DOSBase,A1
  122.                 LINKEXE CloseLibrary
  123.  
  124. initDLErr:
  125.                 MOVEQ   #-1,D0
  126.                 BRA.S   pdiRts
  127.  
  128. ILName:
  129.                 DC.B    'intuition.library'
  130.                 DC.B    0
  131. DLName:
  132.                 DC.B    'dos.library'
  133.                 DC.B    0
  134. GLName:
  135.                 DC.B    'graphics.library'
  136.                 DC.B    0
  137.                 DS.W    0
  138.  
  139.  
  140. *---------------------------------------------------------------------
  141. _Expunge:
  142.                 MOVE.L  _IntuitionBase,A1
  143.                 LINKEXE CloseLibrary
  144.  
  145.                 MOVE.L  _GfxBase,A1
  146.                 LINKEXE CloseLibrary
  147.  
  148.                 MOVE.L  _DOSBase,A1
  149.                 LINKEXE CloseLibrary
  150.  
  151.  
  152. *---------------------------------------------------------------------
  153. _Open:
  154.                 MOVEQ   #0,D0
  155.                 RTS
  156.  
  157.  
  158.  
  159. *---------------------------------------------------------------------
  160. _Close:
  161.                 MOVEQ   #0,D0
  162.                 RTS
  163.  
  164.                 END
  165.