mirror of
https://github.com/robmcmullen/asmgen.git
synced 2024-12-22 14:29:18 +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):
|
||||
|
||||
byteSplits = colorStreams[row]
|
||||
maskSplits = maskStreams[row]
|
||||
|
||||
# Generate blitting code
|
||||
for chunkIndex in range(len(byteSplits)):
|
||||
|
||||
# Optimization
|
||||
if byteSplits[chunkIndex] != "00000000" and \
|
||||
byteSplits[chunkIndex] != "10000000":
|
||||
|
||||
if maskSplits[chunkIndex] == "00000000":
|
||||
optimizationCount += 1
|
||||
else:
|
||||
value = self.binary_constant(byteSplits[chunkIndex])
|
||||
|
||||
# Store byte into video memory
|
||||
@ -333,8 +334,6 @@ class Sprite(Listing):
|
||||
"\tlda %s\n" % value + \
|
||||
"\tsta (SCRATCH0),y\n";
|
||||
cycleCount += 2 + 6
|
||||
else:
|
||||
optimizationCount += 1
|
||||
|
||||
# Increment indices
|
||||
if chunkIndex == len(byteSplits)-1:
|
||||
@ -429,7 +428,7 @@ class HGR(ScreenFormat):
|
||||
black,magenta,green,orange,blue,white,key = range(7)
|
||||
|
||||
def bitsForColor(self, pixel):
|
||||
if pixel == self.black:
|
||||
if pixel == self.black or pixel == self.key:
|
||||
return "00"
|
||||
else:
|
||||
if pixel == self.white:
|
||||
@ -442,7 +441,7 @@ class HGR(ScreenFormat):
|
||||
return "10"
|
||||
|
||||
def bitsForMask(self, pixel):
|
||||
if pixel == self.black:
|
||||
if pixel == self.key:
|
||||
return "00"
|
||||
|
||||
return "11"
|
||||
@ -456,7 +455,7 @@ class HGR(ScreenFormat):
|
||||
return highBit
|
||||
|
||||
def highBitForMask(self, pixel):
|
||||
return "1"
|
||||
return "0"
|
||||
|
||||
def pixelColor(self, pixelData, row, col):
|
||||
r = pixelData[row][col*3]
|
||||
|
Loading…
Reference in New Issue
Block a user