mirror of
https://github.com/blondie7575/SpriteGen.git
synced 2024-10-03 06:54:30 +00:00
Initial commit
The sprite generator basically works for the four primary hires colors. The included sample program renders all the sample sprites in various places on screen.
This commit is contained in:
commit
9a4c4b7b85
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/spritedemo.lst
|
||||
/.DS_Store
|
BIN
AppleCommander.jar
Normal file
BIN
AppleCommander.jar
Normal file
Binary file not shown.
32
Makefile
Normal file
32
Makefile
Normal file
@ -0,0 +1,32 @@
|
||||
#
|
||||
# Makefile
|
||||
# HGR
|
||||
#
|
||||
# Created by Quinn Dunki on 7/19/16
|
||||
# One Girl, One Laptop Productions
|
||||
# http://www.quinndunki.com
|
||||
# http://www.quinndunki.com/blondihacks
|
||||
#
|
||||
|
||||
|
||||
CL65=cl65
|
||||
AC=AppleCommander.jar
|
||||
ADDR=6000
|
||||
|
||||
PGM=spritedemo
|
||||
|
||||
all: $(PGM)
|
||||
|
||||
|
||||
$(PGM):
|
||||
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --start-addr $(ADDR) -l$(PGM).lst $(PGM).s
|
||||
java -jar $(AC) -d $(PGM).dsk $(PGM)
|
||||
java -jar $(AC) -p $(PGM).dsk $(PGM) BIN 0x$(ADDR) < $(PGM)
|
||||
rm -f $(PGM)
|
||||
rm -f $(PGM).o
|
||||
osascript V2Make.scpt $(PROJECT_DIR) $(PGM)
|
||||
|
||||
clean:
|
||||
rm -f $(PGM)
|
||||
rm -f $(PGM).o
|
||||
|
207
SpriteGen.xcodeproj/project.pbxproj
Normal file
207
SpriteGen.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,207 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
701B5DF81D8478B500E6D330 /* spritedemo.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = spritedemo.s; sourceTree = "<group>"; };
|
||||
701B5DF91D847ADA00E6D330 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||
701B5DFB1D847B4100E6D330 /* hgrtableY.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = hgrtableY.s; sourceTree = "<group>"; };
|
||||
701B5DFC1D847B6D00E6D330 /* SpriteGenerator.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = SpriteGenerator.py; sourceTree = "<group>"; };
|
||||
701B5DFD1D847C3900E6D330 /* spritegen0.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = spritegen0.s; sourceTree = "<group>"; };
|
||||
701B5DFE1D847C3900E6D330 /* spritegen1.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = spritegen1.s; sourceTree = "<group>"; };
|
||||
701B5DFF1D847C3900E6D330 /* spritegen2.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = spritegen2.s; sourceTree = "<group>"; };
|
||||
701B5E001D847C3900E6D330 /* spritegen3.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = spritegen3.s; sourceTree = "<group>"; };
|
||||
701B5E011D847D9A00E6D330 /* hgrtableX.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = hgrtableX.s; sourceTree = "<group>"; };
|
||||
701B5E021D847ED300E6D330 /* macros.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = macros.s; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
701B5DED1D84788F00E6D330 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
701B5DF91D847ADA00E6D330 /* Makefile */,
|
||||
701B5DFC1D847B6D00E6D330 /* SpriteGenerator.py */,
|
||||
701B5E021D847ED300E6D330 /* macros.s */,
|
||||
701B5DF81D8478B500E6D330 /* spritedemo.s */,
|
||||
701B5E011D847D9A00E6D330 /* hgrtableX.s */,
|
||||
701B5DFB1D847B4100E6D330 /* hgrtableY.s */,
|
||||
701B5DFD1D847C3900E6D330 /* spritegen0.s */,
|
||||
701B5DFE1D847C3900E6D330 /* spritegen1.s */,
|
||||
701B5DFF1D847C3900E6D330 /* spritegen2.s */,
|
||||
701B5E001D847C3900E6D330 /* spritegen3.s */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXLegacyTarget section */
|
||||
701B5DF21D84788F00E6D330 /* SpriteGen */ = {
|
||||
isa = PBXLegacyTarget;
|
||||
buildArgumentsString = "$(ACTION)";
|
||||
buildConfigurationList = 701B5DF51D84788F00E6D330 /* Build configuration list for PBXLegacyTarget "SpriteGen" */;
|
||||
buildPhases = (
|
||||
);
|
||||
buildToolPath = /usr/bin/make;
|
||||
dependencies = (
|
||||
);
|
||||
name = SpriteGen;
|
||||
passBuildSettingsInEnvironment = 1;
|
||||
productName = SpriteGen;
|
||||
};
|
||||
/* End PBXLegacyTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
701B5DEE1D84788F00E6D330 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0730;
|
||||
ORGANIZATIONNAME = "Quinn Dunki";
|
||||
TargetAttributes = {
|
||||
701B5DF21D84788F00E6D330 = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 701B5DF11D84788F00E6D330 /* Build configuration list for PBXProject "SpriteGen" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 701B5DED1D84788F00E6D330;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
701B5DF21D84788F00E6D330 /* SpriteGen */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
701B5DF31D84788F00E6D330 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
701B5DF41D84788F00E6D330 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
701B5DF61D84788F00E6D330 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEBUGGING_SYMBOLS = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
701B5DF71D84788F00E6D330 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
701B5DF11D84788F00E6D330 /* Build configuration list for PBXProject "SpriteGen" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
701B5DF31D84788F00E6D330 /* Debug */,
|
||||
701B5DF41D84788F00E6D330 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
701B5DF51D84788F00E6D330 /* Build configuration list for PBXLegacyTarget "SpriteGen" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
701B5DF61D84788F00E6D330 /* Debug */,
|
||||
701B5DF71D84788F00E6D330 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 701B5DEE1D84788F00E6D330 /* Project object */;
|
||||
}
|
7
SpriteGen.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
SpriteGen.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:SpriteGen.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
BIN
SpriteGen.xcodeproj/project.xcworkspace/xcuserdata/qd.xcuserdatad/UserInterfaceState.xcuserstate
generated
Normal file
BIN
SpriteGen.xcodeproj/project.xcworkspace/xcuserdata/qd.xcuserdatad/UserInterfaceState.xcuserstate
generated
Normal file
Binary file not shown.
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "701B5DF21D84788F00E6D330"
|
||||
BuildableName = "SpriteGen"
|
||||
BlueprintName = "SpriteGen"
|
||||
ReferencedContainer = "container:SpriteGen.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "701B5DF21D84788F00E6D330"
|
||||
BuildableName = "SpriteGen"
|
||||
BlueprintName = "SpriteGen"
|
||||
ReferencedContainer = "container:SpriteGen.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "701B5DF21D84788F00E6D330"
|
||||
BuildableName = "SpriteGen"
|
||||
BlueprintName = "SpriteGen"
|
||||
ReferencedContainer = "container:SpriteGen.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>SpriteGen.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>701B5DF21D84788F00E6D330</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
182
SpriteGenerator.py
Executable file
182
SpriteGenerator.py
Executable file
@ -0,0 +1,182 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys,os,png
|
||||
|
||||
class Colors:
|
||||
black,magenta,green,orange,blue = range(5)
|
||||
|
||||
|
||||
|
||||
def main(argv):
|
||||
|
||||
if len(argv)<1:
|
||||
printHorzontalLookup()
|
||||
exit(0)
|
||||
|
||||
pngfile = sys.argv[1]
|
||||
|
||||
reader = png.Reader(pngfile)
|
||||
try:
|
||||
pngdata = reader.asRGB8()
|
||||
except:
|
||||
usage()
|
||||
|
||||
disclaimer()
|
||||
|
||||
width = pngdata[0]
|
||||
height = pngdata[1]
|
||||
pixeldata = pngdata[2]
|
||||
byteWidth = width/2+1+1 # TODO: Calculate a power of two for this
|
||||
|
||||
for shift in range(0,7):
|
||||
print "%s_SHIFT%d: ;%d bytes per row" % (os.path.splitext(pngfile)[0].upper(),shift,byteWidth)
|
||||
|
||||
spriteChunks = layoutSpriteChunk(pixeldata,width,height,shift)
|
||||
|
||||
for row in range(height):
|
||||
for chunkIndex in range(len(spriteChunks)):
|
||||
print spriteChunks[chunkIndex][row]
|
||||
|
||||
print "\n"
|
||||
|
||||
|
||||
|
||||
|
||||
def layoutSpriteChunk(pixeldata,width,height,shift):
|
||||
|
||||
bitmap = [[0 for x in range(width)] for y in range(height)]
|
||||
|
||||
byteWidth = width/2+1+1 # TODO: Calculate a power of two for this
|
||||
spriteChunks = [["" for y in range(height)] for x in range(byteWidth)]
|
||||
|
||||
for row in range(height):
|
||||
pixelRow = bitmap[row]
|
||||
bitStream = ""
|
||||
|
||||
for pixelIndex in range(width):
|
||||
pixel = pixelColor(pixeldata,row,pixelIndex)
|
||||
if pixel == Colors.black:
|
||||
bitStream += "00"
|
||||
else:
|
||||
if pixel == Colors.green or pixel == Colors.orange:
|
||||
bitStream += "01"
|
||||
else:
|
||||
bitStream += "10"
|
||||
|
||||
bitStream = shiftStringRight(bitStream,shift)
|
||||
bitStream = bitStream[:byteWidth*8]
|
||||
|
||||
bitPos = 0
|
||||
byteSplits = [0 for x in range(byteWidth)]
|
||||
|
||||
for byteIndex in range(byteWidth):
|
||||
remainingBits = len(bitStream) - bitPos
|
||||
|
||||
bitChunk = ""
|
||||
|
||||
if remainingBits < 0:
|
||||
bitChunk = "0000000"
|
||||
else:
|
||||
if remainingBits < 7:
|
||||
bitChunk = bitStream[bitPos:]
|
||||
bitChunk += fillOutByte(7-remainingBits)
|
||||
else:
|
||||
bitChunk = bitStream[bitPos:bitPos+7]
|
||||
|
||||
bitChunk = bitChunk[::-1]
|
||||
|
||||
highBit = "0"
|
||||
if pixel == Colors.orange or pixel == Colors.blue:
|
||||
highBit = "1"
|
||||
|
||||
byteSplits[byteIndex] = highBit + bitChunk
|
||||
bitPos += 7
|
||||
|
||||
for chunkIndex in range(len(byteSplits)):
|
||||
spriteChunks[chunkIndex][row] = ".byte %%%s" % byteSplits[chunkIndex]
|
||||
|
||||
return spriteChunks
|
||||
|
||||
|
||||
|
||||
def fillOutByte(numBits):
|
||||
filler = ""
|
||||
for bit in range(numBits):
|
||||
filler += "0"
|
||||
|
||||
return filler
|
||||
|
||||
|
||||
def shiftStringRight(string,shift):
|
||||
if shift==0:
|
||||
return string
|
||||
|
||||
shift *=2
|
||||
result = ""
|
||||
|
||||
for i in range(shift):
|
||||
result += "0"
|
||||
|
||||
result += string
|
||||
return result
|
||||
|
||||
|
||||
def pixelColor(pixeldata,row,col):
|
||||
r = pixeldata[row][col*3]
|
||||
g = pixeldata[row][col*3+1]
|
||||
b = pixeldata[row][col*3+2]
|
||||
color = Colors.black
|
||||
|
||||
if r==255 and g==0 and b==255:
|
||||
color = Colors.magenta
|
||||
else:
|
||||
if r==0 and g==255 and b==0:
|
||||
color = Colors.green
|
||||
else:
|
||||
if r==0 and g==0 and b==255:
|
||||
color = Colors.blue
|
||||
else:
|
||||
if r==255 and g>0 and b==0:
|
||||
color = Colors.orange
|
||||
|
||||
return color
|
||||
|
||||
|
||||
def printHorzontalLookup():
|
||||
disclaimer()
|
||||
|
||||
print "HGRROWBYTES:"
|
||||
for byte in range(40):
|
||||
pixels = 4
|
||||
offset = 0
|
||||
if (byte%2):
|
||||
pixels = 3
|
||||
offset = -1
|
||||
|
||||
for entry in range(pixels):
|
||||
print "\t.byte $%02x" % (byte + offset)
|
||||
|
||||
print "\nHGRROWBYTES_BITSHIFT:"
|
||||
for pixel in range(140):
|
||||
print "\t.byte $%02x" % ((pixel % 7)*32) # 32 = 4 shifts of 8 bytes
|
||||
|
||||
|
||||
def usage():
|
||||
print '''
|
||||
Usage: HiSprite <png file>
|
||||
|
||||
PNG file must not have an alpha channel!
|
||||
'''
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
def disclaimer():
|
||||
print '''
|
||||
; This file was generated by SpriteGenerator.py, a sprite generation tool by Quinn Dunki.
|
||||
; If you feel the need to modify this file, you are probably doing it wrong.
|
||||
'''
|
||||
return
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
BIN
V2Make.scpt
Normal file
BIN
V2Make.scpt
Normal file
Binary file not shown.
BIN
box_blu.png
Normal file
BIN
box_blu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 164 B |
BIN
box_grn.png
Normal file
BIN
box_grn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 163 B |
BIN
box_mag.png
Normal file
BIN
box_mag.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 166 B |
BIN
box_org.png
Normal file
BIN
box_org.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 165 B |
287
hgrtableX.s
Normal file
287
hgrtableX.s
Normal file
@ -0,0 +1,287 @@
|
||||
|
||||
; This file was generated by SpriteGenerator.py, a sprite generation tool by Quinn Dunki.
|
||||
; If you feel the need to modify this file, you are probably doing it wrong.
|
||||
|
||||
HGRROWBYTES:
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $02
|
||||
.byte $02
|
||||
.byte $02
|
||||
.byte $02
|
||||
.byte $02
|
||||
.byte $02
|
||||
.byte $02
|
||||
.byte $04
|
||||
.byte $04
|
||||
.byte $04
|
||||
.byte $04
|
||||
.byte $04
|
||||
.byte $04
|
||||
.byte $04
|
||||
.byte $06
|
||||
.byte $06
|
||||
.byte $06
|
||||
.byte $06
|
||||
.byte $06
|
||||
.byte $06
|
||||
.byte $06
|
||||
.byte $08
|
||||
.byte $08
|
||||
.byte $08
|
||||
.byte $08
|
||||
.byte $08
|
||||
.byte $08
|
||||
.byte $08
|
||||
.byte $0a
|
||||
.byte $0a
|
||||
.byte $0a
|
||||
.byte $0a
|
||||
.byte $0a
|
||||
.byte $0a
|
||||
.byte $0a
|
||||
.byte $0c
|
||||
.byte $0c
|
||||
.byte $0c
|
||||
.byte $0c
|
||||
.byte $0c
|
||||
.byte $0c
|
||||
.byte $0c
|
||||
.byte $0e
|
||||
.byte $0e
|
||||
.byte $0e
|
||||
.byte $0e
|
||||
.byte $0e
|
||||
.byte $0e
|
||||
.byte $0e
|
||||
.byte $10
|
||||
.byte $10
|
||||
.byte $10
|
||||
.byte $10
|
||||
.byte $10
|
||||
.byte $10
|
||||
.byte $10
|
||||
.byte $12
|
||||
.byte $12
|
||||
.byte $12
|
||||
.byte $12
|
||||
.byte $12
|
||||
.byte $12
|
||||
.byte $12
|
||||
.byte $14
|
||||
.byte $14
|
||||
.byte $14
|
||||
.byte $14
|
||||
.byte $14
|
||||
.byte $14
|
||||
.byte $14
|
||||
.byte $16
|
||||
.byte $16
|
||||
.byte $16
|
||||
.byte $16
|
||||
.byte $16
|
||||
.byte $16
|
||||
.byte $16
|
||||
.byte $18
|
||||
.byte $18
|
||||
.byte $18
|
||||
.byte $18
|
||||
.byte $18
|
||||
.byte $18
|
||||
.byte $18
|
||||
.byte $1a
|
||||
.byte $1a
|
||||
.byte $1a
|
||||
.byte $1a
|
||||
.byte $1a
|
||||
.byte $1a
|
||||
.byte $1a
|
||||
.byte $1c
|
||||
.byte $1c
|
||||
.byte $1c
|
||||
.byte $1c
|
||||
.byte $1c
|
||||
.byte $1c
|
||||
.byte $1c
|
||||
.byte $1e
|
||||
.byte $1e
|
||||
.byte $1e
|
||||
.byte $1e
|
||||
.byte $1e
|
||||
.byte $1e
|
||||
.byte $1e
|
||||
.byte $20
|
||||
.byte $20
|
||||
.byte $20
|
||||
.byte $20
|
||||
.byte $20
|
||||
.byte $20
|
||||
.byte $20
|
||||
.byte $22
|
||||
.byte $22
|
||||
.byte $22
|
||||
.byte $22
|
||||
.byte $22
|
||||
.byte $22
|
||||
.byte $22
|
||||
.byte $24
|
||||
.byte $24
|
||||
.byte $24
|
||||
.byte $24
|
||||
.byte $24
|
||||
.byte $24
|
||||
.byte $24
|
||||
.byte $26
|
||||
.byte $26
|
||||
.byte $26
|
||||
.byte $26
|
||||
.byte $26
|
||||
.byte $26
|
||||
.byte $26
|
||||
|
||||
HGRROWBYTES_BITSHIFT:
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.byte $40
|
||||
.byte $60
|
||||
.byte $80
|
||||
.byte $a0
|
||||
.byte $c0
|
444
hgrtableY.s
Normal file
444
hgrtableY.s
Normal file
@ -0,0 +1,444 @@
|
||||
;
|
||||
; hgrtableY.s
|
||||
;
|
||||
; Created by Quinn Dunki on 7/19/16
|
||||
; Copyright (c) 2015 One Girl, One Laptop Productions. All rights reserved.
|
||||
;
|
||||
|
||||
HGRROWS_H:
|
||||
.byte $20
|
||||
.byte $24
|
||||
.byte $28
|
||||
.byte $2C
|
||||
.byte $30
|
||||
.byte $34
|
||||
.byte $38
|
||||
.byte $3C
|
||||
|
||||
.byte $20
|
||||
.byte $24
|
||||
.byte $28
|
||||
.byte $2C
|
||||
.byte $30
|
||||
.byte $34
|
||||
.byte $38
|
||||
.byte $3C
|
||||
|
||||
.byte $21
|
||||
.byte $25
|
||||
.byte $29
|
||||
.byte $2D
|
||||
.byte $31
|
||||
.byte $35
|
||||
.byte $39
|
||||
.byte $3D
|
||||
|
||||
.byte $21
|
||||
.byte $25
|
||||
.byte $29
|
||||
.byte $2D
|
||||
.byte $31
|
||||
.byte $35
|
||||
.byte $39
|
||||
.byte $3D
|
||||
|
||||
.byte $22
|
||||
.byte $26
|
||||
.byte $2A
|
||||
.byte $2E
|
||||
.byte $32
|
||||
.byte $36
|
||||
.byte $3A
|
||||
.byte $3E
|
||||
|
||||
.byte $22
|
||||
.byte $26
|
||||
.byte $2A
|
||||
.byte $2E
|
||||
.byte $32
|
||||
.byte $36
|
||||
.byte $3A
|
||||
.byte $3E
|
||||
|
||||
.byte $23
|
||||
.byte $27
|
||||
.byte $2B
|
||||
.byte $2F
|
||||
.byte $33
|
||||
.byte $37
|
||||
.byte $3B
|
||||
.byte $3F
|
||||
|
||||
.byte $23
|
||||
.byte $27
|
||||
.byte $2B
|
||||
.byte $2F
|
||||
.byte $33
|
||||
.byte $37
|
||||
.byte $3B
|
||||
.byte $3F
|
||||
;
|
||||
.byte $20
|
||||
.byte $24
|
||||
.byte $28
|
||||
.byte $2C
|
||||
.byte $30
|
||||
.byte $34
|
||||
.byte $38
|
||||
.byte $3C
|
||||
|
||||
.byte $20
|
||||
.byte $24
|
||||
.byte $28
|
||||
.byte $2C
|
||||
.byte $30
|
||||
.byte $34
|
||||
.byte $38
|
||||
.byte $3C
|
||||
|
||||
.byte $21
|
||||
.byte $25
|
||||
.byte $29
|
||||
.byte $2D
|
||||
.byte $31
|
||||
.byte $35
|
||||
.byte $39
|
||||
.byte $3D
|
||||
|
||||
.byte $21
|
||||
.byte $25
|
||||
.byte $29
|
||||
.byte $2D
|
||||
.byte $31
|
||||
.byte $35
|
||||
.byte $39
|
||||
.byte $3D
|
||||
|
||||
.byte $22
|
||||
.byte $26
|
||||
.byte $2A
|
||||
.byte $2E
|
||||
.byte $32
|
||||
.byte $36
|
||||
.byte $3A
|
||||
.byte $3E
|
||||
|
||||
.byte $22
|
||||
.byte $26
|
||||
.byte $2A
|
||||
.byte $2E
|
||||
.byte $32
|
||||
.byte $36
|
||||
.byte $3A
|
||||
.byte $3E
|
||||
|
||||
.byte $23
|
||||
.byte $27
|
||||
.byte $2B
|
||||
.byte $2F
|
||||
.byte $33
|
||||
.byte $37
|
||||
.byte $3B
|
||||
.byte $3F
|
||||
|
||||
.byte $23
|
||||
.byte $27
|
||||
.byte $2B
|
||||
.byte $2F
|
||||
.byte $33
|
||||
.byte $37
|
||||
.byte $3B
|
||||
.byte $3F
|
||||
;;
|
||||
.byte $20
|
||||
.byte $24
|
||||
.byte $28
|
||||
.byte $2C
|
||||
.byte $30
|
||||
.byte $34
|
||||
.byte $38
|
||||
.byte $3C
|
||||
|
||||
.byte $20
|
||||
.byte $24
|
||||
.byte $28
|
||||
.byte $2C
|
||||
.byte $30
|
||||
.byte $34
|
||||
.byte $38
|
||||
.byte $3C
|
||||
|
||||
.byte $21
|
||||
.byte $25
|
||||
.byte $29
|
||||
.byte $2D
|
||||
.byte $31
|
||||
.byte $35
|
||||
.byte $39
|
||||
.byte $3D
|
||||
|
||||
.byte $21
|
||||
.byte $25
|
||||
.byte $29
|
||||
.byte $2D
|
||||
.byte $31
|
||||
.byte $35
|
||||
.byte $39
|
||||
.byte $3D
|
||||
|
||||
.byte $22
|
||||
.byte $26
|
||||
.byte $2A
|
||||
.byte $2E
|
||||
.byte $32
|
||||
.byte $36
|
||||
.byte $3A
|
||||
.byte $3E
|
||||
|
||||
.byte $22
|
||||
.byte $26
|
||||
.byte $2A
|
||||
.byte $2E
|
||||
.byte $32
|
||||
.byte $36
|
||||
.byte $3A
|
||||
.byte $3E
|
||||
|
||||
.byte $23
|
||||
.byte $27
|
||||
.byte $2B
|
||||
.byte $2F
|
||||
.byte $33
|
||||
.byte $37
|
||||
.byte $3B
|
||||
.byte $3F
|
||||
|
||||
.byte $23
|
||||
.byte $27
|
||||
.byte $2B
|
||||
.byte $2F
|
||||
.byte $33
|
||||
.byte $37
|
||||
.byte $3B
|
||||
.byte $3F
|
||||
|
||||
|
||||
|
||||
HGRROWS_L:
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
.byte $80
|
||||
;
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
.byte $28
|
||||
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
.byte $A8
|
||||
;;
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
.byte $50
|
||||
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
.byte $D0
|
||||
|
||||
|
6535
hgrtest.lst
Normal file
6535
hgrtest.lst
Normal file
File diff suppressed because it is too large
Load Diff
165
macros.s
Normal file
165
macros.s
Normal file
@ -0,0 +1,165 @@
|
||||
;
|
||||
; macros.s
|
||||
; Generally useful macros for 6502 code
|
||||
;
|
||||
; Created by Quinn Dunki on 8/15/14.
|
||||
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
||||
;
|
||||
|
||||
|
||||
; Macros
|
||||
|
||||
.macro SETSWITCH name ; Sets the named softswitch (assumes write method)
|
||||
sta name
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro SAVE_AXY ; Saves all registers
|
||||
pha
|
||||
phx
|
||||
phy
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro RESTORE_AXY ; Restores all registers
|
||||
ply
|
||||
plx
|
||||
pla
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro SAVE_AY ; Saves accumulator and Y index
|
||||
pha
|
||||
phy
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro RESTORE_AY ; Restores accumulator and Y index
|
||||
ply
|
||||
pla
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro SAVE_AX ; Saves accumulator and X index
|
||||
pha
|
||||
phx
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro RESTORE_AX ; Restores accumulator and X index
|
||||
plx
|
||||
pla
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro SAVE_XY ; Saves X and Y index
|
||||
phx
|
||||
phy
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro RESTORE_XY ; Restores X and Y index
|
||||
ply
|
||||
plx
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro SAVE_ZPP ; Saves Zero Page locations we use for parameters
|
||||
lda PARAM0
|
||||
pha
|
||||
lda PARAM1
|
||||
pha
|
||||
lda PARAM2
|
||||
pha
|
||||
lda PARAM3
|
||||
pha
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro RESTORE_ZPP ; Restores Zero Page locations we use for parameters
|
||||
pla
|
||||
sta PARAM3
|
||||
pla
|
||||
sta PARAM2
|
||||
pla
|
||||
sta PARAM1
|
||||
pla
|
||||
sta PARAM0
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro SAVE_ZPS ; Saves Zero Page locations we use for scratch
|
||||
lda SCRATCH0
|
||||
pha
|
||||
lda SCRATCH1
|
||||
pha
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro RESTORE_ZPS ; Restores Zero Page locations we use for scratch
|
||||
pla
|
||||
sta SCRATCH1
|
||||
pla
|
||||
sta SCRATCH0
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro PARAM16 addr
|
||||
lda #<addr
|
||||
sta PARAM0
|
||||
lda #>addr
|
||||
sta PARAM1
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro CALL16 func,addr
|
||||
PARAM16 addr
|
||||
jsr func
|
||||
.endmacro
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Rendering macros
|
||||
;
|
||||
|
||||
|
||||
.macro LDY_AVIEW
|
||||
asl ; Find our new view record
|
||||
asl
|
||||
asl
|
||||
asl ; Records are 16 bytes wide
|
||||
tay
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro LDY_ACTIVEVIEW
|
||||
lda WG_ACTIVEVIEW ; Find our new view record
|
||||
LDY_AVIEW
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro LDX_ACTIVEVIEW
|
||||
lda WG_ACTIVEVIEW ; Find our new view record
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl ; Records are 16 bytes wide
|
||||
tax
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro LDY_FOCUSVIEW
|
||||
lda WG_FOCUSVIEW ; Find our new view record
|
||||
LDY_AVIEW
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro VBL_SYNC ; Synchronize with vertical blanking
|
||||
lda #$80
|
||||
;macroWaitVBLToFinish:
|
||||
; bit RDVBLBAR
|
||||
; bmi macroWaitVBLToFinish
|
||||
@macroWaitVBLToStart:
|
||||
; bit RDVBLBAR
|
||||
; bpl @macroWaitVBLToStart
|
||||
.endmacro
|
BIN
spritedemo.dsk
Normal file
BIN
spritedemo.dsk
Normal file
Binary file not shown.
280
spritedemo.s
Normal file
280
spritedemo.s
Normal file
@ -0,0 +1,280 @@
|
||||
;
|
||||
; spritedemo
|
||||
;
|
||||
; Created by Quinn Dunki on 7/19/16
|
||||
; Copyright (c) 2015 One Girl, One Laptop Productions. All rights reserved.
|
||||
;
|
||||
|
||||
|
||||
.org $6000
|
||||
|
||||
.include "macros.s"
|
||||
|
||||
; Softswitches
|
||||
TEXT = $c050
|
||||
HIRES1 = $c057
|
||||
HIRES2 = $c058
|
||||
|
||||
|
||||
; ROM entry points
|
||||
COUT = $fded
|
||||
ROMWAIT = $fca8
|
||||
|
||||
; Zero page locations we use (unused by Monitor, Applesoft, or ProDOS)
|
||||
PARAM0 = $06
|
||||
PARAM1 = $07
|
||||
PARAM2 = $08
|
||||
PARAM3 = $09
|
||||
SCRATCH0 = $19
|
||||
SCRATCH1 = $1a
|
||||
|
||||
; Macros
|
||||
.macro BLITBYTE xPos,yPos,addr
|
||||
lda #xPos
|
||||
sta PARAM0
|
||||
lda #yPos
|
||||
sta PARAM1
|
||||
lda #<addr
|
||||
sta PARAM2
|
||||
lda #>addr
|
||||
sta PARAM3
|
||||
jsr BlitSpriteOnByte
|
||||
.endmacro
|
||||
|
||||
.macro BLIT xPos,yPos,addr
|
||||
lda #xPos
|
||||
sta PARAM0
|
||||
lda #yPos
|
||||
sta PARAM1
|
||||
lda #<addr
|
||||
sta PARAM2
|
||||
lda #>addr
|
||||
sta PARAM3
|
||||
jsr BlitSprite
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro WAIT
|
||||
lda #$80
|
||||
jsr $fca8
|
||||
.endmacro
|
||||
|
||||
|
||||
|
||||
main:
|
||||
jsr EnableHires
|
||||
|
||||
lda #$00
|
||||
jsr LinearFill
|
||||
|
||||
ldx #0
|
||||
loop:
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
sta PARAM0
|
||||
lda #0
|
||||
sta PARAM1
|
||||
lda #<BOX_MAG_SHIFT0
|
||||
sta PARAM2
|
||||
lda #>BOX_MAG_SHIFT0
|
||||
sta PARAM3
|
||||
jsr BlitSprite
|
||||
|
||||
lda #88
|
||||
sta PARAM1
|
||||
lda #<BOX_GRN_SHIFT0
|
||||
sta PARAM2
|
||||
lda #>BOX_GRN_SHIFT0
|
||||
sta PARAM3
|
||||
jsr BlitSprite
|
||||
|
||||
lda #96
|
||||
sta PARAM1
|
||||
lda #<BOX_BLU_SHIFT0
|
||||
sta PARAM2
|
||||
lda #>BOX_BLU_SHIFT0
|
||||
sta PARAM3
|
||||
jsr BlitSprite
|
||||
|
||||
lda #184
|
||||
sta PARAM1
|
||||
lda #<BOX_ORG_SHIFT0
|
||||
sta PARAM2
|
||||
lda #>BOX_ORG_SHIFT0
|
||||
sta PARAM3
|
||||
jsr BlitSprite
|
||||
|
||||
inx
|
||||
cpx #35
|
||||
bne loop
|
||||
|
||||
rts
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; BlitSprite
|
||||
; Trashes everything, including parameters
|
||||
; PARAM0: X Pos
|
||||
; PARAM1: Y Pos
|
||||
; PARAM2: Sprite Ptr LSB
|
||||
; PARAM3: Sprite Ptr MSB
|
||||
;
|
||||
BlitSprite:
|
||||
SAVE_AXY
|
||||
|
||||
clc ; Compute sprite data base 2
|
||||
ldx PARA |