A89: external variables in TI-GCC


[Prev][Next][Index][Thread]

A89: external variables in TI-GCC



Hello! I'm having trouble with external variables. I have an array of 
structures used to define sprites, and want to stick it in a seperate module 
(to unclutter the code, it's BIG). I have no problem if I define the array 
in the main module, but when I stick it in a seperate one, the program 
compiles just fine, but the sprites are garbled when the program runs! I've 
attached the code (it's pretty long), which will probably reveal me for the 
idiot that I am...hehe.

Thanx,
Michael Cowart


________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
MASKSPRITE is a structure containing data for a 16x16 masked sprite
// a 16x16 masked greyscale sprite
typedef struct
{
	//lightplane array
	unsigned int lightplane[16];

	//darkplane array
	unsigned int darkplane[16];

	//mask array
	unsigned int mask[16];
} MASKSPRITE;

//this is the main module

extern MASKSPRITE kenshu[9]; //an array of sprite structures

//this draws a greyscale masked sprite
DrawMaskSprite (10,10,kenshu[0])

//this is the module conataining the sprite data


MASKSPRITE kenshu[9] = {

	{//sprite id frontstand

	//lightplane
	{0x7E0,0xFF0,0x1FE0,0x1B70,0x1DB0,0xAA0,0x3838,0x6FD4,
	0x3FB8,0x7D3C,0x4FF4,0x3FF8,0x820,0x920,0x1EF0,0x3EF8},

	//darkplane
	{0x7E0,0xFF0,0x1FE0,0x1FF0,0x340,0xAA0,0x3838,0x47C4,
	 0x3A78,0x4AE4,0x4FE4,0x3018,0x0FE0,0x0FE0,0x1290,0x3EF8},

	//mask
	{~0x7E0,~0xFF0,~0x1FE0,~0x1FF0,~0x1FF0,~0xFE0,~0x3FF8,~0x7FFC,
	 ~0x3FF8,~0x7FFC,~0x7FFC,~0x3FF8,~0xFE0,~0xFE0,~0x1FE0,~0x3EF8}},


	{//sprite id frontwalk1

	//lightplane
	{0xFC0,0x3FE0,0x1FE0,0x3B70,0x1DB0,0xAA0,0x1838,0x37EC,
	0x1B6C,0x3A78,0x2FF8,0x1FC8,0x830,0x1F20,0xCF0,0x00F0},

	//darkplane
	{0xFC0,0x3FE0,0x1FE0,0x3FF0,0x0340,0xAA0,0x1838,0x2FC4,
	 0x1DC4,0x2DB8,0x2FC8,0x1048,0xFF0,0x13E0,0xC90,0x00F0},

	//mask
	{~0xFC0,~0x3FE0,~0x1FE0,~0x3FF0,~0x1FF0,~0xFE0,~0x1FF8,~0x3FFC,
	 ~0x1FFC,~0x3FF8,~0x3FF8,~0x1FF8,~0xFF0,~0x1FE0,~0xCF0,~0x00F0}},



	{//sprite id frontwalk2

	//lightplane
	{0x7E0,0xFF8,0xFF0,0x1B78,0x1DB0,0xAA0,0x3830,0x6FD8,
	 0xF770,0x3A78,0x3FE8,0x27F0,0x1820,0x9F0,0x1E60,0x1E00},

	//darkplane
	{0x7E0,0xFF8,0xFF0,0x1FF8,0x340,0xAA0,0x3830,0x47E8,
	 0x45B0,0x3DA8,0x27E8,0x2410,0x1FE0,0xF90,0x1260,0x1E00},

	//mask
	{~0x7E0,~0xFF8,~0xFF0,~0x1FF8,~0x1FF0,~0xFE0,~0x3FF0,~0x7FF8,
	 ~0x7FF0,~0x3FF8,~0x3FF8,~0x3FF8,~0x1FE0,~0xFF0,~0x1E60,~0x1E00}},

	{//sprite id backwalk

	//lightplane
	{0x7E0,0xFB8,0xFFC,0x1FF8,0x1FFC,0xFF8,0xFF0,0x3BDC,
	 0x5436,0x7BFE,0x5ABA,0x5CB2,0x2FF4,0x998,0xFF0,0x1FF8},

	//darkplane
	{0x7E0,0xFF8,0xFDC,0x1FF8,0x1FFC,0x3C0,0xC30,0x3FFC,
	 0x4FEA,0x7FDE,0x5D5A,0x5F72,0x2FD4,0xFF8,0x910,0x1FF8},

	//mask
	{~0x7E0,~0xFF8,~0xFFC,~0x1FF8,~0x1FFC,~0xFF8,~0xFF0,~0x3FFC,
	 ~0x7FFE,~0x7FFE,~0x7FFE,~0x7FFE,~0x2FFC,~0xFF8,~0xFF0,~0x1FF8}},

	{//sprite id backstand

	//lightplane
	{0x7E0,0x1FB0,0x3FF0,0x1FF8,0x3FF8,0x1FF0,0xFF0,0x3BDC,
	 0x5036,0x7BFE,0x5ABA,0x4CBA,0x2FF4,0x1990,0xFF0,0x1FF8},

	//darkplane
	{0x7E0,0x1FF0,0x3FD0,0x1FF8,0x3FF8,0x3C0,0xC30,0x3FFC,
	 0x4FE2,0x7FDE,0x5D5A,0x4F7A,0x2BF4,0x1FF0,0x0890,0x1FF8},

	//mask
	{~0x7E0,~0x1FF0,~0x3FF0,~0x1FF8,~0x3FF8,~0x1FF0,~0xFF0,~0x3FFC,
	 ~0x7FFE,~0x7FFE,~0x7FFE,~0x7FFE,~0x3FF4,~0x1FF0,~0xFF0,~0x1FF8}},

	{//sprite id leftwalk

	//lightplane
	{0x1FC0,0x3FF0,0x37E0,0x37F8,0x1D70,0x1460,0x1020,0xFE0,
	 0x1F50,0x1EF0,0x1DF0,0x1F90,0xFF0,0x1330,0x3EB0,0x3E70},

	//darkplane
	{0x1FC0,0x3FF0,0x3FE0,0x3BB8,0x1FF0,0x1460,0x1020,0xFE0,
	 0x1910,0x18F0,0x1090,0x1F90,0x70,0x1FD0,0x22D0,0x3E70},

	//mask
	{~0x1FC0,~0x3FF0,~0x3FE0,~0x3FF8,~0x1FF0,~0x1FE0,~0x1FE0,~0xFE0,
	 ~0x1FF0,~0x1FF0,~0x1FF0,~0x1FF0,~0xFF0,~0x1FF0,~0x3EF0,~0x3E70}},

	{//sprite id leftstand

	//lightplane
	{0x1FC0,0x3FF0,0x37E0,0x37F8,0x1D70,0x1460,0x1020,0xFE0,
	 0x1F50,0x1EF0,0x1DF0,0x1F30,0xFE0,0x440,0xFC0,0x1FC0},

	//darkplane
	{0x1FC0,0x3FF0,0x3FE0,0x3BB8,0x1FF0,0x1460,0x1020,0xFE0,
	 0x1910,0x18F0,0x1110,0x1F30,0xE0,0x7C0,0x840,0x1FC0},

	//mask
	{~0x1FC0,~0x3FF0,~0x3FE0,~0x3FF8,~0x1FF0,~0x1FE0,~0x1FE0,~0xFE0,
	 ~0x1FF0,~0x1FF0,~0x1FF0,~0x1FF0,~0xFE0,~0x7C0,~0xFC0,~0x1FC0}},

	{//sprite id rightwalk

	//lightplane
	{0x3F8,0xFFC,0x7FC,0x1DDC,0xFF8,0x628,0x408,0x7F0,
	 0xDB8,0xFB8,0xFB8,0x9F8,0xFF0,0xCC8,0xD7C,0xE7C},

	//darkplane
	{0x3F8,0xFFC,0x7FC,0x1DDC,0xFF8,0x628,0x408,0x7F0,
	 0x898,0xF18,0x908,0x9F8,0xE00,0xBF8,0xB44,0xE7C},

	//mask
	{~0x3F8,~0xFFC,~0x7FC,~0x1FFC,~0xFF8,~0x7F8,~0x7F8,~0x7F0,
	 ~0xFF8,~0xFF8,~0xFF8,~0xFF8,~0xFF0,~0xFF8,~0xF7C,~0xE7C}},

	{//sprite id rightstand

	//lightplane
	{0x3F8,0xFFC,0x7EC,0x1FEC,0xEB8,0x628,0x408,0x7F0,
	 0xAF8,0xF78,0xFB8,0xCF8,0x7F0,0x220,0x3F0,0x3F8},

	//darkplane
	{0x3F8,0xFFC,0x7FC,0x1DDC,0xFF8,0x628,0x408,0x7F0,
	 0x898,0xF18,0x888,0xCF8,0x700,0x3E0,0x210,0x3F8},

	//mask
	{~0x3F8,~0xFFC,~0x7FC,~0x1FFC,~0xFF8,~0x7F8,~0x7F8,~0x7F0,
	 ~0xFF8,~0xFF8,~0xFF8,~0xFF8,~0x7F0,~0x3E0,~0x3F0,~0x3F8}}

	} ;