From 985a228bac80bfe897ef711935407fdc7c8a854b Mon Sep 17 00:00:00 2001 From: Bjorn Einar Bjarntes Date: Sun, 19 Dec 2021 13:12:33 +0100 Subject: [PATCH] do not divide --- src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 1702e24..ca88569 100644 --- a/src/main.c +++ b/src/main.c @@ -30,18 +30,18 @@ void setAndClearHiRes(){ } BYTE isPositionWhite() { - ad = 0x2000+(320 * (BYTE)(y/8)) + (y & 7)+8 * (BYTE)(x/8); + ad = 0x2000+(320 * (BYTE)(y >> 3)) + (y & 7)+8 * (BYTE)(x/8); return *(short*)(ad) & 1 << ((7-(x & 7))); } // https://archive.org/details/The_Graphics_Book_for_the_Commodore_64/page/n129/ void setPositionWhite() { - ad = 0x2000+(320 * (y/8)) + (y & 7)+8 * (x/8); + ad = 0x2000+(320 * (y >> 3)) + (y & 7)+8 * (x/8); *(short*)(ad) = *(short*)(ad) | 1 << ((7-(x & 7))); } void setPositionBlack() { - ad = 0x2000+320 * (y/8) + (y & 7)+8 * (x/8); + ad = 0x2000+320 * (y >> 3) + (y & 7)+8 * (x/8); *(short*)(ad) = (*(short*)(ad)) & ~(1 << ((7-(x & 7)))); }