Exemple #1
0
def main():
    fontdir = argv[1]
    print_header()
    print("{} ; <spc>".format(lst2asm([False] * 8)))
    for c in CHARACTERS:
        fname = path.join(fontdir, "font-{}.png".format(c))
        font = parse_font_file(fname)
        print("{} ; {}".format(lst2asm(font), c))
Exemple #2
0
def main():
    x = [round((sin(x * 2 * pi / (N - 1)) + 1) * 10) for x in range(N)]
    y = [round((sin(2 * x * 2 * pi / (N - 1)) + 1) * 10) for x in range(N)]

    print("fxpl_path_x:")
    print(lst2asm(x))
    print()
    print("fxpl_path_y:")
    print(lst2asm(y))
Exemple #3
0
def main():
    fname = sys.argv[1]
    # Convert to 1 byte in {0,255} per pixel
    im = Image.open(fname)

    # Beware im.convert('1') seems to introduce bugs !
    # To be troubleshooted and fixed upstream !
    # In the mean time using im.convert('L') instead
    grey = im.convert('L')
    arr = bool_array(grey)

    cols = None
    if (len(sys.argv) > 2) and (sys.argv[2] == 's'):
        lines = [arr[i:i + 16] for i in range(0, 16 * NLINES, 16)
                 ]  # NLINES lines - 16 pixels per line
        lines = [[False] * 16] * PADDING + lines + [[False] * 16] * PADDING
        lines.reverse()
        pack = pack_bytes(flatten(lines))
        cols = [pack[i:2 * 30:2] for i in range(2)]
    else:
        lines = [arr[i:i + 40] for i in range(0, 40 * 30, 40)
                 ]  # 30 lines - 40 pixels per line
        lines.reverse()
        pfs = [playfields(l) for l in lines]
        pack = pack_bytes(flatten(pfs))
        cols = [pack[i:6 * 30:6] for i in range(6)]

    print("; " + fname)
    print(asmlib.lst2asm(flatten(cols), 15))
    print("")
Exemple #4
0
def main():
    plasma = Plasma(SIZE, [0, 50, 150, 200], 15)
    plasma.compute()
    buf = plasma.get_bytes()
    im = Image.frombytes('L', (SIZE, SIZE), buf)
    im.show()
    print(lst2asm(buf))
Exemple #5
0
def main():
    fname = argv[1]
    sname = argv[2]  # symbol name

    # Convert to pure B&W without alpha picture
    im = Image.open(fname).convert('1')
    sanity_check(im)
    print("{}:".format(sname))
    print(lst2asm(im2fx(im)))
Exemple #6
0
def main():
    if len(sys.argv) < 2:
        raise Exception("At least one filename is required")

    fnames = sys.argv[1:]
    width = None
    height = 0
    arr = []
    for f in fnames:
        # Convert to 1 byte in {0,255} per pixel
        im = Image.open(f)
        width, _ = im.size  # All files should have the same width

        # Beware im.convert('1') seems to introduce bugs !
        # To be troubleshooted and fixed upstream !
        # In the mean time using im.convert('L') instead
        grey = im.convert('L')
        arr.extend(bool_array(grey))

    print(len(arr))
    width_bytes = None
    if width == 32:
        fix_format_32(arr)
        width_bytes = 4
    elif width == 40:
        fix_format_40(arr)
        width_bytes = 6
    else:
        raise Exception("width not supported: {}".format(width))

    print(len(arr))
    pbs = pack_bytes(arr)
    cols = by_column(pbs, width_bytes)

    for i, c in enumerate(cols):
        rev = [~v & 0xff for v in c]
        print("; col_{}".format(i))
        print(asmlib.lst2asm([0xff] * 30, 15))
        print("")
        print(asmlib.lst2asm(c, 15))

    print("")
    print(asmlib.lst2asm([0xff] * 30, 15))
