-
Notifications
You must be signed in to change notification settings - Fork 0
/
mipslab.h
151 lines (120 loc) · 3.65 KB
/
mipslab.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/* mipslab.h
Header file for all labs.
This file written 2015 by F Lundevall
Some parts are original code written by Axel Isaksson
Latest update 2015-08-28 by F Lundevall
For copyright and licensing, see file COPYING */
/* Declare display-related functions from mipslabfunc.c */
void display_image(int x, const uint8_t *data);
void display_init(void);
void display_string(int line, char *s);
void display_update(void);
uint8_t spi_send_recv(uint8_t data);
/* Declare lab-related functions from mipslabfunc.c */
char * itoaconv( int num );
void labwork(void);
int nextprime( int inval );
void quicksleep(int cyc);
void tick( unsigned int * timep );
/* Declare display_debug - a function to help debugging.
After calling display_debug,
the two middle lines of the display show
an address and its current contents.
There's one parameter: the address to read and display.
Note: When you use this function, you should comment out any
repeated calls to display_image; display_image overwrites
about half of the digits shown by display_debug.
*/
void display_debug( volatile int * const addr );
/* Declare bitmap array containing font */
extern const uint8_t const font[128*8];
/* Declare bitmap array containing icon */
extern const uint8_t const icon[128];
/* Declare text buffer for display output */
extern char textbuffer[4][16];
/* Declare functions written by students.
Note: Since we declare these functions here,
students must define their functions with the exact types
specified in the laboratory instructions. */
/* Written as part of asm lab: delay, time2string */
void delay(int);
void time2string( char *, int );
extern uint8_t display[32][128];
extern uint8_t oled_display[512];
/* Written as part of i/o lab: getbtns, getsw, enable_interrupt */
int getbtns(void);
int getsw(void);
void enable_interrupt(void);
//Gamemode functions
void one_player(int);
void score_mode(int);
void two_player(int);
//Move functions
void player_movement_one(int);
void player_movement_two(int);
void ball_movement(void);
void ai_move(void);
//Display functions
void translateToImage(void);
void setPixelArray(int, int, int, int);
void clearDisplay(void);
//Menu functions
void menu(int);
void menu_settings(int);
void highscore_menu(int);
void initial_select(int);
void goal(int);
void quit(void);
void reset_game(void);
void string_clear(void);
void player1_win(void);
void player2_win(void);
void ai_win(void);
//Highscore functions
void highscore_formatting(char[], char[], char[]);
//Menu specific variables
extern float current_menu;
extern float settings_menu;
//Game specific variables
extern float game_active;
extern float game_mode;
extern int score_player1;
extern float score_player2;
extern int ai_difficulty; // 4Easy, 2Medium, 1Hard
extern float player;
extern int light_counter;
extern int player_lives;
//Paddle specific variables
extern float paddle_height;
extern float paddle_width;
extern float paddle_speed;
extern float paddle1_xPos;
extern float paddle1_yPos;
extern float paddle2_xPos;
extern float paddle2_yPos;
extern float paddle2_up;
extern float paddle2_down;
extern float paddle1_up;
extern float paddle1_down;
//Ball specific variables
extern float ball_size;
extern float ball_speedx;
extern float ball_speedy;
extern int ball_xPos;
extern int ball_yPos;
extern int count;
//Highscore specific variables
extern int initials_menu;
extern char initial_1;
extern char initial_2;
extern char initial_3;
extern char highscore_temp[];
extern int highscore_active;
extern char highscore_1[];
extern char highscore_2[];
extern char highscore_3[];
extern char a[];
extern char b[];
extern char c[];
extern char m[];
extern int initial_active;