mirror of
https://github.com/robmcmullen/asmgen.git
synced 2024-06-25 16:29:32 +00:00
Changed optimization that skips the byte write to be based on mask value
* if mask is empty, no pixels change, so no need to write that byte
This commit is contained in:
parent
2c4a951a27
commit
bb06a8bf65
15
HiSprite.py
15
HiSprite.py
|
@ -311,14 +311,15 @@ class Sprite(Listing):
|
||||||
for row in range(self.height):
|
for row in range(self.height):
|
||||||
|
|
||||||
byteSplits = colorStreams[row]
|
byteSplits = colorStreams[row]
|
||||||
|
maskSplits = maskStreams[row]
|
||||||
|
|
||||||
# Generate blitting code
|
# Generate blitting code
|
||||||
for chunkIndex in range(len(byteSplits)):
|
for chunkIndex in range(len(byteSplits)):
|
||||||
|
|
||||||
# Optimization
|
# Optimization
|
||||||
if byteSplits[chunkIndex] != "00000000" and \
|
if maskSplits[chunkIndex] == "00000000":
|
||||||
byteSplits[chunkIndex] != "10000000":
|
optimizationCount += 1
|
||||||
|
else:
|
||||||
value = self.binary_constant(byteSplits[chunkIndex])
|
value = self.binary_constant(byteSplits[chunkIndex])
|
||||||
|
|
||||||
# Store byte into video memory
|
# Store byte into video memory
|
||||||
|
@ -333,8 +334,6 @@ class Sprite(Listing):
|
||||||
"\tlda %s\n" % value + \
|
"\tlda %s\n" % value + \
|
||||||
"\tsta (SCRATCH0),y\n";
|
"\tsta (SCRATCH0),y\n";
|
||||||
cycleCount += 2 + 6
|
cycleCount += 2 + 6
|
||||||
else:
|
|
||||||
optimizationCount += 1
|
|
||||||
|
|
||||||
# Increment indices
|
# Increment indices
|
||||||
if chunkIndex == len(byteSplits)-1:
|
if chunkIndex == len(byteSplits)-1:
|
||||||
|
@ -429,7 +428,7 @@ class HGR(ScreenFormat):
|
||||||
black,magenta,green,orange,blue,white,key = range(7)
|
black,magenta,green,orange,blue,white,key = range(7)
|
||||||
|
|
||||||
def bitsForColor(self, pixel):
|
def bitsForColor(self, pixel):
|
||||||
if pixel == self.black:
|
if pixel == self.black or pixel == self.key:
|
||||||
return "00"
|
return "00"
|
||||||
else:
|
else:
|
||||||
if pixel == self.white:
|
if pixel == self.white:
|
||||||
|
@ -442,7 +441,7 @@ class HGR(ScreenFormat):
|
||||||
return "10"
|
return "10"
|
||||||
|
|
||||||
def bitsForMask(self, pixel):
|
def bitsForMask(self, pixel):
|
||||||
if pixel == self.black:
|
if pixel == self.key:
|
||||||
return "00"
|
return "00"
|
||||||
|
|
||||||
return "11"
|
return "11"
|
||||||
|
@ -456,7 +455,7 @@ class HGR(ScreenFormat):
|
||||||
return highBit
|
return highBit
|
||||||
|
|
||||||
def highBitForMask(self, pixel):
|
def highBitForMask(self, pixel):
|
||||||
return "1"
|
return "0"
|
||||||
|
|
||||||
def pixelColor(self, pixelData, row, col):
|
def pixelColor(self, pixelData, row, col):
|
||||||
r = pixelData[row][col*3]
|
r = pixelData[row][col*3]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user