1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-23 06:32:11 +00:00
8bitworkshop/tools/bin2arr.py

16 lines
280 B
Python
Executable File

#!/usr/bin/python
import sys
out = sys.stdout
chr = open(sys.argv[1],'rb').read()
out.write('const unsigned char ARRAY[%d] = {\n' % len(chr))
for i in range(0,len(chr)):
out.write('0x%02x, ' % ord(chr[i]))
if (i & 7) == 7:
out.write('\n')
out.write('\n};\n')