Screen Saver File Source Code


// C Source File
// Created 1/10/2001; 04:10:31 PM

#define RETURN_VALUE          // Return Pushed Expression

#define OPTIMIZE_ROM_CALLS    // Use ROM Call Optimization

#define SAVE_SCREEN           // Save/Restore LCD Contents

#include <tigcclib.h>         // Include All Header Files

#define SPRITE_HEIGHT   8

short _ti89;                  // Produce .89Z File

unsigned long delay=0;  // Set delay var

int x=1,y=1,key,a=0,b=0;  // Set other vars

static unsigned char sprite1[] =  // Create sprite
{0x3C,0x7E,0xFF,0xFF,0xFF,0xFF,0x7E,0x3C};

void intro(void) {  //Create introducion
 clrscr();
 DrawStr(1,1,"Press any key to exit",A_NORMAL);
 ngetchx ();
}

inline void draw(int x, int y) {  // Create function to draw sprite
 Sprite8(x, y, SPRITE_HEIGHT, sprite1, LCD_MEM, SPRT_XOR);
}

inline void erase(int x, int y) {  //Create function to erase sprite
 draw(x,y);
}

void moveUp() {  // move up
 y+=a;

 if (y < 1) {  //wrap
  y=92;
 }

 if (y > 92) {
  y=1;
 }
}

void moveRight() {  //Move right
 x+=b;

 if (x < 1) {
  x=152;
 }

 if (x > 152) {
  x=1;
 }
}

// Main Function
void _main(void) {
 intro();  // play functions
 clrscr();
 draw(x,y);

 while (!kbhit ()) {  //Start while loop
  while ((delay < 300) & (!kbhit ())) {  //Start delay loop
   a=random(5);  // give processor some thing to do for delay
   b=random(7);
   delay++;  //Make delay loop decrease times left to play
  }
  erase(x,y);  //Execute more functions
  moveUp();
  moveRight();
  draw(x,y);
  delay=0;  //Reset delay loops played to 0
  }
 push_quantum(0xE9);
}

/* This Project possible by:
 David Ratliff: For his tutorials & mods.
 Xavier Vassor: For the almighty TIGCC environment
 Nick P.: I made it. */

Top