Missile Control Game with uLCD
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed wave_player
Fork of missile_command by
segment_display/segment_driver.s@2:eba4ed0263a4, 2015-10-20 (annotated)
- Committer:
- ajindia6
- Date:
- Tue Oct 20 19:13:03 2015 +0000
- Revision:
- 2:eba4ed0263a4
- Parent:
- 0:532cb55d6136
Mbed Mission Control Game
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
arvahsu | 0:532cb55d6136 | 1 | AREA segment_driver, CODE, READONLY |
arvahsu | 0:532cb55d6136 | 2 | ;--------------------OVERVIEW------------------------ |
arvahsu | 0:532cb55d6136 | 3 | ; This file contains ARM Assembly language functions to |
arvahsu | 0:532cb55d6136 | 4 | ; drive a 7-segment LED Display (Kingbright SA03-11HDB). |
arvahsu | 0:532cb55d6136 | 5 | ; This library uses a switch statement on the input |
arvahsu | 0:532cb55d6136 | 6 | ; register (R0) to set or clear each corresponding lead |
arvahsu | 0:532cb55d6136 | 7 | ; of the display. NOTE: The 7 Segments of the LED display |
arvahsu | 0:532cb55d6136 | 8 | ; must be connected to pins p11 - p17 of the mbed digital |
arvahsu | 0:532cb55d6136 | 9 | ; I/O. For further help with understanding this file, |
arvahsu | 0:532cb55d6136 | 10 | ; please refer to files: |
arvahsu | 0:532cb55d6136 | 11 | ; dig_in.s |
arvahsu | 0:532cb55d6136 | 12 | ; dig_out.s |
arvahsu | 0:532cb55d6136 | 13 | ;------------------------------------------------------ |
arvahsu | 0:532cb55d6136 | 14 | ; Import function locations so that C compiler can find it and link |
arvahsu | 0:532cb55d6136 | 15 | IMPORT dig_out_P11 |
arvahsu | 0:532cb55d6136 | 16 | IMPORT P11_write |
arvahsu | 0:532cb55d6136 | 17 | IMPORT dig_out_P12 |
arvahsu | 0:532cb55d6136 | 18 | IMPORT P12_write |
arvahsu | 0:532cb55d6136 | 19 | IMPORT dig_out_P13 |
arvahsu | 0:532cb55d6136 | 20 | IMPORT P13_write |
arvahsu | 0:532cb55d6136 | 21 | IMPORT dig_out_P14 |
arvahsu | 0:532cb55d6136 | 22 | IMPORT P14_write |
arvahsu | 0:532cb55d6136 | 23 | IMPORT dig_out_P15 |
arvahsu | 0:532cb55d6136 | 24 | IMPORT P15_write |
arvahsu | 0:532cb55d6136 | 25 | IMPORT dig_out_P16 |
arvahsu | 0:532cb55d6136 | 26 | IMPORT P16_write |
arvahsu | 0:532cb55d6136 | 27 | IMPORT dig_out_P17 |
arvahsu | 0:532cb55d6136 | 28 | IMPORT P17_write |
arvahsu | 0:532cb55d6136 | 29 | ; Export function location so that C compiler can find it and link |
arvahsu | 0:532cb55d6136 | 30 | EXPORT seg_driver_initialize |
arvahsu | 0:532cb55d6136 | 31 | seg_driver_initialize ;CLEAR DISPLAY |
arvahsu | 0:532cb55d6136 | 32 | PUSH {LR} |
arvahsu | 0:532cb55d6136 | 33 | BL dig_out_P11 |
arvahsu | 0:532cb55d6136 | 34 | BL dig_out_P12 |
arvahsu | 0:532cb55d6136 | 35 | BL dig_out_P13 |
arvahsu | 0:532cb55d6136 | 36 | BL dig_out_P14 |
arvahsu | 0:532cb55d6136 | 37 | BL dig_out_P15 |
arvahsu | 0:532cb55d6136 | 38 | BL dig_out_P16 |
arvahsu | 0:532cb55d6136 | 39 | BL dig_out_P17 |
arvahsu | 0:532cb55d6136 | 40 | MOV R0,#1 |
arvahsu | 0:532cb55d6136 | 41 | BL P11_write |
arvahsu | 0:532cb55d6136 | 42 | BL P12_write |
arvahsu | 0:532cb55d6136 | 43 | BL P13_write |
arvahsu | 0:532cb55d6136 | 44 | BL P14_write |
arvahsu | 0:532cb55d6136 | 45 | BL P15_write |
arvahsu | 0:532cb55d6136 | 46 | BL P16_write |
arvahsu | 0:532cb55d6136 | 47 | BL P17_write |
arvahsu | 0:532cb55d6136 | 48 | POP {LR} |
arvahsu | 0:532cb55d6136 | 49 | BX LR |
arvahsu | 0:532cb55d6136 | 50 | |
arvahsu | 0:532cb55d6136 | 51 | ; Export function location so that C compiler can find it and link |
arvahsu | 0:532cb55d6136 | 52 | EXPORT seg_driver |
arvahsu | 0:532cb55d6136 | 53 | seg_driver ;SWITCH STATEMENT |
arvahsu | 0:532cb55d6136 | 54 | PUSH {LR} |
arvahsu | 0:532cb55d6136 | 55 | ADR R2,switchpool |
arvahsu | 0:532cb55d6136 | 56 | LDR PC,[R2,R0,LSL #2] |
arvahsu | 0:532cb55d6136 | 57 | ALIGN |
arvahsu | 0:532cb55d6136 | 58 | switchpool |
arvahsu | 0:532cb55d6136 | 59 | DCD case0 |
arvahsu | 0:532cb55d6136 | 60 | DCD case1 |
arvahsu | 0:532cb55d6136 | 61 | DCD case2 |
arvahsu | 0:532cb55d6136 | 62 | DCD case3 |
arvahsu | 0:532cb55d6136 | 63 | DCD case4 |
arvahsu | 0:532cb55d6136 | 64 | DCD case5 |
arvahsu | 0:532cb55d6136 | 65 | DCD case6 |
arvahsu | 0:532cb55d6136 | 66 | DCD case7 |
arvahsu | 0:532cb55d6136 | 67 | DCD case8 |
arvahsu | 0:532cb55d6136 | 68 | DCD case9 |
arvahsu | 0:532cb55d6136 | 69 | case0 |
arvahsu | 0:532cb55d6136 | 70 | MOV R0,#0 |
arvahsu | 0:532cb55d6136 | 71 | BL P11_write |
arvahsu | 0:532cb55d6136 | 72 | BL P12_write |
arvahsu | 0:532cb55d6136 | 73 | BL P13_write |
arvahsu | 0:532cb55d6136 | 74 | BL P14_write |
arvahsu | 0:532cb55d6136 | 75 | BL P15_write |
arvahsu | 0:532cb55d6136 | 76 | BL P16_write |
arvahsu | 0:532cb55d6136 | 77 | MOV R0,#1 |
arvahsu | 0:532cb55d6136 | 78 | BL P17_write |
arvahsu | 0:532cb55d6136 | 79 | B end |
arvahsu | 0:532cb55d6136 | 80 | case1 |
arvahsu | 0:532cb55d6136 | 81 | MOV R0,#0 |
arvahsu | 0:532cb55d6136 | 82 | BL P12_write |
arvahsu | 0:532cb55d6136 | 83 | BL P13_write |
arvahsu | 0:532cb55d6136 | 84 | MOV R0,#1 |
arvahsu | 0:532cb55d6136 | 85 | BL P11_write |
arvahsu | 0:532cb55d6136 | 86 | BL P14_write |
arvahsu | 0:532cb55d6136 | 87 | BL P15_write |
arvahsu | 0:532cb55d6136 | 88 | BL P16_write |
arvahsu | 0:532cb55d6136 | 89 | BL P17_write |
arvahsu | 0:532cb55d6136 | 90 | B end |
arvahsu | 0:532cb55d6136 | 91 | case2 |
arvahsu | 0:532cb55d6136 | 92 | MOV R0,#0 |
arvahsu | 0:532cb55d6136 | 93 | BL P11_write |
arvahsu | 0:532cb55d6136 | 94 | BL P12_write |
arvahsu | 0:532cb55d6136 | 95 | BL P14_write |
arvahsu | 0:532cb55d6136 | 96 | BL P15_write |
arvahsu | 0:532cb55d6136 | 97 | BL P17_write |
arvahsu | 0:532cb55d6136 | 98 | MOV R0,#1 |
arvahsu | 0:532cb55d6136 | 99 | BL P13_write |
arvahsu | 0:532cb55d6136 | 100 | BL P16_write |
arvahsu | 0:532cb55d6136 | 101 | B end |
arvahsu | 0:532cb55d6136 | 102 | case3 |
arvahsu | 0:532cb55d6136 | 103 | MOV R0,#0 |
arvahsu | 0:532cb55d6136 | 104 | BL P11_write |
arvahsu | 0:532cb55d6136 | 105 | BL P12_write |
arvahsu | 0:532cb55d6136 | 106 | BL P13_write |
arvahsu | 0:532cb55d6136 | 107 | BL P14_write |
arvahsu | 0:532cb55d6136 | 108 | BL P17_write |
arvahsu | 0:532cb55d6136 | 109 | MOV R0,#1 |
arvahsu | 0:532cb55d6136 | 110 | BL P15_write |
arvahsu | 0:532cb55d6136 | 111 | BL P16_write |
arvahsu | 0:532cb55d6136 | 112 | B end |
arvahsu | 0:532cb55d6136 | 113 | case4 |
arvahsu | 0:532cb55d6136 | 114 | MOV R0,#0 |
arvahsu | 0:532cb55d6136 | 115 | BL P12_write |
arvahsu | 0:532cb55d6136 | 116 | BL P13_write |
arvahsu | 0:532cb55d6136 | 117 | BL P16_write |
arvahsu | 0:532cb55d6136 | 118 | BL P17_write |
arvahsu | 0:532cb55d6136 | 119 | MOV R0,#1 |
arvahsu | 0:532cb55d6136 | 120 | BL P11_write |
arvahsu | 0:532cb55d6136 | 121 | BL P14_write |
arvahsu | 0:532cb55d6136 | 122 | BL P15_write |
arvahsu | 0:532cb55d6136 | 123 | B end |
arvahsu | 0:532cb55d6136 | 124 | case5 |
arvahsu | 0:532cb55d6136 | 125 | MOV R0,#0 |
arvahsu | 0:532cb55d6136 | 126 | BL P11_write |
arvahsu | 0:532cb55d6136 | 127 | BL P13_write |
arvahsu | 0:532cb55d6136 | 128 | BL P14_write |
arvahsu | 0:532cb55d6136 | 129 | BL P16_write |
arvahsu | 0:532cb55d6136 | 130 | BL P17_write |
arvahsu | 0:532cb55d6136 | 131 | MOV R0,#1 |
arvahsu | 0:532cb55d6136 | 132 | BL P12_write |
arvahsu | 0:532cb55d6136 | 133 | BL P15_write |
arvahsu | 0:532cb55d6136 | 134 | B end |
arvahsu | 0:532cb55d6136 | 135 | case6 |
arvahsu | 0:532cb55d6136 | 136 | MOV R0,#0 |
arvahsu | 0:532cb55d6136 | 137 | BL P11_write |
arvahsu | 0:532cb55d6136 | 138 | BL P13_write |
arvahsu | 0:532cb55d6136 | 139 | BL P14_write |
arvahsu | 0:532cb55d6136 | 140 | BL P15_write |
arvahsu | 0:532cb55d6136 | 141 | BL P16_write |
arvahsu | 0:532cb55d6136 | 142 | BL P17_write |
arvahsu | 0:532cb55d6136 | 143 | MOV R0,#1 |
arvahsu | 0:532cb55d6136 | 144 | BL P12_write |
arvahsu | 0:532cb55d6136 | 145 | B end |
arvahsu | 0:532cb55d6136 | 146 | case7 |
arvahsu | 0:532cb55d6136 | 147 | MOV R0,#0 |
arvahsu | 0:532cb55d6136 | 148 | BL P11_write |
arvahsu | 0:532cb55d6136 | 149 | BL P12_write |
arvahsu | 0:532cb55d6136 | 150 | BL P13_write |
arvahsu | 0:532cb55d6136 | 151 | MOV R0,#1 |
arvahsu | 0:532cb55d6136 | 152 | BL P14_write |
arvahsu | 0:532cb55d6136 | 153 | BL P15_write |
arvahsu | 0:532cb55d6136 | 154 | BL P16_write |
arvahsu | 0:532cb55d6136 | 155 | BL P17_write |
arvahsu | 0:532cb55d6136 | 156 | B end |
arvahsu | 0:532cb55d6136 | 157 | case8 |
arvahsu | 0:532cb55d6136 | 158 | MOV R0,#0 |
arvahsu | 0:532cb55d6136 | 159 | BL P11_write |
arvahsu | 0:532cb55d6136 | 160 | BL P12_write |
arvahsu | 0:532cb55d6136 | 161 | BL P13_write |
arvahsu | 0:532cb55d6136 | 162 | BL P14_write |
arvahsu | 0:532cb55d6136 | 163 | BL P15_write |
arvahsu | 0:532cb55d6136 | 164 | BL P16_write |
arvahsu | 0:532cb55d6136 | 165 | BL P17_write |
arvahsu | 0:532cb55d6136 | 166 | B end |
arvahsu | 0:532cb55d6136 | 167 | case9 |
arvahsu | 0:532cb55d6136 | 168 | MOV R0,#0 |
arvahsu | 0:532cb55d6136 | 169 | BL P11_write |
arvahsu | 0:532cb55d6136 | 170 | BL P12_write |
arvahsu | 0:532cb55d6136 | 171 | BL P13_write |
arvahsu | 0:532cb55d6136 | 172 | BL P16_write |
arvahsu | 0:532cb55d6136 | 173 | BL P17_write |
arvahsu | 0:532cb55d6136 | 174 | MOV R0,#1 |
arvahsu | 0:532cb55d6136 | 175 | BL P14_write |
arvahsu | 0:532cb55d6136 | 176 | BL P15_write |
arvahsu | 0:532cb55d6136 | 177 | B end |
arvahsu | 0:532cb55d6136 | 178 | end |
arvahsu | 0:532cb55d6136 | 179 | POP {LR} |
arvahsu | 0:532cb55d6136 | 180 | BX LR |
arvahsu | 0:532cb55d6136 | 181 | ; |
arvahsu | 0:532cb55d6136 | 182 | END |
arvahsu | 0:532cb55d6136 | 183 |