Tetris inner loop MOS6510 / C=64
Introduction
Once in a century code can make me really proud. Especially when it is concise and no byte can be stripped off. The last time was in 1991. Major things still to come in the third millenium.
The lookups to chars and blocks are initialized with an offset to a block/rotation with SMC. The same for color.
The screen matrix of the VIC-II has 25 lines of 40 characters each with a linear memory layout.
0 | 1 | 2 | 3 | 4 | 5 | ... |
40 | 41 | 42 | 43 | 44 | 45 | ... |
80 | 81 | 82 | 83 | 84 | 85 | ... |
120 | 121 | 122 | 123 | 124 | 125 | ... |
In C it would like this:
Of course something will prove that at least one byte can be stripped off...