Line 28... |
Line 28... |
//
|
//
|
// B. Seiler
|
// B. Seiler
|
// July 2006
|
// July 2006
|
//************************************************************
|
//************************************************************
|
|
|
|
#include "omsp_system.h"
|
#include "spacewar.h"
|
#include "spacewar.h"
|
#include "msp430x20x3.h"
|
|
|
|
//************************************************************
|
//************************************************************
|
// externals
|
// externals
|
//
|
//
|
extern void init_all(rkt_data *, rkt_data *);
|
extern void init_all(rkt_data *, rkt_data *);
|
Line 74... |
Line 74... |
|
|
init_all(rkt1, rkt2); // setup MSP430 hardware and variables
|
init_all(rkt1, rkt2); // setup MSP430 hardware and variables
|
|
|
while (1) {
|
while (1) {
|
P1OUT ^= 0x01; // Toggle P1.0
|
P1OUT ^= 0x01; // Toggle P1.0
|
if(flags && time_tick) { // only do updates on time tick
|
if(flags && time_tick) { // only104 do updates on time tick
|
update(rkt1, read_a2d(SD16INCH_2)); // check rkt1's buttons update positions
|
update(rkt1, read_a2d(0x0002)); // check rkt1's buttons update positions
|
update(rkt2, read_a2d(SD16INCH_4)); // check rkt2's buttons update positions
|
update(rkt2, read_a2d(0x0004)); // check rkt2's buttons update positions
|
compar(rkt1, rkt2); // check for collisions or hits
|
compar(rkt1, rkt2); // check for collisions or hits
|
score(rkt1, rkt2); // check for game end, show score
|
score(rkt1, rkt2); // check for game end, show score
|
flags &= ~time_tick; // clear time tick flag
|
flags &= ~time_tick; // clear time tick flag
|
}
|
}
|
rocket1(rkt1); // draw rocket 1
|
rocket1(rkt1); // draw rocket 1
|
Line 94... |
Line 94... |
//
|
//
|
/* Description:
|
/* Description:
|
Calls a function named play_spacewar. This extra call reduces code size
|
Calls a function named play_spacewar. This extra call reduces code size
|
by using registers as the pointers to the structures rkt1 and rkt2.
|
by using registers as the pointers to the structures rkt1 and rkt2.
|
*/
|
*/
|
void main(void)
|
int main(void)
|
{
|
{
|
struct rkt_data rkt1, rkt2;
|
struct rkt_data rkt1, rkt2;
|
|
|
play_spacewar(&rkt1, &rkt2); // play the game
|
play_spacewar(&rkt1, &rkt2); // play the game
|
|
|
|
return 1;
|
}
|
}
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|