From b783dc268f28db48a7d9d0bf332b9ceaf490b036 Mon Sep 17 00:00:00 2001 From: Bjorn Einar Bjarntes Date: Sun, 19 Dec 2021 19:58:35 +0100 Subject: [PATCH] commented the rewrite a bit --- src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.c b/src/main.c index 67c609a..52ccab9 100644 --- a/src/main.c +++ b/src/main.c @@ -31,6 +31,10 @@ void setAndClearHiRes(){ } void calcAdress(){ + /// Refactored it a bit, it had stuff like 320*FLOOR(Y/8) which is made into + /// 40*8*FLOOR(Y/8) which is the same as (32+8)* (Y and remove last three bits) + /// which ends up being (4+1)*Y_with_three bits removed + /// which is split into a temp variable... and summed in the last line tmpY = (y & 0xf8) << 3; ad = 0x2000+tmpY + (tmpY << 2) + (y & 7)+ (x&(0xfff8)); }