Skip to content

Instantly share code, notes, and snippets.

@ork
Created May 15, 2014 14:48
Show Gist options
  • Save ork/6523b8af7008d6251bd7 to your computer and use it in GitHub Desktop.
Save ork/6523b8af7008d6251bd7 to your computer and use it in GitHub Desktop.
Print GameBoy VRAM tiles in your terminal

Source

00333300
03111130
31111213
31111113
31211113
31221113
03111130
00333300

Result

alt text

#!/usr/bin/env python
import fileinput
#http://nocash.emubase.de/pandocs.htm#vramtiledata
colors = ('\033[97m\033[107m', # White
'\033[90m\033[100m', # Dark gray
'\033[37m\033[47m', # Light gray
'\033[30m\033[40m', # Black
'\033[0m') # Escape color
if __name__ == '__main__':
for line in fileinput.input():
if fileinput.isfirstline() is True:
print("==> {}".format(fileinput.filename()))
for point in line.strip():
print("{0} {1}".format(colors[int(point)], colors[4]), end='')
print('')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment