Sunday, August 1, 2010

PC->NES Speed improvement!






So I've been wrestling with the timing of the transfer tool. The Arduino end is a huge unknown since I can't get access to the underlying assembly. The good news is I figured out what was blowing the timing. I had 2 bytes being sent each time - pretty much like a PISO (parallel in serial out) shift register. The way I was doing it originally was

PORTC = (byteToSend1 >> bitIndex);

Which was fine, but in the worst case it would have to shift the value 15 times.
Instead I made the change persistant:

byteToSend1 = (byteToSend1 >> 1);
PORTC = (byteToSend1);

Which ensures each bit only needs to be shifted once!

1 comment: