floobydust wrote:
Even more progress, who knew. First, I removed the SEI instructions in the CHIN/CHOUT routines.... has been tested quite a bit without any issues, two more bytes of code saved and a couple clock cycles per routine.
I told you so.
Quote:
I then went back and looked the IRQ service routine. Finally realized I did another dumb thing. I first BIT test the 6551 status register (bit 7 reflected in the n flag) and branch accordingly. I then load the 6551 status register and BIT with RCV and later XMIT masks. If I just load the status register first, bit 7 still gets reflected in the n flag and I don't need to load the status register to test for RCV or XMIT bits later. Saves another 3 bytes of code and 4 clock cycles off the 6551 ISR for all paths, sans initial exit. Updated code...
I was wondering if you would spot that. I was going to mention it in my earlier post but decided to let it ride and see if you'd catch it.
When working on time-critical code, especially something like an ISR, I always set it aside after the initial testing and debugging, and then come back to it for a fresh perspective. More often than not, I see something that can be compacted, or perhaps a change in logic that will improve speed. I did that several times with my SCSI driver and manage to both shrink size and execution time. The result is that I got the bus to RAM transfer speed up from about 350KB/sec to about 500KB/sec.
I cover some techniques for improving performance in time-critical code in my
65C816 interrupt article.