1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-27 01:51:35 +00:00
8bitworkshop/tools/bin2arr.py

16 lines
280 B
Python
Raw Normal View History

#!/usr/bin/python
2019-08-07 13:26:53 +00:00
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')