From 83d1392c0fd1bcdddb8b63cc8b2156f9ac7fa80b Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Fri, 3 Nov 2023 16:25:11 +0200 Subject: Start copying IBM CGA 8x8 charset, wip memory mapped text memory --- src/charmem.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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): -- cgit v1.3