optimization to save the X mod value -- it's the same for every row

This commit is contained in:
Rob McMullen 2017-06-30 12:33:27 -07:00
parent b3a4a5b5b4
commit 6dfab0efb5

View File

@ -410,10 +410,16 @@ class Sprite(Listing):
self.asm("sta SCRATCH1")
self.asm("lda HGRROWS_L,x")
self.asm("sta SCRATCH0")
self.asm("ldy PARAM0")
self.asm("lda DIV%d_%d,y" % (self.screen.numShifts, self.screen.bitsPerPixel))
self.asm("tay")
return cycles + 4 + 3 + 4 + 3 + 3 + 4 + 2;
if row == 0:
self.asm("ldy PARAM0")
self.asm("lda DIV%d_%d,y" % (self.screen.numShifts, self.screen.bitsPerPixel))
self.asm("sta PARAM2") # save the mod lookup; it doesn't change
self.asm("tay")
cycles += 3 + 4 + 3 + 2
else:
self.asm("ldy PARAM2")
cycles += 2
return cycles + 4 + 3 + 4 + 3;
def shiftStringRight(string, shift, bitsPerPixel, fillerBit):