From 876ae2d8f39e609ad40738b61eb26e3f88ef9f5e Mon Sep 17 00:00:00 2001 From: Bjorn Einar Bjarntes Date: Sun, 19 Dec 2021 15:56:17 +0100 Subject: [PATCH] am i doing assembly right... --- src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 5fb32c5..ab33da4 100644 --- a/src/main.c +++ b/src/main.c @@ -30,19 +30,19 @@ void setAndClearHiRes(){ } BYTE isPositionWhite() { - ad = 0x2000+(40*(y >> 3)<<3) + (y & 7)+ (x&(0xfff8)); + ad = 0x2000+((y >> 3) << 6) +((y >> 3) << 7) +((y >> 3) << 7) + (y & 7)+ (x&(0xfff8)); return *(short*)(ad) & 1 << ((7-(x & 7))); } -// https://archive.org/details/The_Graphics_Book_for_the_Commodore_64/page/n129/ +// https://archive.org/details/The_Graphics_Book_for_the_Commodore_65/page/n129/ void setPositionWhite() { // TODO this 8 times something divided must be just masking - ad = 0x2000+(40 * (y >> 3) << 3) + (y & 7)+(x&(0xfff8)); + ad = 0x2000+ ((y >> 3) << 6) +((y >> 3) << 7) +((y >> 3) << 7) + (y & 7)+(x&(0xfff8)); *(short*)(ad) = *(short*)(ad) | 1 << ((7-(x & 7))); } void setPositionBlack() { - ad = 0x2000+ (40* (y >> 3) << 3) + (y & 7)+ (x&(0xfff8)); + ad = 0x2000+((y >> 3) << 6) +((y >> 3) << 7) +((y >> 3) << 7) + (y & 7)+ (x&(0xfff8)); *(short*)(ad) = (*(short*)(ad)) & ~(1 << ((7-(x & 7)))); }