Exemple #7
0
def main():
    fname = sys.argv[1]
    # Convert to 1 byte in {0,255} per pixel
    im = Image.open(fname)

    # Beware im.convert('1') seems to introduce bugs !
    # To be troubleshooted and fixed upstream !
    # In the mean time using im.convert('L') instead
    grey = im.convert('L')
    mask = [0x10 if p else 0x0f for p in grey.getdata()]
    print(asmlib.lst2asm(mask, 11))
Exemple #8
0
def main():
    for i in range(1, MAX_DISC_SIZE + 1):
        print("fx_disc_{}:".format(i))
        print(lst2asm(gendisc(i, MAX_DISC_SIZE, RESOLUTION)))

    print("fx_disc_l:")
    print("\tdc.b #0 ; Unused")
    for i in range(1, MAX_DISC_SIZE + 1):
        print("\tdc.b #<fx_disc_{}".format(i))

    print("fx_disc_h:")
    print("\tdc.b #0 ; Unused")
    for i in range(1, MAX_DISC_SIZE + 1):
        print("\tdc.b #>fx_disc_{}".format(i))
Exemple #9
0
def main():
    fname = sys.argv[1]
    # Convert to 1 byte in {0,255} per pixel
    im = Image.open(fname)

    # Beware im.convert('1') seems to introduce bugs !
    # To be troubleshooted and fixed upstream !
    # In the mean time using im.convert('L') instead
    grey = im.convert('L')
    sanity_check(grey)
    arr = bool_array(grey)
    lines = [arr[i:i + 40] for i in range(0, 400, 40)]
    pfs = [playfields(l) for l in lines]
    pack = pack_bytes(flatten(pfs))
    rev = [~v & 0xff for v in pack]
    print(asmlib.lst2asm(rev, 6))
Exemple #10
0
def process(fname):
    # Convert to 1 byte in {0,255} per pixel
    im = Image.open(fname)

    # Beware im.convert('1') seems to introduce bugs !
    # To be troubleshooted and fixed upstream !
    # In the mean time using im.convert('L') instead
    grey = im.convert('L')
    sanity_check(grey)

    arr = bool_array(grey)
    pfs = pack_bytes(arr)
    cols = by_column(pfs)
    rev = [~v & 0xff for v in cols]
    print("; " + fname)
    print(asmlib.lst2asm(cols, 15))
    print("")
Exemple #11
0
def process(fname):
    # Convert to 1 byte in {0,255} per pixel
    im   = Image.open(fname)

    # Beware im.convert('1') seems to introduce bugs !
    # To be troubleshooted and fixed upstream !
    # In the mean time using im.convert('L') instead
    grey = im.convert('L')
    arr   = bool_array(grey)
    lines = [arr[i:i+32] for i in range(0, 32*30, 32)] # 30 lines - 32 pixels per line
    lines.reverse()
    pfs   = [playfields(l) for l in lines]
    pack  = pack_bytes(flatten(pfs))
    cols  = [pack[i:4*30:4] for i in range(4)]
    #rev   = [~v & 0xff for v in pack]

    _, name, frame = os.path.basename(fname).split('.')[0].split('-')
    label = "fxa_" + name + frame + ":"
    print(label)
    print(asmlib.lst2asm(flatten(cols), 15))
    print("")
Exemple #12
0
def main():
    fname = argv[1]
    data = parse_font_file(fname)
    for i in range(6):  # We've got 6 sprites
        print("banner_{}:".format(i))
        print("{}".format(lst2asm(reversed(data[i:len(data):6]))))
Exemple #13
0
def main():
    plasma_size = (32, 32)
    plasma = Plasma(plasma_size, [(2, 5), (13, 25), (33, 16)])
    buf = plasma.get_bytes(15)
    #buf = plasma.get_bytes(255)
    print(lst2asm(buf, 8))
def print_block(lst, name):
    print("{}:".format(name))
    print(lst2asm(lst))
def dump_tables():
    print("fxc_square:")
    print(lst2asm([sq(x) for x in range(0, 49)]))
    
    print("\nfxc_sqrt:")
    print(lst2asm([sqrt(x) for x in range(0, 67)]))