Mercurial > public > hwos_code
comparison src/tft_outputs.asm @ 29:50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
author | heinrichsweikamp |
---|---|
date | Sat, 20 Jul 2013 22:01:49 +0200 |
parents | f51caad821b4 |
children | 53a09c1b7410 |
comparison
equal
deleted
inserted
replaced
28:fcaf94b913db | 29:50c3e2c7ba7a |
---|---|
1146 return | 1146 return |
1147 TFT_surface_compass_heading2: | 1147 TFT_surface_compass_heading2: |
1148 WIN_STD surf_compass_head_column,surf_compass_head_row | 1148 WIN_STD surf_compass_head_column,surf_compass_head_row |
1149 call TFT_standard_color | 1149 call TFT_standard_color |
1150 lfsr FSR2,buffer | 1150 lfsr FSR2,buffer |
1151 ; movff sub_c+0,lo ; Show difference to old value | 1151 ; movff compass_heading+0,lo |
1152 ; movff compass_heading+1,hi | |
1153 ; call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | |
1152 ; output_8 | 1154 ; output_8 |
1153 ; movlw "f" ; "Fast" | 1155 ; PUTC " " |
1154 ; btfss compass_fast_mode ; In fast mode? | 1156 ; movff hi,lo |
1155 ; movlw "s" ; "Slow" | 1157 ; output_8 |
1156 ; movwf POSTINC2 | 1158 ; PUTC " " |
1157 movff compass_heading+0,lo | 1159 movff compass_heading+0,lo |
1158 movff compass_heading+1,hi | 1160 movff compass_heading+1,hi |
1159 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | 1161 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
1160 bsf leftbind | 1162 bsf leftbind |
1161 output_16 | 1163 output_16 |
1162 bcf leftbind | 1164 bcf leftbind |
1163 STRCAT_PRINT "° " | 1165 STRCAT "° " |
1166 rcall tft_compass_cardinal ; Add cardinal and ordinal to POSTINC2 | |
1167 STRCAT_PRINT " " | |
1164 return | 1168 return |
1165 | 1169 |
1166 global TFT_dive_compass_heading | 1170 global TFT_dive_compass_heading |
1167 TFT_dive_compass_heading: | 1171 TFT_dive_compass_heading: |
1168 rcall compass_heading_common | 1172 rcall compass_heading_common |
1181 movff compass_heading+1,hi | 1185 movff compass_heading+1,hi |
1182 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | 1186 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
1183 bsf leftbind | 1187 bsf leftbind |
1184 output_16 | 1188 output_16 |
1185 bcf leftbind | 1189 bcf leftbind |
1186 STRCAT_PRINT "° " | 1190 STRCAT "° " |
1187 return | 1191 rcall tft_compass_cardinal ; Add cardinal and ordinal to POSTINC2 |
1188 | 1192 STRCAT_PRINT " " |
1193 return | |
1194 | |
1195 tft_compass_cardinal: | |
1196 btfsc hi,0 ; Heading >255°? | |
1197 bra tft_compass_cardinal2 ; Yes must be W, NW or N | |
1198 ; No, Must be W, SW, S, SE, E, NE or N | |
1199 movlw .23 | |
1200 subwf lo,W | |
1201 btfss STATUS,C | |
1202 bra tft_compass_cardinal_N | |
1203 movlw .68 | |
1204 subwf lo,W | |
1205 btfss STATUS,C | |
1206 bra tft_compass_cardinal_NE | |
1207 movlw .113 | |
1208 subwf lo,W | |
1209 btfss STATUS,C | |
1210 bra tft_compass_cardinal_E | |
1211 movlw .158 | |
1212 subwf lo,W | |
1213 btfss STATUS,C | |
1214 bra tft_compass_cardinal_SE | |
1215 movlw .203 | |
1216 subwf lo,W | |
1217 btfss STATUS,C | |
1218 bra tft_compass_cardinal_S | |
1219 movlw .248 | |
1220 subwf lo,W | |
1221 btfss STATUS,C | |
1222 bra tft_compass_cardinal_SW | |
1223 bra tft_compass_cardinal_W | |
1224 | |
1225 tft_compass_cardinal2: | |
1226 movlw .37 | |
1227 subwf lo,W | |
1228 btfss STATUS,C | |
1229 bra tft_compass_cardinal_W | |
1230 movlw .82 | |
1231 subwf lo,W | |
1232 btfss STATUS,C | |
1233 bra tft_compass_cardinal_NW | |
1234 bra tft_compass_cardinal_N | |
1235 | |
1236 tft_compass_cardinal_N: | |
1237 STRCAT_TEXT tN | |
1238 return | |
1239 tft_compass_cardinal_NE: | |
1240 STRCAT_TEXT tNE | |
1241 return | |
1242 tft_compass_cardinal_E: | |
1243 STRCAT_TEXT tE | |
1244 return | |
1245 tft_compass_cardinal_SE: | |
1246 STRCAT_TEXT tSE | |
1247 return | |
1248 tft_compass_cardinal_S: | |
1249 STRCAT_TEXT tS | |
1250 return | |
1251 tft_compass_cardinal_SW: | |
1252 STRCAT_TEXT tSW | |
1253 return | |
1254 tft_compass_cardinal_W: | |
1255 STRCAT_TEXT tW | |
1256 return | |
1257 tft_compass_cardinal_NW: | |
1258 STRCAT_TEXT tNW | |
1259 return | |
1189 | 1260 |
1190 compass_heading_common: | 1261 compass_heading_common: |
1191 extern compass | 1262 extern compass |
1192 extern compass_filter | 1263 extern compass_filter |
1193 rcall TFT_get_compass | 1264 rcall TFT_get_compass |