aboutsummaryrefslogtreecommitdiffstats
path: root/src/charmem.py
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2023-11-03 16:25:11 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2023-11-03 16:25:11 +0200
commit83d1392c0fd1bcdddb8b63cc8b2156f9ac7fa80b (patch)
tree1e53c87b6a0a4dda341fa8d6a4712c60519ea441 /src/charmem.py
parentd956f3841ad867d631fbe2324cb6e280bc9b2a66 (diff)
Start copying IBM CGA 8x8 charset, wip memory mapped text memory
Diffstat (limited to 'src/charmem.py')
-rw-r--r--src/charmem.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/charmem.py b/src/charmem.py
index 25eeec9..9b19864 100644
--- a/src/charmem.py
+++ b/src/charmem.py
@@ -21,7 +21,7 @@ header_chars = lines[0]
charset: list[list[str]] = []
CHAR_HEIGHT_BITS = 3
CHAR_HEIGHT = 2 ** CHAR_HEIGHT_BITS
-CHAR_WIDTH = 5
+CHAR_WIDTH = 8
i = CHAR_HEIGHT
while i < len(lines):
@@ -34,11 +34,12 @@ while i < len(lines):
CHAR_N = len(charset)
TOTAL_BYTEARRAY_SIZE = CHAR_N * CHAR_HEIGHT
-print("TOTAL_BYTEARRAY_SIZE:", TOTAL_BYTEARRAY_SIZE)
def string_to_byte(input_string: str):
# Replace spaces with '0' and '#' with '1'
- binary_string = input_string.replace(' ', '0').replace('#', '1') + "000"
+ binary_string = input_string.replace(' ', '0').replace('█', '1')
+
+ assert(len(input_string) == CHAR_WIDTH)
# Check if the string contains only '0' or '1'
if not all(c in '01' for c in binary_string):