OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [actel_m1a3pl_dev_kit/] [software/] [spacewar/] [spacewar.h] - Blame information for rev 80

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 80 olivier.gi
//************************************************************
2
//
3
// spacewar.h
4
//
5
//
6
#include <iomacros.h>
7
 
8
#define full_shields 6      // 6 hits on rkt to win
9
#define ammo 2              // # photon torpedos per rocket- only memory for 2
10
#define rktsiz  128         // size of rockets
11
#define max_dac 4095        // max value on scrn
12
#define min_dac 0           // max value on scrn
13
#define fixed_inc 16        // space between dots in lines
14
#define center (max_dac / 2)  // center of the display
15
#define collide 256         // size of rocket for a collision
16
#define fire_bit 1          // fire button is pressed
17
#define time_tick 1         // 10 ms timer tick for system time
18
 
19
#define MY_DAC_X_      0x0190
20
sfrb (MY_DAC_X,MY_DAC_X_);
21
#define MY_DAC_X_STAT_ 0x0192
22
sfrb (MY_DAC_X_STAT,MY_DAC_X_STAT_);
23
#define MY_CNTRL1_     0x0194
24
sfrb (MY_CNTRL1,MY_CNTRL1_);
25
#define MY_CNTRL2_     0x0196
26
sfrb (MY_CNTRL2,MY_CNTRL2_);
27
#define MY_DAC_Y_      0x01A0
28
sfrb (MY_DAC_Y,MY_DAC_Y_);
29
#define MY_DAC_Y_STAT_ 0x01A2
30
sfrb (MY_DAC_Y_STAT,MY_DAC_Y_STAT_);
31
 
32
/* Description:
33
The structure contain all the data for each rocket.  Two of these structures
34
are defined in main, rkt1 and rkt2.  The xdisp, ydisp is the 12 bit position of
35
the rocket.  The xvel, yvel is the velocity if the rocket. xvel, yvel is added
36
into xdisp, ydisp every 10ms to cause motion.  The xsize, ysize are the scaled
37
vectors of the rocket size used to draw the rocket.  The angle is the present
38
angle the rocket is flying.  The angle is 0 - 255 for 0 - 359 degrees.  Flags
39
contains a single bit to debounce the single firing of torpedos.  The pt_dx[],
40
pt_dy[] is the array position for this rockets torpedos.  The pt_vx[], pt_vy[]
41
is the array velocity for this rockets torpedos.
42
*/
43
struct rkt_data {
44
  int xdisp, ydisp;         // rockets x,y position, 0 <= pos <= 4095
45
  long xvel, yvel;          // rockets x,y velocity
46
  int xsize, ysize;         // sine/cosine size of rocket for drawing it
47
  unsigned char ang;        // rockets angle
48
  unsigned char shield;     // shield value, if =0 game over
49
  unsigned char game;       // game points scored
50
  unsigned char flags;      // bit 1 fire flag if = 1 fire button is down 
51
  int pt_dx[ammo], pt_dy[ammo]; // torps x,y position
52
  int pt_vx[ammo], pt_vy[ammo]; // torps x,y velocity
53
};
54
 
55
typedef struct rkt_data rkt_data;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.