diff options
Diffstat (limited to 'tests/xy_to_page.py')
-rwxr-xr-x | tests/xy_to_page.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/xy_to_page.py b/tests/xy_to_page.py new file mode 100755 index 0000000..dc552d9 --- /dev/null +++ b/tests/xy_to_page.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +# +(int(xy / 16) * 16) + int((((xy - (int(xy / 16) * 16)))) / 8) + ((xy - ((int(xy / 16) * 16) + int(((xy - (int(xy / 16) * 16))) / 8) * 8)) * 2) + +BLEN = 2 +WIDTH = 8 +HEIGHT = 4 + +for xy in range(0, 32): + page_offset = int(xy / (BLEN * WIDTH)) * (BLEN * WIDTH) + collumn_offset = int((xy - page_offset) / WIDTH) + + bit_offset = page_offset + collumn_offset + ((xy - (page_offset + collumn_offset * WIDTH)) * BLEN) + + page_location = bit_offset + print(page_location) + #print("pixel {}: bit {}".format(xy, column_offset)) + |