An efficient semi-implicit second-order-accurate finite-difference method is described for studying incompressible Rayleigh-Benard convection in a box, with sidewalls that are periodic, thermally insulated, or thermally conducting. Operator-splitting and a projection method reduce the algorithm at each time step to the solution of four Helmholtz equations and one Poisson equation, and these are are solved by fast direct methods. The method is numerically stable even though all field values are placed on a single non-staggered mesh commensurate with the boundaries. The efficiency and accuracy of the method are characterized for several representative convection problems.