cleaning up the mess
This commit is contained in:
parent
ecedd8fd59
commit
3badd74977
1 changed files with 11 additions and 22 deletions
33
src/main.c
33
src/main.c
|
@ -12,7 +12,7 @@
|
|||
// Should be plenty of stack space between the top of the graphics memory
|
||||
|
||||
|
||||
unsigned short i;
|
||||
short i;
|
||||
short x; // maybe if the ant does not go tooo far it could be an int..
|
||||
short y;
|
||||
short direction; // 0 = right, 64 = up, 128 = left, 192 = down
|
||||
|
@ -54,33 +54,32 @@ void setAndClearHiRes(){
|
|||
}
|
||||
|
||||
// need to think
|
||||
BYTE isPositionWhite(short x, short y)
|
||||
BYTE isPositionWhite(short x, BYTE y)
|
||||
{
|
||||
short ra = (320 * (short)(y/8)) + (y & 7);
|
||||
short ba = 8 * (short)(x/8);
|
||||
short ma = 1 << ((7-(x & 7)));
|
||||
short ra = (320 * (BYTE)(y/8)) + (y & 7);
|
||||
BYTE ba = 8 * (BYTE)(x/8);
|
||||
BYTE ma = 1 << ((7-(x & 7)));
|
||||
short sa = 0x2000;
|
||||
short ad = sa+ra+ba;
|
||||
return *(short*)(ad) & ma;
|
||||
return *(BYTE*)(ad) & ma;
|
||||
}
|
||||
|
||||
|
||||
// https://archive.org/details/The_Graphics_Book_for_the_Commodore_64/page/n129/
|
||||
void setPositionWhite(short x, short y)
|
||||
{
|
||||
short ra = (320 * (short)(y/8)) + (y & 7);
|
||||
short ba = 8 * (short)(x/8);
|
||||
short ma = 1 << ((7-(x & 7)));
|
||||
BYTE ba = 8 * (short)(x/8);
|
||||
BYTE ma = 1 << ((7-(x & 7)));
|
||||
short sa = 0x2000;
|
||||
short ad = sa+ra+ba;
|
||||
*(short*)(ad) = *(short*)(ad) | ma;
|
||||
}
|
||||
|
||||
void setPositionBlack(unsigned short x, unsigned short y)
|
||||
void setPositionBlack(short x, short y)
|
||||
{
|
||||
short ra = (320 * (short)(y/8)) + (y & 7);
|
||||
short ba = 8 * (short)(x/8);
|
||||
short ma = (1 << ((7-(x & 7))));
|
||||
BYTE ba = 8 * (short)(x/8);
|
||||
BYTE ma = (1 << ((7-(x & 7))));
|
||||
short sa = 0x2000;
|
||||
short ad = sa+ra+ba;
|
||||
*(short*)(ad) = (*(short*)(ad)) & ~ma;
|
||||
|
@ -128,16 +127,6 @@ unsigned short j;
|
|||
int main(void) {
|
||||
|
||||
setAndClearHiRes();
|
||||
for (i = 0;i<50;i++){
|
||||
for (j= 0;j<50;j++){
|
||||
setPositionWhite(i,j);
|
||||
}
|
||||
}
|
||||
for (i = 0;i<50;i++){
|
||||
for (j= 0;j<50;j++){
|
||||
setPositionBlack(i,j);
|
||||
}
|
||||
}
|
||||
x = 160;
|
||||
y = 100;
|
||||
direction = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue