diff options
Diffstat (limited to 'transpose.py')
| -rw-r--r-- | transpose.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/transpose.py b/transpose.py new file mode 100644 index 0000000..c2db0c5 --- /dev/null +++ b/transpose.py @@ -0,0 +1,19 @@ +import sys + +chars = [] +with open(sys.argv[1], "rb") as f: + print("const uint8_t c64_chars[512][8] = {") + + while char := f.read(8): + transposed = [0] * 8 + for i in range(8): + for j in range(8): + bit = char[i] & (0b1000000 >> j) + bit <<= j + + transposed[j] |= bit >> i + + joined = ", ".join(str(t) for t in transposed) + print(f" {{{joined}}},") + + print("};") |
