Skip to content

Instantly share code, notes, and snippets.

@blondie7575
Created September 8, 2019 23:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blondie7575/2cc7770bb42390cdd2e94c3997c961cc to your computer and use it in GitHub Desktop.
Save blondie7575/2cc7770bb42390cdd2e94c3997c961cc to your computer and use it in GitHub Desktop.
#!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
import sys,os,fileinput
def main(argv):
for line in fileinput.input():
bytes = line.lstrip(".byte ").rstrip('\n').split(',')
print(".byte ", end="")
for i,byte in enumerate(bytes):
hexValue = int(byte.lstrip('$'),16)
hexFormat = "${:02x}"
print(hexFormat.format((hexValue<<2)&255), end="")
if i != len(bytes) - 1:
print(",",end="")
print("");
if __name__ == "__main__":
main(sys.argv[1:])
@dwaq
Copy link

dwaq commented Sep 9, 2019

run by cat Apple2BootFont.txt | ./Apple2FontShift.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment