From 6dfab0efb570c1c23a4bfb8c248b858a0cd88742 Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Fri, 30 Jun 2017 12:33:27 -0700 Subject: [PATCH] optimization to save the X mod value -- it's the same for every row --- HiSprite.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/HiSprite.py b/HiSprite.py index 91f059c..c86fc06 100755 --- a/HiSprite.py +++ b/HiSprite.py @@ -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):