home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / misc / tinytools.lzh / WBTF / WBTF.ASM next >
Encoding:
Assembly Source File  |  1990-10-10  |  799 b   |  60 lines

  1.  
  2. ; A few equs and equrs.
  3.  
  4. KickVerNum    EQU    31 ; >= Kick 1.1
  5. Fatal    EQU    20
  6. Warn    EQU    5
  7. OK    EQU    0
  8.  
  9. RETURN    EQUR    D2
  10.  
  11.     INCLUDE    "/include/init.i"
  12.  
  13. ; I suppose this is more than sufficient stack for intuition.
  14.  
  15.     STACK    2000
  16.  
  17. ; Open the intuition library
  18.  
  19.     MOVEQ    #Fatal,RETURN
  20.     MOVEQ    #KickVerNum,D0
  21.     LEA    IntuitionName(PC),A1
  22.     MOVE.L    $4.W,A6
  23.     CALL    OpenLibrary
  24.     TST.L    D0
  25.     BEQ.S    FatalExit
  26.  
  27. ; Request that the workbench be sent to front
  28.  
  29.     MOVEQ    #Warn,RETURN
  30.     MOVE.L    D0,A6
  31.     CALL    WBenchToFront
  32.     TST.B    D0
  33.     BNE.S    Exit
  34.  
  35. ; Workbench closed, ask for the workbench to be opened
  36.  
  37.     CALL    OpenWorkBench
  38.     TST.L    D0
  39.     BEQ.S    WarnExit
  40.  
  41. ; Cleanup
  42.  
  43. Exit:
  44.     MOVEQ    #OK,RETURN
  45. WarnExit:
  46.     MOVE.L    A6,A1
  47.     MOVE.L    $4.W,A6
  48.     CALL    CloseLibrary
  49. FatalExit:
  50.     MOVE.L    RETURN,D0
  51.     RTS
  52.  
  53. ; Strings
  54.  
  55. IntuitionName:
  56.     DC.B    'intuition.library',0
  57.     CNOP    0,2
  58.  
  59.     END
  60.