<PAGE>   1
                                                                   EXHIBIT 10.40


                                    AMENDMENT
                                       TO
                           LOAN AND SECURITY AGREEMENT

        This Amendment to Loan and Security Agreement is entered into as of
August 1, 1997, by and between Silicon Valley Bank ("Bank") and AG Associates,
Inc. ("Borrower").

                                    RECITALS

        Borrower and Bank are parties to that certain Loan and Security
Agreement dated as of August 2, 1996, as amended, (the "Agreement"). Borrower
has asked Bank to amend certain provisions of the Agreement.
Bank has agreed to do so, in accordance with the terms of this Amendment.

        NOW, THEREFORE, the parties agree as follows:

        1.      The definition in Section 1.1 of "Maturity Date" is amended to
                read "July 31, 1998."

        2.      Bank approves Accounts owing to Borrower by Lucky Goldstar as
                "Eligible Foreign Accounts".

        3.      Section 2.3(a) is amended to read as follows:

               (a) Interest Rate. Except as set forth in Section 2.3(b), any
        Advances shall bear interest, on the average Daily Balance, at a rate
        equal to One Percent (1.0%) above the Prime Rate; provided the interest
        rate shall be One Half of One Percent (0.5%) above the Prime Rate,
        effective as of the first day of the fiscal quarter following the fiscal
        quarter in which Borrower is profitable.

        4.      Section 6.3 is amended by adding a new paragraph at the end of
        Section 6.3, as follows:

               Notwithstanding the foregoing, beginning the fiscal quarter
        following the fiscal quarter in which Borrower is first profitable, the
        financial statements and backlog and bill-to-book report required under
        clause (a) of the first paragraph of this Section 6.3 shall be due
        within twenty (20) days of the last day of each fiscal quarter.

        5.      Section 6.11 is amended to read as follows (and Exhibit D is
        amended to reflect such change to be in the form of Exhibit D attached 
        hereto):

                6.11 Profitability. Borrower shall not suffer a loss in excess
        of $500,000 for the fiscal quarter ending September 30, 1997. Borrower
        shall be profitable for each fiscal quarter thereafter.

        6.      Unless otherwise defined, all capitalized terms in this
        Amendment shall be as defined in the Agreement. Except as amended, the 
        Agreement remains in full force and effect.

        7.      Borrower represents and warrants that the Representations and
        Warranties contained in the Agreement are true and correct as of the 
        date of this Amendment, and that no Event of Default has occurred and 
        is continuing.

        8.      This Amendment may be executed in two or more counterparts, each
        of which shall be deemed an original, but all of which together shall 
        constitute one instrument.


                                       1

<PAGE>   2




        9. As a condition to the effectiveness of this Amendment, Borrower shall
pay a fee equal to Twenty Five Thousand Dollars ($25,000) and shall reimburse
Bank for the Bank Expenses incurred in connection with this Amendment.

        IN WITNESS WHEREOF, the undersigned have executed this Amendment as of
the first date above written.

                                 AG ASSOCIATES, INC.

                                 By
                                   ---------------------------------------------
                                 Title
                                      ------------------------------------------

                                 SILICON VALLEY BANK

                                 By
                                   ---------------------------------------------
                                 Title
                                      ------------------------------------------



                                       2