home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / dev / asm / tbsource / nbbs / setprog / spwin1idcmp.i < prev   
Text File  |  1993-12-21  |  10KB  |  493 lines

  1. Window1IDCMP1:    move.l    Window1(pc),a0
  2.         jsr    CheckIDCMP
  3.         jmp    WindowIDCMP
  4. Window2IDCMP1:    move.l    Window2(pc),a0
  5.         jsr    CheckIDCMP
  6.         jmp    WindowIDCMP
  7. Window3IDCMP1:    move.l    Window3(pc),a0
  8.         jsr    CheckIDCMP
  9.         jmp    WindowIDCMP
  10. Window4IDCMP1:    move.l    Window4(pc),a0
  11.         jsr    CheckIDCMP
  12.         jmp    WindowIDCMP
  13.  
  14. WindowIDCMP:    cmp.l    #CLOSEWINDOW,d2
  15.         beq    Quit
  16.         cmp.l    #GADGETDOWN,d2
  17.         beq    ButtonDown
  18.         cmp.l    #GADGETUP,d2
  19.         beq    Activategads
  20.         cmp.l    #VANILLAKEY,d2
  21.         beq    VanillaKeys
  22.         cmp.l    #MENUPICK,d2
  23.         beq    Win1Menus
  24.         cmp.l    #RAWKEY,d2
  25.         beq    RawKeys
  26.         jmp    Window1IDCMP
  27.  
  28. Activategads:    move.l    #$01,CheckSum
  29.         move.l    (a5),a0
  30.         lea.l    FontSizeGad(pc),a1    ;take this out when you've
  31.         cmp.l    #$00,(a5)        ;got different sized fonts
  32.         beq    ActivateGads1
  33.         cmp.l    (a5),a1
  34.         bne    ActivateGads2
  35.         move.l    (a1),a0
  36.         jmp    ActivateGads2
  37. ActivateGads1:    lea.l    SerBRKTGad(pc),a0
  38. ActivateGads2:    move.l    Window1(pc),a1
  39.         move.l    #$00,a2
  40.         lib    Intuition,ActivateGadget
  41.         jmp    Window1IDCMP    
  42.  
  43. VanillaKeys:    cmp.w    #$1b,d3
  44.         beq    Quit
  45.         jmp    Window1IDCMP
  46. RawKeys:    cmp.w    #$5f,d3
  47.         beq    Quit        ;Change to help
  48.         jmp    Window1IDCMP
  49.  
  50. Win1Menus:    jsr    MenuNull
  51.         cmp.l    #$00,d6
  52.         beq    Win1Menus9
  53.         cmp.l    #$01,d6
  54.         beq    Win1Menus1
  55.         jmp    Window1IDCMP
  56. Win1Menus1:    cmp.l    #$00,d5
  57.         beq    AskedWin1
  58.         cmp.l    #$01,d5
  59.         beq    AskedWin2
  60.         cmp.l    #$02,d5
  61.         beq    AskedWin3
  62.         cmp.l    #$03,d5
  63.         beq    AskedWin4
  64.         jmp    Window1IDCMP    
  65. Win1Menus9:    cmp.l    #$00,d5
  66.         beq    Load
  67.         cmp.l    #$01,d5
  68.         beq    Save
  69.         cmp.l    #$02,d5
  70.         beq    SaveAs
  71.         cmp.l    #$03,d5
  72.         beq    About
  73.         cmp.l    #$04,d5
  74.         beq    Quit
  75.         jmp    Window1IDCMP
  76.  
  77. AskedWin1:    cmp.w    #$01,ActiveWinNum
  78.         beq    Window1IDCMP
  79.         jmp    StartWin1
  80. AskedWin2:    cmp.w    #$02,ActiveWinNum
  81.         beq    Window1IDCMP
  82.         jmp    StartWin2
  83. AskedWin3:    cmp.w    #$03,ActiveWinNum
  84.         beq    Window1IDCMP
  85.         jmp    StartWin3
  86. AskedWin4:    cmp.w    #$04,ActiveWinNum
  87.         beq    Window1IDCMP
  88.         jmp    StartWin4
  89.  
  90. ButtonDown:    move.l    #$01,CheckSum
  91.  
  92. ;Activate first string gadget again
  93.  
  94.         lea.l    SerBRKTGad(pc),a0
  95.         move.l    Window1(pc),a1
  96.         move.l    #$00,a2
  97.         lib    Intuition,ActivateGadget
  98.  
  99.         lea.l    StopB1Gad(pc),a1
  100.         cmp.l    a1,a5
  101.         beq    ButtonDown1
  102.         lea.l    StopB2Gad(pc),a1
  103.         cmp.l    a1,a5
  104.         beq    ButtonDown2
  105.         lea.l    DataB7Gad(pc),a1
  106.         cmp.l    a1,a5
  107.         beq    ButtonDown3
  108.         lea.l    DataB8Gad(pc),a1
  109.         cmp.l    a1,a5
  110.         beq    ButtonDown4
  111.         lea.l    ParityNGad(pc),a1
  112.         cmp.l    a1,a5
  113.         beq    ButtonDown5
  114.         lea.l    ParityEGad(pc),a1
  115.         cmp.l    a1,a5
  116.         beq    ButtonDown6
  117.         lea.l    ParityOGad(pc),a1
  118.         cmp.l    a1,a5
  119.         beq    ButtonDown7
  120.         lea.l    ParityMGad(pc),a1
  121.         cmp.l    a1,a5
  122.         beq    ButtonDown8
  123.         lea.l    ParitySGad(pc),a1
  124.         cmp.l    a1,a5
  125.         beq    ButtonDown9
  126.         lea.l    DuplexFGad(pc),a1
  127.         cmp.l    a1,a5
  128.         beq    ButtonDown10
  129.         lea.l    DuplexHGad(pc),a1
  130.         cmp.l    a1,a5
  131.         beq    ButtonDown11
  132.         lea.l    DuplexEGad(pc),a1
  133.         cmp.l    a1,a5
  134.         beq    ButtonDown12
  135.         jmp    Window1IDCMP
  136. ButtonDown1:    move.w    #$86,$c(a1)
  137.         lea.l    StopB2Gad(pc),a0
  138.         move.w    #$6,$c(a0)
  139.         lea.l    StopB1Gad(pc),a0
  140.         move.l    Window1(pc),a1
  141.         move.l    #$02,d0
  142.         lib    Intuition,RefreshGList
  143.         jmp    Window1IDCMP
  144. ButtonDown2:    move.w    #$86,$c(a1)
  145.         lea.l    StopB1Gad(pc),a0
  146.         move.w    #$6,$c(a0)
  147.         move.l    Window1(pc),a1
  148.         move.l    #$02,d0
  149.         lib    Intuition,RefreshGList
  150.         jmp    Window1IDCMP
  151. ButtonDown3:    move.w    #$86,$c(a1)
  152.         lea.l    DataB8Gad(pc),a0
  153.         move.w    #$6,$c(a0)
  154.         lea.l    DataB7Gad(pc),a0
  155.         move.l    Window1(pc),a1
  156.         move.l    #$02,d0
  157.         lib    Intuition,RefreshGList
  158.         jmp    Window1IDCMP
  159. ButtonDown4:    move.w    #$86,$c(a1)
  160.         lea.l    DataB7Gad(pc),a0
  161.         move.w    #$6,$c(a0)
  162.         move.l    Window1(pc),a1
  163.         move.l    #$02,d0
  164.         lib    Intuition,RefreshGList
  165.         jmp    Window1IDCMP
  166. ButtonDown5:    move.w    #$86,$c(a1)
  167.         lea.l    ParityEGad(pc),a0
  168.         move.w    #$6,$c(a0)
  169.         lea.l    ParityOGad(pc),a0
  170.         move.w    #$6,$c(a0)
  171.         lea.l    ParityMGad(pc),a0
  172.         move.w    #$6,$c(a0)
  173.         lea.l    ParitySGad(pc),a0
  174.         move.w    #$6,$c(a0)
  175.         lea.l    ParityNGad(pc),a0
  176.         move.l    Window1(pc),a1
  177.         move.l    #$05,d0
  178.         lib    Intuition,RefreshGList
  179.         jmp    Window1IDCMP
  180. ButtonDown6:    move.w    #$86,$c(a1)
  181.         lea.l    ParityNGad(pc),a0
  182.         move.w    #$6,$c(a0)
  183.         lea.l    ParityOGad(pc),a0
  184.         move.w    #$6,$c(a0)
  185.         lea.l    ParityMGad(pc),a0
  186.         move.w    #$6,$c(a0)
  187.         lea.l    ParitySGad(pc),a0
  188.         move.w    #$6,$c(a0)
  189.         lea.l    ParityNGad(pc),a0
  190.         move.l    Window1(pc),a1
  191.         move.l    #$05,d0
  192.         lib    Intuition,RefreshGList
  193.         jmp    Window1IDCMP
  194. ButtonDown7:    move.w    #$86,$c(a1)
  195.         lea.l    ParityNGad(pc),a0
  196.         move.w    #$6,$c(a0)
  197.         lea.l    ParityEGad(pc),a0
  198.         move.w    #$6,$c(a0)
  199.         lea.l    ParityMGad(pc),a0
  200.         move.w    #$6,$c(a0)
  201.         lea.l    ParitySGad(pc),a0
  202.         move.w    #$6,$c(a0)
  203.         lea.l    ParityNGad(pc),a0
  204.         move.l    Window1(pc),a1
  205.         move.l    #$05,d0
  206.         lib    Intuition,RefreshGList
  207.         jmp    Window1IDCMP
  208. ButtonDown8:    move.w    #$86,$c(a1)
  209.         lea.l    ParityNGad(pc),a0
  210.         move.w    #$6,$c(a0)
  211.         lea.l    ParityEGad(pc),a0
  212.         move.w    #$6,$c(a0)
  213.         lea.l    ParityOGad(pc),a0
  214.         move.w    #$6,$c(a0)
  215.         lea.l    ParitySGad(pc),a0
  216.         move.w    #$6,$c(a0)
  217.         lea.l    ParityNGad(pc),a0
  218.         move.l    Window1(pc),a1
  219.         move.l    #$05,d0
  220.         lib    Intuition,RefreshGList
  221.         jmp    Window1IDCMP
  222. ButtonDown9:    move.w    #$86,$c(a1)
  223.         lea.l    ParityNGad(pc),a0
  224.         move.w    #$6,$c(a0)
  225.         lea.l    ParityEGad(pc),a0
  226.         move.w    #$6,$c(a0)
  227.         lea.l    ParityOGad(pc),a0
  228.         move.w    #$6,$c(a0)
  229.         lea.l    ParityMGad(pc),a0
  230.         move.w    #$6,$c(a0)
  231.         lea.l    ParityNGad(pc),a0
  232.         move.l    Window1(pc),a1
  233.         move.l    #$05,d0
  234.         lib    Intuition,RefreshGList
  235.         jmp    Window1IDCMP
  236. ButtonDown10:    move.w    #$86,$c(a1)
  237.         lea.l    DuplexHGad(pc),a0
  238.         move.w    #$6,$c(a0)
  239.         lea.l    DuplexEGad(pc),a0
  240.         move.w    #$6,$c(a0)
  241.         lea.l    DuplexFGad(pc),a0
  242.         move.l    Window1(pc),a1
  243.         move.l    #$03,d0
  244.         lib    Intuition,RefreshGList
  245.         jmp    Window1IDCMP
  246. ButtonDown11:    move.w    #$86,$c(a1)
  247.         lea.l    DuplexFGad(pc),a0
  248.         move.w    #$6,$c(a0)
  249.         lea.l    DuplexEGad(pc),a0
  250.         move.w    #$6,$c(a0)
  251.         lea.l    DuplexFGad(pc),a0
  252.         move.l    Window1(pc),a1
  253.         move.l    #$03,d0
  254.         lib    Intuition,RefreshGList
  255.         jmp    Window1IDCMP
  256. ButtonDown12:    move.w    #$86,$c(a1)
  257.         lea.l    DuplexFGad(pc),a0
  258.         move.w    #$6,$c(a0)
  259.         lea.l    DuplexHGad(pc),a0
  260.         move.w    #$6,$c(a0)
  261.         lea.l    DuplexFGad(pc),a0
  262.         move.l    Window1(pc),a1
  263.         move.l    #$03,d0
  264.         lib    Intuition,RefreshGList
  265.         jmp    Window1IDCMP
  266.  
  267. Load:        jsr    MenusOff
  268.         lea.l    LoadName(pc),a5
  269.         move.l    #FRQABSOLUTEXYM+FRQLOADINGM,d5
  270.         jsr    FileRequester
  271.         tst.l    d0
  272.         beq    LoadOut
  273.  
  274.         lea.l    FRPathName(pc),a1
  275.         move.l    a1,d1
  276.         cmp.b    #$00,(a1)
  277.         beq    LoadOut
  278.         move.l    #MODE_OLDFILE,d2
  279.         lib    Dos,Open
  280.         move.l    d0,ConfigFile
  281.         bne    Load1
  282.         jsr    FileError
  283.         jmp    LoadOut
  284.  
  285. Load1:        move.l    ConfigFile(pc),d1
  286.         lea.l    CONFIG(pc),a0
  287.         move.l    a0,d2
  288.         lea.l    CONFIG(pc),a1
  289.         lea.l    CONFIG_END(pc),a2
  290.         sub.l    a1,a2
  291.         move.l    a2,d3
  292.         lib    Dos,Read
  293.  
  294. Load2:        move.l    ConfigFile(pc),d1
  295.         lib    Dos,Close
  296.         move.l    #$00,ConfigFile
  297.         move.l    #$01,CheckSum
  298.         jsr    SetGads
  299.         lea.l    StopB1Gad(pc),a0
  300.         move.l    Window1(pc),a1
  301.         move.l    #-1,d0
  302.         lib    Intuition,RefreshGList
  303.  
  304. LoadOut:
  305.         jsr    MenusOn
  306.         jmp    Window1IDCMP
  307.  
  308. SaveAs:        jsr    MenusOff
  309.         lea.l    SaveName(pc),a5
  310.         move.l    #FRQABSOLUTEXYM+FRQSAVINGM,d5
  311.         jsr    FileRequester
  312.         tst.l    d0
  313.         beq    SaveOut
  314.  
  315.         lea.l    FRPathName(pc),a1
  316.         move.l    a1,d1
  317.         cmp.b    #$00,(a1)
  318.         beq    SaveOut
  319.         move.l    #MODE_OLDFILE,d2
  320.         lib    Dos,Open
  321.         move.l    d0,ConfigFile
  322.         beq    ConfigNExists        ;ConfigNotExists..
  323.  
  324. ;The file already exists so we'll ask if the user wants to replace old file 
  325.  
  326.         lea.l    AskReplace(pc),a0
  327.         move.l    #$00,a1
  328.         jsr    TwoGadRequest
  329.         tst.l    d0
  330.         beq    SaveOut
  331.  
  332.         move.l    ConfigFile(pc),d1
  333.         lib    Dos,Close
  334.         move.l    #$00,ConfigFile
  335.  
  336. SaveAsOut:    jsr    MenusOn
  337.  
  338. Save:        jsr    MenusOff
  339. ;        jsr    SetSer
  340.  
  341. Save1:        tst.l    ConfigFile
  342.         bne    Save2
  343.         lea.l    FRPathName(pc),a1
  344.         move.l    a1,d1
  345.         move.l    #MODE_NEWFILE,d2
  346.         lib    Dos,Open
  347.         move.l    d0,ConfigFile
  348.         bne    Save2
  349.         jsr    FileError
  350.         jmp    SaveOut
  351. Save2:        move.l    ConfigFile(pc),d1
  352.         lea.l    CONFIG(pc),a0
  353.         move.l    a0,d2
  354.         move.l    a0,a1
  355. ;        lea.l    CONFIG(pc),a1
  356.         lea.l    CONFIG_END(pc),a2
  357.         sub.l    a1,a2
  358.         move.l    a2,d3
  359.         lib    Dos,Write
  360.         cmp.l    #-1,d0
  361.         bne    Save3
  362.         jsr    FileError
  363.  
  364. ;Close the file
  365.  
  366. Save3:        move.l    ConfigFile(pc),d1
  367.         lib    Dos,Close
  368.         move.l    #$00,ConfigFile
  369.         move.l    #$00,CheckSum
  370.     
  371. SaveOut:    jsr    MenusOn
  372.         jmp    Window1IDCMP
  373.  
  374. FileRequester:    move.l    a5,FRTitle
  375.         move.l    d5,FRFlags
  376.         lea.l    FileRequest1(pc),a0
  377.         lib    Req,FileRequester
  378. FROut:        rts
  379.  
  380. Quit:        cmp.l    #$01,CheckSum
  381.         bne    ShutDown
  382.         jsr    MenusOff
  383.         lea.l    NewQuitWin1(pc),a0
  384.         lib    Intuition,OpenWindow
  385.         tst.l    d0
  386.         bne    Quit1
  387.         print    <"Couldn't open Quitting-window",13,10>,_stdout
  388.         jmp    ShutDown
  389. Quit1:        move.l    d0,QuitWin1
  390.         move.l    QuitWin1,a1
  391.         move.l    $32(a1),a0
  392.         lea.l    QuitWin1Txt1,a1
  393.         move.w    #$10,d0
  394.         move.w    #$10,d1
  395.         lib    Intuition,PrintIText
  396.         move.l    Screen1,a0
  397.         lib    Intuition,DisplayBeep
  398.  
  399. QuitIDCMP:    move.l    QuitWin1(pc),a0
  400.         jsr    CheckIDCMP
  401.         cmp.l    #GADGETUP,d2
  402.         beq    QuitIDCMP1
  403.         cmp.l    #VANILLAKEY,d2
  404.         bne    QuitIDCMP
  405.         cmp.w    #$1b,d3
  406.         beq    QuitIDCMP2
  407.         cmp.w    #"y",d3
  408.         beq    QuitIDCMP3
  409.         cmp.w    #"Y",d3
  410.         beq    QuitIDCMP3
  411.         cmp.w    #"n",d3
  412.         beq    QuitIDCMP2
  413.         cmp.w    #"N",d3
  414.         beq    QuitIDCMP2
  415.         jmp    QuitIDCMP
  416.  
  417. QuitIDCMP1:    cmp.w    #$2,$26(a5)
  418.         beq    QuitIDCMP3
  419.         cmp.w    #$3,$26(a5)
  420.         bne    QuitIDCMP
  421. QuitIDCMP2:    move.l    Window1(pc),a0
  422.         lea.l    Menu1(pc),a1
  423.         jsr    MenusOn
  424.         move.l    QuitWin1(pc),a0
  425.         jsr    ClearMSGs
  426.         move.l    #0,QuitWin1
  427.         jmp    Window1IDCMP
  428. QuitIDCMP3:    jsr    MenusOn
  429.         move.l    QuitWin1(pc),a0
  430.         jsr    ClearMSGs
  431.         move.l    #0,QuitWin1
  432.         jmp    ShutDown
  433.  
  434. About:        jsr    MenusOff
  435.         lea.l    NewAbWindow1(pc),a0
  436.         lib    Intuition,OpenWindow
  437.         tst.l    d0
  438.         bne    About1
  439.         print    <"Couldn't open About-window!",13,10>,_stdout
  440.         jmp    ShutDown
  441. About1:        move.l    d0,AbWin
  442.  
  443.         move.l    d0,a0
  444.         move.l    $32(a0),AbRP
  445.  
  446.         move.l    AbRP(pc),a1        ;Color the background
  447.         move.l    #$02,d0
  448.         lib    Gfx,SetRast
  449.  
  450.         move.l    AbWin(pc),a1        ;Draw the Gads again
  451.         lea.l    YNGad1(pc),a0
  452.         move.l    #$00,a2
  453.         move.l    #-1,d0
  454.         lib    Intuition,RefreshGList
  455.  
  456.         move.l    AbRP(pc),a0        ;Border
  457.         lea.l    AbBorder1(pc),a1
  458.         move.l    #$00,d0
  459.         move.l    #$00,d1
  460.         lib    Intuition,DrawBorder
  461.  
  462.         move.l    AbRP(pc),a0        ;Texts
  463.         lea.l    AboutTxt1(pc),a1
  464.         move.l    #$00,d0
  465.         move.l    d0,d1
  466.         lib    Intuition,PrintIText
  467.  
  468. About2:        move.l    AbWin(pc),a0
  469.         jsr    CheckIDCMP
  470.         cmp.l    #GADGETUP,d2
  471.         beq    AboutOut
  472.         cmp.l    #VANILLAKEY,d2
  473.         beq    AboutKeys
  474.         jmp    About2
  475.  
  476. AboutKeys:    cmp.w    #$1b,d3
  477.         beq    AboutOut
  478.         cmp.w    #"y",d3
  479.         beq    AboutOut
  480.         cmp.w    #"Y",d3
  481.         beq    AboutOut
  482.         cmp.w    #"n",d3
  483.         beq    AboutOut
  484.         cmp.w    #"N",d3
  485.         beq    AboutOut
  486.         jmp    About2
  487.  
  488. AboutOut:    move.l    AbWin(pc),a0
  489.         jsr    ClearMSGs
  490.         move.l    #$0,AbWin
  491.         jsr    MenusOn
  492.         jmp    Window1IDCMP
  493.