A puzzle from a 6809 tile blitter

Draw the tile broken, and it lands whole.

Stack pushes made this 8-bit tile copy 1.71 times faster, but drew it upside down with its halves swapped. Store the tile pre-mangled, and it lands whole. Your turn.

1Prepare the tile

Blitter: Moves: 0Par:
Memory (you edit this, tap two septets to swap)
Screen after the blit
Goal

A septet is 7 bytes, 14 four-bit pixels. Each strip above is one septet of one pixel row, scaled down from the article's 28 by 28 tile (2 septets per row). Pixels inside a septet never change order.

2,893cycles per tile, tuned loop
1,689cycles per tile, stack hack
56cycles per row, down from 157

2Interrupt lab: let the corruption happen, just not there

The stack trick took the system stack pointer S. A sound interrupt that fires mid-copy pushes its registers where S points. Pick what S points at and the order tiles are drawn, arm some interrupts, and run a frame. Your goal: a frame with no bad tile, and no damaged reference tile.

S points at:
Draw order:
Reference tiles:

Tap tiles to arm up to 4 interrupts. Model: each one lands on the last push of that tile, the worst moment, and scribbles on the bytes just below the stack pointer.

Arm some interrupts, then run a frame.

3The cycle ledger

Cycles to copy one 28-pixel row, as counted in the article:

The same hack, per whole 28 by 28 tile. Choose how many tiles a frame redraws (a 320 by 240 screen holds at most 12 by 9, which is 108):


0cycles, tuned loop (2,893 per tile)
0cycles, stack hack (1,689 per tile)
0cycles saved per frame (computed)
1.71x2,893 / 1,689, computed. The author says 70 percent.

The heart of the hack, from the article, one row of 28 pixels in 56 cycles:

PULS D,X,Y,DP  ; first 7 bytes    12 cycles
PSHU D,X,Y,DP  ;                  12
PULS D,X,Y,DP  ; second 7 bytes   12
PSHU D,X,Y,DP  ;                  12
LEAU -WOFF,U   ; next dst row      8

Pulls walk S up through the tile, pushes walk U down the screen. That is why rows land upside down and the two septets of each row land swapped.

Sources

Primary (the author's own account, with his cycle counts; he says he reconstructed details from memory): Tom Moertel, "A Great Old-Timey Game-Programming Hack", posted 14 December 2013. All cycle figures, the 28 by 28 tile, the 6809 instructions and the interrupt story come from it. Read on 11 November 2026.

Resurfaced on the Hacker News front page on 11 November 2026. Not used for any figure.

Computed here, not from the source: the 1.71 ratio, 108 tiles, per-frame totals, the puzzle pars (found by exhaustive search) and the interrupt model in section 2. The tile art is original and scaled down.