optimizing
This commit is contained in:
parent
5e9d2fdecc
commit
8bea2e8121
1 changed files with 5 additions and 4 deletions
|
@ -30,19 +30,19 @@ void setAndClearHiRes(){
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE isPositionWhite() {
|
BYTE isPositionWhite() {
|
||||||
ad = 0x2000+(320 * (BYTE)(y >> 3)) + (y & 7)+ (x&(0xfff8));
|
ad = 0x2000+(40*(y >> 3)<<3) + (y & 7)+ (x&(0xfff8));
|
||||||
return *(short*)(ad) & 1 << ((7-(x & 7)));
|
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_64/page/n129/
|
||||||
void setPositionWhite() {
|
void setPositionWhite() {
|
||||||
// TODO this 8 times something divided must be just masking
|
// TODO this 8 times something divided must be just masking
|
||||||
ad = 0x2000+(320 * (y >> 3)) + (y & 7)+(x&(0xfff8));
|
ad = 0x2000+(40 * (y >> 3) << 3) + (y & 7)+(x&(0xfff8));
|
||||||
*(short*)(ad) = *(short*)(ad) | 1 << ((7-(x & 7)));
|
*(short*)(ad) = *(short*)(ad) | 1 << ((7-(x & 7)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPositionBlack() {
|
void setPositionBlack() {
|
||||||
ad = 0x2000+320 * (y >> 3) + (y & 7)+ (x&(0xfff8));
|
ad = 0x2000+ (40* (y >> 3) << 3) + (y & 7)+ (x&(0xfff8));
|
||||||
*(short*)(ad) = (*(short*)(ad)) & ~(1 << ((7-(x & 7))));
|
*(short*)(ad) = (*(short*)(ad)) & ~(1 << ((7-(x & 7))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,8 @@ int main(void) {
|
||||||
x = 270;
|
x = 270;
|
||||||
y = 100;
|
y = 100;
|
||||||
direction = 0;
|
direction = 0;
|
||||||
while(x > 0 && x < 320 && y > 0 && y < 200)
|
//while(x > 0 && x < 320 && y > 0 && y < 200)
|
||||||
|
while(1)
|
||||||
{
|
{
|
||||||
makeMove();
|
makeMove();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue