Martin Marietta Corp. of Bethesda yesterday reported second-quarter net earnings of $55.1 million ($1 a share) on revenue of $1.2 billion, down 55 percent from net earnings of $122 million ($2.09) on revenue of $1.1 billion last year.

The 1985 second-quarter results included a nonrecurring gain of $73 million ($1.29) from the sale of the master builders division during that quarter.

Six-months net earnings for the aerospace and high-technology company were $101.3 million ($1.84) on revenue of $2.3 billion, down 32 percent from net earnings of $149.8 million ($2.63) on revenue of $2.1 billion last year. The sale of the masters division also is reflected in these results.

According to Chairman Thomas G. Pownall, there were earnings gains in the aerospace and materials businesses in the second quarter of this year, and a continuation of marginal losses in the packaged software segment of the data systems company Marietta owns. VM Software Inc. of Vienna reported net earnings of $965,787 (23 cents a share) on revenue of $6.2 million for the second quarter, up 64 percent from earnings of $590,543 (16 cents) on revenue of $4.2 million for the same period last year. For the first half of this year, the company reported net earnings of $1.6 million (38 cents) on revenue of $10.6 million, up 77 percent from net earnings of $909,416 (25 cents) on revenue of $7.4 million for the first half of 1985.

Richard L. Earnest, president of the company, which develops, markets and supports system software products for use with IBM's VM operating system, said a key factor in earnings gains was a high demand for software that reduces operating costs for customers. ERC International of Vienna yesterday reported second-quarter net earnings of $705,000 (17 cents a share) on revenue of $26.3 million, up 35 percent over net earnings of $521,000 (14 cents) on revenue of $13.1 million for the same quarter a year ago. The professional services company also reported six-month net earnings of $1.3 million (31 cents) on revenue of $47.1 million, up 54 percent over net earnings of $842,000 (22 cents) on revenue of $25 million for the same period of 1985.

ERC President Jack Aalseth said the company's improved performance was due to significantly increased revenue from the energy and environmental systems group, internal growth in the operations of ERC's defense systems group, and benefits from a division newly acquired by the logistics and facilities management group. Continued losses with the computer systems group's operations prevented earnings from increasing at the same rate as revenue, he said. Legg Mason Inc. of Baltimore reported net earnings of $2.8 million (50 cents a share) on revenue of $34.3 million for its first quarter that ended June 30, up 60 percent over net earnings of $1.7 million (36 cents) on revenue of $24.4 million last year.

Legg Mason Inc. provides securities brokerage, investment advisory and other financial services through Legg Mason Wood Walker Inc. and other wholly owned subsidiaries. The company said its improved performance was due to an increase in securities commission revenue in its 39 offices, as well as from investment banking and investment advisory activities. Assets under management in Legg Mason's five mutual funds and in the company's investment advisory subsidiary have grown to $1.3 billion from $600 million at the same time last year. Universal Security Instruments Inc. of Owings Mills, Md., reported net income of $386,380 (10 cents a share) on revenue of $6.2 million for its first quarter that ended June 30, an increase of 450 percent over net income of $70,236 (2 cents) on revenue of $3.1 million for the same period a year ago.

Harvey Grossblatt, vice president and chief financial officer of the video, telecommunications and security products company, said the increase was due to a broader base of customers and a broader sales network. The demand for video accessories also is increasing substantially, he said.