trying to speed things up a bit
This commit is contained in:
parent
431572f223
commit
4adaa74550
1 changed files with 6 additions and 22 deletions
28
src/main.c
28
src/main.c
|
@ -4,10 +4,6 @@ short i;
|
||||||
short x;
|
short x;
|
||||||
BYTE y;
|
BYTE y;
|
||||||
BYTE direction;
|
BYTE direction;
|
||||||
short ra;
|
|
||||||
BYTE ba;
|
|
||||||
BYTE ma;
|
|
||||||
short sa;
|
|
||||||
short ad;
|
short ad;
|
||||||
|
|
||||||
void setHiRes() {
|
void setHiRes() {
|
||||||
|
@ -33,31 +29,19 @@ void setAndClearHiRes(){
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE isPositionWhite() {
|
BYTE isPositionWhite() {
|
||||||
ra = (320 * (BYTE)(y/8)) + (y & 7);
|
ad = 0x2000+(320 * (BYTE)(y/8)) + (y & 7)+8 * (BYTE)(x/8);
|
||||||
ba = 8 * (BYTE)(x/8);
|
return *(BYTE*)(ad) & 1 << ((7-(x & 7)));
|
||||||
ma = 1 << ((7-(x & 7)));
|
|
||||||
sa = 0x2000;
|
|
||||||
ad = sa+ra+ba;
|
|
||||||
return *(BYTE*)(ad) & ma;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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() {
|
||||||
ra = (320 * (y/8)) + (y & 7);
|
ad = 0x2000+(320 * (y/8)) + (y & 7)+8 * (short)(x/8);
|
||||||
ba = 8 * (short)(x/8);
|
*(short*)(ad) = *(short*)(ad) | 1 << ((7-(x & 7)));
|
||||||
ma = 1 << ((7-(x & 7)));
|
|
||||||
sa = 0x2000;
|
|
||||||
ad = sa+ra+ba;
|
|
||||||
*(short*)(ad) = *(short*)(ad) | ma;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPositionBlack() {
|
void setPositionBlack() {
|
||||||
ra = 320 * (y/8) + (y & 7);
|
ad = 0x2000+320 * (y/8) + (y & 7)+8 * (short)(x/8);
|
||||||
ba = 8 * (short)(x/8);
|
*(short*)(ad) = (*(short*)(ad)) & ~(1 << ((7-(x & 7))));
|
||||||
ma = (1 << ((7-(x & 7))));
|
|
||||||
sa = 0x2000;
|
|
||||||
ad = sa+ra+ba;
|
|
||||||
*(short*)(ad) = (*(short*)(ad)) & ~ma;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveForward() {
|
void moveForward() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue