home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 2 / FFMCD02.bin / new / dev / asm / tbsource / shellbench / sb.bak next >
Encoding:
Text File  |  1993-12-21  |  22.3 KB  |  1,123 lines

  1. *************************************************
  2. *                        *
  3. *         (C)opyright 1991        *
  4. *                        *
  5. *        by  Tomi Blinnikka        *
  6. *                        *
  7. *    DonĀ“t try to understand the code    *
  8. *                        *
  9. * Version 0.01    11/01/1992            *
  10. *                        *
  11. * BUGS:    Version string incompatible.        *
  12. *                        *
  13. * Version 0.02    05/06/1992            *
  14. *                        *
  15. * BUGS:                        *
  16. *                        *
  17. *************************************************
  18.  
  19. ;add prefs and config file
  20.  
  21.     INCLUDE    "JMPLibs.i"
  22.     INCLUDE    "libraries/dos.i"
  23.     INCLUDE    "libraries/dosextens.i"
  24.     INCLUDE    "intuition/intuition.i"
  25.     INCLUDE    "intuition/gadgetclass.i"
  26.     INCLUDE    "libraries/gadtools.i"
  27.  
  28.     INCLUDE    "XREF:2.0.xref"
  29.  
  30.     INCLUDE    "XREF:gfx.xref"
  31.     INCLUDE    "XREF:intuition.xref"
  32.     INCLUDE    "XREF:exec.xref"
  33.     INCLUDE    "XREF:dos.xref"
  34.  
  35. TRUE:        EQU    1
  36. DGadTools:    set    1
  37.  
  38.         section    SB,CODE
  39.  
  40. Start:        push    d2-d7/a2-a6
  41.         push    a0
  42.  
  43.         sub.l    a1,a1            ;Find our task
  44.         lib    Exec,FindTask
  45.         move.l    d0,OurTask
  46.         move.l    d0,a4
  47.         move.l    $b8(a4),OldTaskWinPtr
  48.  
  49.         move.l    pr_CLI(a4),d0
  50.         bne    OpenDos
  51.  
  52.         lea.l    pr_MsgPort(a4),a0
  53.         lib    Exec,WaitPort
  54.         lea.l    pr_MsgPort(a4),a0
  55.         flib    Exec,GetMsg
  56.         move.l    d0,WBMsg
  57.  
  58. OpenDos:    openlib    Dos,NoDos
  59.  
  60.         move.l    pr_CLI(a4),d0
  61.         bne    CLIStart
  62.  
  63.         add.l    #4,sp
  64.         lea.l    NILName,a0
  65.         move.l    a0,d1
  66.         move.l    #MODE_NEWFILE,d2
  67.         lib    Dos,Open
  68.         move.l    d0,NILFile
  69.         beq    ShutDown
  70.         move.l    NILFile,_stdout
  71.         bra    MainStart
  72.  
  73. CLIStart:    lib    Dos,Output
  74.         move.l    d0,_stdout
  75.         beq    ShutDown
  76.  
  77.         pull    a0
  78.         cmp.b    #'?',(a0)
  79.         beq    Usage
  80.         cmp.w    #'-?',(a0)
  81.         beq    Usage
  82.         cmp.w    #'-h',(a0)
  83.         beq    Usage
  84.  
  85. ;To see if we have ks2.0 we'll try to open the gadtools.library
  86.  
  87. MainStart:    move.l    #37,d0
  88.         lea.l    _GadToolsLib,a1
  89.         lib    Exec,OpenLibrary
  90.         move.l    d0,_GadToolsBase
  91.         beq    NoKS20
  92.  
  93.         openlib    Intuition,NoInt
  94.  
  95. ;Open screen and main window
  96.  
  97.         lea.l    NewScreen1,a0
  98.         lea.l    Screen1TagList,a1
  99.         lib    Intuition,OpenScreenTagList
  100.         move.l    d0,Screen1
  101.         beq    NoScreen
  102.  
  103.         move.l    Screen1,d0
  104.         lea.l    NewWindow1,a0            ;do stuff for win1
  105.         move.l    d0,nw_Screen(a0)
  106.         move.l    d0,a1
  107.         move.b    sc_BarHeight(a1),BHeight+1
  108.         add.w    #1,BHeight
  109.         move.l    sc_Width(a1),nw_Width(a0)
  110.         move.w    BHeight,d2
  111.         move.w    d2,nw_TopEdge(a0)
  112.         sub.w    d2,nw_Height(a0)
  113.  
  114.         lea.l    NewWindow2,a0            ;do stuff for win2
  115.         move.l    d0,nw_Screen(a0)
  116.         add.w    d2,nw_Height(a0)
  117.  
  118.         lea.l    NewWindow3,a0            ;do stuff for win3
  119.         move.l    d0,nw_Screen(a0)
  120.         add.w    d2,nw_Height(a0)
  121.  
  122.         add.w    d2,PubGad1Top
  123.  
  124.         add.l    #$2c,d0                ;get ViewPort
  125.         move.l    d0,VP1
  126.  
  127.         move.l    Screen1,a0
  128.         clr.l    d0
  129.         lib    Intuition,PubScreenStatus
  130.  
  131.         lea.l    PubName,a0
  132.         lib    Intuition,SetDefaultPubScreen
  133.  
  134.         move.w    #SHANGHAI!POPPUBSCREEN,d0
  135.         lib    Intuition,SetPubScreenModes
  136.         move.l    d0,OldPubModes
  137.  
  138. ;Do GadTools preparations, gadgets and menus
  139.  
  140.         lea.l    glist,a0
  141.         lib    GadTools,CreateContext
  142.         move.l    d0,ContextGad
  143.         beq    NoContextGad
  144.  
  145.         move.l    Screen1,a0
  146.         lea.l    Screen1TagList,a1
  147.         lib    GadTools,GetVisualInfoA
  148.         move.l    d0,vi
  149.  
  150.         move.l    glist,a0
  151.         lea.l    NGExecuteGad1,a1
  152.         move.l    #TEXT_KIND,d0
  153.         move.l    vi,gng_VisualInfo(a1)
  154.         sub.l    a2,a2
  155.         lib    GadTools,CreateGadgetA
  156.         move.l    d0,a0
  157.  
  158.         add.w    #GRELBOTTOM,$c(a0)
  159.  
  160.         lea.l    NGCommandGad1,a1
  161.         move.l    #STRING_KIND,d0
  162.         move.l    vi,gng_VisualInfo(a1)
  163.         lea.l    CommandGadTagList,a2
  164.         lib    GadTools,CreateGadgetA
  165.  
  166.         move.l    d0,CommandGad1
  167.         move.l    d0,a0
  168.         move.l    $22(a0),a1
  169.         move.l    (a1),CommandGadBuf
  170.         add.w    #GRELBOTTOM,$c(a0)
  171.  
  172.         lea.l    NGOKGad,a1
  173.         move.l    #BUTTON_KIND,d0
  174.         move.l    vi,gng_VisualInfo(a1)
  175.         lea.l    GadTagList,a2
  176.         lib    GadTools,CreateGadgetA
  177.         move.l    d0,a0
  178.  
  179.         add.w    #GRELBOTTOM,$c(a0)
  180.  
  181.         lea.l    NGCancelGad,a1
  182.         move.l    #BUTTON_KIND,d0
  183.         move.l    vi,gng_VisualInfo(a1)
  184.         lea.l    GadTagList,a2
  185.         lib    GadTools,CreateGadgetA
  186.         move.l    d0,a0
  187.  
  188.         add.w    #GRELBOTTOM+GRELRIGHT,$c(a0)
  189.  
  190.         lea.l    MNProjectMenu1,a0
  191.         lea.l    MenuTagList,a1
  192.         lib    GadTools,CreateMenusA
  193.         move.l    d0,mlist
  194.         beq    NoMenus
  195.  
  196.         move.l    mlist,a0
  197.         move.l    vi,a1
  198.         lea.l    MenuTagList,a2
  199.         lib    GadTools,LayoutMenusA
  200.  
  201.         lea.l    MNProjectMenu2,a0
  202.         lea.l    MenuTagList,a1
  203.         lib    GadTools,CreateMenusA
  204.         move.l    d0,mlist2
  205.         beq    NoMenus
  206.  
  207.         move.l    mlist2,a0
  208.         move.l    vi,a1
  209.         lea.l    MenuTagList2,a2
  210.         lib    GadTools,LayoutMenusA
  211.  
  212.         bsr    OpenWin1
  213.         tst.l    d0
  214.         beq    NoWindow
  215.  
  216. ;move requesters to Window1
  217.  
  218.         move.l    OurTask,a0
  219.         move.l    Window1,$b8(a0)
  220.  
  221.         move.l    Window1,a0
  222.         lib    Intuition,WindowToFront
  223.  
  224. ;Start of main loop
  225.  
  226. Window1IDCMP:    move.l    Window1,a0
  227.         bsr    CheckIDCMP
  228.         cmp.l    #CLOSEWINDOW,d2
  229.         beq    Quit
  230.         cmp.l    #REFRESHWINDOW,d2
  231.         beq    Refresher
  232.         cmp.l    #VANILLAKEY,d2
  233.         beq    VanillaKeys
  234.         cmp.l    #MENUPICK,d2
  235.         beq    Win1Menus
  236.         cmp.l    #RAWKEY,d2
  237. ;        beq    RawKeys
  238.         cmp.l    #GADGETUP,d2
  239.         beq    GadgetSelect
  240.         cmp.l    #ACTIVEWINDOW,d2
  241. ;        beq    ActivateGads
  242.         bra    Window1IDCMP
  243.  
  244. GadgetSelect:    cmp.w    #51,$26(a5)
  245.         beq    DoPubState
  246.         bra    Window1IDCMP
  247.  
  248. DoPubState:    move.w    gg_Flags(a5),d0
  249.         and.w    #SELECTED,d0
  250.         cmp.w    #SELECTED,d0
  251.         bne    DoPubState1
  252.         lea.l    PubName,a0
  253.         lib    Intuition,SetDefaultPubScreen
  254.         bra    Window1IDCMP
  255. DoPubState1:    sub.l    a0,a0
  256.         lib    Intuition,SetDefaultPubScreen
  257.         bra    Window1IDCMP
  258.  
  259. Refresher:    move.l    Window1,a0
  260.         lib    GadTools,GT_BeginRefresh
  261.         move.l    Window1,a0
  262.         move.l    #TRUE,d0
  263.         lib    GadTools,GT_EndRefresh
  264.         bra    Window1IDCMP
  265.  
  266. VanillaKeys:    cmp.w    #$1b,d3
  267.         beq    Quit
  268.         bra    Window1IDCMP
  269. RawKeys:    cmp.w    #$5f,d3
  270.         beq    Help
  271.         bra    Window1IDCMP
  272.  
  273. Win1Menus:    bsr    MenuNull
  274.         cmp.w    #$00,d6
  275.         beq    Win1Menus1
  276.         cmp.w    #$01,d6
  277.         beq    Win1Menus2
  278.         bra    Window1IDCMP
  279. Win1Menus1:    cmp.w    #$00,d5
  280.         beq    DoBackDrop
  281.         cmp.w    #$01,d5
  282.         beq    ExecuteCommand
  283.         cmp.w    #$02,d5
  284.         beq    About
  285.         cmp.w    #$04,d5
  286.         beq    Quit
  287.         bra    Window1IDCMP
  288. Win1Menus2:    bra    Window1IDCMP
  289.  
  290. ExecuteCommand:    bsr    MenusOff
  291.         bsr    SleepPointer
  292.  
  293.         bsr    OpenWin2
  294.         tst.l    d0
  295.         beq    NoWindow
  296.  
  297. Window2IDCMP:    move.l    Window2,a0
  298.         bsr    CheckIDCMP
  299.         cmp.l    #CLOSEWINDOW,d2
  300.         beq    ExecuteQuit
  301.         cmp.l    #VANILLAKEY,d2
  302.         beq    ExecuteVKeys
  303.         cmp.l    #MENUPICK,d2
  304.         beq    Win2Menus
  305.         cmp.l    #GADGETUP,d2
  306.         beq    ExecuteGads
  307.         bra    Window2IDCMP
  308.  
  309. ExecuteGads:    cmp.w    #10,$26(a5)
  310.         beq    DoExecute
  311.         cmp.w    #98,$26(a5)
  312.         beq    DoExecute
  313.         cmp.w    #99,$26(a5)
  314.         beq    ExecuteQuit
  315.         bra    Window2IDCMP
  316.  
  317. Win2Menus:    bsr    MenuNull
  318.         cmp.w    #$00,d6
  319.         beq    Win2Menus1
  320.         bra    Window2IDCMP
  321. Win2Menus1:    cmp.w    #$00,d5
  322.         beq    DoExecute
  323.         cmp.w    #$02,d5
  324.         beq    ExecuteQuit
  325.         bra    Window2IDCMP
  326.  
  327. ExecuteVKeys:    cmp.w    #$1b,d3
  328.         beq    ExecuteQuit
  329.         bra    Window2IDCMP
  330.  
  331. DoExecute:    lea.l    CONName,a0
  332.         move.l    a0,d1
  333.         move.l    #MODE_OLDFILE,d2
  334.         lib    Dos,Open
  335.         move.l    d0,CONFile
  336.         beq    NoCON
  337.  
  338.         move.l    CommandGadBuf,d1
  339.         clr.l    d2
  340.         move.l    CONFile,d3
  341.         lib    Dos,Execute
  342.  
  343.         tst.l    CONFile
  344.         beq    ShutDown2000
  345.         move.l    CONFile,d1
  346.         lib    Dos,Close
  347.         clr.l    CONFile
  348.         bra    ExecuteQuit
  349.  
  350. ExecuteQuit:    bsr    CloseWin2
  351.  
  352.         bsr    MenusOn
  353.         bsr    NormalPointer
  354.         bra    Window1IDCMP
  355.  
  356. About:        bsr    SleepPointer
  357.         bsr    MenusOff
  358.  
  359.         move.l    Window1,a0
  360.         lea.l    AboutTxt1,a1
  361.         move.l    #$00,a2        ;positive text
  362.         lea.l    OKTxt,a3    ;a bit the wrong way around but...
  363.         move.l    #$00,d0
  364.         move.l    #$00,d1
  365.         move.l    #320,d2
  366.         move.l    #$50,d3
  367.         lib    Intuition,AutoRequest
  368.         bsr    MenusOn
  369.         bsr    NormalPointer
  370.         bra    Window1IDCMP
  371.  
  372. DoBackDrop:    move.l    mlist,a0
  373.         move.l    #$F800,d0
  374.         lib    Intuition,ItemAddress
  375.         move.l    d0,a0
  376.         move.w    mu_Flags(a0),d0
  377.         and.w    #CHECKED,d0
  378.         cmp.w    #CHECKED,d0
  379.         beq    DoBackDrop1
  380.         bsr    CloseWin1
  381.         lea.l    NewWindow1,a0
  382.         and.l    #~BACKDROP!BORDERLESS,nw_Flags(a0)
  383.         or.l    #WINDOWDEPTH!WINDOWCLOSE!WINDOWDRAG!WINDOWSIZING,nw_Flags(a0)
  384.         lea.l    SBName1,a1
  385.         move.l    a1,nw_Title(a0)
  386.         bra    DoBD_OUT
  387. DoBackDrop1:    bsr    CloseWin1
  388.         lea.l    NewWindow1,a0
  389.         or.l    #BACKDROP!BORDERLESS,nw_Flags(a0)
  390.         and.l    #~WINDOWDEPTH!WINDOWCLOSE!WINDOWDRAG!WINDOWSIZING,nw_Flags(a0)
  391.         clr.l    nw_Title(a0)
  392.         move.l    Screen1,a1
  393.         move.l    sc_Width(a1),nw_Width(a0)
  394.         move.w    BHeight,d2
  395.         move.w    d2,nw_TopEdge(a0)
  396.         sub.w    d2,nw_Height(a0)
  397. DoBD_OUT:    bsr    OpenWin1
  398.         tst.l    d0
  399.         beq    NoWindow
  400.         bra    Window1IDCMP
  401.  
  402. Help:        bra    Window1IDCMP
  403.  
  404. Quit:        bsr    CloseWin1
  405. Quit1:        bsr    CloseScreen1
  406.         tst.l    d0
  407.         beq    Quit2
  408.         move.l    OldPubModes,d0
  409.         lib    Intuition,SetPubScreenModes
  410.         sub.l    a0,a0
  411.         lib    Intuition,SetDefaultPubScreen
  412.         bra    ShutDown
  413.  
  414. Quit2:        bsr    OpenWin1
  415.         tst.l    d0
  416.         beq    Quit1
  417.         bsr    VisitorsOpen
  418.         bra    Window1IDCMP
  419.  
  420. OpenWin1:    lea.l    NewWindow1,a0
  421.         lib    Intuition,OpenWindow
  422.         move.l    d0,Window1
  423.         beq    OpenWin1_ERR1
  424.         move.l    d0,a0
  425.         move.l    $32(a0),RP1
  426. ;        move.l    Window1,a0
  427.         move.l    mlist,a1
  428.         lib    Intuition,SetMenuStrip
  429.         move.l    #-1,d0
  430.         rts
  431. OpenWin1_ERR1:    clr.l    d0
  432.         rts
  433.  
  434. CloseWin1:    tst.l    Window1
  435.         beq    CloseWin1_OUT
  436.         move.l    Window1,a0
  437.         lib    Intuition,ClearMenuStrip
  438.         move.l    Window1,a0
  439.         bsr    ClearMSGs
  440. CloseWin1_OUT:    clr.l    Window1
  441.         rts
  442.  
  443. CloseScreen1:    move.l    #-1,d0    
  444.         tst.l    Screen1
  445.         beq    CloseScr1_OUT
  446.         move.l    Screen1,a0
  447.         lib    Intuition,CloseScreen
  448. CloseScr1_OUT:    rts
  449.  
  450. OpenWin2:    lea.l    NewWindow2,a0
  451.         lib    Intuition,OpenWindow
  452.         move.l    d0,Window2
  453.         beq    OpenWin2_ERR1
  454.         move.l    d0,a0
  455.         move.l    $32(a0),RP1
  456. ;        move.l    Window2,a0
  457.         move.l    mlist2,a1
  458.         lib    Intuition,SetMenuStrip
  459.         move.l    CommandGad1,a0
  460.         move.l    Window2,a1
  461.         sub.l    a2,a2
  462.         flib    Intuition,ActivateGadget
  463.         move.l    #-1,d0
  464.         rts
  465. OpenWin2_ERR1:    clr.l    d0
  466.         rts
  467.  
  468. CloseWin2:    tst.l    Window2
  469.         beq    CloseWin2_OUT
  470.         move.l    Window2,a0
  471.         lib    Intuition,ClearMenuStrip
  472.         move.l    Window2,a0
  473.         bsr    ClearMSGs
  474. CloseWin2_OUT:    clr.l    Window2
  475.         rts
  476.  
  477. ShutDown:    move.l    OurTask,a0
  478.         move.l    OldTaskWinPtr,$b8(a0)
  479.  
  480. ShutDown3500:    tst.l    NILFile
  481.         beq    ShutDown3000
  482.         move.l    NILFile,d1
  483.         lib    Dos,Close
  484.  
  485. ShutDown3000:    tst.l    CONFile
  486.         beq    ShutDown2000
  487.         move.l    CONFile,d1
  488.         lib    Dos,Close
  489.  
  490. ShutDown2000:    bsr    CloseWin2
  491.         bsr    CloseWin1
  492.  
  493. ShutDown1900:    bsr    Clean2.0Magic
  494.         bsr    CloseScreen1
  495.  
  496. ShutDown1000:    move.l    WBMsg,d2
  497.         beq    ShutDown_OUT
  498.         lib    Exec,Forbid
  499.         move.l    d2,a1
  500.         flib    Exec,ReplyMsg
  501.  
  502. ShutDown_OUT:
  503.         closlib    GadTools
  504.         closlib    Intuition
  505.         closlib    Dos
  506.  
  507.         pull    d2-d7/a2-a6
  508.         move.l    #RETURN_OK,d0
  509.         rts
  510.  
  511. ;Subroutines atleast should be here...
  512.  
  513. SleepPointer:    move.l    Window1,a0
  514.         lea.l    ClockPointer1,a1
  515.         move.l    #16,d0
  516.         move.l    #16,d1            ;WHAT-THE-HECK IS THIS FOR?
  517.         move.l    #-6,d2
  518.         move.l    #0,d3
  519.         lib    Intuition,SetPointer
  520.         rts
  521.  
  522. NormalPointer:    move.l    Window1,a0
  523.         lib    Intuition,ClearPointer
  524.         rts
  525.  
  526. MenusOn:    move.l    Window1,a0
  527.         move.l    mlist,a1
  528.         lib    Intuition,SetMenuStrip
  529.         rts
  530.  
  531. MenusOff:    move.l    Window1,a0
  532.         lib    Intuition,ClearMenuStrip
  533.         rts
  534.  
  535. ;CheckIDCMP gets messages from both our Input-Handler and Intuition.
  536. ; a0 = window structure
  537.  
  538. CheckIDCMP:    move.l    $56(a0),a2        ;Get window's port
  539.         move.l    #0,d1            ;Set signals for
  540.         move.b    $0f(a2),d1        ;IntuiMessages
  541.         move.l    #SIGBREAKF_CTRL_C,d0    ;and for CTRL_C check
  542.         bset.l    d1,d0
  543.         lib    Exec,Wait    
  544.     
  545.         cmp.l    #SIGBREAKF_CTRL_C,d0
  546.         beq    Break
  547.  
  548. GetMsg1:    move.l    a2,a0    
  549.         lib    GadTools,GT_GetIMsg
  550.         tst.l    d0
  551.         beq    GetMsg2
  552.     
  553.         move.l    d0,a1 
  554.         move.l    $14(a1),d2        ;answers with Class in d2,
  555.         move.w    $18(a1),d3        ;Code in d3 and
  556.         move.w    $1a(a1),a4        ;Qualifier in a4
  557.         move.l    $1c(a1),a5        ;IAddress in a5
  558.         lib    GadTools,GT_ReplyIMsg
  559.         bra    GetMsg1
  560. GetMsg2:    move.l    #-1,d0
  561.         rts
  562.  
  563. ;Newer MenuNull subroutine
  564.  
  565. MenuNull:    move.w    d3,d0
  566.         and.w    #$1f,d0
  567.         move.w    d0,d6
  568.         move.w    d3,d0
  569.         lsr.w    #5,d0
  570.         move.w    d0,d1
  571.         and.w    #$3f,d0
  572.         move.w    d0,d5
  573.         lsr.w    #6,d1
  574.         move.w    d1,d4
  575.         rts
  576.  
  577. ClearMSGs:    move.l    a0,d0
  578.         tst.l    d0
  579.         beq    ClearMsg3
  580.         move.l    a0,a3
  581.         lib    Exec,Forbid
  582.         move.l    $56(a3),a2        ;Give it the window structure in a0
  583. ClearMsg1:    move.l    a2,a0    
  584.         lib    GadTools,GT_GetIMsg
  585.         tst.l    d0
  586.         beq    ClearMsg2
  587.         move.l    d0,a1 
  588.         lib    GadTools,GT_ReplyIMsg
  589.         bra    ClearMsg1
  590. ClearMsg2:    move.l    a3,a0
  591.         move.l    #$00,d0
  592.         lib    Intuition,ModifyIDCMP
  593.         lib    Exec,Permit
  594.         move.l    a3,a0
  595.         lib    Intuition,CloseWindow
  596. ClearMsg3:    rts
  597.  
  598. Clean2.0Magic:    tst.l    glist
  599.         beq    Clean2.0M2
  600.         move.l    glist,a0
  601.         lib    GadTools,FreeGadgets
  602.  
  603. Clean2.0M2:    tst.l    mlist
  604.         beq    Clean2.0M3
  605.         move.l    mlist,a0
  606.         lib    GadTools,FreeMenus
  607.  
  608. Clean2.0M3:    tst.l    mlist2
  609.         beq    Clean2.0M4
  610.         move.l    mlist2,a0
  611.         lib    GadTools,FreeMenus
  612.  
  613. Clean2.0M4:    tst.l    vi
  614.         beq    Clean2.0_OUT
  615.         move.l    vi,a0
  616.         lib    GadTools,FreeVisualInfo
  617.  
  618. Clean2.0_OUT:    rts
  619.  
  620. NoDos:        add.l    #4,sp
  621.         pull    d2-d7/a2-a6
  622.         move.l    #RETURN_FAIL,d0
  623.         rts
  624.  
  625. Usage:        lea.l    UsageText1,a0
  626.         bsr    Printer
  627.         bra    ShutDown
  628.  
  629. NoKS20:        lea.l    NoKS20Text1,a0
  630.         bsr    Printer
  631.         bra    ShutDown
  632.  
  633. NoInt:        lea.l    NoIntText1,a0
  634.         bsr    Printer
  635.         bra    ShutDown
  636.  
  637. NoScreen:    lea.l    NoScreenText1,a0
  638.         bsr    Printer
  639.         bra    ShutDown
  640.  
  641. NoWindow:    lea.l    NoWindowText1,a0
  642.         bsr    Printer
  643.         bra    ShutDown
  644.  
  645. NoContextGad:    lea.l    NoContextText1,a0
  646.         bsr    Printer
  647.         bra    ShutDown
  648.  
  649. NoMenus:    lea.l    NoMenusText1,a0
  650.         bsr    Printer
  651.         bra    ShutDown
  652.  
  653. NoCON:        lea.l    NoCONText1,a0
  654.         bsr    Printer
  655.         bra    ShutDown
  656.  
  657. VisitorsOpen:    lea.l    VisitorsTxt1,a1
  658.         bsr    DoAutoRequest
  659.         rts
  660.  
  661. Break:        lea.l    BreakText1,a0
  662.         bsr    Printer
  663.         move.l    #CLOSEWINDOW,d2        ;fake closewindow...
  664.         move.l    #-1,d0
  665.         rts
  666.  
  667. Printer:    printa    a0,_stdout
  668.         rts
  669.  
  670. ;Does a request
  671. ;
  672. ;a1 = IntuiText
  673.  
  674. DoAutoRequest:    sub.l    a2,a2        ;positive text
  675.         lea.l    OKTxt(pc),a3    ;a bit the wrong way around but...
  676.         clr.l    d0
  677.         clr.l    d1
  678.         clr.l    d2
  679.         clr.l    d3
  680.         sub.l    a0,a0
  681.         lib    Intuition,AutoRequest
  682.         rts
  683.  
  684.  
  685. ;Reservations
  686.  
  687. ;Library stuff
  688.  
  689.         libnames
  690.  
  691. ;GadTools stuff
  692.  
  693. vi:        dc.l    0        ;Visual Info
  694. mlist:        dc.l    0
  695. mlist2:        dc.l    0
  696. ContextGad:    dc.l    0
  697. CommandGad1:    dc.l    0
  698. CommandGadBuf:    dc.l    0
  699.  
  700. ;WB Stuff
  701.  
  702. WBMsg:        dc.l    0
  703.  
  704. ;Display stuff
  705.  
  706. Screen1:    dc.l    0
  707. Window1:    dc.l    0
  708. Window2:    dc.l    0
  709. VP1:        dc.l    0
  710. RP1:        dc.l    0
  711. OldPubModes:    dc.l    0
  712. BHeight:    dc.w    0
  713.  
  714. ;Task stuff
  715.  
  716. OurTask:    dc.l    0
  717. OldTaskWinPtr:    dc.l    0
  718.  
  719. ;File stuff
  720.  
  721. NILFile:    dc.l    0
  722. CONFile:    dc.l    0
  723. _stdout:    dc.l    0
  724.  
  725.  
  726. ;Strings
  727.  
  728. BreakText1:    dc.b    "**Break",10,0
  729. NoKS20Text1:    dc.b    "ERROR: Kickstart 2.0 or higher required!",10,0
  730. NoIntText1:    dc.b    "ERROR: Couldn't open Intuition.library!",10,0
  731. NoScreenText1:    dc.b    "ERROR: Couldn't open screen!",10,0
  732. NoContextText1:    dc.b    "ERROR: Couldn't create context gadget!",10,0
  733. NoMenusText1:    dc.b    "ERROR: Couldn't allocate menu structure!",10,0
  734. NoWindowText1:    dc.b    "ERROR: Couldn't open window!",10,0
  735. NoCONText1:    dc.b    "ERROR: Couldn't open CON: for output!",10,0
  736. NodeNotFoundText1: dc.b    "ERROR: PubScreen node not found!",10,0
  737. VisitorsText1:    dc.b    "ERROR: Visitor windows still open!",0
  738.  
  739. SBVersion:    dc.b    "$VER: "
  740. UsageText1:    dc.b    "ShellBench 0.02 (5.6.92). (C)opyright Tomi Blinnikka 1992",10,10
  741.         dc.b    10,"*** BETA TESTER VERSION ***",10,10,10
  742.         dc.b    "USAGE: ShellBench []",10,10
  743.         dc.b    "       Where: [] is (unused)",10
  744.         dc.b    "       Default for [] is (unused)",10,10
  745.         dc.b    "This program requires Kickstart 2.0 or higher!",10,10
  746.         dc.b    "See docs for more information.",10,0
  747. SBName1:    dc.b    "ShellBench, (C)opyright Tomi Blinnikka 1992.",0
  748. AboutText1:    dc.b    "Name    : ShellBench",0
  749. AboutText2:    dc.b    "Version : 0.02",0
  750. AboutText3:    dc.b    "Author  : Tomi Blinnikka",0
  751. AboutText4:    dc.b    "   (C)opyright  1992",0
  752. OKText1:    dc.b    "OK",0
  753. CancelText1:    dc.b    "Cancel",0
  754. PubName:    dc.b    "ShellBench",0
  755. Window2Title:    dc.b    "Execute a File",0
  756. Window3Title:    dc.b    "Preferences",0
  757.  
  758. ;File strings
  759.  
  760. NILName:    dc.b    "NIL:",0
  761. CONName:    dc.b    "CON:0/25/640/150/Output Window/AUTO/WAIT",0
  762.         ds.w    0
  763.  
  764. ;Structures
  765.  
  766. NewScreen1:    dc.w    0,0            ;X,Y POS
  767. Screen1MaxCol:    dc.w    -1            ;WIDTH
  768. Screen1MaxRow:    dc.w    -1            ;HEIGHT
  769.         dc.w    1            ;DEPTH
  770.         dc.b    0,1            ;COLORS
  771.         dc.w    V_HIRES            ;VIEWMODES
  772.         dc.w    CUSTOMSCREEN        ;TYPE
  773.         dc.l    0            ;FONT
  774.         dc.l    SBName1            ;DEFULT TITLE
  775.         dc.l    0            ;GADGETS
  776.         dc.l    0            ;CUSTOMBITMAP
  777.  
  778. Screen1TagList:    dc.l    SA_Pens,default_pens
  779.         dc.l    SA_PubName,PubName
  780.         dc.l    TAG_DONE,0
  781. default_pens:    dc.w    ~0
  782.  
  783. NewWindow1:    dc.w    0,11            ;X,Y POS
  784.         dc.w    0            ;WIDTH
  785.         dc.w    0            ;HEIGHT
  786.         dc.b    0,1            ;PENS
  787.         dc.l    REFRESHWINDOW!CLOSEWINDOW!MENUPICK!VANILLAKEY!GADGETUP
  788.         dc.l    ACTIVATE!BACKDROP!BORDERLESS
  789.         dc.l    PublicGad1,0        ;GADGETS, CHECKMARK
  790.         dc.l    0            ;TITLE
  791. SToW1        dc.l    0            ;SCREEN ADDRESS
  792.         dc.l    0            ;BITMAP            
  793.         dc.w    100,20,0,0        ;MIN/MAX SIZE
  794.         dc.w    CUSTOMSCREEN        ;TYPE
  795.  
  796. NewWindow2:    dc.w    20,20            ;X,Y POS
  797.         dc.w    460            ;WIDTH
  798.         dc.w    51            ;HEIGHT
  799.         dc.b    0,1            ;PENS
  800.         dc.l    CLOSEWINDOW!MENUPICK!VANILLAKEY!GADGETUP
  801.         dc.l    ACTIVATE!WINDOWCLOSE!WINDOWDRAG!WINDOWDEPTH
  802.         dc.l    glist,0            ;GADGETS, CHECKMARK
  803.         dc.l    Window2Title        ;TITLE
  804. SToW2        dc.l    0            ;SCREEN ADDRESS
  805.         dc.l    0            ;BITMAP            
  806.         dc.w    460,49,460,0        ;MIN/MAX SIZE
  807.         dc.w    CUSTOMSCREEN        ;TYPE
  808.  
  809. NewWindow3:    dc.w    20,20            ;X,Y POS
  810.         dc.w    620            ;WIDTH
  811.         dc.w    100            ;HEIGHT
  812.         dc.b    0,1            ;PENS
  813.         dc.l    CLOSEWINDOW!MENUPICK!VANILLAKEY!GADGETUP
  814.         dc.l    ACTIVATE!WINDOWCLOSE!WINDOWDRAG!WINDOWDEPTH
  815.         dc.l    0,0 ;glist2,0            ;GADGETS, CHECKMARK
  816.         dc.l    Window3Title        ;TITLE
  817. SToW3        dc.l    0            ;SCREEN ADDRESS
  818.         dc.l    0            ;BITMAP            
  819.         dc.w    100,20,0,0        ;MIN/MAX SIZE
  820.         dc.w    CUSTOMSCREEN        ;TYPE
  821.  
  822. ;Fonts
  823.  
  824. Topaz        dc.l    TopazName
  825.         dc.w    8
  826.         dc.b    0
  827.         dc.b    0
  828. TopazName    dc.b    "topaz.font",0
  829.         ds.w    0
  830.  
  831. ;Gadgets
  832.  
  833. glist:        dc.l    0        ;Next Gadget
  834.         dc.w    0        ;"hit-box" left edge
  835.         dc.w    0        ;"hit-box" top  edge
  836.         dc.w    0        ;"hit-box" Width
  837.         dc.w    0        ;"hit-box" Height
  838.         dc.w    0        ;flags
  839.         dc.w    0        ;activation
  840.         dc.w    0        ;gadget type
  841.         dc.l    0        ;gadget rendering
  842.         dc.l    0        ;select rendering
  843.         dc.l    0        ;gadget text
  844.         dc.l    0        ;mutual exclude
  845.         dc.l    0        ;special info
  846.         dc.w    0        ;gadget ID (user definable)
  847.         dc.l    0        ;ptr to general purpose user data
  848.  
  849. NGExecuteGad1:    dc.w    10        ;gng_LeftEdge
  850.         dc.w    -48        ;gng_TopEdge
  851.         dc.w    0        ;gng_Width
  852.         dc.w    9        ;gng_Height
  853.         dc.l    ExecuteText1    ;gng_GadgetText
  854.         dc.l    Topaz        ;gng_TextAttr
  855.         dc.w    0        ;gng_GadgetID
  856.         dc.l    PLACETEXT_RIGHT    ;gng_Flags
  857.         dc.l    0        ;gng_VisualInfo
  858.         dc.l    0        ;gng_UserData
  859.  
  860. NGCommandGad1:    dc.w    160        ;gng_LeftEdge
  861.         dc.w    -35        ;gng_TopEdge
  862.         dc.w    286        ;gng_Width
  863.         dc.w    12        ;gng_Height
  864.         dc.l    CommandText1    ;gng_GadgetText
  865.         dc.l    Topaz        ;gng_TextAttr
  866.         dc.w    10        ;gng_GadgetID
  867.         dc.l    PLACETEXT_LEFT    ;gng_Flags
  868.         dc.l    0        ;gng_VisualInfo
  869.         dc.l    0        ;gng_UserData
  870.  
  871. NGOKGad:    dc.w    13        ;gng_LeftEdge
  872.         dc.w    -18        ;gng_TopEdge
  873.         dc.w    65        ;gng_Width
  874.         dc.w    12        ;gng_Height
  875.         dc.l    OKGadText1    ;gng_GadgetText
  876.         dc.l    Topaz        ;gng_TextAttr
  877.         dc.w    98        ;gng_GadgetID
  878.         dc.l    PLACETEXT_IN    ;gng_Flags
  879.         dc.l    0        ;gng_VisualInfo
  880.         dc.l    0        ;gng_UserData
  881.  
  882. NGCancelGad:    dc.w    -78        ;gng_LeftEdge
  883.         dc.w    -18        ;gng_TopEdge
  884.         dc.w    65        ;gng_Width
  885.         dc.w    12        ;gng_Height
  886.         dc.l    CancelGadText1    ;gng_GadgetText
  887.         dc.l    Topaz        ;gng_TextAttr
  888.         dc.w    99        ;gng_GadgetID
  889.         dc.l    PLACETEXT_IN    ;gng_Flags
  890.         dc.l    0        ;gng_VisualInfo
  891.         dc.l    0        ;gng_UserData
  892.  
  893. PublicGad1:    dc.l    0        ;Next Gadget
  894.         dc.w    10        ;"hit-box" left edge
  895. PubGad1Top:    dc.w    0        ;"hit-box" top  edge
  896.         dc.w    56        ;"hit-box" Width
  897.         dc.w    11        ;"hit-box" Height
  898.         dc.w    GADGHCOMP!SELECTED
  899.         dc.w    RELVERIFY!TOGGLESELECT    ;activation
  900.         dc.w    BOOLGADGET    ;gadget type
  901.         dc.l    Border1        ;gadget rendering
  902.         dc.l    0        ;select rendering
  903.         dc.l    PubTxt1        ;gadget text
  904.         dc.l    0        ;mutual exclude
  905.         dc.l    0        ;special info
  906.         dc.w    51        ;gadget ID (user definable)
  907.         dc.l    0        ;ptr to general purpose user data
  908.  
  909. PubTxt1:    dc.b    1,2        ;PENS
  910.         dc.w    0        ;DRAW MODE
  911.         dc.w    3,2        ;LEFT & TOP EDGE
  912.         dc.l    Topaz        ;FONT
  913.         dc.l    PubText1    ;TEXT
  914.         dc.l    0        ;NEXT TEXT
  915.  
  916. ;Gadget TagList(s)
  917.  
  918. GadTagList:    dc.l    GT_Underscore,'_'
  919.         dc.l    TAG_DONE,0
  920.  
  921. CommandGadTagList dc.l    GTST_MaxChars,126
  922.         dc.l    TAG_DONE,0
  923.  
  924. ;Menus
  925.  
  926. PubText1:    dc.b    "Public",0
  927. Menu1Name:    dc.b    "Project",0
  928. BDMenu1I1Text: dc.b    "Backdrop",0
  929. BDCommKey:    dc.b    "B",0
  930. ExecuteMenu1I1Text: dc.b "Execute Command...",0
  931. ExecuteCommKey:    dc.b    "E",0
  932. AboutMenu1I1Text: dc.b    "About...",0
  933. AboutCommKey:    dc.b    "?",0
  934. QuitMenu1I1Text: dc.b    "Quit",0
  935. QuitCommKey:    dc.b    "Q",0
  936.  
  937. ;Gadget texts (maybe a few menu strings to save space
  938.  
  939. ExecuteText1:    dc.b    "Enter Command and its Arguments:",0
  940. CommandText1:    dc.b    "Command:",0
  941. OKGadText1:    dc.b    "_"
  942. OKMenu1I1Text:    dc.b    "OK",0
  943. CancelGadText1:    dc.b    "_"
  944. CancelMenu1I1Text: dc.b    "Cancel",0
  945. CancelCommKey:    dc.b    "C",0
  946. OKCommKey:    dc.b    "O",0
  947.  
  948.         ds.w    0
  949.  
  950. MNProjectMenu1:    dc.b    NM_TITLE        ;gnm_Type
  951.         dc.b    0            ;gnm_Pad
  952.         dc.l    Menu1Name        ;gnm_Label
  953.         dc.l    0            ;gnm_CommKey
  954.         dc.w    0            ;gnm_Flags
  955.         dc.l    0            ;gnm_MutualExclude
  956.         dc.l    0            ;gnm_UserData
  957.  
  958. MNBDMenu1:    dc.b    NM_ITEM            ;gnm_Type
  959.         dc.b    0            ;gnm_Pad
  960.         dc.l    BDMenu1I1Text        ;gnm_Label
  961.         dc.l    BDCommKey        ;gnm_CommKey
  962.         dc.w    CHECKED!CHECKIT!MENUTOGGLE    ;gnm_Flags
  963.         dc.l    0            ;gnm_MutualExclude
  964.         dc.l    0            ;gnm_UserData
  965.  
  966. MNExecuteMenu1:    dc.b    NM_ITEM            ;gnm_Type
  967.         dc.b    0            ;gnm_Pad
  968.         dc.l    ExecuteMenu1I1Text    ;gnm_Label
  969.         dc.l    ExecuteCommKey        ;gnm_CommKey
  970.         dc.w    0 ;NM_ITEMDISABLED        ;gnm_Flags
  971.         dc.l    0            ;gnm_MutualExclude
  972.         dc.l    0            ;gnm_UserData
  973.  
  974. MNAboutMenu1:    dc.b    NM_ITEM            ;gnm_Type
  975.         dc.b    0            ;gnm_Pad
  976.         dc.l    AboutMenu1I1Text    ;gnm_Label
  977.         dc.l    AboutCommKey        ;gnm_CommKey
  978.         dc.w    0            ;gnm_Flags
  979.         dc.l    0            ;gnm_MutualExclude
  980.         dc.l    0            ;gnm_UserData
  981.  
  982. MNSepMenu1:    dc.b    NM_ITEM            ;gnm_Type
  983.         dc.b    0            ;gnm_Pad
  984.         dc.l    NM_BARLABEL        ;gnm_Label
  985.         dc.l    0            ;gnm_CommKey
  986.         dc.w    0            ;gnm_Flags
  987.         dc.l    0            ;gnm_MutualExclude
  988.         dc.l    0            ;gnm_UserData
  989.  
  990. MNQuitNMenu1:    dc.b    NM_ITEM            ;gnm_Type
  991.         dc.b    0            ;gnm_Pad
  992.         dc.l    QuitMenu1I1Text        ;gnm_Label
  993.         dc.l    QuitCommKey        ;gnm_CommKey
  994.         dc.w    0            ;gnm_Flags
  995.         dc.l    0            ;gnm_MutualExclude
  996.         dc.l    0            ;gnm_UserData
  997.  
  998.         dc.w    0            ;ITEM_END?
  999.  
  1000. MNProjectMenu2:    dc.b    NM_TITLE        ;gnm_Type
  1001.         dc.b    0            ;gnm_Pad
  1002.         dc.l    Menu1Name        ;gnm_Label
  1003.         dc.l    0            ;gnm_CommKey
  1004.         dc.w    0            ;gnm_Flags
  1005.         dc.l    0            ;gnm_MutualExclude
  1006.         dc.l    0            ;gnm_UserData
  1007.  
  1008. MNOKNMenu2:    dc.b    NM_ITEM            ;gnm_Type
  1009.         dc.b    0            ;gnm_Pad
  1010.         dc.l    OKMenu1I1Text        ;gnm_Label
  1011.         dc.l    OKCommKey        ;gnm_CommKey
  1012.         dc.w    0            ;gnm_Flags
  1013.         dc.l    0            ;gnm_MutualExclude
  1014.         dc.l    0            ;gnm_UserData
  1015.  
  1016. MNSepMenu2:    dc.b    NM_ITEM            ;gnm_Type
  1017.         dc.b    0            ;gnm_Pad
  1018.         dc.l    NM_BARLABEL        ;gnm_Label
  1019.         dc.l    0            ;gnm_CommKey
  1020.         dc.w    0            ;gnm_Flags
  1021.         dc.l    0            ;gnm_MutualExclude
  1022.         dc.l    0            ;gnm_UserData
  1023.  
  1024. MNCancelNMenu2:    dc.b    NM_ITEM            ;gnm_Type
  1025.         dc.b    0            ;gnm_Pad
  1026.         dc.l    CancelMenu1I1Text    ;gnm_Label
  1027.         dc.l    CancelCommKey        ;gnm_CommKey
  1028.         dc.w    0            ;gnm_Flags
  1029.         dc.l    0            ;gnm_MutualExclude
  1030.         dc.l    0            ;gnm_UserData
  1031.  
  1032.         dc.w    0            ;ITEM_END?
  1033.  
  1034. ;Menu TagList(s)
  1035.  
  1036. MenuTagList:    ;dc.l    GTMN_TextAttr,Topaz
  1037.         dc.l    GTMN_Menu,MNProjectMenu1
  1038.         dc.l    TAG_DONE,0
  1039. MenuTagList2:    ;dc.l    GTMN_TextAttr,Topaz
  1040.         dc.l    GTMN_Menu,MNProjectMenu2
  1041.         dc.l    TAG_DONE,0
  1042.  
  1043.  
  1044. ;IntuiTexts
  1045.  
  1046. AboutTxt1:    dc.b    3,1            ;PENS
  1047.         dc.w    0            ;MODE
  1048.         dc.w    10,10            ;LEFT+TOPEDGE
  1049.         dc.l    0            ;FONT
  1050.         dc.l    AboutText1        ;TEXT
  1051.         dc.l    AboutTxt2        ;NEXTTEXT
  1052.         
  1053. AboutTxt2:    dc.b    3,2            ;PENS
  1054.         dc.w    4            ;MODE
  1055.         dc.w    10,20            ;LEFT+TOPEDGE
  1056.         dc.l    0            ;FONT
  1057.         dc.l    AboutText2        ;TEXT
  1058.         dc.l    AboutTxt3        ;NEXTTEXT
  1059.  
  1060. AboutTxt3:    dc.b    3,1            ;PENS
  1061.         dc.w    4            ;MODE
  1062.         dc.w    10,30            ;LEFT+TOPEDGE
  1063.         dc.l    0            ;FONT
  1064.         dc.l    AboutText3        ;TEXT
  1065.         dc.l    AboutTxt4        ;NEXTTEXT
  1066.  
  1067. AboutTxt4:    dc.b    3,1            ;PENS
  1068.         dc.w    4            ;MODE
  1069.         dc.w    10,50            ;LEFT+TOPEDGE
  1070.         dc.l    0            ;FONT
  1071.         dc.l    AboutText4        ;TEXT
  1072.         dc.l    0            ;NEXTTEXT
  1073.  
  1074. OKTxt:        dc.b    1,2            ;PENS
  1075.         dc.w    0            ;MODE
  1076.         dc.w    1,1            ;LEFT+TOPEDGE
  1077.         dc.l    0            ;FONT
  1078.         dc.l    OKText1            ;TEXT
  1079.         dc.l    0            ;NEXTTEXT
  1080.  
  1081. CancelTxt:    dc.b    1,2            ;PENS
  1082.         dc.w    0            ;MODE
  1083.         dc.w    1,1            ;LEFT+TOPEDGE
  1084.         dc.l    0            ;FONT
  1085.         dc.l    CancelText1        ;TEXT
  1086.         dc.l    0            ;NEXTTEXT
  1087.  
  1088. VisitorsTxt1:    dc.b    1,2            ;PENS
  1089.         dc.w    0            ;MODE
  1090.         dc.w    1,10            ;LEFT+TOPEDGE
  1091.         dc.l    0            ;FONT
  1092.         dc.l    VisitorsText1        ;TEXT
  1093.         dc.l    0            ;NEXTTEXT
  1094.  
  1095. ;Border structures
  1096.  
  1097. Border1:    dc.w    0        ;Initial offsets from the origin
  1098.         dc.w    0        ;LeftEdge and TopEdge
  1099.         dc.b    1,0        ;Pens
  1100.         dc.b    1        ;Draw Mode
  1101.         dc.b    5        ;Line Count (XY)
  1102.         dc.l    BorderXY1    ;XY's
  1103.         dc.l    0        ;Next Border
  1104.  
  1105. BorderXY1:    dc.w    0,0
  1106.         dc.w    55,0
  1107.         dc.w    55,10
  1108.         dc.w    0,10
  1109.         dc.w    0,0
  1110.  
  1111.         Section    SB,DATA,CHIP
  1112.  
  1113.         ds.w    0
  1114.  
  1115. ClockPointer1:    dc.w    $0000,$0000
  1116.         dc.w    $0400,$07C0,$0000,$07C0,$0100,$0380,$0000,$07E0
  1117.         dc.w    $07C0,$1FF8,$1FF0,$3FEC,$3FF8,$7FDE,$3FF8,$7FBE
  1118.         dc.w    $7FFC,$FF7F,$7EFC,$FFFF,$7FFC,$FFFF,$3FF8,$7FFE
  1119.         dc.w    $3FF8,$7FFE,$1FF0,$3FFC,$07C0,$1FF8,$0000,$07E0
  1120.         dc.w    $0000,$0000
  1121.  
  1122.         END
  1123.