1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2026-04-26 10:21:30 +00:00

fixed pix edit dups; new cosmic

This commit is contained in:
Steven Hugg
2018-08-12 23:29:05 -04:00
parent bb639a0820
commit 56aab0e6a5
4 changed files with 153 additions and 92 deletions
+13 -1
View File
@@ -11,7 +11,8 @@ parser.add_argument('-e', '--end', type=int, default=255, help="index of last ch
parser.add_argument('-H', '--height', type=int, default=8, help="character height")
parser.add_argument('-i', '--invert', action="store_true", help="invert bits")
parser.add_argument('-r', '--rotate', action="store_true", help="rotate bits")
parser.add_argument('-f', '--flip', action="store_true", help="flip bits (vertically")
parser.add_argument('-f', '--flip', action="store_true", help="flip bits (vertically)")
parser.add_argument('-m', '--mirror', action="store_true", help="mirror bits (horizontally)")
outfmtgroup = parser.add_mutually_exclusive_group()
outfmtgroup.add_argument("-A", "--asmhex", action="store_true", help="DASM-compatible hex")
outfmtgroup.add_argument("-B", "--asmdb", action="store_true", help="Z80ASM-compatible hex")
@@ -27,6 +28,7 @@ hichar = args.end
invert = args.invert
flip = args.flip
rotate = args.rotate
mirror = args.mirror
chars = {}
inbitmap = 0
@@ -54,6 +56,13 @@ with open(args.bdffile,'r') as f:
byte = int(toks[0],16)
bytes.append(byte)
def revbits(n):
r = 0
for i in range(0,8):
if (n & (1<<i)):
r |= (1<<(7-i))
return r
# output font table
x = 0
output = []
@@ -66,6 +75,9 @@ for ch in range(lochar,hichar+1):
bytes = [0] * height
if flip:
bytes.reverse()
if mirror:
for i in range(0,height):
bytes[i] = revbits(bytes[i])
if rotate:
rotbytes = [0] * height
for x in range(0,height):