#ifndef _DISPLAY_H #define _DISPLAY_H // NTSC horizontal sync pulses occur at 63.55 microseconds. // We will make our cycles 63.625 microseconds. // Clock: 16 MHz Interrupt when counter is at: 1018. #define _DISP_LINE_TIME 1018 // Top and bottom line numbers of the viewable portion of the screen #define _DISP_SCREEN_TOP 30 #define _DISP_SCREEN_BOTTOM 230 #define _DISP_HEIGHT 100 // Sync is when Video Output = 0V. No pins are asserted #define _DISP_SYNC 0x00; // Low is when Video Port Pin 5 is asserted, which correspons to black ~ 0.3 V. #define _DISP_LOW 0x20; extern int lineCount; // The current scanline number to be outputed. extern char syncOn; // The output for video out when sync is ON. extern char syncOff; // The output for video out when sync is OFF. extern char screen[1600]; // The TV screen buffer. /** Flags Bits **/ #define RENDER_SHIP_1 0x1 #define RENDER_SHIP_2 0x2 #define RENDER_BULLET 0x4 #define RENDER_EXPLODE 0x10 #define RENDER_PLANET 0x20 #define RENDER_ERROR 0x80 /** Last Screen Index for last line */ #define MAX_SCREEN_LINE 1584 /** * Zoom Mode Enable. * @param x The horizontal coordinate for top left corner of zoom. * @param y The vertical coordinate for top left corner of zoom. * @returns Whether zoom was successful. (0 if unsuccessful). */ char zoomEnable (char x, char y); /** * Zoom Mode Disable. */ void zoomDisable(); /** * returns whether we are in zoom mode. */ char isZoomed(); /** * Initalize Display Parameters */ void initializeDisplay(); /** * Clears the screen. - Might be slow. */ void clearScreen(); /** * Draws ship for player on screen. * @param x The horizontal coordinate for the center of the ship. * @param y The vertical coordinate for the center of the ship. * @param theat The angle of ship's orientation (0 to NUM_ANGLES - 1) * @param type The ship type. * @param player The player number 0 or 1. */ void drawShip(char x, char y, char theta, char type, char player); /** * Erases the ship from screen. * @param player The player number 0 or 1. */ void eraseShip(char player); /** * Renderes the ships on the screen. Must be called every frame. */ void renderShip(); /** * Draw Bullet on screen * @param x The horizontal coordinate for the center of the bullet. * @param y The vertical coordinate for the center of the bullet. * @param theta The angle of bullet's orientation. * @param type The type of bullet. * @param player The player who fired the bullet. */ void drawBullet(char x, char y, char theta, char type, char player); /** * Erase the bullets from screen fired by the given player. * @param player The player who fired the bullets. */ void eraseBullets(char player); /** * Render all the bullets. * @param Render bullets for player. */ void renderBullets(char player); /** * Draw Explosion on screen * @param x The horizontal coordinate for the center of the explosion. * @param y The vertical coordinate for the center of the explosion. * @param type The type of explosion effect (Frame #). */ void drawExplosion(char x, char y, char type); /** * Erase the all the explosions from screen. */ void eraseExplosions(); /** * Render all the explosions. */ void renderExplosions(); /** * Draw Planet on Screen. */ void drawPlanet(); /** * Render the Planet. drawPlanet call is required. */ void renderPlanet(); /** * Draw a Big Ship @ (x,y) - Top Left Corner. * @param xCoord Top Left x-coordinates * @param yCoord Top Left y-coordinates. * @param type The ship type */ void drawBigShips(signed char xCoord, signed char yCoord, char type); #endif