home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / dev / asm / tbsource / nbbs / setprog / spwin1idcmp.bak < prev    next >
Text File  |  1993-12-21  |  10KB  |  492 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.         lea.l    CONFIG(pc),a1
  355.         lea.l    CONFIG_END(pc),a2
  356.         sub.l    a1,a2
  357.         move.l    a2,d3
  358.         lib    Dos,Write
  359.         cmp.l    #-1,d0
  360.         bne    Save3
  361.         jsr    FileError
  362.  
  363. ;Close the file
  364.  
  365. Save3:        move.l    ConfigFile(pc),d1
  366.         lib    Dos,Close
  367.         move.l    #$00,ConfigFile
  368.         move.l    #$00,CheckSum
  369.     
  370. SaveOut:    jsr    MenusOn
  371.         jmp    Window1IDCMP
  372.  
  373. FileRequester:    move.l    a5,FRTitle
  374.         move.l    d5,FRFlags
  375.         lea.l    FileRequest1(pc),a0
  376.         lib    Req,FileRequester
  377. FROut:        rts
  378.  
  379. Quit:        cmp.l    #$01,CheckSum
  380.         bne    ShutDown
  381.         jsr    MenusOff
  382.         lea.l    NewQuitWin1(pc),a0
  383.         lib    Intuition,OpenWindow
  384.         tst.l    d0
  385.         bne    Quit1
  386.         print    <"Couldn't open Quitting-window",13,10>,_stdout
  387.         jmp    ShutDown
  388. Quit1:        move.l    d0,QuitWin1
  389.         move.l    QuitWin1,a1
  390.         move.l    $32(a1),a0
  391.         lea.l    QuitWin1Txt1,a1
  392.         move.w    #$10,d0
  393.         move.w    #$10,d1
  394.         lib    Intuition,PrintIText
  395.         move.l    Screen1,a0
  396.         lib    Intuition,DisplayBeep
  397.  
  398. QuitIDCMP:    move.l    QuitWin1(pc),a0
  399.         jsr    CheckIDCMP
  400.         cmp.l    #GADGETUP,d2
  401.         beq    QuitIDCMP1
  402.         cmp.l    #VANILLAKEY,d2
  403.         bne    QuitIDCMP
  404.         cmp.w    #$1b,d3
  405.         beq    QuitIDCMP2
  406.         cmp.w    #"y",d3
  407.         beq    QuitIDCMP3
  408.         cmp.w    #"Y",d3
  409.         beq    QuitIDCMP3
  410.         cmp.w    #"n",d3
  411.         beq    QuitIDCMP2
  412.         cmp.w    #"N",d3
  413.         beq    QuitIDCMP2
  414.         jmp    QuitIDCMP
  415.  
  416. QuitIDCMP1:    cmp.w    #$2,$26(a5)
  417.         beq    QuitIDCMP3
  418.         cmp.w    #$3,$26(a5)
  419.         bne    QuitIDCMP
  420. QuitIDCMP2:    move.l    Window1(pc),a0
  421.         lea.l    Menu1(pc),a1
  422.         jsr    MenusOn
  423.         move.l    QuitWin1(pc),a0
  424.         jsr    ClearMSGs
  425.         move.l    #0,QuitWin1
  426.         jmp    Window1IDCMP
  427. QuitIDCMP3:    jsr    MenusOn
  428.         move.l    QuitWin1(pc),a0
  429.         jsr    ClearMSGs
  430.         move.l    #0,QuitWin1
  431.         jmp    ShutDown
  432.  
  433. About:        jsr    MenusOff
  434.         lea.l    NewAbWindow1(pc),a0
  435.         lib    Intuition,OpenWindow
  436.         tst.l    d0
  437.         bne    About1
  438.         print    <"Couldn't open About-window!",13,10>,_stdout
  439.         jmp    ShutDown
  440. About1:        move.l    d0,AbWin
  441.  
  442.         move.l    d0,a0
  443.         move.l    $32(a0),AbRP
  444.  
  445.         move.l    AbRP(pc),a1        ;Color the background
  446.         move.l    #$02,d0
  447.         lib    Gfx,SetRast
  448.  
  449.         move.l    AbWin(pc),a1        ;Draw the Gads again
  450.         lea.l    YNGad1(pc),a0
  451.         move.l    #$00,a2
  452.         move.l    #-1,d0
  453.         lib    Intuition,RefreshGList
  454.  
  455.         move.l    AbRP(pc),a0        ;Border
  456.         lea.l    AbBorder1(pc),a1
  457.         move.l    #$00,d0
  458.         move.l    #$00,d1
  459.         lib    Intuition,DrawBorder
  460.  
  461.         move.l    AbRP(pc),a0        ;Texts
  462.         lea.l    AboutTxt1(pc),a1
  463.         move.l    #$00,d0
  464.         move.l    d0,d1
  465.         lib    Intuition,PrintIText
  466.  
  467. About2:        move.l    AbWin(pc),a0
  468.         jsr    CheckIDCMP
  469.         cmp.l    #GADGETUP,d2
  470.         beq    AboutOut
  471.         cmp.l    #VANILLAKEY,d2
  472.         beq    AboutKeys
  473.         jmp    About2
  474.  
  475. AboutKeys:    cmp.w    #$1b,d3
  476.         beq    AboutOut
  477.         cmp.w    #"y",d3
  478.         beq    AboutOut
  479.         cmp.w    #"Y",d3
  480.         beq    AboutOut
  481.         cmp.w    #"n",d3
  482.         beq    AboutOut
  483.         cmp.w    #"N",d3
  484.         beq    AboutOut
  485.         jmp    About2
  486.  
  487. AboutOut:    move.l    AbWin(pc),a0
  488.         jsr    ClearMSGs
  489.         move.l    #$0,AbWin
  490.         jsr    MenusOn
  491.         jmp    Window1IDCMP
  492.