Phew! Today was definitely a busy day in terms of assembly work. Leading off from the hardware problems yesterday, I actually got a wonderful piece of advice on what functions 68K supports: binary coded decimal arithmetic.
Binary coded decimals, or BCD, is a way to encode decimal values as hexadecimals, but still have them read as such from memory. For example, $999 could still be read as a decimal number (not in the regular way, as it's still 9 * 256 + 9 * 16 + 9 * 1). Also, the processor allows abcd and sbcd instructions, which only work with byte sized spaces (logical shifting, anyone?) but do proper BCD arithmetic and even carries the extension from addition that overflows the byte size into another addition, so 50 + 50 could indeed be 100.
What next? Optimizing the bitmap was a slight nightmare, as I had to work from scratch, 16x16 pixel scratch (Augh my eyes). Luckily enough, I found the error of my ways to be in the dbra instructions I was using; instead of checking at 0, it actually checked at -1. Just like that, my problems were solved relatively quickly and I have a pink paddle moving with proper input on my screen, with unfortunate flickering from redrawing the bitmap:
What's next? Double-buffering may be the key to my issue, but that may still lead to some flickering. The ball also needs to be implemented, as I will soon need it for collision testing and possible floating point shenaniganery.
No comments:
Post a Comment