Updated from 4:49 p.m. EST

SAN FRANCISCO -- Advanced Micro Devices ( AMD) posted a massive $1.8 billion fourth-quarter loss as the company wrote off a large chunk of its acquisition of graphics chipmaker ATI.

But AMD managed to improve its margins, despite spending much of the fourth-quarter doing damage control, and reaffirmed its goal of returning to an operating profit in the third quarter.

"Our No. 1 goal operationally is we've got to return to profitability as soon as we can," said CEO Hector Ruiz in a post-earnings conference call Thursday. "We believe we have a plan that will allow us to do that in second half of year."

Shares of AMD were up 4.1%, or 21 cents, at $6.60 in extended trading Thursday.

The Sunnvyale, Calif., chipmaker said demand for its new quad-core microprocessors is strong, even as AMD scrambles to fix a bug in the chip that has prevented it from selling it to the general public.

AMD said it shipped 400,000 quad-core chips for servers and desktop PCs in the fourth-quarter, and expects to double that number in the current quarter.

A more significant sales volume won't be possible until AMD releases a new version of the chip that corrects the flaw. Ruiz said that AMD's factories are currently producing silicon with the fixes in places, with production samples slated to ship to customers toward the end of the first quarter and the beginning of the second quarter.

While AMD appeared to be making some progress righting itself, its fourth-quarter financial results were hardly pretty and provided a fitting end to a year in which the company lost $3.3 billion.

AMD's stock is down 64% from its 52-week high of $18.28.

In the three months ended Dec. 29 AMD had a loss of $1.77 billion, or $3.06 a share vs. a loss of $576 million, or $1.08 a share, at this time last year.

The loss included $1.6 billion, or $2.89 a share, in charges to reflect impairment in the goodwill and other intangible assets related to ATI, the Canadian graphics chipmaker that AMD acquired for $5.4 billion in 2006, as well as to account for AMD's investment in flash memory firm Spansion ( SPSN).

Excluding those items, AMD lost 17 cents, vs. the average analyst expectation of 36 cents.

"We were close to break-even operationally for the quarter, reducing our fourth quarter non-GAAP operating loss to $9 million," said CFO Bob Rivet in a statement.

AMD warned in December that it would write off a "material" amount of its ATI purchase, though it didn't say how much. Thursday's writeoff suggests that AMD overpaid in the deal by about 30%.

The chipmaker's revenue was flat year over year at $1.77 billion, vs. the average analyst expectation of $1.78 billion.

But margins grew sequentially to 44% from 41% in the third quarter.

AMD said the margin improvement was due to shipments of new products and higher average selling prices.

According to AMD, total microprocessor revenue increased 11% sequentially, as the company achieved record desktop and mobile processor unit shipments.

On Tuesday, Intel ( INTC), the world's No.1 microprocessor company, reported a 51% increase in its bottom line on revenue of $10.7 billion.

But Intel's stock has fallen more than 14% since the report, on fears that the global PC market is slowing.

AMD's management echoed comments by Intel executives Tuesday, insisting that the company was not seeing any signs of trouble in its own business environment.

AMD said it expects revenue in the current quarter to decrease in line with seasonality, which executives said ranges from a 5% to 10% sequential decline.

The average analyst expectation calls for AMD's sales to decline 6% to $1.66 billion in the current quarter, with a loss of 38 cents.

If you liked this article you might like

AMD Unveils New Profit Goals

AMD Unveils New Profit Goals

AMD Relying on Chip Do-Over

AMD Relying on Chip Do-Over

Intel Slashes Revenue Forecast (Update)

Intel Slashes Revenue Forecast (Update)

Intel Slashes Revenue Forecast

Intel Slashes Revenue Forecast

Street Frowns on Hostile Fight for Atmel

Street Frowns on Hostile Fight for Atmel