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