diff --git a/index.html b/index.html index e2f13d42..afd04cb1 100644 --- a/index.html +++ b/index.html @@ -205,8 +205,8 @@ div.bitmap_editor {
5: + print s diff --git a/tools/vcs/p4_to_pfbytes.py b/tools/vcs/p4_to_pfbytes.py new file mode 100755 index 00000000..f7379543 --- /dev/null +++ b/tools/vcs/p4_to_pfbytes.py @@ -0,0 +1,62 @@ +#!/usr/bin/python + +import sys, struct + +# playfield bytes, one array for each of 6 columns +output = [[],[],[],[],[],[]] + +# reverse byte +def rev(n): + return int('{:08b}'.format(n)[::-1], 2) + +# output bits in given range +def out(i, pix, lb, hb, reverse=0, shift=0): + x = (pix >> lb) & ((1<<(hb-lb))-1) + if reverse: + x = rev(x) + if shift: + x = x << shift + assert(x>=0 and x<=255) + output[i].append(x) + +# read PBM (binary P4 format) file +with open(sys.argv[1],'rb') as f: + # read PBM header + header = f.readline().strip() + assert(header == 'P4') + dims = f.readline().strip() + if dims[0] == '#': + dims = f.readline().strip() + width,height = map(int, dims.split()) + assert(width==40) + # read bitmap rows + for y in range(0,height): + row = bytes(f.read(5) + '\0\0\0') # pad to 8 bytes + # convert bytes from MSB first to LSB first + row2 = '' + for i in range(0,8): + row2 += chr(rev(ord(row[i]))) + # convert to 64-bit integer + pix = struct.unpack('5: + print s diff --git a/tools/vicdual/Makefile b/tools/vicdual/Makefile index fe351418..cbad1606 100644 --- a/tools/vicdual/Makefile +++ b/tools/vicdual/Makefile @@ -1,10 +1,10 @@ all: cp437.vicdual.c c64.vicdual.c -cp437.vicdual.c: ../cp437-8x8.bdf +cp437.vicdual.c: ../fonts/cp437-8x8.bdf python ../parsebdf8.py $< -r -C > $@ -c64.vicdual.c: ../c64.bdf +c64.vicdual.c: ../fonts/c64.bdf python ../parsebdf8.py $< -r -C > $@ %.h: diff --git a/tools/vicdual/rom_carnival.py b/tools/vicdual/rom_carnival.py new file mode 100755 index 00000000..33db721c --- /dev/null +++ b/tools/vicdual/rom_carnival.py @@ -0,0 +1,44 @@ +#!/usr/bin/python + +import sys, zipfile + +OUTFILE = 'carnival.zip' + +ROMS = [ + ( "epr-651.u33", 0x0000, 0x0400 ), + ( "epr-652.u32", 0x0400, 0x0400 ), + ( "epr-653.u31", 0x0800, 0x0400 ), + ( "epr-654.u30", 0x0c00, 0x0400 ), + ( "epr-655.u29", 0x1000, 0x0400 ), + ( "epr-656.u28", 0x1400, 0x0400 ), + ( "epr-657.u27", 0x1800, 0x0400 ), + ( "epr-658.u26", 0x1c00, 0x0400 ), + ( "epr-659.u8", 0x2000, 0x0400 ), + ( "epr-660.u7", 0x2400, 0x0400 ), + ( "epr-661.u6", 0x2800, 0x0400 ), + ( "epr-662.u5", 0x2c00, 0x0400 ), + ( "epr-663.u4", 0x3000, 0x0400 ), + ( "epr-664.u3", 0x3400, 0x0400 ), + ( "epr-665.u2", 0x3800, 0x0400 ), + ( "epr-666.u1", 0x3c00, 0x0400 ), + ( "316-633", 0x4000, 0x0020 ), + ( "epr-412", 0x4040, 0x0400 ), + ( "316-0206.u14", 0x4020, 0x0020 ) +] + +fn = sys.argv[1] +with open(fn, 'rb') as f: + data = f.read() + print "Read %d bytes of %s" % (len(data), fn) + +with zipfile.ZipFile(OUTFILE, 'w') as zipf: + for name,start,length in ROMS: + romdata = data[start:start+length] + if len(romdata) != length: + print "*** No data for %s (offset 0x%x)" % (name,start) + romdata = '\0' * length + zipf.writestr(name, romdata) + else: + zipf.writestr(name, romdata) + + \ No newline at end of file diff --git a/tools/williams/Makefile b/tools/williams/Makefile new file mode 100644 index 00000000..5fe91bcd --- /dev/null +++ b/tools/williams/Makefile @@ -0,0 +1,18 @@ + +all: baddies.4.pcx.h badspacerobots.tga + +%.h: % + cat $* | hexdump -v -e '"\n" 128/1 "0x%02x,"' > $@ + +%.tga: %.png + convert $< -resize 192 $<.gif + convert $<.gif +dither -type palette -depth 4 -compress RLE -colors 8 -flip $@ + convert $@ $@.png + +%.pcx: %.png + convert $< -format raw -type palette -compress none -colors 15 +dither $@ +%.rle.pcx: %.png + convert $< -format raw -type palette -compress rle -colors 15 +dither $@ +%.4.pcx: %.png + convert $< -format raw -type palette -compress none -colors 4 +dither $@ + diff --git a/tools/williams/baddies.png b/tools/williams/baddies.png new file mode 100644 index 00000000..e3b440d1 Binary files /dev/null and b/tools/williams/baddies.png differ diff --git a/tools/badspacerobots.png b/tools/williams/badspacerobots.png similarity index 100% rename from tools/badspacerobots.png rename to tools/williams/badspacerobots.png