quickdev16/snes/loader/conv_rle.py
David Voswinkel 7f84c8d97a add loader
2009-07-28 08:37:40 +02:00

20 lines
395 B
Python

import binascii
data = open("rom.smc","r").read()
data = binascii.rlecode_hqx(data)
print '''
#include <avr/pgmspace.h>
#define ROM_SIZE %i
const char _rom[ROM_SIZE] PROGMEM = {
''' % len(data)
for idx,c in enumerate(data):
c = ord(c)
if idx<len(data)-1:
print "0x%02x," % c,
else:
print "0x%02x" % c,
if idx and idx%16==0:
print
print '''
};
'''