{
  "id": 19431084,
  "title": "A great old-timey game-programming hack (2013)",
  "url": "https://urgent.news/2026/11/11/a-great-old-timey-game-programming-hack-2013",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-11T01:56:31.000Z",
  "source": {
    "name": "Hacker News",
    "slug": "hacker-news",
    "url": "https://blog.moertel.com/posts/2013-12-14-great-old-timey-game-programming-hack.html"
  },
  "original_language": "en",
  "account": "In the 8-bit PC era of the 1980s, game programmers had to resort to creative measures to ensure their games ran smoothly on the slow hardware of that time. In particular, they had to manually draw every pixel on the screen, byte by byte, without the aid of texture mappers or blitters. My friend, a gifted programmer, had created a side-scroller game that faithfully recreated a graphically impressive coin-op game popular in arcades, but it was running too slowly due to the choppy motion breaking the player's immersion. After exhausting all possible optimization techniques, he turned to me for help. The graphics hardware of the time did not perform any operations automatically. Instead, it required programmers to manually draw each pixel, using bytes to represent colors. The game spent most of its time redrawing the background, drawing nearly a screen's worth of background tiles for each frame. Each tile was 28 by 28 pixels, represented in memory as 28 contiguous rows of 14 bytes each. The screen buffer was laid out as 240 contiguous rows of 160 bytes each. Copying a tile onto the screen buffer involved copying 28 rows, each consisting of 14 bytes. The processor for the game was a 6809, which had 16-bit index registers and auto-increment addressing modes, allowing for efficient copying. My friend had already unrolled loops and eliminated unnecessary draws, but there seemed to be no easy optimization left. The inner loop, responsible for copying a single tile, took 2893 cycles to execute. The programmer attempted to reduce the loop overhead by unrolling the loop, which decreased the cycle count per row from 157 to 120. However, further optimizations were not apparent. Despite the inability to improve the performance, the programmer felt compelled to find a solution, even though they couldn't see any way to make the code any faster.",
  "summary": null,
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}