home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / util / acmautils.lha / AcmaUtils / Source / WaitAccess.s < prev   
Encoding:
Text File  |  1994-03-05  |  3.8 KB  |  225 lines

  1. ;
  2. ; WaitAccess V1.00   Friday, 18-Feb-1994
  3. ;
  4. ; by Jan Hagqvist
  5. ;
  6.  
  7. ; V0.01  Friday 18-Feb-1994
  8.  
  9.  
  10.   XREF _LVOOpenLibrary
  11.   XREF _LVOCloseLibrary
  12.   XREF _LVOOpenWindow
  13.   XREF _LVOCloseWindow
  14.   XREF _LVOWaitPort
  15.   XREF _LVOGetMsg
  16.   XREF _LVOReplyMsg
  17.   XREF _LVOVPrintf
  18.   XREF _LVOOpen
  19.   XREF _LVOClose
  20.   XREF _LVOMove
  21.   XREF _LVOText
  22.   XREF _LVODelay
  23.  
  24.  
  25. JAM1                equ 0
  26. WBENCHSCREEN            equ 1
  27. IDCMP_CLOSEWINDOW        equ $00000200
  28. WFLG_SMART_REFRESH        equ $00000000
  29. WFLG_DRAGBAR            equ $00000002
  30. WFLG_DEPTHGADGET        equ $00000004
  31. WFLG_CLOSEGADGET        equ $00000008
  32.  
  33.  
  34.  
  35. WaitAccess
  36.   move.l  a0,FileName
  37.   add.l   d0,a0
  38.   clr.b   -1(a0)
  39.  
  40.   move.l  4,a6
  41.   moveq.l #36,d0
  42.   lea     IntuitionName(pc),a1
  43.   jsr     _LVOOpenLibrary(a6)
  44.   move.l  d0,IntuitionBase
  45.   tst.l   d0
  46.   beq     Quit
  47.   moveq.l #0,d0
  48.   lea     GfxName(pc),a1
  49.   jsr     _LVOOpenLibrary(a6)
  50.   move.l  d0,GfxBase
  51.   tst.l   d0
  52.   beq     Quit
  53.   moveq.l #0,d0
  54.   lea     DosName(pc),a1
  55.   jsr     _LVOOpenLibrary(a6)
  56.   move.l  d0,DosBase
  57.   tst.l   d0
  58.   beq     Quit
  59.  
  60.   move.l  FileName(pc),a0
  61.   tst.b   (a0)
  62.   beq     NoFileName
  63.  
  64.   move.l  IntuitionBase(pc),a6
  65.   lea     NewWindow(pc),a0
  66.   jsr     _LVOOpenWindow(a6)
  67.   tst.l   d0
  68.   beq     NoWindow
  69.   move.l  d0,MyWindow
  70.   move.l  d0,a0
  71.   move.l  50(a0),MyRastPort
  72.   move.l  86(a0),MyUserPort
  73.  
  74.   move.l  GfxBase(pc),a6
  75.   move.l  MyRastPort(pc),a1
  76.   moveq.l #10,d0
  77.   moveq.l #18,d1
  78.   jsr     _LVOMove(a6)
  79.   move.l  MyRastPort(pc),a1
  80.   move.l  FileName(pc),a0
  81.   bsr     StrLen
  82.   jsr     _LVOText(a6)
  83.  
  84.   clr.b   QuitFlag
  85. WaitForMessage1
  86.   tst.b   QuitFlag
  87.   bne     Quit
  88.  
  89.   move.l  DosBase(pc),a6
  90.   moveq.l #5,d1
  91.   jsr     _LVODelay(a6)
  92.   bsr     AccessFile
  93.  
  94. WaitForMessage2
  95.   move.l  4,a6
  96.   move.l  MyUserPort(pc),a0
  97.   jsr     _LVOGetMsg(a6)
  98.   tst.l   d0
  99.   beq.s   WaitForMessage1
  100.   move.l  d0,a1
  101.   move.l  20(a1),Class
  102.   jsr     _LVOReplyMsg(a6)
  103. WaitForMessage3
  104.   cmp.l   #IDCMP_CLOSEWINDOW,Class
  105.   bne.s   WaitForMessage4
  106.   bsr     SetQuitFlag
  107. WaitForMessage4
  108. WaitForMessage500
  109.   bra     WaitForMessage2
  110.  
  111.  
  112.  
  113. Quit
  114.   move.l  IntuitionBase(pc),a6
  115.   tst.l   MyWindow
  116.   beq.s   Quit7
  117.   move.l  MyWindow(pc),a0
  118.   jsr     _LVOCloseWindow(a6)
  119. Quit7
  120.   move.l  4,a6
  121.   tst.l   DosBase
  122.   beq.s   Quit3
  123.   move.l  DosBase(pc),a1
  124.   jsr     _LVOCloseLibrary(a6)
  125. Quit3
  126.   tst.l   GfxBase
  127.   beq.s   Quit2
  128.   move.l  GfxBase(pc),a1
  129.   jsr     _LVOCloseLibrary(a6)
  130. Quit2
  131.   tst.l   IntuitionBase
  132.   beq.s   Quit1
  133.   move.l  IntuitionBase(pc),a1
  134.   jsr     _LVOCloseLibrary(a6)
  135. Quit1
  136.   moveq.l #0,d0
  137.   rts                    ; Exit to CLI
  138.  
  139.  
  140.  
  141. SetQuitFlag
  142.   move.b  #1,QuitFlag
  143.   rts
  144.  
  145.  
  146.  
  147. NoWindow
  148.   move.l  #NoWindowMessage,d1
  149.   bsr.s   ShowMessage
  150.   bra     Quit
  151.  
  152. NoFileName
  153.   move.l  #NoFileNameMessage,d1
  154.   bsr.s   ShowMessage
  155.   bra     Quit
  156.  
  157. ShowMessage
  158.   move.l  DosBase(pc),a6
  159.   move.l  #MessageFormat,d2
  160.   jsr     _LVOVPrintf(a6)
  161.   rts
  162.  
  163.  
  164.  
  165. StrLen
  166.   moveq.l #0,d0
  167.   move.l  a0,a2
  168. StrLen2
  169.   tst.b   (a2)+
  170.   beq.s   StrLen3
  171.   addq.l  #1,d0
  172.   bra.s   StrLen2
  173. StrLen3
  174.   rts
  175.  
  176.  
  177.  
  178. AccessFile
  179.   move.l  FileName(pc),d1
  180.   move.w  #1005,d2
  181.   jsr     _LVOOpen(a6)
  182.   tst.l   d0
  183.   bne.s   AccessFile2
  184.   rts
  185. AccessFile2
  186.   move.l  d0,d1
  187.   jsr     _LVOClose(a6)
  188.   bsr     SetQuitFlag
  189.   rts
  190.  
  191.  
  192.  
  193. NewWindow
  194.   dc.w 20,70,600,23
  195.   dc.b 0,1
  196.   dc.l IDCMP_CLOSEWINDOW
  197.   dc.l WFLG_DRAGBAR!WFLG_CLOSEGADGET!WFLG_DEPTHGADGET!WFLG_SMART_REFRESH
  198.   dc.l 0,0,WindowTitle,0,0
  199.   dc.w 600,23,-1,-1,WBENCHSCREEN
  200.  
  201.  
  202. IntuitionBase        dc.l 0
  203. GfxBase            dc.l 0
  204. DosBase            dc.l 0
  205. MyUserPort        dc.l 0
  206. MyRastPort        dc.l 0
  207. MyWindow        dc.l 0
  208. FileName        dc.l 0
  209.  
  210. Class            dc.l 0
  211.  
  212. QuitFlag        dc.b 0
  213.  
  214. IntuitionName        dc.b 'intuition.library',0
  215. GfxName            dc.b 'graphics.library',0
  216. DosName            dc.b 'dos.library',0
  217.  
  218. VersionString        dc.b '$VER: WaitAccess V1.00 (18.2.94) by Jan Hagqvist',10,0
  219. MessageFormat        dc.b '%s',0
  220. NoWindowMessage        dc.b 'Can''t open window',10,0
  221. NoFileNameMessage    dc.b 'No file name given',10,0
  222. WindowTitle        dc.b 'WaitAccess V1.00',0
  223.  
  224.   END
  225.