The last four hours or so of coding time have been spent doing a huge chunk of refactoring in the dirty-row and string-display routines, mainly to get them to play nice with the new dirty-row set/scan routines. Interestingly, reworking these two quite large routines has been a lot of fun, not least for those moments when I can say to myself "hey, I don't have to do that any more!" because I've either eliminated something that works a better way somewhere else, or just because the act of plugging-in the new code has led to an overall optimisation. Hacking chunks of code out, saving a few bytes and a few cycles here and there, but without altering the end result in terms of functionality, is most enjoyable.
There was a bad moment about 90 minutes in where I had half-a-dozen windows open in the editor each with at least one routine undergoing revision to a greater or lesser degree. I felt like I'd plucked a thread on a wool jumper and was watching it slowly fall to pieces in front of me. Having altered the dirty-row table and logic to be zero-based instead of one-based (an artifact of how the cursor logic worked) I had to work back through a number of support routines to adjust them for zero as a valid row number - tweaking branch conditions, mostly, but occasionally something larger would need altering. Trying to keep the picture of the whole structure in my head whilst deliberately breaking bits of it in order that a dependent routine would work as expected gave me a few hairy moments, but I think I've managed to keep everything in place.
The code is now almost back to a working version - I still have the cursor and keyboard handlers disabled, but that's because they're going to get a complete rewrite anyway. Just for fun, here's the list of stuff I need to do over the next week in order to get a releasable demo as promised at or about the end of the month:
- Finalise new dirty-row logic integration
- Rework glyph renderer to reduce ZP usage from 8 bytes to 1 byte
- Fix the 'guessed' placeholder VIC and VIA settings for NTSC so they work properly
- Integrate cursor blink timer with time-of-day clock counter
- Remove code to support block-style cursor (leaving underline-style only)
- Re-enable cursor mechanics using simpler (working!) logic
- Add a visual progress-monitor for the RESET memory test (if I have time)
- Add a startup 'beep' to prove audio is working (again, if I have time)
- Move line-25 raster interrupt from IRQ to NMI (maybe, not sure if actually possible)
As I've been mooching-about in the sourcecode anyway, I've also taken the occasional opportunity to generally overhaul the logical layout; I've encountered a few situations where chunks of code could be moved to allow 'fall-through' processing rather than a JSR call, which of course saves 12 cycles every time the routine is exercised. Judicious arrangement of such cascading subroutines means they can all be used in one path, or individually called for sub-section usage - it's a bit tricky sometimes making sure register usage remains clean and concise, but worth it - the little bit of cycle-timing I've done here and there shows some nice little speedups in critical sections, and this is visually reinforced by the fact that the IRQ-time border colour thickness has reduced noticeably when the OS is running.
So nothing much to show this time, because almost everything I'm working on is foundation stuff that has little impact visually - although I might tweak the visuals a bit for the release. Nose to the grindstone, I guess...
No comments:
Post a Comment