ECE2035 class project

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed wave_player

Fork of missile_command by ECE 2035 TA

Files at this revision

API Documentation at this revision

Comitter:
arvahsu
Date:
Wed Oct 29 01:21:34 2014 +0000
Child:
1:3da29f1d84b4
Commit message:
First public version

Changed in this revision

4DGL-uLCD-SE.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
city_landscape/city_landscape.cpp Show annotated file Show diff for this revision Revisions of this file
city_landscape/city_landscape_private.h Show annotated file Show diff for this revision Revisions of this file
city_landscape/city_landscape_public.h Show annotated file Show diff for this revision Revisions of this file
globals.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
missile/missile.cpp Show annotated file Show diff for this revision Revisions of this file
missile/missile_private.h Show annotated file Show diff for this revision Revisions of this file
missile/missile_public.h Show annotated file Show diff for this revision Revisions of this file
player.cpp Show annotated file Show diff for this revision Revisions of this file
player.h Show annotated file Show diff for this revision Revisions of this file
segment_display/dig_out.s Show annotated file Show diff for this revision Revisions of this file
segment_display/segment_display.h Show annotated file Show diff for this revision Revisions of this file
segment_display/segment_driver.s Show annotated file Show diff for this revision Revisions of this file
segment_display/setup.s Show annotated file Show diff for this revision Revisions of this file
wave_player.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/4DGL-uLCD-SE.lib	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/4180_1/code/4DGL-uLCD-SE/#e39a44de229a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/mbed/code/SDFileSystem/#7b35d1709458
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/city_landscape/city_landscape.cpp	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,117 @@
+/* Gatech ECE2035 2014 FALL missile command
+ * Copyright (c) 2014 Gatech ECE2035
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "city_landscape_private.h"
+
+CITY city_record[MAX_NUM_CITY];
+int building_height[NUM_BUILDING];
+
+// See the comments in city_landscape_public.h
+void city_landscape_init(int num_city) {
+    int i;
+    int city_distance = (SIZE_X-CITY_TO_SCREEN_MARGIN*2)/num_city;
+    
+    // All interface for user should have error checking
+    ASSERT_P(num_city<=MAX_NUM_CITY,ERROR_CITY_NUMBER);
+    
+    //initialize the record of cities
+    for(i=0;i<MAX_NUM_CITY;i++){
+        if(i<num_city){
+            // See the definition of CITY structure in city_landscape.h
+            city_record[i].y = REVERSE_Y(LANDSCAPE_HEIGHT)-1;
+            city_record[i].x = i*city_distance + CITY_TO_SCREEN_MARGIN;
+            city_record[i].width = CITY_WIDTH;            // the width is fix number
+            city_record[i].height = MAX_BUILDING_HEIGHT;  // the height is fix number
+            city_record[i].status = EXIST;
+        }
+        else{
+            city_record[i].status = DESTORIED;
+        }
+    }
+    
+    //initialize the height of the buildings
+    srand(1);
+    for(i=0;i<NUM_BUILDING;i++){
+        building_height[i] = (rand() % MAX_BUILDING_HEIGHT*2/3)+MAX_BUILDING_HEIGHT/3;
+    }
+    
+    //draw city landscape on the screen
+    draw_cities();
+    draw_landscape();
+
+}
+
+CITY city_get_info(int index){
+    // All interface for user should have error checking
+    ASSERT_P(index<MAX_NUM_CITY,ERROR_CITY_INDEX_GET_INFO);
+    
+    return city_record[index];
+}
+
+void city_destory(int index){
+    int j;
+    int city_x, city_y, building_x, building_y;
+    int height;
+    
+    // error checking. the index must smaller than its max.
+    ASSERT_P(index<MAX_NUM_CITY,ERROR_CITY_INDEX_DESTROY);
+    
+    // remove the record
+    city_record[index].status = DESTORIED;
+    
+    // use the background color to cover the city
+    city_x = city_record[index].x;
+    city_y = city_record[index].y;
+    for(j=0;j<NUM_BUILDING;j++){
+        building_x = city_x+j*BUILDING_WIDTH;
+        building_y = city_y;
+        height = building_y-building_height[j]+1;
+        uLCD.filled_rectangle(building_x, building_y, building_x+BUILDING_WIDTH-1, height, BACKGROUND_COLOR);
+    }
+}
+
+void draw_cities(void){
+    int i,j;
+    int city_x, city_y, building_x, building_y;
+    int height;
+    
+    for(i=0;i<MAX_NUM_CITY;i++){
+        
+        // draw each city
+        if(city_record[i].status==EXIST){
+            city_x = city_record[i].x;
+            city_y = city_record[i].y;
+            
+            // draw each building
+            for(j=0;j<NUM_BUILDING;j++){
+                building_x = city_x+j*BUILDING_WIDTH;
+                building_y = city_y;
+                height = building_y-building_height[j]+1;
+                uLCD.filled_rectangle(building_x, building_y, building_x+BUILDING_WIDTH-1, height, BUILDING_COLOR);
+            }
+        }
+    }
+}
+
+void draw_landscape(void){
+    uLCD.filled_rectangle(0, SIZE_Y-1, SIZE_X-1, REVERSE_Y(LANDSCAPE_HEIGHT), LANDSCAPE_COLOR);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/city_landscape/city_landscape_private.h	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,60 @@
+/* Gatech ECE2035 2014 FALL missile command
+ * Copyright (c) 2014 Gatech ECE2035
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef CITY_LANDSCAPE_PRIVATE_H
+#define CITY_LANDSCAPE_PRIVATE_H
+
+#include "mbed.h"
+#include "uLCD_4DGL.h"
+#include "globals.h"
+#include "city_landscape_public.h"
+
+//==== [private type] ====
+// N/A
+
+
+
+//==== [private function] ====
+// N/A
+
+
+
+//==== [private macros] ====
+// The bottom of the screen => y=127
+// Gut the landscape grow up from the bottom of the screen. It is awkward.
+// Thus, we use a macro to reverse the coordinate for convenience.
+#define REVERSE_Y(x) (SIZE_Y-(x))
+
+//==== [private settings] ====
+// You could modify these settings, but try to keep them be used only inside city_landscape.cpp
+// Here are the settings to define the looking of your city landscape
+#define CITY_TO_SCREEN_MARGIN 25 // pixel on the screen
+#define CITY_WIDTH 10 // pixel on the screen
+#define BUILDING_WIDTH 2 // pixel on the screen
+#define NUM_BUILDING (CITY_WIDTH/BUILDING_WIDTH)
+#define BUILDING_COLOR 0x00FF00
+#define LANDSCAPE_COLOR 0xCCAA00
+
+
+
+
+
+#endif //CITY_LANDSCAPE_PRIVATE_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/city_landscape/city_landscape_public.h	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,71 @@
+/* Gatech ECE2035 2014 FALL missile command
+ * Copyright (c) 2014 Gatech ECE2035
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+/** @file city_landscape_public.h */
+#ifndef CITY_LANDSCAPE_PUBLIC_H
+#define CITY_LANDSCAPE_PUBLIC_H
+
+/// The enum define the status of a city
+typedef enum {
+    EXIST=1,      ///< The city will be shown on screen
+    DESTORIED=0   ///< The city won't be shown on screen
+} CITY_STATUS;
+
+/// The structure to store the information of a city
+typedef struct {
+    int x;        ///< Bottom-left corner of the city. x coordinate on the screen.
+    int y;        ///< Bottom-left corner of the city. y coordinate on the screen.
+    int width;    ///< The width of the city. The shape of the city is an rectangle.
+    int height;   ///< The height of the city
+    CITY_STATUS status;  ///< See enum CITY_STATUS
+} CITY;
+
+#define MAX_NUM_CITY 6
+
+/** Call city_landscape_init() once at the begining of your code
+    @brief It initialize the city data structure and draw the cities.
+    @param num_city number of city to be draw. It must be less/equal to MAX_NUM_CITY.
+*/
+void city_landscape_init(int num_city);
+
+/** Get the information of city
+    @param index The index in city_record. It must be smaller than MAX_NUM_CITY.
+    @return The structure of city information
+*/
+CITY city_get_info(int index);
+
+/** Remove the city from its record and the screen
+    @param index The index in city_record. It must be smaller than MAX_NUM_CITY.
+*/
+void city_destory(int index);
+
+/** Draw all exist cities on the screen
+    @brief You might not need to use this function, but you could still use it if you want.
+*/
+void draw_cities(void);
+
+/** Draw the landscape
+    @brief You might not need to use this function, but you could still use it if you want.
+*/
+void draw_landscape(void);
+
+
+#endif //CITY_LANDSCAPE_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/globals.h	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,56 @@
+/* Gatech ECE2035 2014 FALL missile command
+ * Copyright (c) 2014 Gatech ECE2035
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef GLOBAL_H
+#define GLOBAL_H
+
+// === [global object] ===
+extern uLCD_4DGL uLCD;
+
+
+// === [global settings] ===
+#define BACKGROUND_COLOR 0x000000 //black
+#define LANDSCAPE_HEIGHT 4        // number of pixel on the screen
+#define MAX_BUILDING_HEIGHT 10    // number of pixel on the screen
+
+
+// === [define the macro of error heandle function] ===
+// when the condition (c) is not true, assert the program and show error code
+#define ASSERT_P(c,e) do { \
+    if(!(c)){ \
+        uLCD.printf("\nERROR:%d\n",e); \
+        while(1); \
+    } \
+} while (0)
+
+
+// === [error code] ===
+#define ERROR_MISSILE_INDEX_GET_INFO      -1  // make sure your code give the valid index for missile_get_info()
+#define ERROR_MISSILE_INDEX_UPDATE_STATUS -2  // make sure your code give the valid index for missile_update_status()
+#define ERROR_MISSILE_SPEED               -3  // missile speed has to be between 1 and 8
+#define ERROR_MISSILE_INTERVAL            -4  // missile interval has to be between 1 and 100
+// other missile error code ...
+#define ERROR_CITY_NUMBER                 -11 // num_city in city_landscape_init() is larger than MAX_NUM_CITY
+#define ERROR_CITY_INDEX_GET_INFO         -12 // make sure your code give the valid index for city_get_info()
+#define ERROR_CITY_INDEX_DESTROY          -13 // make sure your code give the valid index for city_destory()
+// other player-missile error code ...
+
+#endif //GLOBAL_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,132 @@
+/* Gatech ECE2035 2014 FALL missile command
+ * Copyright (c) 2014 Gatech ECE2035
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+/** @file main.cpp */
+// Include header files for platform
+#include "mbed.h"
+#include "uLCD_4DGL.h"
+#include "wave_player.h"
+#include "SDFileSystem.h"
+#include "segment_display.h"
+
+// Include header files for missile command project
+#include "globals.h"
+#include "city_landscape_public.h"
+#include "missile_public.h"
+#include "player.h"
+
+// Platform initialization
+DigitalIn left_pb(p23); DigitalIn right_pb(p21); DigitalIn fire_pb(p22);
+uLCD_4DGL uLCD(p28,p27,p29);
+AnalogOut DACout(p18);
+wave_player waver(&DACout);
+SDFileSystem sd(p5, p6, p7, p8, "sd"); // mosi, miso, sck, cs
+
+// Example of the decleration of your implementation
+void playSound(char * wav);
+
+/** Main() is where you start your implementation
+    @brief The hints of implementation are in the comments. <br>
+    @brief You are expected to implement your code in main.cpp and player.cpp. But you could modify any code if you want to make the game work better.
+*/
+int main()
+{   
+    // [Demo of 7-segment display]
+    // 1.Initialize the segment display
+    setup_sequence();
+    seg_driver_initialize();
+    // 2.show numbers
+    int i;
+    for(i=0;i<10;i++){
+        seg_driver(i);
+        wait(0.2);
+    }
+    
+    // [Demo of play sound file]
+    playSound("/sd/wavfiles/BUZZER.wav");
+    
+    /// [Example of missile command implementation]
+        /// Here is a rough flow to implement the missile command: <br><br>
+    
+    /// 1.Initialize and draw the city landscape
+    city_landscape_init(4); 
+    // Initialize the buttons        
+    left_pb.mode(PullUp);  // The variable left_pb will be zero when the pushbutton for moving the player left is pressed    
+    right_pb.mode(PullUp); // The variable rightt_pb will be zero when the pushbutton for moving the player right is pressed        
+    fire_pb.mode(PullUp);  //the variable fire_pb will be zero when the pushbutton for firing a missile is pressed
+    
+    /// 2.Begin the game loop
+    while(1){
+        
+        /// 3.Example of drawing the player
+        player_draw(60,100); // draws a player at the center of the screen
+        
+        /// 4.Example of calling the missile API.
+        missile_generator(); /// It updates all incoming missiles on the screen
+        
+        /// 5.Implement the code to get user input and update the player
+            /// -[Hint] You could see city_landscape.cpp to get some ideas about how to implement your player. <br>
+        if(left_pb == 0){
+            /// -[Hint] Implement the code to move player left <br>
+        }
+        if(right_pb == 0){
+            /// -[Hint] Implement the code to move player right <br>
+        }
+        if(fire_pb == 0){
+            /// -[Hint] Implement the code to fire player-missile <br>
+            
+            // [Demo of play sound file]
+            playSound("/sd/wavfiles/BUZZER.wav");
+        }
+        
+        /// 6.Implement the code to draw a user missile
+            /// -[Hint] You could see missile.cpp or missile_generator() for your reference <br>
+        
+        /// 7.Implement the code to detect the collision between missiles and cities
+            /// -[Hint] You could use city_get_info() and  missile_get_info() <br>
+            /// -[Hint] You could use missile_set_exploded() to notify the missile module that the missile was exploded. <br>
+            /// -[Hint] You need to check which city was hit by the missile, and call city_destory() to destroy it. <br>
+            /// -[Hint] You might also check whether the missile hit the land <br>
+        
+        /// 8.Implement the code to detect a collision between player-missiles and incoming missiles
+            /// -[Hint] You could use missile_get_info() to get the position of incoming missile <br>
+            /// -[Hint] You could use missile_set_exploded() to notify the missile module that the missile was exploded. <br>
+            /// -[Hint] You might also check whether the missile hit the player <br>
+        
+        /// 9.Implement the code to check the end of game
+            /// -[Hint] For example, if there is no more city, it should be gameover. <br>
+        
+    }
+}
+
+// Example of implementation of your functions
+void playSound(char * wav)
+{
+    // open wav file
+    FILE *wave_file;
+    wave_file=fopen(wav,"r");
+
+    // play wav file
+    waver.play(wave_file);
+
+    // close wav file
+    fclose(wave_file);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/cb3d968589d8
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/missile/missile.cpp	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,143 @@
+/* Gatech ECE2035 2014 FALL missile command
+ * Copyright (c) 2014 Gatech ECE2035
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "missile_private.h"
+
+MISSILE missile_record[MAX_NUM_MISSILE];
+int missile_tick=0;
+int missile_interval = 10;
+int missile_speed = 4;
+
+// See the comments in missile_public.h
+void missile_generator(void){
+    missile_tick++;
+    // only fire the missile at certain ticks
+    if((missile_tick % missile_interval)==0 || missile_tick==0){
+        missile_create();
+    }
+    
+    // update the missiles and draw them
+    missile_update_position();
+}
+
+// set missile speed (default speed is 4)
+void set_missile_speed(int speed){
+    ASSERT_P(speed>=1 && speed<=8,ERROR_MISSILE_SPEED);
+    if(speed>=1 && speed<=8){  
+        missile_speed = speed;
+    }
+}
+
+// set missile interval (default interval is 10)
+void set_missile_interval(int interval){
+    ASSERT_P(interval>=1 && interval<=100,ERROR_MISSILE_INTERVAL);
+    if(interval>=1 && interval<=100){
+        missile_interval = interval;
+    }
+}
+
+// See the comments in missile_public.h
+MISSILE missile_get_info(int index){
+    // All interface for user should have error checking
+    ASSERT_P(index<MAX_NUM_MISSILE,ERROR_MISSILE_INDEX_GET_INFO);
+    
+    return missile_record[index];
+}
+
+// See the comments in missile_public.h
+void missile_set_exploded(int index){
+    // All interface for user should have error checking
+    ASSERT_P(index<MAX_NUM_MISSILE,ERROR_MISSILE_INDEX_UPDATE_STATUS);
+    
+    missile_record[index].status = MISSILE_EXPLODED;
+}
+
+/** This function finds an empty slot of missile record, and active it.
+*/
+void missile_create(void){
+    int i;
+    for(i=0;i<MAX_NUM_MISSILE;i++){
+        if(missile_record[i].status == MISSILE_DEACTIVE){
+            missile_record[i].y = 0;
+            //each missile has its own tick
+            missile_record[i].tick = 0;
+            //set a random source for the missile
+            missile_record[i].source_x = rand() % SIZE_X;
+            //set a random target for the missile
+            missile_record[i].target_x = rand() % SIZE_X;
+            //the missile starts at its source
+            missile_record[i].x = missile_record[i].source_x;
+            missile_record[i].status = MISSILE_ACTIVE;
+            break;
+        }
+    }
+}
+
+/** This function update the position of all missiles and draw them
+*/
+void missile_update_position(void){
+    int i;
+    //controls how fast the missile will move
+    int rate = missile_speed * 25;
+    //delta_x and delta_y account for the slope of the missile
+    double delta_x,delta_y;
+    for(i=0;i<MAX_NUM_MISSILE;i++){
+        if(missile_record[i].status == MISSILE_ACTIVE){
+            // update missile position
+            delta_y = 200/rate;
+            delta_x = (missile_record[i].target_x - missile_record[i].source_x)/rate;
+            missile_draw(missile_record[i], BACKGROUND_COLOR);
+            missile_record[i].y = (int)(delta_y*(missile_record[i].tick%rate));
+            missile_record[i].x = (int)(missile_record[i].source_x + delta_x*(missile_record[i].tick%rate));
+            // draw missile
+            missile_draw(missile_record[i], MISSILE_COLOR);
+            //update missile's internal tick
+            missile_record[i].tick++;
+        }       
+        else if(missile_record[i].status == MISSILE_EXPLODED){
+            // clear the missile on the screen
+            missile_draw(missile_record[i], BACKGROUND_COLOR);
+            
+            // we have done with this missile, remove it from record
+            missile_record[i].status = MISSILE_DEACTIVE;
+            //resets the missile's internal tick
+            missile_record[i].tick = 0;
+        }
+        
+    }
+}
+
+/** This function draw a missile.
+    @param missile The missile to be drawn
+    @param color The color of the missile
+*/
+void missile_draw(MISSILE missile, int color){
+    int init_x,init_y,current_x,current_y;
+
+    init_x = missile.source_x;
+    init_y = 0;
+    current_x = missile.x;
+    current_y = missile.y;
+    uLCD.line(init_x, init_y, current_x, current_y, color);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/missile/missile_private.h	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,43 @@
+/* Gatech ECE2035 2014 FALL missile command
+ * Copyright (c) 2014 Gatech ECE2035
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef MISSILE_PRIVATE_H
+#define MISSILE_PRIVATE_H
+
+#include "mbed.h"
+#include "uLCD_4DGL.h"
+#include "globals.h"
+#include "missile_public.h"
+
+//==== [private settings] ====
+#define MISSILE_COLOR    0xFF0000
+
+//==== [private type] ====
+
+
+//==== [private function] ====
+void missile_create(void);
+void missile_update_position(void);
+void missile_draw(MISSILE missile, int color);
+
+#endif //MISSILE_PRIVATE_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/missile/missile_public.h	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,70 @@
+/* Gatech ECE2035 2014 FALL missile command
+ * Copyright (c) 2014 Gatech ECE2035
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+/** @file missile_public.h */
+#ifndef MISSILE_PUBLIC_H
+#define MISSILE_PUBLIC_H
+
+///The missile status
+typedef enum {
+    MISSILE_EXPLODED=2,///<missile has been destroyed
+    MISSILE_ACTIVE=1,///<missile is active
+    MISSILE_DEACTIVE=0///<missile is no longer active
+} MISSILE_STATUS;
+
+/// The structure to store the information of a missile
+typedef struct {
+    int x;                   ///< The x-coordinate of missile current position
+    int y;                   ///< The y-coordinate of missile current position
+    double source_x;           ///< The x-coordinate of the missile's origin
+    double target_x;           ///< The x-coordinate of the missile's target
+    int tick;                  ///< The missile's internal tick
+    MISSILE_STATUS status;   ///< The missile status, see MISSILE_STATUS
+} MISSILE;
+
+#define MAX_NUM_MISSILE  5
+
+/** This function draw the missiles onto the screen
+    Call missile_generator() repeatedly in your game-loop. ex: main()
+*/
+void missile_generator(void);
+
+/** The function set the status of missile to be MISSILE_EXPLODED
+    @param index The index in missile_record. It must be smaller than MAX_NUM_MISSILE.
+*/
+void missile_set_exploded(int index);
+
+/** Get the information of a missile
+    @param index The index in missile_record. It must be smaller than MAX_NUM_MISSILE.
+    @return The structure of missile information
+*/
+MISSILE missile_get_info(int index);
+
+/** Set the speed of missiles, Speed has range of 1-8 with 1 being fastest and 8 being slowest
+*/
+void set_missile_speed(int speed);
+
+/** Set the interval that the missiles fire, interval has range of 1-100 with 1 being fired in
+    very quick succession and 100 being fired very slowly after one another
+*/
+void set_missile_interval(int interval);
+
+#endif //MISSILE_PUBLIC_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/player.cpp	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,37 @@
+/* Gatech ECE2035 2014 FALL missile command
+ * Copyright (c) 2014 Gatech ECE2035
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+// Template of player implementation
+#include "mbed.h"
+#include "uLCD_4DGL.h"
+#include "globals.h"
+#include "player.h"
+
+// Example of drawing the player
+void player_draw(int x, int y) {
+    uLCD.filled_rectangle(x, y, x+PLAYER_WIDTH, y+PLAYER_HEIGHT, PLAYER_COLOR); 
+    uLCD.filled_rectangle(x+PLAYER_DELTA, y-PLAYER_DELTA, x+PLAYER_WIDTH-PLAYER_DELTA, y+PLAYER_HEIGHT, PLAYER_COLOR);  
+}
+
+// ... You need to implement your own functions for player ...
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/player.h	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,41 @@
+/* Gatech ECE2035 2014 FALL missile command
+ * Copyright (c) 2014 Gatech ECE2035
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+ 
+// Template of player header file
+#ifndef PLAYER_H
+#define PLAYER_H
+
+// Example of some player settings
+#define PLAYER_WIDTH   10 
+#define PLAYER_HEIGHT  3
+#define PLAYER_DELTA   3
+#define PLAYER_COLOR   0x0000FF
+
+
+/** Get the information of city
+    @brief x and y are the top left corner of the player drawing
+    @param x x-coordinate
+    @param y y-coordinate
+*/
+void player_draw(int x, int y);
+
+#endif //PLAYER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/segment_display/dig_out.s	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,332 @@
+    AREA dig_out, CODE, READONLY
+;--------------------OVERVIEW------------------------
+; This file contains ARM Assembly language functions to set
+; designated pins to General Purpose Output.  It uses
+; the PINSELx Register to Set the Pin Function to GPIO.
+; Then, it uses the FIOxDIR register to set the
+; direction of the pin to output. It also contains functions
+; to write a digital HIGH or LOW to these output pins. It uses
+; the FIOxCLR AND FIOxSET registers to clear/set the
+; port bits respectively.  Refer to the Pinnames.h
+; file to see which LPC1768 pins a given mbed module is
+; connected to.  Then, refer to Chapters 8 and 9 of the
+; LPC1768 User Manual to acquire information on the GPIO
+; registers and their addresses.
+;
+; Example:
+; LED1 is on GPIO port 1 bit 18 according to Pinnames.h
+; For this bit: -the PINSEL3 register determines its pin function
+;               -the FIO1DIR register determines its pin direction
+; According to the LPC1768 User Manual: -PINSEL3 is located at 0x4002C00C
+;                                       -FIO1DIR is located at 0x2009C020
+; Now refer to the dig_out_LED1 function below to see the execution
+;------------------------------------------------------
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_LED1
+dig_out_LED1
+;========dig_out_LED1========
+; LED1 LOCATED AT PORT-1 PIN-18
+    LDR     R0, =0x4002C00C ; LOAD ADDRESS OF PINSEL3 REGISTER
+    MOV.W   R1, #0x00040000 ; MOVE BIT MASK (FOR BIT 18) INTO TEMP REGISTER (0x40000 = 0x01 << 18)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER
+    LDR     R2, =0x2009C020 ; LOAD ADDRESS OF FIO1DIR REGISTER
+    MOV     R3, #0x30       ; FORM BITMASK FOR PINSEL3 REGISTER (clear appropriate bits)   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES     
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT LED1_write
+LED1_write
+;========LED1_write=========
+; LED1 LOCATED AT PORT-1 PIN-18 
+    LDR     R1, =0x2009C020 ; LOAD ADDRESS OF FIO1DIR (PORT 1 BASE REGISTER)
+    MOV.W   R2, #0x040000   ; MOVE BIT MASK (FOR BIT 18) INTO TEMP REGISTER (0x40000 = 0x01 << 18)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_LED2
+dig_out_LED2
+;========dig_out_LED2========
+; LED2 LOCATED AT PORT-1 PIN-20
+    LDR     R0, =0x4002C00C ; LOAD ADDRESS OF PINSEL3 REGISTER
+    LDR     R1, =0x00100000 ; MOVE BIT MASK (FOR BIT 20) INTO TEMP REGISTER (0x100000 = 0x01 << 20)
+    LDR     R2, =0x2009C020 ; LOAD ADDRESS OF FIO1DIR REGISTER
+    MOV.W   R3, #0x300      ; FORM BITMASK FOR PINSEL3 REGISTER (clear appropriate bits)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES     
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT LED2_write
+LED2_write
+;========LED2_write=========
+; LED2 LOCATED AT PORT-1 PIN-20 
+    LDR     R1, =0x2009C020 ; LOAD ADDRESS OF FIO1DIR (PORT 1 BASE REGISTER)
+    LDR     R2, =0x0100000  ; MOVE BIT MASK (FOR BIT 20) INTO TEMP REGISTER (0x100000 = 0x01 << 20)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_LED3
+dig_out_LED3
+;========dig_out_LED3========
+; LED3 LOCATED AT PORT-1 PIN-21
+    LDR     R0, =0x4002C00C ; LOAD ADDRESS OF PINSEL3 REGISTER
+    LDR     R1, =0x00200000 ; MOVE BIT MASK (FOR BIT 21) INTO TEMP REGISTER (0x200000 = 0x01 << 21)
+    LDR     R2, =0x2009C020 ; LOAD ADDRESS OF FIO1DIR REGISTER
+    MOV.W   R3, #0xC00      ; FORM BITMASK FOR PINSEL3 REGISTER (clear appropriate bits)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES     
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT LED3_write
+LED3_write
+;========LED3_write=========
+; LED3 LOCATED AT PORT-1 PIN-21 
+    LDR     R1, =0x2009C020 ; LOAD ADDRESS OF FIO1DIR (PORT 1 BASE REGISTER)
+    LDR     R2, =0x0200000  ; MOVE BIT MASK (FOR BIT 21) INTO TEMP REGISTER (0x200000 = 0x01 << 21)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_LED4
+dig_out_LED4
+;========dig_out_LED4========
+; LED4 LOCATED AT PORT-1 PIN-23
+    LDR     R0, =0x4002C00C ; LOAD ADDRESS OF PINSEL3 REGISTER
+    LDR     R1, =0x00800000 ; MOVE BIT MASK (FOR BIT 23) INTO TEMP REGISTER (0x800000 = 0x01 << 23)
+    LDR     R2, =0x2009C020 ; LOAD ADDRESS OF FIO1DIR REGISTER
+    MOV.W   R3, #0xC000     ; FORM BITMASK FOR PINSEL3 REGISTER (clear appropriate bits)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES     
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT LED4_write
+LED4_write
+;========LED4_write=========
+; LED4 LOCATED AT PORT-1 PIN-23 
+    LDR     R1, =0x2009C020 ; LOAD ADDRESS OF FIO1DIR (PORT 1 BASE REGISTER)
+    LDR     R2, =0x0800000  ; MOVE BIT MASK (FOR BIT 21) INTO TEMP REGISTER (0x800000 = 0x01 << 23)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_P11
+dig_out_P11
+;========dig_out_P11========
+; P11 LOCATED AT PORT-0 PIN-18
+    LDR     R0, =0x4002C004 ; LOAD ADDRESS OF PINSEL1 REGISTER
+    MOV.W   R1, #0x00040000 ; MOVE BIT MASK (FOR BIT 18) INTO TEMP REGISTER (0x40000 = 0x01 << 18)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER
+    LDR     R2, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 REGISTER
+    MOV     R3, #0x30       ; FORM BITMASK FOR PINSEL1 REGISTER (clear appropriate bits)   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES     
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT P11_write
+P11_write
+;========P11_write=========
+; P11 LOCATED AT PORT-0 PIN-18 
+    LDR     R1, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 (PORT 0 BASE REGISTER)
+    MOV.W   R2, #0x040000   ; MOVE BIT MASK (FOR BIT 18) INTO TEMP REGISTER (0x40000 = 0x01 << 18)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_P12
+dig_out_P12
+;========dig_out_P12========
+; P12 LOCATED AT PORT-0 PIN-17
+    LDR     R0, =0x4002C004 ; LOAD ADDRESS OF PINSEL1 REGISTER
+    MOV.W   R1, #0x00020000 ; MOVE BIT MASK (FOR BIT 17) INTO TEMP REGISTER (0x40000 = 0x01 << 18)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER
+    LDR     R2, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 REGISTER
+    MOV     R3, #0xC        ; FORM BITMASK FOR PINSEL1 REGISTER (clear appropriate bits)   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES   
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT P12_write
+P12_write
+;========P12_write=========
+; P12 LOCATED AT PORT-0 PIN-17
+    LDR     R1, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 (PORT 0 BASE REGISTER)
+    MOV.W   R2, #0x020000   ; MOVE BIT MASK (FOR BIT 17) INTO TEMP REGISTER (0x40000 = 0x01 << 18)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_P13
+dig_out_P13
+;========dig_out_P13========
+; P13 LOCATED AT PORT-0 PIN-15
+    LDR     R0, =0x4002C000 ; LOAD ADDRESS OF PINSEL0 REGISTER
+    MOV.W   R1, #0x00008000 ; MOVE BIT MASK (FOR BIT 15) INTO TEMP REGISTER (0x08000 = 0x01 << 15)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER
+    LDR     R2, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 REGISTER
+    LDR     R3, =0x70000000 ; FORM BITMASK FOR PINSEL0 REGISTER (clear appropriate bits)   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES     
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT P13_write
+P13_write
+;========P13_write=========
+; P13 LOCATED AT PORT-0 PIN-15
+    LDR     R1, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 (PORT 0 BASE REGISTER)
+    MOV.W   R2, #0x008000   ; MOVE BIT MASK (FOR BIT 15) INTO TEMP REGISTER (0x08000 = 0x01 << 15)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_P14
+dig_out_P14
+;========dig_out_P14========
+; P14 LOCATED AT PORT-0 PIN-16
+    LDR     R0, =0x4002C004 ; LOAD ADDRESS OF PINSEL1 REGISTER
+    MOV.W   R1, #0x00010000 ; MOVE BIT MASK (FOR BIT 16) INTO TEMP REGISTER (0x10000 = 0x01 << 16)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER
+    LDR     R2, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 REGISTER
+    MOV     R3, #0x03       ; FORM BITMASK FOR PINSEL0 REGISTER (clear appropriate bits)   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES     
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT P14_write
+P14_write
+;========P14_write=========
+; P14 LOCATED AT PORT-0 PIN-16
+    LDR     R1, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 (PORT 0 BASE REGISTER)
+    MOV.W   R2, #0x010000   ; MOVE BIT MASK (FOR BIT 16) INTO TEMP REGISTER (0x10000 = 0x01 << 16)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_P15
+dig_out_P15
+;========dig_out_P15========
+; P15 LOCATED AT PORT-0 PIN-23
+    LDR     R0, =0x4002C004 ; LOAD ADDRESS OF PINSEL1 REGISTER
+    LDR     R1, =0x00800000 ; MOVE BIT MASK (FOR BIT 23) INTO TEMP REGISTER (0x800000 = 0x01 << 23)
+    LDR     R2, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 REGISTER
+    MOV.W   R3, #0x7000     ; FORM BITMASK FOR PINSEL1 REGISTER (clear appropriate bits)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES     
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT P15_write
+P15_write
+;========P15_write=========
+; P15 LOCATED AT PORT-0 PIN-23
+    LDR     R1, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 (PORT 0 BASE REGISTER)
+    MOV.W   R2, #0x0800000  ; MOVE BIT MASK (FOR BIT 23) INTO TEMP REGISTER (0x800000 = 0x01 << 23)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_P16
+dig_out_P16
+;========dig_out_P16========
+; P16 LOCATED AT PORT-0 PIN-24
+    LDR     R0, =0x4002C004 ; LOAD ADDRESS OF PINSEL1 REGISTER
+    LDR     R1, =0x01000000 ; MOVE BIT MASK (FOR BIT 24) INTO TEMP REGISTER (0x1000000 = 0x01 << 24)
+    LDR     R2, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 REGISTER
+    MOV.W   R3, #0x30000    ; FORM BITMASK FOR PINSEL1 REGISTER (clear appropriate bits)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES     
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT P16_write
+P16_write
+;========P16_write=========
+; P16 LOCATED AT PORT-0 PIN-24
+    LDR     R1, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 (PORT 0 BASE REGISTER)
+    MOV.W   R2, #0x1000000  ; MOVE BIT MASK (FOR BIT 23) INTO TEMP REGISTER (0x1000000 = 0x01 << 24)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT dig_out_P17
+dig_out_P17
+;========dig_out_P17========
+; P17 LOCATED AT PORT-0 PIN-25
+    LDR     R0, =0x4002C004 ; LOAD ADDRESS OF PINSEL1 REGISTER
+    MOV.W   R1, #0x02000000 ; MOVE BIT MASK (FOR BIT 25) INTO TEMP REGISTER (0x40000 = 0x01 << 25)
+;                           ; NOTE: THE ABOVE IS A 32-BIT INSTRUCTION BC OF ".W" QUALIFIER
+    LDR     R2, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 REGISTER
+    MOV     R3, #0xC0000    ; FORM BITMASK FOR PINSEL1 REGISTER (clear appropriate bits)   
+    B       dig_out_exec    ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES   
+;
+;
+;
+; EXPORT FUNCTION LOCATION SO THAT C-COMPILER CAN LINK
+    EXPORT P17_write
+P17_write
+;========P17_write=========
+; P17 LOCATED AT PORT-0 PIN-25
+    LDR     R1, =0x2009C000 ; LOAD ADDRESS OF FIO0DIR0 (PORT 0 BASE REGISTER)
+    MOV.W   R2, #0x2000000  ; MOVE BIT MASK (FOR BIT 25) INTO TEMP REGISTER (0x1000000 = 0x01 << 25)
+    B       write_exec      ; CALL SUBROUTINE TO EXECUTE YOUR CHANGES
+;
+;
+;
+dig_out_exec
+;========dig_out_execution========
+; SET PIN FUNCTION TO GPIO
+    LDR     R4, [R0]        ; \ 
+    BIC     R4, R3          ; - APPLY BITMASK FOR PINSELx REGISTER (clear appropriate bits) 
+    STR     R4, [R0]        ; STORE BITMASK IN PINSELx REGISTER
+;
+; SET UP GPIO PORT FOR OUTPUT DIRECTION (WITH SPECIFIED BITMASK IN REGISTER R2)
+    LDR     R6, [R2]        ; \ 
+    ORR     R6, R1          ; - ACQUIRE BITMASK FOR FIOxDIR REGISTER (1 = Output)      
+    STR     R6, [R2]        ; STORE BITMASK IN FIOxDIR REGISTER
+;
+;RETURN TO MAIN
+    BX      LR              ; RETURN TO MAIN USING LINKER REGISTER
+;
+;
+;
+write_exec
+;========write_execution=========                   
+; CLEAR/SET BASED ON INPUT VALUE 
+    CMP     R0, #0          ; VALUE == 0 ?
+    ITE EQ                  ; (IF-THEN-ELSE) ON NEXT TWO INSTRUCTIONS USING "EQ" FLAG
+    STREQ   R2, [R1,#0x1C]  ; if==0, CLEAR LED1 BIT
+    STRNE   R2, [R1,#0x18]  ; if==1, SET LED1 BIT
+;
+; RETURN TO MAIN
+    BX      LR              ; RETURN TO MAIN USING LINKER REGISTER
+;
+;
+;
+    ALIGN 4 ; make sure the file is ended with align 4
+    NOP
+    NOP
+    END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/segment_display/segment_display.h	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,9 @@
+#ifndef SEGMENT_DISPLAY_H
+#define SEGMENT_DISPLAY_H
+
+//declare functions (assembly subroutines)
+extern "C" void setup_sequence(void);
+extern "C" void seg_driver_initialize(void);
+extern "C" void seg_driver(int value);
+
+#endif //SEGMENT_DISPLAY_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/segment_display/segment_driver.s	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,183 @@
+    AREA segment_driver, CODE, READONLY
+;--------------------OVERVIEW------------------------
+; This file contains ARM Assembly language functions to
+; drive a 7-segment LED Display (Kingbright SA03-11HDB).
+; This library uses a switch statement on the input
+; register (R0) to set or clear each corresponding lead
+; of the display.  NOTE: The 7 Segments of the LED display
+; must be connected to pins p11 - p17 of the mbed digital
+; I/O.  For further help with understanding this file,
+; please refer to files:
+;                       dig_in.s
+;                       dig_out.s
+;------------------------------------------------------
+; Import function locations so that C compiler can find it and link
+    IMPORT dig_out_P11
+    IMPORT P11_write
+    IMPORT dig_out_P12
+    IMPORT P12_write
+    IMPORT dig_out_P13
+    IMPORT P13_write
+    IMPORT dig_out_P14
+    IMPORT P14_write
+    IMPORT dig_out_P15
+    IMPORT P15_write
+    IMPORT dig_out_P16
+    IMPORT P16_write
+    IMPORT dig_out_P17
+    IMPORT P17_write
+; Export function location so that C compiler can find it and link
+    EXPORT seg_driver_initialize
+seg_driver_initialize       ;CLEAR DISPLAY
+    PUSH    {LR}
+    BL      dig_out_P11
+    BL      dig_out_P12
+    BL      dig_out_P13
+    BL      dig_out_P14
+    BL      dig_out_P15
+    BL      dig_out_P16
+    BL      dig_out_P17
+    MOV     R0,#1
+    BL      P11_write
+    BL      P12_write
+    BL      P13_write
+    BL      P14_write
+    BL      P15_write
+    BL      P16_write
+    BL      P17_write
+    POP     {LR}
+    BX      LR
+    
+; Export function location so that C compiler can find it and link    
+    EXPORT seg_driver
+seg_driver                  ;SWITCH STATEMENT
+    PUSH    {LR}
+    ADR     R2,switchpool
+    LDR     PC,[R2,R0,LSL #2]
+    ALIGN
+switchpool
+    DCD case0
+    DCD case1
+    DCD case2
+    DCD case3
+    DCD case4
+    DCD case5
+    DCD case6
+    DCD case7
+    DCD case8
+    DCD case9
+case0
+    MOV     R0,#0
+    BL      P11_write
+    BL      P12_write
+    BL      P13_write
+    BL      P14_write
+    BL      P15_write
+    BL      P16_write
+    MOV     R0,#1
+    BL      P17_write
+    B       end
+case1
+    MOV     R0,#0
+    BL      P12_write
+    BL      P13_write
+    MOV     R0,#1
+    BL      P11_write
+    BL      P14_write
+    BL      P15_write
+    BL      P16_write
+    BL      P17_write
+    B       end
+case2
+    MOV     R0,#0
+    BL      P11_write
+    BL      P12_write
+    BL      P14_write
+    BL      P15_write
+    BL      P17_write
+    MOV     R0,#1
+    BL      P13_write
+    BL      P16_write  
+    B       end
+case3
+    MOV     R0,#0
+    BL      P11_write
+    BL      P12_write
+    BL      P13_write
+    BL      P14_write   
+    BL      P17_write
+    MOV     R0,#1
+    BL      P15_write
+    BL      P16_write    
+    B       end
+case4
+    MOV     R0,#0    
+    BL      P12_write
+    BL      P13_write
+    BL      P16_write  
+    BL      P17_write
+    MOV     R0,#1
+    BL      P11_write
+    BL      P14_write
+    BL      P15_write       
+    B       end
+case5
+    MOV     R0,#0
+    BL      P11_write       
+    BL      P13_write
+    BL      P14_write
+    BL      P16_write  
+    BL      P17_write
+    MOV     R0,#1
+    BL      P12_write
+    BL      P15_write          
+    B       end
+case6
+    MOV     R0,#0
+    BL      P11_write       
+    BL      P13_write
+    BL      P14_write
+    BL      P15_write
+    BL      P16_write  
+    BL      P17_write
+    MOV     R0,#1
+    BL      P12_write          
+    B       end
+case7
+    MOV     R0,#0
+    BL      P11_write
+    BL      P12_write       
+    BL      P13_write  
+    MOV     R0,#1
+    BL      P14_write  
+    BL      P15_write
+    BL      P16_write
+    BL      P17_write       
+    B       end
+case8
+    MOV     R0,#0
+    BL      P11_write
+    BL      P12_write       
+    BL      P13_write  
+    BL      P14_write  
+    BL      P15_write
+    BL      P16_write
+    BL      P17_write       
+    B       end
+case9
+    MOV     R0,#0
+    BL      P11_write
+    BL      P12_write       
+    BL      P13_write
+    BL      P16_write
+    BL      P17_write  
+    MOV     R0,#1
+    BL      P14_write  
+    BL      P15_write          
+    B       end
+end
+    POP     {LR}
+    BX      LR
+;
+    END
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/segment_display/setup.s	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,42 @@
+    AREA setup, CODE, READONLY
+;--------------------OVERVIEW------------------------
+; This file contains ARM Assembly language functions to
+; initialize select registers/memory-locations in the
+; LPC1768 to predetermined values.  This startup sequence
+; will be used to test the integrity of your program, and
+; IT SHOULD NOT BE ALTERED BY ANY MEANS.  Any student
+; attempting to alter this file will be subject to academic
+; dishonesty and any disciplinary actions pertaining
+; thereto.
+;------------------------------------------------------
+; Export function location so that C compiler can find it and link
+    EXPORT setup_sequence
+setup_sequence
+    ;PUSH LINK REGISTER TO STACK
+    PUSH    {LR}
+    
+    ;INIT PINSEL0
+    LDR     R0, =0x4002C000     ;LOAD ADDRESS OF PINSEL0 REGISTER
+    LDR     R1, =0x40000000     ;LOAD BITMASK FOR PINSEL0 REGISTER
+    LDR     R2, [R0]            ;\ 
+    ORR     R2, R1              ;- APPLY BITMASK
+    STR     R2, [R0]            ;/ 
+    
+    ;INIT PINSEL1
+    LDR     R0, =0x4002C004     ;LOAD ADDRESS OF PINSEL1 REGISTER
+    LDR     R1, =0x00054015     ;LOAD BITMASK FOR PINSEL1 REGISTER
+    LDR     R2, [R0]            ;\ 
+    ORR     R2, R1              ;- APPLY BITMASK
+    STR     R2, [R0]            ;/ 
+    
+    ;INIT PINSEL3
+    LDR     R0, =0x4002C00C     ;LOAD ADDRESS OF PINSEL3 REGISTER
+    LDR     R1, =0x00004510     ;LOAD BITMASK FOR PINSEL4 REGISTER
+    LDR     R2, [R0]            ;\ 
+    ORR     R2, R1              ;- APPLY BITMASK
+    STR     R2, [R0]            ;/ 
+    
+    ;RETURN TO MAIN
+    POP     {LR}
+    BX      LR 
+    END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wave_player.lib	Wed Oct 29 01:21:34 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/sravet/code/wave_player/#acc3e18e77ad