Speed-coding for the 6502 – a simple example
13 days ago
- #bitmap-scaling
- #assembly
- #optimization
- The article discusses optimizing an algorithm for scaling down a bitmap from 256×192 to 192×144 on a 1MHz processor with limited hardware support.
- Initial naive approach using multiplication and division takes about 20 seconds for the entire image scaling process.
- First optimization replaces multiplication and division with bit shifting and addition, reducing the time to under 2 seconds.
- Further optimization simplifies the formula to use 9-bit math, cutting the time down to 0.6 seconds.
- Final optimization involves pre-calculating a lookup table, reducing the scaling time to just 0.2 seconds.
- The article emphasizes the importance of algorithm optimization in constrained environments.