making one line to reduce size
This commit is contained in:
parent
3fad901873
commit
5a45ff1c36
1 changed files with 7 additions and 4 deletions
11
src/main.c
11
src/main.c
|
@ -29,20 +29,23 @@ void setAndClearHiRes(){
|
||||||
setHiRes();
|
setHiRes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void calcAdress(){
|
||||||
|
ad = 0x2000+((y & 0xf8) << 3) +((y & 0xf8) << 4) +((y & 0xf8) << 4) + (y & 7)+ (x&(0xfff8));
|
||||||
|
}
|
||||||
|
|
||||||
BYTE isPositionWhite() {
|
BYTE isPositionWhite() {
|
||||||
ad = 0x2000+((y >> 3) << 6) +((y >> 3) << 7) +((y >> 3) << 7) + (y & 7)+ (x&(0xfff8));
|
calcAdress();
|
||||||
return *(short*)(ad) & 1 << ((7-(x & 7)));
|
return *(short*)(ad) & 1 << ((7-(x & 7)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://archive.org/details/The_Graphics_Book_for_the_Commodore_65/page/n129/
|
// https://archive.org/details/The_Graphics_Book_for_the_Commodore_65/page/n129/
|
||||||
void setPositionWhite() {
|
void setPositionWhite() {
|
||||||
ad = 0x2000+ ((y >> 3) << 6) +((y >> 3) << 7) +((y >> 3) << 7) + (y & 7)+(x&(0xfff8));
|
calcAdress();
|
||||||
*(short*)(ad) = *(short*)(ad) | 1 << ((7-(x & 7)));
|
*(short*)(ad) = *(short*)(ad) | 1 << ((7-(x & 7)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPositionBlack() {
|
void setPositionBlack() {
|
||||||
// TODO is it faster to somehow reuse y >> 3 than do it many times, and maybe add the same result twice...
|
calcAdress();
|
||||||
ad = 0x2000+((y >> 3) << 6) +((y >> 3) << 7) +((y >> 3) << 7) + (y & 7)+ (x&(0xfff8));
|
|
||||||
*(short*)(ad) = (*(short*)(ad)) & ~(1 << ((7-(x & 7))));
|
*(short*)(ad) = (*(short*)(ad)) & ~(1 << ((7-(x & 7))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue