Witam kod do gry telewizyjnej niestety nie chcą mi się skompilować tablice. Wydaje mi się że są, ponieważ bo w dev-cpp nie ma żadnych problemów z ich kompilacją. Co robię źle?
kod:
Lista błędów:

kod:
#define PB7 7
#define PB6 6
#define PC7 7
#define PC6 6
#define PA7 7
#define PB1 1
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <stdio.h>
#include <stdlib.h>
#include <util/delay.h>
#include "collision.h"
int y, x;
int obrazek_x, obrazek_y;
int petelka=0;
unsigned char ball_x = 100;
unsigned char ball_y = 100;
unsigned char ball_horizontal_dir;
unsigned char ball_vertical_dir;
unsigned char p1_y = 100;
unsigned char p2_y = 100;
unsigned char p1_score=0;
unsigned char p2_score=0;
unsigned char p1_miss=0;
unsigned char p2_miss=0;
unsigned char winner;
unsigned char ball_speed = 5;
char mode=0;
char result_str[3];
///////////////////////////////////////////////
void ekran_paletka(int paletkay, int paletkax)
{
unsigned char wizjapaletka[33][4] = {
0,2,2,0, //33
2,2,2,2, //32
2,2,2,2,//31
2,2,2,2, //30
2,2,2,2, //29
2,2,2,2, //28
2,2,2,2,//27
2,2,2,2, //26
2,2,2,2, //25
2,2,2,2, //24
2,2,2,2, //23
2,2,2,2,//22
2,2,2,2, //21
2,2,2,2, //20
2,2,2,2, //19
2,2,2,2, //18
2,2,2,2,//17
2,2,2,2, //16
2,2,2,2, //15
2,2,2,2, //14
2,2,2,2, //13
2,2,2,2,//12
2,2,2,2, //11
2,2,2,2, //10
2,2,2,2, //9
2,2,2,2, //8
2,2,2,2,//7
2,2,2,2, //6
2,2,2,2, //5
2,2,2,2, //3
2,2,2,2, //2
0,2,2,0 //1
//2 3 4
};
while( (UCSRA & (1<<UDRE)));
UDR = "zapytanie";
while( (UCSRA & (1<<UDRE)));
UDR = paletkax;
while( (UCSRA & (1<<UDRE)));
UDR = paletkay;
while( (UCSRA & (1<<UDRE)));
UDR = 33;
while( (UCSRA & (1<<UDRE)));
UDR = 4;
for(obrazek_y=0; obrazek_y <=33; obrazek_y++)
{
for(obrazek_x=0; obrazek_x <=4; obrazek_x++)
{
while( (UCSRA & (1<<UDRE) ));
UDR = wizjapaletka[obrazek_x, obrazek_y];
}}}
//////////////////////////////////////////////
//procedura rysowania piłki
void wizja_ball(int pilkax, int pilkay)
{
unsigned char pilkaball[5][5] = {
0,1,1,1,0,
1,1,1,1,1,
1,1,1,1,1,
1,1,1,1,1,
0,1,1,1,0};
while (!(UCSRA & (1<<UDRE)));
UDR = "zapytanie";
while( (UCSRA & (1<<UDRE)));
UDR = pilkax;
while( (UCSRA & (1<<UDRE)));
UDR = pilkay;
while( (UCSRA & (1<<UDRE)));
UDR = 5;
while( (UCSRA & (1<<UDRE)));
UDR = 5;
for(obrazek_y=0; obrazek_y <=5; obrazek_y++)
{
for(obrazek_x=0; obrazek_x <=5; obrazek_x++)
{
while( (UCSRA & (1<<UDRE)));
UDR = pilkaball[obrazek_x, obrazek_y];
}}
}
//procedura pisania napisu PONG
void pong(int pongx, int pongy)
{
char pongobraz[44][14] = {
1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,0,0,
1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,1,1,1,1,0,
1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,
1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,
1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,1,1,0,1,1,0,1,1,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,
1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,1,1,1,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,
1,1,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,1,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,
1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,1,1,1,0,0,1,1,0,0,0,1,1,1,1,1,
1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,1,1,1,1,0,0,1,1,0,0,0,1,1,1,1,1,
1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,
1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,
1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,1,1,1,1,0,
1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,0,0};
int pong_x=0;
int pong_y=0;
while( (UCSRA & (1<<UDRE)));
UDR = "zapytanie";
while( (UCSRA & (1<<UDRE)));
UDR = pongx;
while( (UCSRA & (1<<UDRE)));
UDR = pongy;
while( (UCSRA & (1<<UDRE)));
UDR = 44;
while( (UCSRA & (1<<UDRE)));
UDR = 14;
for(obrazek_y; obrazek_y <=44; obrazek_y++)
{
for(obrazek_x=0; obrazek_x <=14; obrazek_x++)
{
while( (UCSRA & (1<<UDRE)));
UDR = pongobraz[obrazek_x, obrazek_y];
}}}
void nacisni_jeden(int x, int y)
{
char njobraz[89][7] = {
1,0,0,0,1,0,0,1,1,1,0,0,0,1,1,1,1,0,0,1,0,0,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,1,0,0,0,0,1,
1,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,0,1,0,0,0,1,1,
1,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,0,1,0,1,
1,0,0,1,1,0,1,1,1,1,1,0,1,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,0,0,1,1,0,1,0,0,0,0,1,0,0,0,0,1,
1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,
1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,0,1,0,0,0,0,1,
1,0,0,0,1,0,1,0,0,0,1,0,0,1,1,1,1,0,0,1,0,0,1,1,1,1,0,0,1,0,0,0,1,0,1,0,0,1,1,0,0,0,0,0,1};
while( (UCSRA & (1<<UDRE)));
UDR = "zapytanie";
while( (UCSRA & (1<<UDRE)));
UDR = x;
while( (UCSRA & (1<<UDRE)));
UDR = y;
while( (UCSRA & (1<<UDRE)));
UDR = 89;
while( (UCSRA & (1<<UDRE)));
UDR = 7;
for(int obrazek_y=0; obrazek_y <=89; obrazek_y++)
{
for(int obrazek_x=0; obrazek_x <=7; obrazek_x++)
{
while( (UCSRA & (1<<UDRE)));
UDR= njobraz[obrazek_x, obrazek_y];
}}
}
void wygral_jeden(int x, int y)
{
char wjobraz[156][7] = {
3,0,0,0,0,0,3,0,3,0,0,0,3,0,0,3,3,3,3,0,0,3,3,3,3,0,0,0,3,3,3,3,0,0,3,0,0,0,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( (UCSRA & (1<<UDRE)));
UDR = "zapytanie";
while( (UCSRA & (1<<UDRE)));
UDR = x;
while( (UCSRA & (1<<UDRE)));
UDR = y;
while( (UCSRA & (1<<UDRE)));
UDR = 156;
while( (UCSRA & (1<<UDRE)));
UDR = 7;
for(obrazek_y=0; obrazek_y <=156; obrazek_y++)
{
for(obrazek_x=0; obrazek_x <=7; obrazek_x++)
{
while( (UCSRA &(1<<UDRE)))
UDR = wjobraz[obrazek_x] [obrazek_y];
}}
}
void wygral_dwa(int x, int y)
{
char wdobraz[164][7] = {
1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,1,1,1,1,1,0,0,0,1,1,1,1,0,
1,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,1,
1,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,
1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,
1,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,
1,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,
0,1,1,0,1,1,0,0,0,0,1,0,0,0,0,1,1,1,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,1,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1};
while( (UCSRA & (1<<UDRE)));
UDR = "zapytanie";
while( (UCSRA & (1<<UDRE)));
UDR = x;
while( (UCSRA & (1<<UDRE)));
UDR = y;
while( (UCSRA & (1<<UDRE)));
UDR = 164;
while( (UCSRA & (1<<UDRE)));
UDR = 7;
for(obrazek_y=0; obrazek_y <=164; obrazek_y++)
{
for(obrazek_x=0; obrazek_x <=7; obrazek_x++)
{
while( (UCSRA & (1<<UDRE)));
UDR = wdobraz[obarzek_x, obazrek_y];
}}
}
void liczby(int x, int y, int liczba)
{
int pole_x, pole_y;
if(liczba == 0)
{
char zeroobraz[6][7] = {
0,1,1,1,1,0,
1,0,0,0,0,1,
1,0,0,0,0,1,
1,0,0,0,0,1,
1,0,0,0,0,1,
1,0,0,0,0,1,
0,1,1,1,1,0};
pole_x=6;
pole_x=7;
}
if(liczba == 1)
{
char jedenobraz[3][7] = {
0,0,1,
0,1,1,
1,0,1,
0,0,1,
0,0,1,
0,0,1,
0,0,1};
pole_x=3;
pole_y=7;
}
if(liczba == 2)
{
char dwaobraz[6][7] = {
0,1,1,1,1,0,
1,0,0,0,0,1,
0,0,0,0,0,1,
0,0,0,0,1,0,
0,0,0,1,0,0,
0,0,1,0,0,0,
1,1,1,1,1,1};
}
if(liczba == 3)
{
char trzyobraz[6][7] = {
0,1,1,1,1,0,
1,0,0,0,0,1,
0,0,0,0,0,1,
0,0,0,1,1,0,
0,0,0,0,0,1,
1,0,0,0,0,1,
0,1,1,1,1,0};
pole_x=6;
pole_y=7;
}
if(liczba == 4)
{
char czteryobraz[6][7] = {
1,0,0,0,0,1,
1,0,0,0,0,1,
1,0,0,0,0,1,
0,1,1,1,1,0,
0,0,0,0,0,1,
0,0,0,0,0,1,
0,0,0,0,0,1};
pole_x=6;
pole_y=7;
}
while( (UCSRA & (1<<UDRE)));
UDR = "zapytanie";
while( (UCSRA & (1<<UDRE)));
UDR = x;
while( (UCSRA & (1<<UDRE)));
UDR = y;
while( (UCSRA & (1<<UDRE)) );
UDR = pole_x;
while( (UCSRA & (1<<UDRE) ) );
UDR = pole_y;
for(obrazek_y=0; obrazek_y <=5; obrazek_y++)
{
for(obrazek_x=0; obrazek_x <=5; obrazek_x++)
{
if(liczba == 0){while( (UCSRA & (1<<UDRE))); /**/ UDR = zeroobraz[obrazek_x][obrazek_y]; }
if(liczba == 1){while( (UCSRA & (1<<UDRE))); /**/ UDR = jedenobraz[obrazek_x][obrazek_y]; }
if(liczba == 2){while( (UCSRA & (1<<UDRE))); /**/ UDR = dwaobraz[obrazek][obrazek_y]; }
if(liczba == 3){while( (UCSRA & (1<<UDRE))); /**/ UDR = trzyobraz[obrazek_x][obrazek_y]; }
if(liczba == 4){while( (UCSRA & (1<<UDRE)));/**/ UDR = czteryobraz[obrazek_x][obrazek_y];}
}}}
int main(void)
{
//konfiguracja portow
DDRA = 0xff; //<-wyjscie
DDRC = 0xff; //<-wyjscie
DDRB = 0xff; //<-wyjscie
UCSRA = 0x00;
UCSRB = 0x00;
UCSRC = 0x86; // No Parity | 1 Stop Bit | 8 Data Bit
UBRRL = 103; // 9600bps @ 16.00MHz
UCSRB |= (1<<TXEN) ; // enable transmiter
//inicjalizuj przerwania
//InitInterrupts();
while(1)
{
//NextFrame();
//InputUpdate();
/**********************************************************************************************************************************/
ekran_paletka(10, p1_y);
/*************************************************/
ekran_paletka(246, p2_y);
/***********************************************/
wizja_ball(ball_x,ball_y);
/***********************************************/
liczby(82, 10, p1_score);
/**********************************************/
liczby(106, 10, p2_score);
if( PORTB & (1<<PB7) && p1_y > 0){ //if( PORTB &= ~(1<<PB7) && p1_y > 0){
p1_y=p1_y-10;
} else if( PORTB & (1<<PB6) && p1_y < 220){ //if( PORTB &= ~(1<<PB6) && p1_y < 220){
p1_y=p1_y+10;
}
if( PORTB & (1<<PC7) && p2_y > 0){ if( PORTB &= ~(1<<PC7) && p2_y > 0){
p2_y=p2_y-10;
} else if( PORTB & (1<<PC6) && p2_y < 220){ //if( PORTB &= ~(1<<PC6) && p2_y < 220){
p2_y=p2_y+10;
}
/***********************************************/
if(mode==1)
{
//////////////////////////
if (CheckRectangleCollision(ball_x,ball_y,ball_x+2,ball_y+4,10,p1_y,20,p1_y+32))
{
ball_horizontal_dir=1;
}
else if (CheckRectangleCollision(ball_x,ball_y,ball_x+2,ball_y+4,172,p2_y,182,p2_y+32))
{
ball_horizontal_dir=0;
}
if (ball_y<6) ball_vertical_dir=1;
if (ball_y>245) ball_vertical_dir=0;
if (ball_horizontal_dir) ball_x=ball_x+ball_speed; else ball_x=ball_x-ball_speed;
if (ball_vertical_dir) ball_y=ball_y+ball_speed; else ball_y=ball_y-ball_speed;
if ((!p1_miss)&&(!p2_miss))
{
if (ball_x<10)
{
p1_miss=1;
p2_score++;
} else
if (ball_x>182)
{
p2_miss=1;
p1_score++;
}
} else
{
if ((ball_x>14)&&(ball_x<24))
{
p2_miss=0;
} else
if ((ball_x<178)&&(ball_x>168))
{
p1_miss=0;
}
}
if ((p1_score >= 4)&&((p1_score-p2_score)>1))
{
winner=1;
mode++;
}
if ((p2_score >= 4)&&((p2_score-p1_score)>1))
{
winner=2;
mode++;
}
//////////////////////////
} else
if (mode==0)
{
//////////////////////////
//DrawRectangle(40,60,162,180,0);
nacisni_jeden(60, 120);
//DrawText(60,120,"NACISNIJ PRZYCISK",R);
// DrawText(75,150,"K RACHWAL",W);
//DrawText(75,80,"PONG 2008",B);
if(PORTB & (1<<PA7))
{
petelka = 1;
}
if(PORTB & (1<<PB1))
{
petelka = 1;
}
if (petelka == 1 ) petelka = 0; mode++; //if (PORTB &= ~(1<<PA7)|PORTB &= ~(1<<PB1)) mode++;
//////////////////////////
} else
if (mode==2)
{
//////////////////////////
if (winner==1) /*DrawText(73,80,"GRACZ 1 WYGRAL",0);*/wygral_jeden(73, 80);
if (winner==2) /*DrawText(73,80,"GRACZ 2 WYGRAL",0);*/wygral_dwa(73, 80);
//DrawRectangle(40,115,162,135,0);
//DrawText(60,120,"NACISNIJ PRZYCISK",R);
nacisni_jeden(60, 120);
if (PORTB & (1<<PA7) ) //if (PORTB &= ~(1<<PA7)|PORTB &= ~(1<<PB1))
{
ball_x = 100;
ball_y = 100;
p1_score=0;
p2_score=0;
p1_miss=0;
p2_miss=0;
mode=1;
}
if (PORTB & (1<<PB1)) //if (PORTB &= ~(1<<PA7)|PORTB &= ~(1<<PB1))
{
ball_x = 100;
ball_y = 100;
p1_score=0;
p2_score=0;
p1_miss=0;
p2_miss=0;
mode=1;
}
//|
//////////////////////////
}
/***********************************************/
/*Procedury wyśwwietlania obrazu*/
int obrazek;
char read_memory(unsigned char px, unsigned char py);
for(int obraz_y=1; obraz_y<=240; obraz_y++)
{
for(int obraz_x=1; obraz_x<=257; obraz_x++)
{
while(!(UCSRA & 0x80));
obrazek=UDR;
if(obrazek == 0){obraz_x=0b00100000;}
if(obrazek == 1){obraz_x=0b01110000;}
if(obrazek == 2){obraz_x=0b00010000;}
if(obrazek == 3){obraz_x=0b01000000;}
_delay_us(5.5);
PORTC=obraz_y;
PORTA=obraz_x;
PORTB=read_memory(obraz_x,obraz_y);
}}
}
//}
Lista błędów: