home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d128 / prtdriver.lha / PrtDriver / init.asm < prev    next >
Assembly Source File  |  1988-01-02  |  2KB  |  157 lines

  1. *
  2. * initialization stub for the toshiba printer driver
  3. *
  4.  
  5.     INCLUDE "exec/types.i"
  6.     INCLUDE "exec/nodes.i"
  7.     INCLUDE "exec/lists.i"
  8.     INCLUDE "exec/memory.i"
  9.     INCLUDE "exec/ports.i"
  10.     INCLUDE "exec/libraries.i"
  11.  
  12.     INCLUDE "macros.i"
  13.     INCLUDE "devices/prtbase.i"
  14.  
  15.     XREF_EXE    CloseLibrary
  16.     XREF_EXE    OldOpenLibrary
  17.     XREF_EXE    OpenLibrary
  18.  
  19.     XREF        _AbsExecBase    ;these are in the Aztec Library
  20.     XREF        _SysBase    ;and this
  21.  
  22.     XREF        _PEDData
  23.  
  24.     ifd        DEBUG
  25.     XREF        _dbstart
  26.     XREF        _dbuninit
  27.     XREF        _dbprintf
  28.     XREF        _PWait
  29.     endc
  30.  
  31.     XDEF        _Init
  32.     XDEF        _Expunge
  33.     XDEF        _PrOpen
  34.     XDEF        _PrClose
  35.     XDEF        _PD
  36.     XDEF        _PED
  37.     XDEF        _DOSBase
  38.     XDEF        _GfxBase
  39.     XDEF        _IntuitionBase
  40.  
  41. *------------------------------------------------------
  42.     section    printer,data
  43. _PD        dc.l    0
  44. _PED        dc.l    0
  45. _DosBase    dc.l    0
  46. _GfxBase    dc.l    0
  47. _IntuitionBase    dc.l    0
  48.  
  49. *------------------------------------------------------
  50.     section printer,code
  51. _Init
  52.         move.l    4(sp),_PD
  53.  
  54.         lea    _PEDData(pc),a0
  55.         move.l    a0,_PED
  56.         move.l    a6,-(a7)
  57.         move.l    _AbsExecBase,a6
  58.         move.l    a6,_SysBase
  59.  
  60. * open dos library
  61.  
  62.         lea    DLName,a1
  63.         moveq    #1,d0
  64.         callexe    OpenLibrary
  65.         move.l    d0,_DOSBase
  66.         beq    initDLErr
  67.  
  68. * open gfx libarary
  69.  
  70.         lea    GLName,a1
  71.         moveq    #1,d0
  72.         callexe    OpenLibrary
  73.         move.l    d0,_GfxBase
  74.         beq    initGLErr
  75.  
  76. * open intuition libarary
  77.  
  78.         lea    ILName,a1
  79.         moveq    #1,d0
  80.         callexe    OpenLibrary
  81.         move.l    d0,_IntuitionBase
  82.         beq    initILErr
  83.  
  84.         ifd    DEBUG
  85.         jsr    _dbstart
  86.         endc
  87.  
  88.         moveq    #0,d0
  89. pdiRts:
  90.         move.l    (a7)+,a6
  91.         rts
  92.  
  93. initPAErr:
  94.         move.l    _IntuitionBase,a1
  95.         LINKEXE    CloseLibrary
  96.  
  97. initILErr:
  98.         move.l    _GfxBase,a1
  99.         LINKEXE    CloseLibrary
  100.  
  101. initGLErr:
  102.         move.l    _DOSBase,a1
  103.         LINKEXE    CloseLibrary
  104.  
  105. initDLErr:
  106.         moveq    #-1,d0
  107.         bra.s    pdiRts
  108.  
  109. ILName:        dc.b    "intuition.library",0
  110. DLName:        dc.b    "dos.library",0
  111. GLName:        dc.b    "graphics.library",0
  112. DeathMsg:    dc.b    "I'm being rubbed out!",0
  113.         ds.w    0
  114.  
  115.  
  116.  
  117. *------------------------------------------------------
  118.  
  119. _Expunge:
  120.         move.l    a6,-(sp)
  121.  
  122.         ifd    DEBUG
  123.         pea.l    DeathMsg
  124.         jsr    _dbprintf
  125.         addq.l    #4,sp
  126.         pea    0
  127.         pea    1
  128.         jsr    _PWait
  129.         addq.l    #8,sp
  130.         jsr    _dbuninit
  131.         endc
  132.  
  133.         move.l    _SysBase,a6
  134.  
  135.         move.l    _IntuitionBase,a1
  136.         callexe    CloseLibrary
  137.  
  138.         move.l    _GfxBase,a1
  139.         callexe    CloseLibrary
  140.  
  141.         move.l    _DOSBase,a1
  142.         callexe    CloseLibrary
  143.  
  144.         move.l    (sp)+,a6
  145.         moveq    #0,d0
  146.         rts
  147.  
  148. *------------------------------------------------------
  149. _PrOpen:
  150.         moveq    #0,d0
  151.         rts
  152.  
  153. *------------------------------------------------------
  154. _PrClose:
  155.         moveq    #0,d0
  156.         rts
  157.