We present a fast 2-D phase retrieval approach used to perform optical phase modulation of a microelectromechanical-deformable mirror (MEM-DM). Traditional solutions to beamsplitting, beam steering, and beam shaping (BS3) involve multiple and sometimes costly optical components. For example, beamsplitting is normally accomplished with beamsplitters, beam steering is normally achieved with gimbaled mechanical devices, and beam shaping is normally done with addressable, polarized, and potentially absorptive devices such as LCDs. Using the phase retrieval algorithm with a desired far-field amplitude pattern as a constraint, a segmented wavefront control device is shown to simultaneously perform the functions of BS3. The MEM-DM used is a foundry- microfabricated device that is attractive for optical phase modulation applications primarily because of its inherent low cost and low drive voltages. The MEM-DM shapes the beam based on the results of a modified Fienup and Roggemann/Lee phase retrieval algorithm implemented within the system. The optical bench setup and the experimental results for BS3 are presented. Measured experimental data show good agreement with model simulations. A comparison between analog MEM- DMs and a digitally controlled MEM-DM is presented. Overall, experimental results demonstrate the efficacy of the phase retrieval algorithm and a single phase control device in solving optics problems normally solved through traditional techniques and multiple devices.