home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / commodities / huntwindows / huntwindows.s < prev   
Text File  |  1993-04-26  |  41KB  |  1,981 lines

  1.              output    work:huntwindows
  2.             OPT o+,ow-
  3.             ;no includes - i use them all preassembled!
  4.  
  5.             ;.... nearly all ....
  6.  
  7.             incdir    "sys:devpac/include/"
  8.             include "workbench/startup.i"
  9.             include "workbench/workbench.i"
  10.             include    "workbench/icon_lib.i"
  11.             include    "libraries/commodities.i"
  12.             include    "graphics/view.i"
  13.  
  14. ;TODO:
  15. ;Hotkey for GUI
  16.  
  17. ;BUGS:
  18. ;SOMETIMES... there is a guru at closedown
  19.     
  20.             ;Some helpful macros
  21. CALL            macro
  22.             jsr    _LVO\1(a6)
  23.             endm
  24. Push            macro
  25.             movem.l    \1,-(sp)
  26.             endm
  27. Pull            macro
  28.             movem.l    (sp)+,\1
  29.             endm
  30. RSave            macro
  31.             movem.l    a0-a6/d0-d7,-(sp)
  32.             endm
  33. RLoad            macro
  34.             movem.l    (sp)+,a0-a6/d0-d7
  35.             endm
  36.  
  37. MaxScreens        equ    64    ;Maximum of 64 Screens - who has more?
  38. ScreenMemSize        equ    MaxScreens*8    
  39.  
  40.         ;Bits for Communication
  41. SignalWindow        equ    0
  42. SignalScreen        equ    1
  43. SignalButton        equ    2
  44.  
  45.  
  46.  
  47. MyHotkeyID    =    1
  48. MyCustomID    =    2
  49.  
  50.             RSave
  51.  
  52.             move.l    $04,a6
  53.             move.l    #AllocLength,d0
  54.             move.l    #MEMF_CLEAR,d1
  55.             CALL    AllocMem
  56.             move.l    d0,a4
  57.             tst.l    d0
  58.             beq    EndeRaus
  59.  
  60.             move.l    d0,RememberA4
  61.             move.l    a7,RememberStack
  62.  
  63.             lea    intuition(pc),a1
  64.             moveq.l    #37,d0
  65.             CALL    OpenLibrary
  66.             move.l    d0,IntBase(a4)
  67.             beq    Error2
  68.  
  69.             lea    DosName(pc),a1
  70.             moveq.l    #37,d0
  71.             CALL    OpenLibrary    
  72.             move.l    d0,DosBase(a4)
  73.             beq    Error2
  74.  
  75.             lea    GadName(pc),a1
  76.             moveq.l    #37,d0
  77.             CALL    OpenLibrary
  78.             move.l    d0,GadBase(a4)
  79.             beq    Error2
  80.  
  81.             lea    CommName(pc),a1
  82.             moveq.l    #37,d0
  83.             CALL    OpenLibrary
  84.             move.l    d0,CommBase(a4)
  85.             beq    Error2
  86.  
  87.             CALL    CreateMsgPort
  88.             move.l    d0,MouseMsgPort(a4)
  89.             beq    Error2
  90.  
  91.             move.l    #SIGBREAKF_CTRL_C,SignalMask(a4)
  92.  
  93.             move.l    d0,a0
  94.             move.l    #IOSTD_SIZE,d0
  95.             CALL    CreateIORequest
  96.             move.l    d0,MyIORequest(a4)
  97.             beq    Error2
  98.  
  99.             lea    InputName(pc),a0
  100.             moveq.l    #0,d0
  101.             move.l    MyIORequest(a4),a1
  102.             moveq.l    #0,d1
  103.             CALL    OpenDevice
  104.             tst.l    d0
  105.             bne    Error2
  106.  
  107.             lea    IconName(pc),a1
  108.             moveq.l    #33,d0
  109.             CALL    OpenLibrary
  110.             move.l    d0,IconBase(a4)
  111.             beq    Error2
  112.  
  113.             move.l    ThisTask(a6),a1
  114.             move.l    a1,OwnTask(a4)
  115.             tst.l    pr_CLI(a1)
  116.             bne    CliStart
  117.             lea    pr_MsgPort(a1),a2
  118.             move.l    a2,a0
  119.             CALL    WaitPort
  120.             move.l    a2,a0
  121.             CALL    GetMsg
  122.             move.l    d0,WBMessage(a4)
  123.             move.l    d0,a3
  124.         
  125.             move.l    sm_ArgList(a3),d7
  126.             beq    DisableSave
  127.             move.l    d7,a0
  128.             move.l    wa_Lock(a0),d1
  129.             move.l    DosBase(a4),a6
  130.             CALL    CurrentDir
  131.  
  132.             move.l    IconBase(a4),a6
  133.             move.l    d7,a0
  134.             move.l    wa_Name(a0),a0
  135.             CALL    GetDiskObject
  136.             move.l    d0,DObject(a4)
  137.             beq    Error2
  138.  
  139.             lea    WBTemplate(pc),a3
  140.  
  141.             move.l    d0,a0
  142.             move.l    do_ToolTypes(a0),a0
  143.             
  144. GetEmLoop        tst.l    (a3)
  145.             beq.s    FreeDobj
  146.             move.l    TemplateText(a3),a1
  147.             beq.s    FreeDobj
  148.             move.l    a0,-(sp)
  149.             CALL    FindToolType
  150.             move.l    (sp)+,a0
  151.             sub.l    a2,a2
  152.             move.w    TemplateA4(a3),a2
  153.             add.l    a4,a2
  154.             move.l    d0,(a2)
  155.             add.l    #TemplateSize,a3
  156.             bra.s    GetEmLoop
  157.  
  158. FreeDobj        bsr    BuildPatterns
  159.  
  160.             bra.s    SkipReadArgs
  161.  
  162. CliStart        move.l    DosBase(a4),a6
  163.  
  164.             move.l    #Template,d1
  165.             lea    TemplateArray(a4),a0
  166.             move.l    a0,d2
  167.             moveq.l    #0,d3
  168.             CALL    ReadArgs    ;Get options
  169.             tst.l    d0
  170.             beq    Error2
  171.             move.l    d0,Args(a4)
  172.     
  173.             bsr    BuildPatterns
  174.  
  175. DisableSave        move.l    #1,TempSave(a4)
  176.  
  177. SkipReadArgs        move.l    $04,a6
  178.             lea    GraphicsName(pc),a1
  179.             moveq.l    #36,d0
  180.             CALL    OpenLibrary
  181.             move.l    d0,GraphicsBase(a4)
  182.             beq    Error2
  183.  
  184.             tst.l    TempHADJ(a4)
  185.             beq    GotIt1
  186.             move.l    TempHADJ(a4),a0
  187.             bsr    GetNexta0
  188.             clr.l    TempHADJ(a4)
  189.             cmp.b    #"l",d0
  190.             beq.s    GotIt1
  191.             add.l    #1,TempHADJ(a4)
  192.             cmp.b    #"r",d0
  193.             beq.s    GotIt1
  194.             add.l    #1,TempHADJ(a4)
  195.             cmp.b    #"c",d0
  196.             beq.s    GotIt1
  197.             add.l    #1,TempHADJ(a4)
  198.  
  199. GotIt1            tst.l    TempVADJ(a4)
  200.             beq    GotIt2
  201.             move.l    TempVADJ(a4),a0
  202.             bsr    GetNexta0
  203.             clr.l    TempVADJ(a4)
  204.             cmp.b    #"t",d0
  205.             beq.s    GotIt2
  206.             add.l    #1,TempVADJ(a4)
  207.             cmp.b    #"b",d0
  208.             beq.s    GotIt2
  209.             add.l    #1,TempVADJ(a4)
  210.             cmp.b    #"c",d0
  211.             beq.s    GotIt2
  212.             add.l    #1,TempVADJ(a4)
  213.  
  214. GotIt2            tst.l    TempCXPRI(a4)
  215.             beq.s    GotIt3
  216.             move.l    TempCXPRI(a4),a0
  217.             bsr    GetNexta0
  218.             bsr    GetInteger
  219.             move.l    d0,TempCXPRI(a4)
  220.             move.b    d0,MyPri
  221.  
  222. GotIt3            move.l    $04,a6
  223.             CALL    CreateMsgPort
  224.             move.l    d0,BrokerPort
  225.             move.l    d0,MyPort(a4)
  226.             move.l    d0,a0
  227.             move.b    MP_SIGBIT(a0),d0
  228.             move.l    SignalMask(a4),d1    ;Enter signal into
  229.             bset    d0,d1            ;mask for waiting
  230.             move.l    d1,SignalMask(a4)
  231.  
  232.             move.l    CommBase(a4),a6
  233.             lea    MyNewBroker(pc),a0
  234.             clr.l    d0
  235.             CALL    CxBroker
  236.             tst.l    d0
  237.             beq    QuitPrg
  238.             move.l    d0,Broker(a4)
  239.  
  240.             move.l    d0,a0
  241.             moveq.l    #1,d0
  242.             CALL    ActivateCxObj
  243.             
  244.             ;Install Handler for Mouse_Button_test
  245.  
  246.             move.l    #CX_CUSTOM,d0
  247.             lea    TestButton(pc),a0    ;My Program
  248.             move.l    #MyCustomID,a1        ;ID
  249.             CALL    CreateCxObj
  250.             move.l    d0,a1
  251.             tst.l    d0
  252.             beq    QuitPrg
  253.             move.l    Broker(a4),a0
  254.             CALL    AttachCxObj
  255.  
  256.             bsr    InstallHotKey
  257.  
  258.             move.l    $04,a6
  259.                     moveq   #-1,d0            ;A Signal for telling
  260.                     jsr     _LVOAllocSignal(a6)    ;our task that sth happened
  261.                     tst.l   d0
  262.                     bmi     Error2
  263.                     move.l  d0,Signal(a4)
  264.             move.l    SignalMask(a4),d1
  265.                     bset    d0,d1
  266.                     move.l    d1,SignalMask(a4)
  267.  
  268.             lea    MyInterrupt(a4),a1
  269.             move.l    #Interrupt3,IS_CODE(a1)
  270.             clr.l    IS_DATA(a1)
  271.             move.b    #NT_INTERRUPT,LN_TYPE(a1)
  272.             move.b    #0,LN_PRI(a1)
  273.             move.l    #HandlerName,LN_NAME(a1)
  274.             move.l    #5,d0            ;INTB_VERTB
  275.             jsr    _LVOAddIntServer(a6)
  276.  
  277.             tst.l    TempCXPOPUP(a4)
  278.             beq.s    WaitOn
  279.             bsr    OpenGUI
  280.  
  281. WaitOn            tst.w    QuitMe(a4)
  282.             bne    QuitPrg
  283.  
  284.             move.l    $04,a6
  285.             move.l    SignalMask(a4),d0    ;Wait for Port and Break
  286.             CALL    Wait
  287.             btst    #SIGBREAKB_CTRL_C,d0    ;This means quit
  288.             bne    QuitPrg
  289.             move.l    Signal(a4),d1
  290.             btst    d1,d0            ;Signal from Interrupt?
  291.             beq.s    TryNextMsg
  292.  
  293.             tst.w    DisableHW(a4)
  294.             bne.s    TryNextMsg        ;Do nothing
  295.  
  296.             tst.w    ButtonPressed(a4)
  297.             bne.s    TryNextMsg        ;Omit that stuff for now
  298.             bclr    #SignalButton,What(a4)    ;We will get a signal when
  299.                             ;the button will be released
  300.             move.l    IntBase(a4),a0
  301.             btst    #SignalWindow,What(a4)
  302.             beq.s    NoWindowStuff
  303.             
  304.             move.l    ib_ActiveWindow(a0),a0
  305.             bsr    DoYourJob
  306.             bclr    #SignalWindow,What(a4)
  307.  
  308. NoWindowStuff        btst    #SignalScreen,What(a4)
  309.             beq.s    TryNextMsg
  310.             move.l    IntBase(a4),a0
  311.             move.l    ib_FirstScreen(a0),a0
  312.             bsr    AdjustScreen
  313.             bclr    #SignalScreen,What(a4)
  314.  
  315. TryNextMsg        move.l    MyPort(a4),a0        ;Get the message awaiting
  316.             CALL    GetMsg
  317.             tst.l    d0
  318.             bne.s    GotMsg
  319.             bsr    CheckGUI
  320.             bra    WaitOn
  321.  
  322. GotMsg            move.l    d0,a3
  323.             move.l    d0,a0
  324.             move.l    CommBase(a4),a6
  325.             CALL    CxMsgType
  326.             move.l    d0,d6
  327.             move.l    a3,a0
  328.             CALL    CxMsgID
  329.             move.l    d0,d5
  330.             move.l    a3,a1
  331.             move.l    $04,a6
  332.             CALL    ReplyMsg
  333.             cmp.w    #CXM_IEVENT,d6
  334.             bne.s    OtherCommand
  335.             bsr    OpenGUI
  336.  
  337. OtherCommand        cmp.w    #CXM_COMMAND,d6
  338.             bne    WaitOn
  339.  
  340.             cmp.w    #CXCMD_DISABLE,d5
  341.             bne.s    OtherI1
  342.             move.w    #1,DisableHW(a4)
  343.  
  344. OtherI1            cmp.w    #CXCMD_ENABLE,d5
  345.             bne.s    OtherI2
  346.             clr.w    DisableHW(a4)
  347.  
  348. OtherI2            cmp.w    #CXCMD_UNIQUE,d5
  349.             beq.s    OtherII
  350.             cmp.w    #CXCMD_APPEAR,d5
  351.             bne.s    OtherI3
  352. OtherII            bsr    OpenGUI
  353.  
  354. OtherI3            cmp.w    #CXCMD_DISAPPEAR,d5
  355.             bne.s    OtherI4
  356.             bsr    CloseGUI
  357.  
  358. OtherI4            cmp.w    #CXCMD_KILL,d5
  359.             beq    QuitPrg
  360.  
  361.             bra    TryNextMsg
  362.  
  363. Error2            lea    Text1(pc),a0        ;Seems there is an error
  364.             bsr    OpenRequester        ;in the given arguments
  365.             bra.s    QuitPrg
  366.  
  367. EndeRaus2        lea    Text2(pc),a0        ;Wrong Kickstart
  368.             bsr    PrintText
  369.  
  370. QuitPrg            move.l    RememberStack,a7
  371.             bsr    CloseGUI
  372.             move.l    $04,a6    
  373.             move.l    #5,d0
  374.             lea    MyInterrupt(a4),a1
  375.             tst.l    IS_CODE(a1)
  376.             beq.s    NoHandler
  377.             CALL    RemIntServer        ;Remove the Interrupt-Server
  378.  
  379. NoHandler        tst.l    MyIORequest(a4)
  380.             beq.s    NoDevIO
  381.             move.l    MyIORequest(a4),a1
  382.             CALL    CloseDevice
  383.             move.l    MyIORequest(a4),a0
  384.             CALL    DeleteIORequest    
  385. NoDevIO            tst.l    MouseMsgPort(a4)
  386.             beq.s    NoMouseMsg
  387.  
  388.             move.l    MouseMsgPort(a4),a0
  389.             bsr    CloseMsgPort
  390.  
  391. NoMouseMsg        move.l    IconBase(a4),a6
  392.             tst.l    DObject(a4)
  393.             beq.s    SkipFreeDobj
  394.             move.l    DObject(a4),a0
  395.             CALL    FreeDiskObject
  396.  
  397. SkipFreeDobj        move.l    $04,a6
  398.             move.l    Signal(a4),d0        ;Free the signal
  399.             beq.s    DontFreeS
  400.                     CALL    FreeSignal
  401.  
  402. DontFreeS        tst.l    Args(a4)
  403.             beq.s    HmmNoArgs
  404.             move.l    DosBase(a4),a6
  405.             move.l    Args(a4),d1
  406.             CALL    FreeArgs
  407.  
  408. HmmNoArgs        bsr    RemovePopKey
  409.  
  410.             tst.l    Broker(a4)
  411.             beq.s    NoCX
  412.             move.l    CommBase(a4),a6
  413.             move.l    Broker(a4),a0
  414.             CALL    DeleteCxObjAll
  415.  
  416. NoCX            move.l    $04,a6
  417.             tst.l    MyPort(a4)
  418.             beq.s    NoPort
  419.             move.l    MyPort(a4),a0
  420.             bsr    CloseMsgPort
  421.  
  422. NoPort            move.l    IntBase(a4),d0        ;Close librarys
  423.             beq.s    ErrorX2
  424.             move.l    d0,a1
  425.             CALL    CloseLibrary
  426.  
  427. ErrorX2            move.l    GraphicsBase(a4),d0
  428.             beq.s    ErrorX1
  429.             move.l    d0,a1
  430.             CALL    CloseLibrary
  431.  
  432. ErrorX1            move.l    IconBase(a4),d0
  433.             beq.s    NoIconLib
  434.             move.l    d0,a1
  435.             CALL    CloseLibrary
  436.             
  437. NoIconLib        move.l    CommBase(a4),d0
  438.             beq.s    NoCommLib
  439.             move.l    d0,a1
  440.             CALL    CloseLibrary
  441.  
  442. NoCommLib        move.l    GadBase(a4),d0
  443.             beq.s    OnlyDOS
  444.             move.l    d0,a1
  445.             CALL    CloseLibrary
  446.  
  447. OnlyDOS            move.l    DosBase(a4),d0
  448.             beq.s    FreeOnly
  449.             move.l    d0,a1
  450.             CALL    CloseLibrary
  451.  
  452. FreeOnly        move.l    ScreenPatLen(a4),d0
  453.             beq.s    NoScreenPat
  454.             move.l    ScreenPattern(a4),a1
  455.             CALL    FreeMem
  456.  
  457. NoScreenPat        move.l    WindowPatLen(a4),d0
  458.             beq.s    NoWindowPat
  459.             move.l    WindowPattern(a4),a1
  460.             CALL    FreeMem
  461.  
  462. NoWindowPat        move.l    WBMessage(a4),d7
  463.             move.l    a4,a1
  464.             move.l    #AllocLength,d0
  465.             CALL    FreeMem            
  466.  
  467.             move.l    d7,a1
  468.             tst.l    d7
  469.             beq.s    EndeRaus
  470.             CALL    Forbid
  471.             CALL    ReplyMsg
  472.  
  473. EndeRaus        RLoad
  474.             moveq.l    #0,d0
  475.             rts
  476.  
  477. CloseMsgPort        move.l    a0,a3
  478. ClosePortRout        move.l    a3,a0
  479.             CALL    GetMsg
  480.             tst.l    d0
  481.             beq.s    NoMsgLeft
  482.             move.l    d0,a1
  483.             CALL    ReplyMsg
  484.             bra.s    ClosePortRout
  485. NoMsgLeft        move.l    a3,a0
  486.             CALL    DeleteMsgPort        ;and free it
  487.             rts
  488.  
  489.  
  490.             ;Subroutine to print a text to stdout
  491. PrintText        Push    d0-d4/a0-a1/a6
  492.             move.l    a0,a1
  493.             moveq.l    #0,d0
  494. TestLen            tst.b    (a1)+
  495.             beq.s    LaengeOk
  496.             addq    #1,d0
  497.             bra.s    TestLen
  498. LaengeOk        move.l    $04,a6
  499.             lea    DosName(pc),a1
  500.             moveq.l    #0,d0
  501.             CALL    OpenLibrary    
  502.             move.l    d0,DosBase(a4)
  503.             beq    SkipWrite
  504.             move.l    d0,a6
  505.             move.l    a0,d2
  506.             move.l    d0,d3
  507.             CALL    Output
  508.             move.l    d0,d1
  509.             beq.s    SkipWrite
  510.             CALL    Write
  511. SkipWrite        Pull    d0-d4/a0-a1/a6
  512.             rts
  513.  
  514.             ;MainPart: does the scrolling if necessary
  515.             ;Gets window in a0
  516. DoYourJob        RSave
  517.             move.l    a0,d0        ;No Window - let it be!
  518.             beq    LeaveIt
  519.             move.l    a0,a5
  520.  
  521.             move.l    wd_WScreen(a5),a3
  522.             
  523.             move.l    DosBase(a4),a6
  524.  
  525.             tst.b    ScreenPatternMem(a4)
  526.             beq.s    NoMatter2
  527.             move.l    ScreenPattern(a4),d1
  528.             move.l    sc_DefaultTitle(a3),d2
  529.             CALL    MatchPatternNoCase
  530.             beq    LeaveIt
  531.  
  532. NoMatter2        tst.b    WindowPatternMem(a4)
  533.             beq.s    NoMatter3
  534.             move.l    WindowPattern(a4),d1
  535.             move.l    wd_Title(a5),d2
  536.             CALL    MatchPatternNoCase
  537.             beq    LeaveIt
  538.  
  539. NoMatter3        move.l    a3,a0
  540.             move.l    a5,d0
  541.             bsr    RememberWindow
  542. NoInterest        move.l    a0,d0        ;Screen not valid? - let it be!
  543.             beq    LeaveIt
  544.  
  545.  
  546. NoMatter        move.l    GraphicsBase(a4),a6    ;Get the visible size
  547.             lea    sc_ViewPort(a3),a0    ;of the screen to
  548.             move.l    vp_ColorMap(a0),a0
  549.             ;lea    VideoConTags,a1
  550.             move.l    cm_vpe(a0),a0    ;extra
  551.             ;CALL    VideoControl
  552.             ;tst.l    d0
  553.             ;bne    LeaveIt
  554.             ;lea    (ViewPortExt+vpe_DisplayClip)(pc),a0
  555.             lea    vpe_DisplayClip(a0),a0 ;extra
  556.  
  557. ;REMARK: Due to an error in OS3 I cannot use the system-friendly way which would be:
  558. ;    -Decomment all comments above
  559. ;    -Decomment the TagList at Label ";VideoConTags"
  560. ;    -Decomment the Structure at Label ";ViewPortExt"
  561. ;    -Comment the lines with the comment ";extra"
  562.  
  563.             move.w    ra_MaxX(a0),d0
  564.             sub.w    ra_MinX(a0),d0
  565.             addq    #1,d0
  566.             move.w    d0,VisualX(a4)
  567.             move.w    sc_LeftEdge(a3),d0
  568.             sub.w    ra_MinX(a0),d0
  569.             move.w    d0,PositionX(a4)
  570.  
  571.             move.w    ra_MaxY(a0),d0
  572.             sub.w    ra_MinY(a0),d0
  573.             addq    #1,d0
  574.             move.w    d0,VisualY(a4)
  575.             move.w    sc_TopEdge(a3),d0
  576.             sub.w    ra_MinY(a0),d0
  577.             move.w    d0,PositionY(a4)
  578.  
  579.             move.l    a3,a0
  580.             move.l    IntBase(a4),a6
  581.             tst.l    TempSFront(a4)        ;do we want screentofront?
  582.             beq.s    NoFront
  583.             cmp.l    ib_FirstScreen(a6),a0
  584.             beq.s    NoFront            ;Not necessary (optimize!)
  585.             CALL    ScreenToFront
  586.             bset    #SignalScreen,What(a4)    ;ScreenChange!
  587.  
  588. NoFront            move.l    wd_Flags(a5),d0
  589.             and.l    #WFLG_BACKDROP,d0
  590.             bne    LeaveIt            ;Not with backdrops!
  591.  
  592.             tst.l    TempWFront(a4)        ;do we WindowToFront() ?
  593.             beq.s    NoFront2
  594.             move.l    a5,a0
  595.             CALL    WindowToFront
  596.  
  597. NoFront2        tst.l    TempMove(a4)
  598.             beq    LeaveIt
  599.  
  600.             move.l    wd_WScreen(a5),a0    
  601.             moveq.l    #0,d7
  602.             moveq.l    #0,d6
  603.             moveq.l    #0,d0
  604.             moveq.l    #0,d2
  605.             move.w    wd_LeftEdge(a5),d0
  606.             add.w    wd_Width(a5),d0
  607.             move.w    PositionX(a4),d2
  608.             neg.w    d2
  609.             add.w    VisualX(a4),d2
  610.             sub.w    d0,d2
  611.             beq.s    SeemsOk2
  612.             bpl.s    SeemsOk
  613.             move.w    d2,d7        ;MOVEX!
  614.             ext.l    d7
  615. SeemsOk            move.w    wd_LeftEdge(a5),d0
  616.             move.w    PositionX(a4),d2
  617.             neg.w    d2
  618.             sub.w    d2,d0
  619.             bne.s    TestAgain
  620.             moveq.l    #0,d7
  621. TestAgain        bpl.s    SeemsOk2
  622.             move.w    d0,d7        ;MOVEX!    - Prefer Leftedge
  623.             ext.l    d7
  624.             neg.l    d7
  625. SeemsOk2        move.w    wd_TopEdge(a5),d0
  626.             move.w    PositionY(a4),d2
  627.             neg.w    d2
  628.             sub.w    d2,d0
  629.             beq.s    SeemsOk4
  630.             bpl.s    SeemsOk3
  631.             move.w    d0,d6
  632.             ext.l    d6        ;MOVEY!
  633.             neg.l    d6
  634. SeemsOk3        move.w    wd_TopEdge(a5),d0
  635.             add.w    wd_Height(a5),d0
  636.             move.w    PositionY(a4),d2
  637.             neg.w    d2
  638.             add.w    VisualY(a4),d2
  639.             sub.w    d0,d2
  640.             bne.s    TestAgain2
  641.             moveq.l    #0,d6
  642. TestAgain2        bpl.s    SeemsOk4
  643.             move.w    d2,d6        ;MOVEY! - Prefer bottom
  644.             ext.l    d6
  645. SeemsOk4        tst.l    TempAlways(a4)
  646.             bne.s    DOOO
  647.             tst.l    d7
  648.             bne.s    DOOO
  649.             tst.l    d6
  650.             beq    LeaveIt
  651.  
  652. DOOO            move.l    d7,d0
  653.             tst.l    TempAlways(a4)
  654.             bne.s    DoAlways1
  655.             tst.l    d0
  656.             beq.s    NoMoveAny1
  657. DoAlways1        cmp.l    #2,TempHADJ(a4)
  658.             bne.s    NoCentering1
  659.  
  660.             moveq.l    #0,d0
  661.             move.w    wd_Width(a5),d0
  662.             lsr.w    #1,d0
  663.             add.w    wd_LeftEdge(a5),d0
  664.             moveq.l    #0,d2
  665.             move.w    VisualX(a4),d2
  666.             lsr.w    #1,d2
  667.             move.w    PositionX(a4),d3
  668.             neg.w    d3
  669.             add.w    d3,d2
  670.             sub.w    d0,d2
  671.             move.l    d2,d0
  672.             ext.l    d0
  673.             bra    NoMoveAny1
  674.             
  675. NoCentering1        tst.l    TempHADJ(a4)
  676.             bne.s    RightAdj
  677.             moveq.l    #0,d0
  678.             move.w    wd_LeftEdge(a5),d0
  679.             add.w    PositionX(a4),d0
  680.             neg.w    d0
  681.             ext.l    d0
  682.             bra.s    NoMoveAny1
  683.  
  684. RightAdj        cmp.l    #1,TempHADJ(a4)
  685.             bne.s    NoMoveAny1
  686.             move.w    wd_LeftEdge(a5),d0
  687.             add.w    wd_Width(a5),d0
  688.             move.w    PositionX(a4),d2
  689.             neg.w    d2
  690.             add.w    VisualX(a4),d2
  691.             sub.w    d0,d2
  692.             move.l    d2,d0
  693.             ext.l    d0
  694.  
  695. NoMoveAny1        move.l    d6,d1
  696.             tst.l    TempAlways(a4)
  697.             bne.s    DoAlways2
  698.             tst.l    d1
  699.             beq.s    NoMoveAny2
  700. DoAlways2        cmp.l    #2,TempVADJ(a4)
  701.             bne.s    NoCentering2
  702.  
  703.             moveq.l    #0,d1
  704.             move.w    wd_Height(a5),d1
  705.             lsr.w    #1,d1
  706.             add.w    wd_TopEdge(a5),d1
  707.             moveq.l    #0,d2
  708.             move.w    VisualY(a4),d2
  709.             lsr.w    #1,d2
  710.             move.w    PositionY(a4),d3
  711.             neg.w    d3
  712.             add.w    d3,d2
  713.             sub.w    d1,d2
  714.             move.l    d2,d1
  715.             ext.l    d1
  716.             bra    NoMoveAny2
  717.  
  718. NoCentering2        tst.l    TempVADJ(a4)
  719.             bne.s    BotAdj
  720.             moveq.l    #0,d1
  721.             move.w    wd_TopEdge(a5),d1
  722.             add.w    PositionY(a4),d1
  723.             neg.w    d1
  724.             ext.l    d1
  725.             bra.s    NoMoveAny2
  726.  
  727. BotAdj            cmp.l    #1,TempVADJ(a4)
  728.             bne.s    NoMoveAny2
  729.             move.w    wd_TopEdge(a5),d1
  730.             add.w    wd_Height(a5),d1
  731.             move.w    PositionY(a4),d2
  732.             neg.w    d2
  733.             add.w    VisualY(a4),d2
  734.             sub.w    d1,d2
  735.             move.l    d2,d1
  736.             ext.l    d1
  737.  
  738. NoMoveAny2        move.w    sc_TopEdge(a0),d5
  739.             move.w    sc_LeftEdge(a0),d6
  740.             RSave
  741.             CALL    MoveScreen
  742.             RLoad
  743.             sub.w    sc_TopEdge(a0),d5    ;Find out how far the
  744.             sub.w    sc_LeftEdge(a0),d6    ;screen really moves
  745.             move.l    d6,d0
  746.             move.l    d5,d1
  747.             neg.l    d0
  748.             neg.l    d1
  749.  
  750.             tst.l    TempMoveMouse(a4)
  751.             beq.s    LeaveIt
  752.  
  753.             ;If a window becomes active without clicking, the Mouse
  754.             ;can be out of range, and moving it would scroll the
  755.             ;Screen back, so we check this here and disable movement
  756.             ;if "dangerous"
  757.             move.w    sc_MouseX(a0),d2
  758.             add.w    sc_LeftEdge(a0),d2
  759.             add.w    d0,d2            ;Movement in X
  760.             bmi.s    ClearXMovement
  761.             cmp.w    VisualX(a4),d2
  762.             bcs.s    LeaveXMovement
  763. ClearXMovement        moveq.l    #0,d0
  764. LeaveXMovement        move.w    sc_MouseY(a0),d2
  765.             add.w    sc_TopEdge(a0),d2
  766.             add.w    d1,d2            ;Movement in Y
  767.             bmi.s    ClearYMovement
  768.             cmp.w    VisualY(a4),d2
  769.             bcs.s    LeaveYMoveMent
  770. ClearYMovement        moveq.l    #0,d1
  771. LeaveYMoveMent        bsr    SetPointer
  772. LeaveIt            RLoad
  773.             rts
  774.  
  775.             ;ScreenID in a0
  776. AdjustScreen        RSave
  777.             move.l    a0,a3
  778.             tst.b    ScreenPatternMem(a4)
  779.             beq.s    NoMatter5
  780.             move.l    ScreenPattern(a4),d1
  781.             move.l    sc_DefaultTitle(a3),d2
  782.             move.l    DosBase(a4),a6
  783.             CALL    MatchPatternNoCase
  784.             beq    SkipActive
  785.             move.l    a3,a0
  786.  
  787. NoMatter5        tst.l    TempPDef(a4)    ;Enter FirstScreen as Default
  788.                         ;PublicScreen ?
  789.             beq.s    Skip_NoPub
  790.             bsr    GetPubFromID
  791.             move.l    a0,d0
  792.             beq.s    Skip_NoPub
  793.             move.l    IntBase(a4),a6
  794.             CALL    SetDefaultPubScreen
  795.  
  796. Skip_NoPub        move.l    a3,a0
  797.             tst.l    TempRemWin(a4)    ;Activate a Window on the new
  798.                         ;Screen?
  799.             beq.s    SkipActive
  800.             bsr    GetScreenWindow
  801.             tst.l    d0
  802.             bne.s    FoundActive
  803.  
  804.             move.l    sc_FirstWindow(a0),d0    ;Take Firstwindow if none
  805.             beq.s    SkipActive        ;known
  806.  
  807. FoundActive        move.l    d0,a5
  808.             tst.b    WindowPatternMem(a4)
  809.             beq.s    NoMatter4
  810.             move.l    WindowPattern(a4),d1
  811.             move.l    wd_Title(a5),d2
  812.             move.l    DosBase(a4),a6
  813.             CALL    MatchPatternNoCase
  814.             beq    SkipActive
  815. NoMatter4        move.l    a5,a0
  816.             move.l    IntBase(a4),a6
  817.             CALL    ActivateWindow
  818. SkipActive        RLoad
  819.             rts
  820.  
  821.         ;a0=Screen         Back:d0=Window
  822. GetScreenWindow        Push    a1/d1
  823.             lea    ScreenMem(a4),a1
  824.             move.w    #MaxScreens-1,d1
  825. ScreenFindLoop        cmp.l    (a1),a0
  826.             beq.s    FoundScreen
  827.             lea    8(a1),a1
  828.             dbf    d1,ScreenFindLoop
  829. FoundScreen        move.l    4(a1),d0
  830.             bsr    TestWindowOnScreen
  831.             Pull    a1/d1
  832.             rts
  833.  
  834.         ;a0=Screen d0=Window
  835. RememberWindow        Push    a1-a3/a6/d1
  836.             move.l    IntBase(a4),a6
  837.             lea    ScreenMem(a4),a1
  838.             move.w    #MaxScreens-1,d1
  839. ScreenFindLoop2        tst.l    (a1)
  840.             beq.s    FoundEmpty
  841.             move.l    (a1),a2
  842.             cmp.l    a0,a2
  843.             beq.s    FoundEmpty    ;because Identical
  844.  
  845.             move.l    ib_FirstScreen(a6),a3
  846. CheckAllScreens        cmp.l    a3,a2
  847.             beq    ScreenValid
  848.             move.l    sc_NextScreen(a3),a3
  849.             cmp.l    #0,a3
  850.             bne.s    CheckAllScreens
  851.             bra.s    FoundEmpty    ;because Entry is invalid
  852.  
  853. ScreenValid        lea    8(a1),a1
  854.             dbf    d1,ScreenFindLoop2
  855.             ;Reaching this Point our List is full of valid
  856.             ;Screens - not the best thing, but we simply ignore...
  857.             bra.s    IgnoreOver
  858. FoundEmpty        move.l    a0,(a1)
  859.             move.l    d0,4(a1)
  860. IgnoreOver        Pull    a1-a3/a6/d1
  861.             rts
  862.  
  863.         ;d0=Window , a0=Screen    =Back: d0=0 no window
  864. TestWindowOnScreen    tst.l    d0
  865.             beq.s    NotWindow
  866.             move.l    sc_FirstWindow(a0),a1
  867. WindowListOn        cmp.l    d0,a1
  868.             beq.s    WindowIsOK
  869.             move.l    wd_NextWindow(a1),a1
  870.             cmp.l    #0,a1
  871.             bne.s    WindowListOn
  872. NotWindow        clr.l    d0
  873.             rts
  874. WindowIsOK        move.l    a1,d0
  875.             rts
  876.  
  877.             ;ScreenID in a0    ;Return a0=PubScreenName or Zero
  878. GetPubFromID        Push    d0/a3/a6
  879.             move.l    a0,a3
  880.             move.l    IntBase(a4),a6
  881.             CALL    LockPubScreenList
  882.  
  883. CarryListOn        move.l    d0,a0
  884.             cmp.l    psn_Screen(a0),a3
  885.             beq.s    ScreenFound
  886.             move.l    LN_SUCC(a0),d0
  887.             bne.s    CarryListOn
  888.             sub.l    a0,a0
  889.             bra.s    ENDPS
  890.  
  891. ScreenFound        move.l    LN_NAME(a0),a0
  892. ENDPS            move.l    a0,-(sp)
  893.             CALL    UnlockPubScreenList
  894.             move.l    (sp)+,a0
  895.             Pull    d0/a3/a6
  896.             rts
  897.  
  898. Interrupt3        Push    d1-d4/a0-a1/a3/a4/a6
  899.             move.l    RememberA4,a4
  900.             move.l    IntBase(a4),a3
  901.             move.l    Active(a4),d0
  902.             cmp.l    ib_ActiveWindow(a3),d0        ;New ActiveWindow?
  903.             beq.s    DoScreen
  904.             move.l    ib_ActiveWindow(a3),Active(a4)
  905.  
  906.             bsr    SignalMyself
  907.  
  908.             bset    #SignalWindow,What(a4)
  909.             
  910. DoScreen        move.l    FirstSc(a4),d0
  911.             cmp.l    ib_FirstScreen(a3),d0        ;New FirstScreen?
  912.             beq.s    DoNothing
  913.             move.l    ib_FirstScreen(a3),FirstSc(a4)
  914.  
  915.             bsr    SignalMyself
  916.  
  917.             bset    #SignalScreen,What(a4)
  918.  
  919. DoNothing        Pull    d1-d4/a0-a1/a3/a4/a6
  920.             moveq.l    #0,d0
  921.             rts
  922.  
  923. SignalMyself        move.l  $04,a6
  924.             move.l  OwnTask(a4),a1
  925.             move.l  Signal(a4),d1        ;send a signal to move Screen
  926.             moveq.l    #0,d0
  927.             bset    d1,d0
  928.             jmp    _LVOSignal(a6)
  929.  
  930. OpenGUI            RSave
  931.             tst.w    GUIOpened(a4)
  932.             bne    OpenNoGUI
  933.             move.l    IntBase(a4),a6
  934.             sub.l    a0,a0
  935.             CALL    LockPubScreen
  936.             move.l    d0,PublicScreen(a4)
  937.             move.l    d0,StorePublicScreen
  938.  
  939.             move.l    d0,a0
  940.             lea    sc_RastPort(a0),a1
  941.             move.l    a1,PublicRastport(a4)
  942.             lea    TagListDone(pc),a1
  943.             move.l    GadBase(a4),a6
  944.             CALL    GetVisualInfoA
  945.             move.l    d0,MyVisual(a4)
  946.             lea    MyNewGadget(a4),a3
  947.             move.l    d0,gng_VisualInfo(a3)
  948.  
  949.             lea    GadgetList(a4),a0
  950.             CALL    CreateContext
  951.             move.l    d0,Gadget0(a4)
  952.  
  953.             move.l    GraphicsBase(a4),a6
  954.             move.l    PublicRastport(a4),a1
  955.             lea    GUI_Text5(pc),a0
  956.             moveq.l    #GUI_Text6-GUI_Text5-1,d0
  957.             CALL    TextLength
  958.             add.w    #40,d0        ;CheckBox
  959.             lsr.w    #1,d0
  960.             move.w    d0,RemLen(a4)
  961.  
  962.             moveq.l    #1,d0
  963.             add.w    RemLen(a4),d0
  964.             lsl.l    #2,d0
  965.             move.l    d0,StoreInnerWidth
  966.  
  967.             move.l    PublicScreen(a4),a0
  968.             moveq.l    #6,d0
  969.             add.b    sc_WBorLeft(a0),d0
  970.             move.w    d0,RemLeft(a4)
  971.  
  972.             move.l    sc_Font(a0),a1
  973.             move.l    a1,gng_TextAttr(a3)
  974.             moveq.l    #1,d0
  975.             add.b    sc_WBorTop(a0),d0    ;Base (Top)
  976.             move.w    d0,RemTop(a4)
  977.  
  978.             move.w    ta_YSize(a1),d6
  979.             add.w    #4,d6            ;Height of One Line
  980.             move.w    d6,RemHeight(a4)
  981.  
  982.             add.w    #2,d6
  983.             mulu    #10,d6
  984.             add.w    #8,d6
  985.             move.l    d6,StoreInnerHeight
  986.  
  987.             move.l    Gadget0(a4),d7
  988.  
  989.             bsr    DoAllGadgets
  990.  
  991.             move.l    d7,LastGadget(a4)
  992.  
  993.             sub.l    a0,a0
  994.             lea    WindowTagList(pc),a1
  995.             move.l    IntBase(a4),a6
  996.             CALL    OpenWindowTagList
  997.             move.l    d0,MyWindow(a4)
  998.             beq    FailWindow
  999.  
  1000.             move.l    d0,a0
  1001.             bsr    EnterSignal
  1002.             ;move.l    d0,a0
  1003.             move.l    GadgetList(a4),a1
  1004.             moveq.l    #-1,d0
  1005.             moveq.l    #-1,d1
  1006.             sub.l    a2,a2
  1007.             CALL    AddGList
  1008.  
  1009.             move.l    GadgetList(a4),a0
  1010.             move.l    MyWindow(a4),a1
  1011.             moveq.l    #-1,d0
  1012.             sub.l    a2,a2
  1013.             CALL    RefreshGList
  1014.             
  1015.             move.l    GadBase(a4),a6
  1016.             move.l    MyWindow(a4),a0
  1017.             sub.l    a1,a1
  1018.             CALL    GT_RefreshWindow
  1019.  
  1020.             move.w    #1,GUIOpened(a4)
  1021.             RLoad
  1022.             rts
  1023. OpenNoGUI        move.l    IntBase(a4),a6
  1024.             move.l    MyWindow(a4),a0
  1025.             CALL    ActivateWindow
  1026.             RLoad
  1027.             rts
  1028.  
  1029.             rsreset
  1030. MyGadgetText        rs.l    1
  1031. MyGadgetList        rs.l    1
  1032. MyGadgetRowNr        rs.b    1
  1033. MyGadgetXPos        rs.b    1
  1034. MyGadgetWidth        rs.b    1
  1035. MyGadgetFlags        rs.b    1
  1036. MyGadgetStore        rs.w    1
  1037. MyGadgetKind        rs.w    1
  1038. MyGadgetSize        rs.w    1
  1039.             
  1040.             ;    gng_Flags      ,gng_Text ,CreateKind   ,CreateTags
  1041.             ;    gng_TopEdge    ,gng_LeftEdge
  1042. AllGadgets        dc.l    GUI_Text8,CycleTagList
  1043.             dc.b    1,2,2,PLACETEXT_LEFT
  1044.             dc.w    TempHADJ,CYCLE_KIND
  1045.             dc.l    GUI_Text9,CycleTagList2
  1046.             dc.b    2,2,2,PLACETEXT_LEFT
  1047.             dc.w    TempVADJ,CYCLE_KIND
  1048.             dc.l    GUI_Text16,StringTagList
  1049.             dc.b    5,2,2,PLACETEXT_LEFT
  1050.             dc.w    TempCXPOPKEY,STRING_KIND
  1051.             dc.l    GUI_Text12,StringTagList
  1052.             dc.b    3,2,2,PLACETEXT_LEFT
  1053.             dc.w    TempScreen,STRING_KIND
  1054.             dc.l    GUI_Text13,StringTagList
  1055.             dc.b    4,2,2,PLACETEXT_LEFT
  1056.             dc.w    TempWindow,STRING_KIND
  1057.  
  1058.             dc.l    GUI_Text1,GadgetTagList
  1059.             dc.b    6,0,2,PLACETEXT_RIGHT
  1060.             dc.w    TempMove,CHECKBOX_KIND
  1061.             dc.l    GUI_Text2,GadgetTagList
  1062.             dc.b    6,2,2,PLACETEXT_RIGHT
  1063.             dc.w    TempSFront,CHECKBOX_KIND
  1064.             dc.l    GUI_Text3,GadgetTagList
  1065.             dc.b    7,0,2,PLACETEXT_RIGHT
  1066.             dc.w    TempWFront,CHECKBOX_KIND
  1067.             dc.l    GUI_Text5,GadgetTagList
  1068.             dc.b    7,2,2,PLACETEXT_RIGHT
  1069.             dc.w    TempPDef,CHECKBOX_KIND
  1070.             dc.l    GUI_Text6,GadgetTagList
  1071.             dc.b    8,0,2,PLACETEXT_RIGHT
  1072.             dc.w    TempAlways,CHECKBOX_KIND
  1073.             dc.l    GUI_Text7,GadgetTagList
  1074.             dc.b    8,2,2,PLACETEXT_RIGHT
  1075.             dc.w    TempRemWin,CHECKBOX_KIND
  1076.             dc.l    GUI_Text7_1,GadgetTagList
  1077.             dc.b    9,0,2,PLACETEXT_RIGHT
  1078.             dc.w    TempMoveMouse,CHECKBOX_KIND
  1079.             dc.l    GUI_Text7_2,GadgetTagList
  1080.             dc.b    9,2,2,PLACETEXT_RIGHT
  1081.             dc.w    TempCXPOPUP,CHECKBOX_KIND
  1082.  
  1083.             dc.l    GUI_Text10,TagList
  1084.             dc.b    10,0,1,PLACETEXT_IN
  1085.             dc.w    TempZero,BUTTON_KIND
  1086.             dc.l    GUI_Text11,TagList
  1087.             dc.b    10,3,1,PLACETEXT_IN
  1088.             dc.w    TempZero,BUTTON_KIND
  1089. SaveGadgData        dc.l    GUI_Text14,TagList
  1090.             dc.b    10,1,1,PLACETEXT_IN
  1091.             dc.w    TempSave,BUTTON_KIND
  1092.             dc.l    GUI_Text15,TagList
  1093.             dc.b    10,2,1,PLACETEXT_IN
  1094.             dc.w    TempZero,BUTTON_KIND
  1095.  
  1096.             dc.l    -1
  1097.  
  1098.  
  1099.  
  1100. ;a3:Pointer to the GadgetStructure
  1101. ;d7:Previous Gadget
  1102.  
  1103. DoAllGadgets        lea    AllGadgets(pc),a5
  1104.             move.l    GadBase(a4),a6
  1105.             moveq.l    #1,d6
  1106.  
  1107. DoAllGadgets2        tst.l    (a5)
  1108.             bmi.s    WasLastGadget
  1109.  
  1110.             moveq.l    #0,d0
  1111.             move.b    MyGadgetRowNr(a5),d0
  1112.             move.w    RemHeight(a4),d1
  1113.             addq.w    #2,d1
  1114.             mulu    d1,d0
  1115.             add.w    RemTop(a4),d0        ;Top
  1116.             move.w    d0,gng_TopEdge(a3)
  1117.  
  1118.             moveq.l    #0,d0
  1119.             move.b    MyGadgetXPos(a5),d0
  1120.             mulu    RemLen(a4),d0
  1121.             add.w    RemLeft(a4),d0
  1122.             move.w    d0,gng_LeftEdge(a3)
  1123.  
  1124.             moveq.l    #0,d0
  1125.             move.b    MyGadgetWidth(a5),d0
  1126.             mulu    RemLen(a4),d0
  1127.             sub.w    #8,d0
  1128.             move.w    d0,gng_Width(a3)
  1129.  
  1130.             move.w    RemHeight(a4),gng_Height(a3)
  1131.  
  1132.             moveq.l    #0,d0
  1133.             move.b    MyGadgetFlags(a5),d0
  1134.             move.l    d0,gng_Flags(a3)
  1135.             add.w    #1,gng_GadgetID(a3)
  1136.  
  1137.             move.l    MyGadgetText(a5),gng_GadgetText(a3)
  1138.  
  1139.             move.w    d6,gng_GadgetID(a3)
  1140.  
  1141.             sub.l    a2,a2
  1142.             move.w    MyGadgetStore(a5),a2
  1143.             add.l    a4,a2
  1144.             move.l    (a2),d4
  1145.  
  1146.             moveq.l    #0,d0
  1147.             move.w    MyGadgetKind(a5),d0
  1148.             move.l    d7,a0        ;Previous Gadget
  1149.             move.l    a3,a1
  1150.             move.l    MyGadgetList(a5),a2
  1151.             move.l    d4,4(a2)
  1152.             CALL    CreateGadgetA
  1153.             move.l    d0,d7        ;Remember Previous Gadget
  1154.             add.l    #MyGadgetSize,a5
  1155.             addq.l    #1,d6
  1156.             bra.s    DoAllGadgets2
  1157. WasLastGadget        rts
  1158.  
  1159. CheckGUI        RSave
  1160.  
  1161.             tst.w    GUIOpened(a4)
  1162.             beq    NoGUI
  1163.  
  1164.             move.l    GadBase(a4),a6
  1165.             move.l    MyWindow(a4),a0
  1166.             move.l  wd_UserPort(a0),a0
  1167.             CALL    GT_GetIMsg
  1168.             tst.l   d0         
  1169.             beq     NoGUI
  1170.             move.l  d0,a1
  1171.             moveq.l    #0,d6
  1172.             move.w    im_Code(a1),d6    ;Value of Gadget
  1173.             move.l  im_IAddress(a1),a2
  1174.  
  1175.             move.l    im_Class(a1),d7
  1176.             CALL    GT_ReplyIMsg
  1177.  
  1178.             cmp.l    #GADGETUP,d7
  1179.             bne    Others
  1180.  
  1181.             move.w    gg_GadgetID(a2),d0
  1182.             move.l    gg_SpecialInfo(a2),a3
  1183.             cmp.w    #14,d0
  1184.             beq    HideGad
  1185.             cmp.w    #15,d0
  1186.             beq    QuitGad
  1187.             cmp.w    #16,d0
  1188.             beq    SaveGad
  1189.             cmp.w    #17,d0
  1190.             beq    AboutGad
  1191.  
  1192.             subq.l    #1,d0
  1193.  
  1194.             lea    AllGadgets(pc),a5
  1195.             mulu    #MyGadgetSize,d0
  1196.             sub.l    a2,a2
  1197.             move.w    MyGadgetStore(a5,d0.w),a2
  1198.             add.l    a4,a2
  1199.  
  1200.             cmp.w    #STRING_KIND,MyGadgetKind(a5,d0.w)
  1201.             bne.s    CheckBoxTest
  1202.             move.l    si_Buffer(a3),a0
  1203.             move.l    (a2),a1
  1204.             bsr    CopyPattern
  1205.             bsr    BuildPatterns
  1206.             bsr    InstallHotKey
  1207.             bra.s    NoGUI
  1208.  
  1209. CheckBoxTest        cmp.w    #CHECKBOX_KIND,MyGadgetKind(a5,d0.w)
  1210.             bne.s    StandardGUI
  1211.             ;using im_Code works only since V39, so:
  1212.             moveq.l    #1,d6
  1213.             tst.l    (a2)
  1214.             beq.s    StandardGUI
  1215.             moveq.l    #0,d6
  1216.  
  1217. StandardGUI        move.l    d6,(a2)
  1218.             bra.s    NoGUI
  1219.  
  1220. SaveGad            bsr    SaveConfig
  1221.             bra.s    NoGUI
  1222.  
  1223. AboutGad        lea    AboutText(pc),a0
  1224.             bsr    OpenRequester
  1225.             bra.s    NoGUI
  1226.  
  1227. QuitGad            bsr    CloseGUI
  1228.             move.w    #1,QuitMe(a4)
  1229.             bra.s    HideGad
  1230.  
  1231. Others                    cmp.l   #CLOSEWINDOW,d7
  1232.                     bne.s    NoClose
  1233. HideGad            bsr    CloseGUI
  1234.             bra.s    NoGUI
  1235. NoClose            cmp.l    #IDCMP_VANILLAKEY,d7
  1236.             bne.s    NoGUI
  1237.             cmp.b    #"q",d6
  1238.             beq.s    QuitGad
  1239.             cmp.b    #"a",d6
  1240.             beq.s    AboutGad
  1241.             cmp.b    #"s",d6
  1242.             beq.s    SaveGad
  1243.             cmp.b    #"h",d6
  1244.             beq.s    HideGad
  1245.  
  1246. NoGUI            RLoad
  1247.             rts
  1248.  
  1249. CloseGUI        RSave
  1250.             tst.w    GUIOpened(a4)
  1251.             beq.s    NotOpened
  1252.             move.l    IntBase(a4),a6
  1253.             move.l    MyWindow(a4),a0
  1254.             bsr    RemoveSignal
  1255.             ;move.l    MyWindow(a4),a0
  1256.             move.l    GadgetList(a4),a1
  1257.             moveq.l    #-1,d0
  1258.             CALL    RemoveGList
  1259.  
  1260.             move.l    MyWindow(a4),a0
  1261.             clr.l    d0
  1262.             move.w    wd_TopEdge(a0),d0
  1263.             move.l    d0,RemWindowY
  1264.             move.w    wd_LeftEdge(a0),d0
  1265.             move.l    d0,RemWindowX
  1266.             CALL    CloseWindow
  1267.             
  1268. FailWindow        move.l    GadgetList(a4),a0
  1269.             move.l    GadBase(a4),a6
  1270.             CALL    FreeGadgets
  1271.  
  1272.             move.l    MyVisual(a4),a0
  1273.             CALL    FreeVisualInfo
  1274.  
  1275.             move.l    IntBase(a4),a6
  1276.             sub.l    a0,a0
  1277.             move.l    PublicScreen(a4),a1
  1278.             CALL    UnlockPubScreen
  1279.  
  1280. NotOpened        clr.w    GUIOpened(a4)
  1281.  
  1282.             RLoad
  1283.             rts
  1284.  
  1285. EnterSignal        Push    d0-d1/a0          
  1286.             move.l  wd_UserPort(a0),a0
  1287.             move.b  MP_SIGBIT(a0),d0  
  1288.             move.l    SignalMask(a4),d1
  1289.             bset    d0,d1             
  1290.             move.l  d1,SignalMask(a4) 
  1291.             Pull    d0-d1/a0          
  1292.             rts                       
  1293.                                           
  1294. RemoveSignal        Push    d0-d1/a0          
  1295.             move.l  wd_UserPort(a0),a0
  1296.             move.b  MP_SIGBIT(a0),d0
  1297.             move.l    SignalMask(a4),d1
  1298.             bclr    d0,d1             
  1299.             move.l    d1,SignalMask(a4) 
  1300.             Pull    d0-d1/a0          
  1301.             rts
  1302.  
  1303. GetNexta0.1        tst.b    (a0)+
  1304. GetNexta0        move.b    (a0),d0
  1305.             cmp.b    #"=",d0
  1306.             beq.s    GetNexta0.1
  1307.             cmp.b    #" ",d0
  1308.             beq.s    GetNexta0.1
  1309.             or.w    #$20,d0
  1310.             rts
  1311.  
  1312. ;Screen in a0, X-Coord(rel) in d0, Y-Coord(rel) in d1
  1313. SetPointer        Push    a0-a2/d0-d1/a6
  1314.             lea    PointerPixEvent(a4),a2
  1315.             move.l    a0,iepp_Screen(a2)
  1316.             move.w    sc_LeftEdge(a0),d2
  1317.             add.w    sc_MouseX(a0),d2
  1318.             move.w    sc_TopEdge(a0),d3
  1319.             add.w    sc_MouseY(a0),d3
  1320.  
  1321.             move.l    MyIORequest(a4),a1
  1322.             move.w    #IND_WRITEEVENT,io_Command(a1)
  1323.             lea    MyInputEvent(a4),a0
  1324.             move.l    #0,ie_NextEvent(a0)
  1325.             move.b    #IECLASS_POINTERPOS,ie_Class(a0)
  1326.             move.w    #0,ie_Qualifier(a0)
  1327.             add.w    d0,d2
  1328.             add.w    d1,d3
  1329.             move.w    d2,ie_X(a0)
  1330.             move.w    d3,ie_Y(a0)
  1331.  
  1332.             move.b    #IESUBCLASS_PIXEL,ie_SubClass(a0)
  1333.             move.w    #IECODE_NOBUTTON,ie_Code(a0)
  1334.             move.l    a0,io_Data(a1)
  1335.             move.l    #ie_SIZEOF,io_Length(a1)
  1336.             move.l    $04,a6
  1337.             CALL    DoIO
  1338.             Pull    a0-a2/a6/d0-d1
  1339.             rts
  1340.  
  1341. BuildPatterns        RSave
  1342.             tst.l    TempScreen(a4)
  1343.             beq.s    NoScreenPattern
  1344.             move.l    TempScreen(a4),a0
  1345.             bsr    GetNexta0
  1346.             lea    ScreenPatternMem(a4),a1
  1347.             bsr    CopyPattern
  1348.  
  1349.             lea    ScreenPatternMem(a4),a0
  1350.             lea    ScreenPatLen(a4),a2
  1351.             lea    ScreenPattern(a4),a3
  1352.             bsr    GetLen
  1353.             bpl    NoScreenPattern
  1354.             bsr    PatternError
  1355.  
  1356. NoScreenPattern        lea    ScreenPatternMem(a4),a0
  1357.             move.l    a0,TempScreen(a4)
  1358.             tst.l    TempWindow(a4)
  1359.             beq.s    NoWindowPattern
  1360.             move.l    TempWindow(a4),a0
  1361.             bsr    GetNexta0
  1362.             lea    WindowPatternMem(a4),a1
  1363.             bsr    CopyPattern
  1364.  
  1365.             lea    WindowPatternMem(a4),a0
  1366.             lea    WindowPatLen(a4),a2
  1367.             lea    WindowPattern(a4),a3
  1368.             bsr    GetLen
  1369.             bpl.s    NoWindowPattern
  1370.             bsr    PatternError
  1371.     
  1372. NoWindowPattern        lea    WindowPatternMem(a4),a0
  1373.             move.l    a0,TempWindow(a4)
  1374.             RLoad
  1375.             rts        
  1376.  
  1377. PatternError        lea    Text3(pc),a0
  1378.             bra    OpenRequester
  1379.  
  1380. ;a0:Source, a1:Dest
  1381. CopyPattern        move.w    #511,d0
  1382. CopyPattern2        move.b    (a0)+,(a1)+
  1383.             beq.s    EndCopy
  1384.             dbf    d0,CopyPattern2
  1385.             bsr    PatternError
  1386. EndCopy            rts
  1387.  
  1388.  
  1389. ;In: (a2): LEN - (a3): MEMORY - a0: Source-Pattern    :back: d0=pattern ok?
  1390. GetLen            move.l    a0,d6
  1391.             clr.l    d3
  1392. GetLen2            tst.b    (a0)+
  1393.             beq.s    EndOfString
  1394.             addq.l    #1,d3
  1395.             bra.s    GetLen2
  1396. EndOfString        lsl.w    #1,d3    ;StandardLen Of Pattern
  1397.             addq    #2,d3
  1398.             move.l    $04,a6
  1399.             tst.l    (a3)
  1400.             beq    AllocNew
  1401.             move.l    (a3),a1
  1402.             move.l    (a2),d0
  1403.             CALL    FreeMem
  1404.             clr.l    (a3)
  1405. AllocNew        move.l    d3,(a2)
  1406.             move.l    d3,d0
  1407.             move.l    #MEMF_CLEAR,d1
  1408.             CALL    AllocMem
  1409.             move.l    d0,d2
  1410.             beq    QuitPrg        ;No Memory? Good bye !
  1411.             move.l    d0,(a3)
  1412.             move.l    d6,d1
  1413.             move.l    DosBase(a4),a6
  1414.             CALL    ParsePatternNoCase
  1415.             rts
  1416.  
  1417.             
  1418. ;a0: Requester-Text
  1419. OpenRequester        Push    a0-a3
  1420.             lea    EasyReqStruct(a4),a1
  1421.             lea    PortName(pc),a2
  1422.             move.l    a2,es_Title(a1)
  1423.             move.l    a0,es_TextFormat(a1)
  1424.             lea    GadgetText(pc),a2
  1425.             move.l    a2,es_GadgetFormat(a1)
  1426.             move.l    IntBase(a4),a6
  1427.             sub.l    a0,a0
  1428.             ;a1: EasyReq
  1429.             sub.l    a2,a2
  1430.             sub.l    a3,a3
  1431.             CALL    EasyRequestArgs
  1432.             Pull    a0-a3
  1433.             rts
  1434.  
  1435. SaveConfig        RSave
  1436.             tst.l    WBMessage(a4)
  1437.             beq    SkipConfig
  1438.             move.l    WBMessage(a4),a3
  1439.             move.l    sm_ArgList(a3),d0
  1440.             beq    SkipConfig
  1441.             move.l    d0,a0
  1442.             move.l    wa_Name(a0),a0
  1443.             move.l    a0,d5
  1444.  
  1445.             move.l    DObject(a4),d0
  1446.             beq    SkipConfig
  1447.  
  1448.             move.l    d0,a0
  1449.             move.l    do_ToolTypes(a0),a5    ;Remember Old
  1450.             move.l    #1,TempDummy(a4)
  1451.  
  1452.             Push    a0/a6
  1453.             move.l    $04,a6
  1454.             move.l    #NumberOfTemps*10+2*512+2*8,d0    ;Memory for tool arrays
  1455.             move.l    #MEMF_CLEAR,d1
  1456.             CALL    AllocMem
  1457.             move.l    d0,a3
  1458.             beq    MemErrTool
  1459.             move.l    DObject(a4),a0
  1460.             move.l    d0,do_ToolTypes(a0)
  1461.  
  1462.             move.l    d0,a1
  1463.             add.l    #(NumberOfTemps+1)*4,a1    ;Maximum Number of Pointers
  1464.  
  1465.             clr.l    d7
  1466.             lea    WBTemplate(pc),a2
  1467. LoopAllTemps        sub.l    a0,a0
  1468.             move.w    TemplateA4(a2),a0
  1469.             add.l    a4,a0
  1470.             move.l    (a0),d6
  1471.             beq.s    IsDefault
  1472.             move.l    a1,(a3,d7)
  1473.             move.l    TemplateText(a2),a0
  1474.             bsr    CopyPattern
  1475.             move.w    TemplateType(a2),d1
  1476.             beq    ThatsAllTemp
  1477.             move.b    #"=",-1(a1)
  1478.             
  1479.             cmp.w    #T_CYCLE,d1
  1480.             bne.s    ThatsString
  1481.             move.l    TemplateSpecial(a2),a0
  1482.             lsl.l    #2,d6
  1483.             move.l    (a0,d6.w),a0
  1484.             bsr    CopyPattern
  1485.             bra.s    ThatsAllTemp
  1486.  
  1487. ThatsString        cmp.w    #T_STRING,d1
  1488.             bne.s    ThatsInteger
  1489.             move.l    d6,a0
  1490.             bsr    CopyPattern
  1491.             bra.s    ThatsAllTemp
  1492.  
  1493. ThatsInteger        move.l    d6,d0
  1494.             bsr    PrintInteger
  1495.  
  1496. ThatsAllTemp        addq.l    #4,d7
  1497.             move.l    a1,d0
  1498.             and.l    #$ffffffc,d0
  1499.             move.l    d0,a1
  1500.             lea    4(a1),a1    ;Align on Longwords
  1501. IsDefault        add.l    #TemplateSize,a2
  1502.             tst.l    TemplateText(a2)
  1503.             bne    LoopAllTemps
  1504.  
  1505.             move.l    d5,a0
  1506.             move.l    DObject(a4),a1
  1507.             move.l    IconBase(a4),a6
  1508.             CALL    PutDiskObject
  1509.             bne.s    Done
  1510.             lea    Text4(pc),a0
  1511.             bsr    OpenRequester
  1512.  
  1513. Done            move.l    $04,a6
  1514.             move.l    #NumberOfTemps*10+2*512+2*8,d0
  1515.             move.l    a3,a1
  1516.             CALL    FreeMem
  1517. MemErrTool        Pull    a0/a6
  1518.  
  1519.             move.l    a5,do_ToolTypes(a0)
  1520.                 
  1521.             bra.s    DoneConfig
  1522.  
  1523. SkipConfig        lea    Text4(pc),a0
  1524.             bsr    OpenRequester
  1525. DoneConfig        RLoad
  1526.             rts
  1527.  
  1528.  
  1529. ;Where in hell has this damned OS a atoi and itoa function???
  1530.  
  1531. ;Quick implementation of word-only functions:
  1532.  
  1533. ;a0:String    Back: d0: Integer
  1534. GetInteger        Push    d1-d2/a0
  1535.             moveq.l    #0,d0
  1536.             moveq.l    #0,d1
  1537.             moveq.l    #1,d2
  1538.             cmp.b    #"-",(a0)
  1539.             bne.s    GetDezNr
  1540.             tst.b    (a0)+
  1541.             moveq.l    #-1,d2
  1542. GetDezNr        move.b    (a0)+,d1
  1543.             cmp.b    #"0",d1
  1544.             bcs    StringOver
  1545.             cmp.b    #"9"+1,d1
  1546.             bcc    StringOver
  1547.             sub.w    #$30,d1
  1548.             mulu    #$0a,d0
  1549.             add.l    d1,d0
  1550.             bra.s    GetDezNr
  1551. StringOver        muls    d2,d0
  1552.             Pull    d1-d2/a0
  1553.             rts    
  1554.  
  1555. ;d0: Integer        a1:String
  1556. PrintInteger        tst.l    d0
  1557.             bpl.s    PrDez0
  1558.             move.b    #"-",(a1)+
  1559.             neg.l    d0
  1560. PrDez0            move.w    #-1,-(sp)
  1561. PrDez            divu    #$0a,d0
  1562.             swap    d0
  1563.             move.w    d0,-(sp)
  1564.             clr.w    d0
  1565.             swap    d0
  1566.             bne.s    PrDez
  1567. PrDez1            move.w    (sp)+,d0
  1568.             bmi.s    CloseUp
  1569.             add.w    #"0",d0
  1570.             move.b    d0,(a1)+
  1571.             bra.s    PrDez1
  1572. CloseUp            clr.b    (a1)+
  1573.             rts
  1574.  
  1575. InstallHotKey        Push    a0-a1/a6
  1576. InstallHotKey2        lea    DefaultDescr(pc),a0
  1577.             lea    Description(a4),a1
  1578.             tst.l    TempCXPOPKEY(a4)
  1579.             beq.s    NoPOPKEY
  1580.             move.l    TempCXPOPKEY(a4),a0
  1581.             bsr    GetNexta0
  1582. NoPOPKEY        move.l    a1,TempCXPOPKEY(a4)
  1583.             bsr    CopyKey
  1584.             bmi.s    HotKeyError
  1585.  
  1586.             bsr    RemovePopKey
  1587.  
  1588.             lea    Description(a4),a0
  1589.             move.l    MyPort(a4),a1
  1590.             move.l    #MyHotkeyID,d0    ;ID... I only got one Key to manage
  1591.             bsr    HotKey
  1592.             bmi    HotKeyError
  1593.             move.l    a0,Filter(a4)
  1594.             CALL    CxObjError
  1595.             bne.s    DeleteAndErr
  1596.             move.l    Filter(a4),a1
  1597.             move.l    Broker(a4),a0
  1598.             CALL    AttachCxObj
  1599.             Pull    a0-a1/a6
  1600.             rts
  1601.  
  1602. DeleteAndErr        bsr    DeletePopKey
  1603. HotKeyError        lea    HotKeyErrorT(pc),a0
  1604.             bsr    OpenRequester
  1605.             clr.l    TempCXPOPKEY(a4)
  1606.             bra.s    InstallHotKey2
  1607.  
  1608. CopyKey            move.w    #63,d0
  1609. CopyString        move.b    (a0)+,(a1)+
  1610.             beq.s    EndString
  1611.             dbf    d0,CopyString
  1612.             moveq.l    #-1,d0
  1613. EndString        rts
  1614.  
  1615. RemovePopKey        move.l    CommBase(a4),a6
  1616.             tst.l    Filter(a4)
  1617.             beq.s    NoFilter
  1618.             move.l    Filter(a4),a0
  1619.             CALL    RemoveCxObj
  1620. DeletePopKey        move.l    Filter(a4),a0
  1621.             CALL    DeleteCxObjAll
  1622.             clr.l    Filter(a4)
  1623. NoFilter        rts                
  1624.  
  1625.  
  1626. ;Implementation of the cx.lib function
  1627. ;HotKey(char *Description,MsgPort *CxPort,long Event)
  1628.  
  1629. ;a0=Description, a1=CxPort, d0=Event    ;Back: d0:Error, a0:Filter
  1630. HotKey            Push    d1-d7/a1-a2/a6
  1631.             move.l    a1,a2        ;Rem Port
  1632.             move.l    d0,d6        ;Rem Event
  1633.             move.l    CommBase(a4),a6
  1634.             move.l    #CX_FILTER,d0
  1635.             ;Description is in a0
  1636.             sub.l    a1,a1
  1637.             CALL    CreateCxObj
  1638.             move.l    d0,d7        ;Remember Filter
  1639.             beq.s    HKErr2
  1640.             move.l    #CX_SEND,d0
  1641.             move.l    a2,a0        ;Given Port
  1642.             move.l    d6,a1        ;Event
  1643.             CALL    CreateCxObj
  1644.             move.l    d0,d6        ;Remember Sender
  1645.             beq.s    HKErr
  1646.             move.l    d7,a0        ;Filter
  1647.             move.l    d6,a1        ;Sender
  1648.             CALL    AttachCxObj
  1649.             move.l    #CX_TRANSLATE,d0
  1650.             sub.l    a0,a0
  1651.             move.l    a0,a1
  1652.             CALL    CreateCxObj
  1653.             move.l    d0,a1
  1654.             tst.l    d0
  1655.             beq.s    HKErr
  1656.             move.l    d6,a0        ;Sender
  1657.             ;Translate is in a1
  1658.             CALL    AttachCxObj
  1659.             move.l    d7,a0        ;Return Filter in a0
  1660.             moveq.l    #0,d0
  1661.             bra.s    HKOut
  1662. HKErr            move.l    Filter(a4),a0
  1663.             CALL    DeleteCxObjAll
  1664. HKErr2            
  1665.             lea    GadgetText(pc),a0
  1666.             bsr    OpenRequester
  1667.             moveq.l    #-1,d0
  1668. HKOut            Pull    d1-d7/a1-a2/a6
  1669.             rts
  1670.  
  1671. TestButton        RSave
  1672.             cmp.l    #0,a0
  1673.             beq.s    SkipTestButton
  1674.             move.l    RememberA4,a4
  1675.             move.l    CommBase(a4),a6
  1676.             CALL    CxMsgData
  1677.             tst.l    d0
  1678.             beq    SkipTestButton
  1679.             move.l    d0,a0
  1680.             cmp.b    #IECLASS_RAWMOUSE,ie_Class(a0)
  1681.             bne.s    SkipTestButton
  1682.             cmp.w    #IECODE_UP_PREFIX!IECODE_LBUTTON,ie_Code(a0)
  1683.             beq.s    RelButton
  1684.             cmp.w    #IECODE_LBUTTON,ie_Code(a0)
  1685.             bne.s    SkipTestButton
  1686.             move.w    #1,ButtonPressed(a4)
  1687.             bra.s    SkipTestButton
  1688. RelButton        clr.w    ButtonPressed(a4)
  1689.             bsr    SignalMyself
  1690.  
  1691.             bset    #SignalButton,What(a4)
  1692.  
  1693. SkipTestButton        RLoad
  1694.             rts
  1695.  
  1696. BLINK            RSave
  1697.             move.w    #$10,d1
  1698. blink2            move.w    #$7fff,d0
  1699. blink1            move.w    d0,$dff180
  1700.             dbf    d0,blink1
  1701.             dbf    d1,blink2
  1702.             RLoad
  1703.             rts
  1704.  
  1705. StringTagList        dc.l    GTST_String
  1706.             dc.l    0
  1707.             dc.l    GTST_MaxChars
  1708.             dc.l    511
  1709.             dc.l    TAG_DONE
  1710.  
  1711. CycleTagList        dc.l    GTCY_Active
  1712.             dc.l    0
  1713.             dc.l    GTCY_Labels
  1714.             dc.l    CycleList
  1715.             dc.l    TAG_DONE
  1716.  
  1717. CycleTagList2        dc.l    GTCY_Active
  1718.             dc.l    0
  1719.             dc.l    GTCY_Labels
  1720.             dc.l    CycleList2
  1721.             dc.l    TAG_DONE
  1722.  
  1723. GadgetTagList        dc.l    GTCB_Checked
  1724.             dc.l    0
  1725.             dc.l    TAG_DONE
  1726.  
  1727. TagList            dc.l    GA_Disabled
  1728.             dc.l    0
  1729.             dc.l    GT_Underscore
  1730.             dc.l    '_'
  1731. TagListDone        dc.l    TAG_DONE
  1732.  
  1733. WindowTagList        dc.l    WA_InnerWidth
  1734. StoreInnerWidth            dc.l    0
  1735.             dc.l    WA_InnerHeight
  1736. StoreInnerHeight        dc.l    0
  1737.             dc.l    WA_IDCMP
  1738.                 dc.l    BUTTONIDCMP!CLOSEWINDOW!IDCMP_VANILLAKEY
  1739.             dc.l    WA_Flags
  1740.                 dc.l    WINDOWCLOSE!WINDOWDRAG!WINDOWDEPTH!ACTIVATE    
  1741.             dc.l    WA_PubScreen
  1742. StorePublicScreen        dc.l    0
  1743.             dc.l    WA_Title
  1744.                 dc.l    Texth
  1745.             dc.l    WA_AutoAdjust
  1746.                 dc.l    1
  1747.             dc.l    WA_Left
  1748. RemWindowX            dc.l    -1
  1749.             dc.l    WA_Top
  1750. RemWindowY            dc.l    -1
  1751.             dc.l    TAG_DONE
  1752.  
  1753. ;VideoConTags        dc.l    VTAG_VIEWPORTEXTRA_GET
  1754. ;            dc.l    ViewPortExt
  1755. ;            dc.l    TAG_DONE
  1756.  
  1757. ;ViewPortExt        ds.b    vpe_SIZEOF
  1758.  
  1759. RememberA4        dc.l    0
  1760. RememberStack        dc.l    0
  1761.  
  1762.             rsreset
  1763. ScreenPatLen        rs.l    1
  1764. ScreenPattern        rs.l    1
  1765. WindowPatLen        rs.l    1
  1766. WindowPattern        rs.l    1
  1767. GadgetList        rs.l    1
  1768. PositionX        rs.w    1
  1769. PositionY        rs.w    1
  1770. What            rs.w    1
  1771. DisableHW        rs.w    1
  1772. GUIOpened        rs.w    1
  1773. QuitMe            rs.w    1
  1774. RemFontSize        rs.w    1
  1775. ButtonPressed        rs.w    1
  1776. GadgetInside        rs.w    11
  1777. MyPort            rs.l    1
  1778. MyVisual        rs.l    1
  1779. Broker            rs.l    1
  1780. ScreenMem        rs.b    ScreenMemSize
  1781. IntBase            rs.l    1
  1782. RemLen            rs.w    1
  1783. RemHeight        rs.w    1
  1784. RemTop            rs.w    1
  1785. RemLeft            rs.w    1
  1786.  
  1787. GadBase            rs.l    1
  1788. DosBase            rs.l    1
  1789. CommBase        rs.l    1
  1790. IconBase        rs.l    1
  1791. DObject            rs.l    1
  1792. Active            rs.l    1
  1793. FirstSc            rs.l    1
  1794. GraphicsBase        rs.l    1
  1795. PublicScreen        rs.l    1
  1796. PublicRastport        rs.l    1
  1797. Gadget0            rs.l    1
  1798. Filter            rs.l    1
  1799. VisualX            rs.w    1
  1800. VisualY            rs.w    1
  1801. TemplateArray        rs.l    0    ;Do not change order!
  1802. TempMove        rs.l    1
  1803. TempSFront        rs.l    1
  1804. TempWFront        rs.l    1
  1805. TempPDef        rs.l    1
  1806. TempAlways        rs.l    1
  1807. TempRemWin        rs.l    1
  1808. TempMoveMouse        rs.l    1
  1809. TempCXPOPUP        rs.l    1
  1810. TempCXPRI        rs.l    1
  1811. TempCXPOPKEY        rs.l    1
  1812. TempHADJ        rs.l    1
  1813. TempVADJ        rs.l    1
  1814. TempScreen        rs.l    1
  1815. TempWindow        rs.l    1
  1816. TempDummy        rs.l    1
  1817. TempZero        rs.l    1
  1818. TempSave        rs.l    1
  1819.  
  1820. OwnTask            rs.l    1
  1821. Signal            rs.l    1
  1822. Args            rs.l    1
  1823. WBMessage        rs.l    1
  1824. SignalMask        rs.l    1
  1825. MyWindow        rs.l    1
  1826. LastGadget        rs.l    1
  1827. MyIORequest        rs.l    1
  1828. MouseMsgPort        rs.l    1
  1829. MyNewGadget        rs.b    gng_SIZEOF
  1830. MyInterrupt        rs.b    IS_SIZE
  1831. MyInputEvent        rs.b    ie_SIZEOF
  1832. PointerPixEvent        rs.b    IEPointerPixel_SIZEOF
  1833. EasyReqStruct        rs.b    es_SIZEOF
  1834. Description        rs.b    64
  1835. ScreenPatternMem    rs.b    512    ;sufficient I think
  1836. WindowPatternMem    rs.b    512
  1837. AllocLength        rs.w    1
  1838.  
  1839. intuition        dc.b    "intuition.library",0
  1840. DosName            dc.b    "dos.library",0
  1841. InputName        dc.b    "input.device",0
  1842. GraphicsName        dc.b    "graphics.library",0
  1843. IconName        dc.b    "icon.library",0
  1844. GadName            dc.b    "gadtools.library",0
  1845. CommName        dc.b    "commodities.library",0
  1846.             even
  1847.  
  1848. MyNewBroker        dc.b    NB_VERSION    ;Version
  1849.             dc.b    0        ;Reserve1
  1850.             dc.l    HandlerName    ;Name
  1851.             dc.l    PortName    ;Title
  1852.             dc.l    DescText    ;Description
  1853.             dc.w    NBU_NOTIFY!NBU_UNIQUE        ;Unique
  1854.             dc.w    COF_SHOW_HIDE    ;Flags
  1855. MyPri            dc.b    0        ;Pri
  1856.             dc.b    0        ;Reserve2
  1857. BrokerPort        dc.l    0        ;Port
  1858.             dc.w    0        ;ReservedChannel
  1859.  
  1860. CycleList    dc.l    GUI_Choose1.1,GUI_Choose1.2,GUI_Choose1.3,GUI_Choose1.4,0
  1861. CycleList2    dc.l    GUI_Choose2.1,GUI_Choose2.2,GUI_Choose2.3,GUI_Choose2.4,0
  1862.  
  1863.         rsreset
  1864. TemplateText    rs.l    1
  1865. TemplateSpecial    rs.l    1
  1866. TemplateA4    rs.w    1
  1867. TemplateType    rs.w    1
  1868. TemplateSize    rs.w    0
  1869.  
  1870. T_CHECK        =    0
  1871. T_CYCLE        =    1
  1872. T_STRING    =    2
  1873. T_INTEGER    =    3
  1874.  
  1875. NumberOfTemps    =    13
  1876.  
  1877. WBTemplate    dc.l    TextDNW,0
  1878.         dc.w    TempDummy,T_CHECK
  1879.  
  1880.         dc.l    TextMove,0
  1881.         dc.w    TempMove,T_CHECK
  1882.  
  1883.         dc.l    TextSFront,0
  1884.         dc.w    TempSFront,T_CHECK
  1885.  
  1886.         dc.l    TextWFront,0
  1887.         dc.w    TempWFront,T_CHECK
  1888.  
  1889.         dc.l    TextPDef,0
  1890.         dc.w    TempPDef,T_CHECK
  1891.  
  1892.         dc.l    TextAlways,0
  1893.         dc.w    TempAlways,T_CHECK
  1894.  
  1895.         dc.l    TextRemWin,0
  1896.         dc.w    TempRemWin,T_CHECK
  1897.  
  1898.         dc.l    TextMoveMouse,0
  1899.         dc.w    TempMoveMouse,T_CHECK
  1900.  
  1901.         dc.l    TextCXPOPUP,0
  1902.         dc.w    TempCXPOPUP,T_CHECK
  1903.  
  1904.         dc.l    TextScreen,0
  1905.         dc.w    TempScreen,T_STRING
  1906.  
  1907.         dc.l    TextWindow,0
  1908.         dc.w    TempWindow,T_STRING
  1909.  
  1910.         dc.l    TextCXPOPKEY,0
  1911.         dc.w    TempCXPOPKEY,T_STRING
  1912.  
  1913.         dc.l    TextCXPRI,0
  1914.         dc.w    TempCXPRI,T_INTEGER
  1915.  
  1916.         dc.l    TextHADJ,CycleList
  1917.         dc.w    TempHADJ,T_CYCLE
  1918.  
  1919.         dc.l    TextVADJ,CycleList2
  1920.         dc.w    TempVADJ,T_CYCLE
  1921.  
  1922.         dc.l    0
  1923.  
  1924.  
  1925. TextDNW        dc.b    "DONOTWAIT",0
  1926. TextMove    dc.b    "MOVE",0
  1927. TextSFront    dc.b    "SFRONT",0
  1928. TextWFront    dc.b    "WFRONT",0
  1929. TextPDef    dc.b    "DEFPUB",0
  1930. TextAlways    dc.b    "ALWAYS",0
  1931. TextCXPOPUP    dc.b    "CX_POPUP",0
  1932. TextCXPRI    dc.b    "CX_PRIORITY",0
  1933. TextCXPOPKEY    dc.b    "CX_POPKEY",0
  1934. TextRemWin    dc.b    "REMWIN",0
  1935. TextMoveMouse    dc.b    "MOVEMOUSE",0
  1936. TextHADJ    dc.b    "HADJ",0
  1937. TextVADJ    dc.b    "VADJ",0
  1938. TextScreen    dc.b    "SCREEN",0
  1939. TextWindow    dc.b    "WINDOW",0
  1940. Template    dc.b    "MOVE/S,SFRONT/S,WFRONT/S,DEFPUB/S,ALWAYS/S,REMWIN/S,MOVEMOUSE/S,CX_POPUP/S,CX_PRIORITY/K,CX_POPKEY/K,HADJ/K,VADJ/K,SCREEN/K,WINDOW/K",0
  1941. PortName    dc.b    "Huntwindows 2.7",0
  1942. HandlerName    dc.b    "Huntwindows",0
  1943. GadgetText    dc.b    "Ok",0
  1944. DefaultDescr    dc.b    "control alt h",0
  1945. AboutText    dc.b    "© by Jörg Bublath 1992-1993",$0a,"EMAIL:",$0a,"bublath@forwiss.uni-passau.de",0
  1946. HotKeyErrorT    dc.b    "Wrong hotkey description!",$0a,0
  1947. Text1        dc.b    "Error in arguments or libraries!",$0a,0
  1948. Text2        dc.b    "I need V37+ !",$0a,0
  1949. Text3        dc.b    "Error in given patterns!",$0a,0
  1950. Text4        dc.b    "Cannot Save!",$0a,0
  1951.         dc.b    "$VER: "    ;for version information
  1952. Texth        dc.b    "Huntwindows 2.7 (26.4.93) by Jörg Bublath",0
  1953. DescText    dc.b    "Moves screen to show windows",0
  1954. GUI_Text1    dc.b    "Move Screen",0
  1955. GUI_Text2    dc.b    "ScreenToFront",0
  1956. GUI_Text3    dc.b    "WindowToFront",0
  1957. GUI_Text5    dc.b    "Set Default PubScreen",0
  1958. GUI_Text6    dc.b    "Always",0
  1959. GUI_Text7    dc.b    "Remember Window",0
  1960. GUI_Text7_1    dc.b    "Move Mouse",0
  1961. GUI_Text7_2    dc.b    "GUI Popup",0
  1962. GUI_Text8    dc.b    "Horizontal Adjustment",0
  1963. GUI_Text9    dc.b    "Vertical Adjustment",0
  1964. GUI_Text10    dc.b    "_Hide",0
  1965. GUI_Text11    dc.b    "_Quit",0
  1966. GUI_Text12    dc.b    "Screen Pattern",0
  1967. GUI_Text13    dc.b    "Window Pattern",0
  1968. GUI_Text14    dc.b    "_Save",0
  1969. GUI_Text15    dc.b    "_About",0
  1970. GUI_Text16    dc.b    "Popup Hotkey",0
  1971. GUI_TextEnd    ;
  1972. GUI_Choose1.1    dc.b    "left",0
  1973. GUI_Choose1.2    dc.b    "right",0
  1974. GUI_Choose1.3    dc.b    "center",0
  1975. GUI_Choose1.4    dc.b    "off",0
  1976. GUI_Choose2.1    dc.b    "top",0
  1977. GUI_Choose2.2    dc.b    "bottom",0
  1978. GUI_Choose2.3    dc.b    "center",0
  1979. GUI_Choose2.4    dc.b    "off",0
  1980.         even
  1981.