Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/menu_gassetup.asm @ 117:d92a6a8ab516
added sample workspace file
| author | heinrichsweikamp |
|---|---|
| date | Sun, 26 Dec 2010 16:47:29 +0100 |
| parents | 50a06adabc67 |
| children | e0f29e20bd24 |
| rev | line source |
|---|---|
| 0 | 1 |
| 2 ; OSTC - diving computer code | |
| 3 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
| 4 | |
| 5 ; This program is free software: you can redistribute it and/or modify | |
| 6 ; it under the terms of the GNU General Public License as published by | |
| 7 ; the Free Software Foundation, either version 3 of the License, or | |
| 8 ; (at your option) any later version. | |
| 9 | |
| 10 ; This program is distributed in the hope that it will be useful, | |
| 11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 ; GNU General Public License for more details. | |
| 14 | |
| 15 ; You should have received a copy of the GNU General Public License | |
| 16 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 17 | |
| 18 | |
| 19 ; Gas Setup menu | |
| 20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
| 21 ; written: 10/08/07 | |
| 22 ; last updated: 080906 | |
| 23 ; known bugs: | |
| 24 ; ToDo: | |
| 25 | |
| 26 menu_gassetup: | |
| 27 movlw d'1' | |
| 28 movwf menupos | |
| 29 | |
| 30 menu_gassetup_prelist: | |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
31 call PLED_ClearScreen |
| 47 | 32 call gassetup_sort_gaslist ; Sorts Gaslist according to change depth |
| 0 | 33 clrf timeout_counter2 |
| 34 bcf sleepmode | |
| 35 bcf menubit2 | |
| 36 bcf menubit3 | |
| 37 call PLED_topline_box | |
| 38 WIN_INVERT .1 ; Init new Wordprocessor | |
| 39 DISPLAYTEXT .106 ; Gas List | |
| 40 WIN_INVERT .0 ; Init new Wordprocessor | |
| 41 clrf decodata+0 ; Here: # of gas 0-4 | |
| 42 clrf divemins+0 ; Here: # of Gas * 4 | |
| 43 movlw d'5' | |
| 44 movwf waitms_temp ; here: stores row for gas list | |
| 45 movlw d'2' | |
| 46 movwf wait_temp ; here: stores eeprom address for gas list | |
| 47 | |
| 48 ; Changed v1.44se | |
| 49 menu_gassetup_list: | |
| 50 WIN_LEFT .20 | |
| 51 movlw d'4' | |
| 52 addwf wait_temp,F ; Increase eeprom address for gas list | |
| 53 movlw d'30' | |
| 54 addwf waitms_temp,F ; Increase row | |
| 55 movf waitms_temp,W ; Load row into WREG | |
| 56 movff WREG,win_top | |
| 57 lfsr FSR2,letter | |
| 58 movlw 'G' | |
| 59 movwf POSTINC2 | |
| 60 movff decodata+0,lo | |
| 61 incf lo,F | |
| 62 bsf leftbind | |
| 63 output_99 | |
| 64 movlw ':' | |
| 65 movwf POSTINC2 | |
| 66 | |
| 67 call menu_gassetup_grey_inactive ; Sets Greyvalue for inactive gases | |
| 68 call word_processor | |
| 69 WIN_LEFT .40 | |
| 70 movf waitms_temp,W ; Load row into WREG | |
| 71 movff WREG,win_top | |
| 72 lfsr FSR2,letter | |
| 73 | |
| 74 movlw d'33' | |
| 75 movwf EEADR | |
| 76 call read_eeprom ; Get current startgas 1-5 # into EEDATA | |
| 77 decf EEDATA,W ; 0-4 | |
| 78 cpfseq decodata+0 ; =current displayed gas #? | |
| 79 bra menu_gassetup_Tx ; no, do not display * | |
| 80 movlw '*' ; display * | |
| 81 movwf POSTINC2 | |
| 82 | |
| 83 ; New v1.44se | |
| 84 menu_gassetup_Tx: | |
| 85 call menu_gassetup_grey_inactive ; Sets Greyvalue for inactive gases | |
| 86 call word_processor | |
| 87 | |
| 88 WIN_LEFT .48 | |
| 89 movf waitms_temp,W ; Load row into WREG | |
| 90 movff WREG,win_top | |
| 91 lfsr FSR2,letter | |
| 92 | |
| 93 movff wait_temp, EEADR ; Gas %He - Set address in internal EEPROM | |
| 94 incf EEADR,F ; Gas %He - Set address in internal EEPROM | |
| 95 call read_eeprom ; Read He value from EEPROM | |
| 96 movff EEDATA,lo ; Move EEDATA -> lo | |
| 97 movf lo,f ; Move lo -> f | |
| 98 movlw d'0' ; Move 0 -> WREG | |
| 99 cpfsgt lo ; He > 0? | |
| 100 bra menu_gassetup_Nx ; NO check o2 | |
| 101 | |
| 102 ; YES Write TX 15/55 | |
| 103 call gassetup_write_Tx | |
| 104 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM | |
| 105 call read_eeprom ; O2 value | |
| 106 movff EEDATA,lo | |
| 107 output_8 | |
| 108 movlw '/' | |
| 109 movwf POSTINC2 | |
| 110 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM | |
| 111 call read_eeprom ; He value | |
| 112 movff EEDATA,lo | |
| 113 output_8 | |
| 114 bra menu_gassetup_list0 | |
| 115 | |
| 116 ; New v1.44se | |
| 117 menu_gassetup_Nx: | |
| 118 movff wait_temp, EEADR ; Gas %O2 - Set address in internal EEPROM | |
| 119 call read_eeprom ; Read O2 value from EEPROM | |
| 120 movff EEDATA,lo ; Move EEDATA -> lo | |
| 121 movf lo,f ; Move lo -> f | |
| 122 movlw d'21' ; Move 21 -> WREG | |
| 123 cpfsgt lo ; o2 > 21% | |
| 124 bra menu_gassetup_Air ; NO AIR | |
| 125 movlw d'100' ; Move 100 -> WREG | |
| 126 cpfslt lo ; o2 < 100% | |
| 127 bra menu_gassetup_O2 ; NO write O2 | |
| 128 | |
| 129 ; YES Write NX 32 | |
| 130 call gassetup_write_Nx | |
| 131 output_8 | |
| 132 bra menu_gassetup_list0 | |
| 133 | |
| 134 ; New v1.44se | |
| 135 menu_gassetup_O2: | |
| 136 movlw 'O' | |
| 137 movwf POSTINC2 | |
| 138 movlw '2' | |
| 139 movwf POSTINC2 | |
| 140 movlw ' ' | |
| 141 movwf POSTINC2 | |
| 142 output_8 | |
| 143 bra menu_gassetup_list0 | |
| 144 | |
| 145 ; New v1.44se | |
| 146 menu_gassetup_Air: | |
| 147 cpfseq lo ; o2 = 21% | |
| 148 call menu_gassetup_Err | |
| 149 | |
| 150 movlw 'A' | |
| 151 movwf POSTINC2 | |
| 152 movlw 'I' | |
| 153 movwf POSTINC2 | |
| 154 movlw 'R' | |
| 155 movwf POSTINC2 | |
| 156 movlw ' ' | |
| 157 movwf POSTINC2 | |
| 158 output_8 | |
| 159 bra menu_gassetup_list0 | |
| 160 | |
| 161 ; New v1.44se | |
| 162 menu_gassetup_Err: | |
| 163 movlw 'E' | |
| 164 movwf POSTINC2 | |
| 165 movlw 'R' | |
| 166 movwf POSTINC2 | |
| 167 movlw 'R' | |
| 168 movwf POSTINC2 | |
| 169 movlw ' ' | |
| 170 movwf POSTINC2 | |
| 171 output_8 | |
| 172 | |
| 173 ; Changed v1.44se | |
| 174 menu_gassetup_list0: | |
| 175 call menu_gassetup_grey_inactive ; Sets Greyvalue for inactive gases | |
| 176 call word_processor | |
| 177 | |
| 178 WIN_LEFT .105 | |
| 179 movf waitms_temp,W ; Load row into WREG | |
| 180 movff WREG,win_top | |
| 181 lfsr FSR2,letter | |
| 182 | |
| 183 movlw ' ' | |
| 184 movwf POSTINC2 | |
| 185 movlw 'i' | |
| 186 movwf POSTINC2 | |
| 187 movlw 'n' | |
| 188 movwf POSTINC2 | |
| 189 movlw ' ' | |
| 190 movwf POSTINC2 | |
| 191 movf decodata+0,W ; read current value | |
| 192 addlw d'28' ; offset in memory | |
| 193 movwf EEADR | |
| 194 call read_eeprom ; Low-value | |
| 195 movff EEDATA,lo | |
| 196 output_8 | |
| 197 movlw 'm' | |
| 198 movwf POSTINC2 | |
| 199 call menu_gassetup_grey_inactive ; Sets Greyvalue for inactive gases | |
| 200 call word_processor | |
| 201 | |
| 3 | 202 call PLED_standard_color |
| 0 | 203 |
| 204 incf decodata+0,F | |
| 205 movlw d'5' | |
| 206 cpfseq decodata+0 | |
| 207 goto menu_gassetup_list | |
| 208 | |
| 209 DISPLAYTEXT .11 ; Exit | |
| 210 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
| 211 call PLED_menu_cursor | |
| 212 | |
| 213 gassetup_list_loop: | |
| 214 call check_switches_logbook | |
| 215 | |
| 216 btfsc menubit3 | |
| 217 bra gassetup_list2 ; move cursor | |
| 218 | |
| 219 btfsc menubit2 | |
| 220 bra do_gassetup_list; call gas-specific submenu | |
| 221 | |
| 222 btfsc divemode | |
| 223 goto restart ; dive started! | |
| 224 | |
| 225 btfsc onesecupdate | |
| 226 call timeout_surfmode | |
| 227 | |
| 228 btfsc onesecupdate | |
| 229 call set_dive_modes | |
| 230 | |
| 231 bcf onesecupdate ; 1 sec. functions done | |
| 232 | |
| 233 btfsc sleepmode | |
| 234 bra exit_gassetup_list | |
| 235 | |
| 236 bra gassetup_list_loop | |
| 237 | |
| 238 gassetup_list2: | |
| 239 incf menupos,F | |
| 240 movlw d'7' | |
| 241 cpfseq menupos ; =7? | |
| 242 bra gassetup_list3 ; No | |
| 243 movlw d'1' | |
| 244 movwf menupos | |
| 245 | |
| 246 gassetup_list3: | |
| 247 clrf timeout_counter2 | |
| 248 call PLED_menu_cursor | |
| 249 | |
| 250 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
| 251 | |
| 252 bcf menubit3 ; clear flag | |
| 253 bra gassetup_list_loop | |
| 254 | |
| 255 exit_gassetup_list: ; exit... | |
| 256 movlw d'2' | |
| 257 movwf menupos | |
| 258 goto menu2 | |
| 259 | |
| 260 do_gassetup_list: | |
| 261 dcfsnz menupos,F | |
| 262 bra gassetup_list_edit_gas1 | |
| 263 dcfsnz menupos,F | |
| 264 bra gassetup_list_edit_gas2 | |
| 265 dcfsnz menupos,F | |
| 266 bra gassetup_list_edit_gas3 | |
| 267 dcfsnz menupos,F | |
| 268 bra gassetup_list_edit_gas4 | |
| 269 dcfsnz menupos,F | |
| 270 bra gassetup_list_edit_gas5 | |
| 271 bra exit_gassetup_list ; Exit List | |
| 272 | |
| 273 gassetup_list_edit_gas1: | |
| 274 movlw d'0' | |
| 275 movwf decodata+0 | |
| 276 movlw d'0' | |
| 277 movwf divemins+0 | |
| 278 bra menu_gassetup_page1 | |
| 279 | |
| 280 gassetup_list_edit_gas2: | |
| 281 movlw d'1' | |
| 282 movwf decodata+0 | |
| 283 movlw d'4' | |
| 284 movwf divemins+0 | |
| 285 bra menu_gassetup_page1 | |
| 286 | |
| 287 gassetup_list_edit_gas3: | |
| 288 movlw d'2' | |
| 289 movwf decodata+0 | |
| 290 movlw d'8' | |
| 291 movwf divemins+0 | |
| 292 bra menu_gassetup_page1 | |
| 293 | |
| 294 gassetup_list_edit_gas4: | |
| 295 movlw d'3' | |
| 296 movwf decodata+0 | |
| 297 movlw d'12' | |
| 298 movwf divemins+0 | |
| 299 bra menu_gassetup_page1 | |
| 300 | |
| 301 gassetup_list_edit_gas5: | |
| 302 movlw d'4' | |
| 303 movwf decodata+0 | |
| 304 movlw d'16' | |
| 305 movwf divemins+0 | |
| 306 bra menu_gassetup_page1 | |
| 307 | |
| 308 menu_gassetup_page1: | |
| 309 movlw d'1' | |
| 310 movwf menupos | |
| 311 bcf gas_setup_page2 ; Page 1 of gassetup | |
| 312 bcf menubit4 | |
| 313 bcf cursor | |
| 314 bcf sleepmode | |
| 315 bcf first_FA ; Here: =1: -, =0: + | |
| 316 | |
| 317 menu_gassetup0: | |
| 318 call PLED_ClearScreen | |
|
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
50
diff
changeset
|
319 DISPLAYTEXT .147 ; More... |
| 0 | 320 DISPLAYTEXT .11 ; Exit |
| 321 | |
| 322 menu_gassetup1: | |
| 323 clrf timeout_counter2 | |
| 324 bcf menubit2 | |
| 325 bcf menubit3 | |
| 326 | |
| 327 rcall gassetup_title_bar2 ; Displays the title bar with the current Gas info | |
| 328 | |
| 329 WIN_TOP .65 | |
| 330 WIN_LEFT .20 | |
| 331 lfsr FSR2,letter | |
| 332 movlw 'O' | |
| 333 movwf POSTINC2 | |
| 334 movlw '2' | |
| 335 movwf POSTINC2 | |
| 336 movlw ':' | |
| 337 movwf POSTINC2 | |
| 338 movlw ' ' | |
| 339 movwf POSTINC2 | |
| 340 | |
| 341 movf divemins+0,W | |
| 342 addlw 0x06 | |
| 343 movwf EEADR | |
| 344 call read_eeprom ; O2 value | |
| 345 movff EEDATA,lo | |
| 346 output_8 | |
| 347 movlw '%' | |
| 348 movwf POSTINC2 | |
| 349 movlw ' ' | |
| 350 movwf POSTINC2 | |
| 351 movlw '(' | |
| 352 movwf POSTINC2 | |
| 353 movlw 'M' | |
| 354 movwf POSTINC2 | |
| 355 movlw 'O' | |
| 356 movwf POSTINC2 | |
| 357 movlw 'D' | |
| 358 movwf POSTINC2 | |
| 359 movlw ':' | |
| 360 movwf POSTINC2 | |
| 361 | |
| 362 ; Show MOD in m | |
| 363 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG | |
| 364 mullw d'10' | |
| 365 movff PRODL,xA+0 | |
| 366 movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10 | |
| 367 | |
| 368 movf divemins+0,W | |
| 369 addlw 0x06 | |
| 370 movwf EEADR | |
| 371 call read_eeprom ; O2 value | |
| 372 movff EEDATA,xB+0 | |
| 373 clrf xB+1 | |
| 374 call div16x16 ;xA/xB=xC with xA as remainder | |
| 375 movlw d'10' | |
| 376 subwf xC+0,F ; Subtract 10m... | |
| 377 movff xC+0,lo | |
| 378 movlw d'0' | |
| 379 subwfb xC+1,F | |
| 380 movff xC+1,hi | |
| 381 output_16 | |
| 382 movlw 'm' | |
| 383 movwf POSTINC2 | |
| 384 movlw ')' | |
| 385 movwf POSTINC2 | |
| 386 movlw ' ' | |
| 387 movwf POSTINC2 | |
| 388 movlw ' ' | |
| 389 movwf POSTINC2 | |
| 390 call word_processor | |
| 391 | |
| 392 WIN_TOP .95 | |
| 393 lfsr FSR2,letter | |
| 394 movlw 'H' | |
| 395 movwf POSTINC2 | |
| 396 movlw 'e' | |
| 397 movwf POSTINC2 | |
| 398 movlw ':' | |
| 399 movwf POSTINC2 | |
| 400 movlw ' ' | |
| 401 movwf POSTINC2 | |
| 402 movf divemins+0,W | |
| 403 addlw 0x07 | |
| 404 movwf EEADR | |
| 405 call read_eeprom ; He value | |
| 406 movff EEDATA,lo | |
| 407 output_8 | |
| 408 movlw '%' | |
| 409 movwf POSTINC2 | |
| 410 movlw ' ' | |
| 411 movwf POSTINC2 | |
| 105 | 412 movlw '(' |
| 413 movwf POSTINC2 | |
| 414 movlw 'E' | |
| 415 movwf POSTINC2 | |
| 416 movlw 'N' | |
| 417 movwf POSTINC2 | |
| 418 movlw 'D' | |
| 419 movwf POSTINC2 | |
| 420 movlw ':' | |
| 421 movwf POSTINC2 | |
| 422 | |
| 423 ; Show END in m | |
| 424 GETCUSTOM8 .18 ; ppO2 warnvalue in WREG | |
| 425 mullw d'10' | |
| 426 movff PRODL,xA+0 | |
| 427 movff PRODH,xA+1 ; ppO2 in [0.01Bar] * 10 | |
| 428 movf divemins+0,W | |
| 429 addlw 0x06 | |
| 430 movwf EEADR | |
| 431 call read_eeprom ; O2 value | |
| 432 movff EEDATA,xB+0 | |
| 433 clrf xB+1 | |
| 434 call div16x16 ;xA/xB=xC with xA as remainder | |
| 435 movlw d'10' | |
| 436 subwf xC+0,F ; Subtract 10m... | |
| 437 movff xC+0,lo | |
| 438 movlw d'0' | |
| 439 subwfb xC+1,F | |
| 440 movff xC+1,hi ; lo:hi holding MOD in meters | |
| 441 movlw d'10' | |
| 442 addwf lo,F | |
| 443 movlw d'0' | |
| 444 addwfc hi,F ; lo:hi holding MOD+10m | |
| 445 | |
| 446 movf divemins+0,W | |
| 447 addlw 0x07 | |
| 448 movwf EEADR | |
| 449 call read_eeprom ; He value in % -> EEDATA | |
| 450 movlw d'100' | |
| 451 movwf xA+0 | |
| 452 movf EEDATA,W ; He value in % -> EEDATA | |
| 453 subwf xA+0,F ; xA+0 = 100 - He Value in % | |
| 454 clrf xA+1 | |
| 455 movff lo,xB+0 | |
| 456 movff hi,xB+1 ; Copy MOD+10 | |
| 457 call mult16x16 ;xA*xB=xC | |
| 458 movff xC+0,xA+0 | |
| 459 movff xC+1,xA+1 | |
| 460 movlw d'100' | |
| 461 movwf xB+0 | |
| 462 clrf xB+1 | |
| 463 call div16x16 ;xA/xB=xC with xA as remainder | |
| 464 ; xC:2 = ((MOD+10) * 100 - HE Value in %) / 100 | |
| 465 movlw d'10' | |
| 466 subwf xC+0,F ; Subtract 10m... | |
| 467 movff xC+0,lo | |
| 468 movlw d'0' | |
| 469 subwfb xC+1,F | |
| 470 movff xC+1,hi | |
| 471 output_16 | |
| 472 movlw 'm' | |
| 473 movwf POSTINC2 | |
| 474 movlw ')' | |
| 475 movwf POSTINC2 | |
| 0 | 476 movlw ' ' |
| 477 movwf POSTINC2 | |
| 105 | 478 movlw ' ' |
| 479 movwf POSTINC2 | |
| 480 | |
| 0 | 481 call word_processor |
| 482 | |
| 483 WIN_TOP .125 | |
| 484 lfsr FSR2,letter | |
| 485 movlw '+' | |
| 486 movwf POSTINC2 | |
| 487 movlw '/' | |
| 488 movwf POSTINC2 | |
| 489 movlw '-' | |
| 490 movwf POSTINC2 | |
| 491 movlw ':' | |
| 492 movwf POSTINC2 | |
| 493 movlw ' ' | |
| 494 movwf POSTINC2 | |
| 495 movlw '+' | |
| 496 btfsc first_FA | |
| 497 movlw '-' | |
| 498 movwf POSTINC2 | |
| 499 call word_processor | |
| 500 | |
| 501 WIN_TOP .155 | |
| 502 lfsr FSR2,letter | |
| 503 OUTPUTTEXT .89 ; Default: | |
| 504 movf divemins+0,W | |
| 505 addlw 0x04 | |
| 506 movwf EEADR | |
| 507 call read_eeprom ; Default O2 value | |
| 508 movff EEDATA,lo | |
| 509 output_8 | |
| 510 movlw '/' | |
| 511 movwf POSTINC2 | |
| 512 movf divemins+0,W | |
| 513 addlw 0x05 | |
| 514 movwf EEADR | |
| 515 call read_eeprom ; Default He value | |
| 516 movff EEDATA,lo | |
| 517 output_8 | |
| 518 movlw ' ' | |
| 519 movwf POSTINC2 | |
| 520 movlw ' ' | |
| 521 movwf POSTINC2 | |
| 522 call word_processor | |
| 523 | |
| 524 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
| 525 call PLED_menu_cursor | |
| 526 | |
| 527 gassetup_loop: | |
| 528 call check_switches_logbook | |
| 529 | |
| 530 btfsc menubit3 | |
| 531 bra gassetup2 ; move cursor | |
| 532 | |
| 533 btfsc menubit2 | |
| 534 bra do_gassetup ; call submenu | |
| 535 | |
| 536 btfsc divemode | |
| 537 goto restart ; dive started! | |
| 538 | |
| 539 btfsc onesecupdate | |
| 540 call timeout_surfmode | |
| 541 | |
| 542 btfsc onesecupdate | |
| 543 call set_dive_modes | |
| 544 | |
| 545 bcf onesecupdate ; 1 sec. functions done | |
| 546 | |
| 547 btfsc sleepmode | |
| 548 bra exit_gassetup | |
| 549 | |
| 550 bra gassetup_loop | |
| 551 | |
| 552 gassetup2: | |
| 553 incf menupos,F | |
| 554 movlw d'7' | |
| 555 cpfseq menupos ; =7? | |
| 556 bra gassetup3 ; No | |
| 557 movlw d'1' | |
| 558 movwf menupos | |
| 559 | |
| 560 gassetup3: | |
| 561 | |
| 562 clrf timeout_counter2 | |
| 563 call PLED_menu_cursor | |
| 564 | |
| 565 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
| 566 | |
| 567 bcf menubit3 ; clear flag | |
| 568 bra gassetup_loop | |
| 569 | |
| 570 do_gassetup: | |
| 571 dcfsnz menupos,F | |
| 572 bra next_gas_page | |
| 573 dcfsnz menupos,F | |
| 574 bra adjust_o2 | |
| 575 dcfsnz menupos,F | |
| 576 bra adjust_he | |
| 577 dcfsnz menupos,F | |
| 578 bra toggle_plus_minus_gassetup | |
| 579 dcfsnz menupos,F | |
| 580 bra restore_gas | |
| 581 exit_gassetup: ; exit... | |
| 582 movff decodata+0,menupos | |
| 583 incf menupos,F | |
| 584 bra menu_gassetup_prelist | |
| 585 | |
| 586 toggle_plus_minus_gassetup: | |
| 587 btg first_FA | |
| 588 movlw d'4' | |
| 589 movwf menupos | |
| 590 bra menu_gassetup1 ; return | |
| 591 | |
| 592 next_gas: | |
| 593 movlw d'1' | |
| 594 movwf menupos | |
| 595 bra menu_gassetup0 ; incl. clear screen | |
| 596 | |
| 597 adjust_o2: | |
| 598 movf divemins+0,W ; read current value | |
| 599 addlw 0x06 | |
| 600 movwf EEADR | |
| 601 call read_eeprom ; Low-value | |
| 602 movff EEDATA,lo | |
| 603 | |
| 604 btfsc first_FA ; Minus? | |
| 605 bra adjust_o2_1 ; yes, minus! | |
| 606 | |
| 607 incf lo,F ; increase O2 | |
| 608 movlw d'101' | |
| 609 cpfseq lo | |
| 610 bra adjust_o2_2 | |
| 611 movlw d'4' ; LOWER O2 Limit | |
| 612 movwf lo | |
| 613 bra adjust_o2_2 | |
| 614 | |
| 615 adjust_o2_1: | |
| 616 decf lo,F ; decrease O2 | |
| 617 movlw d'3' | |
| 618 cpfseq lo | |
| 619 bra adjust_o2_2 | |
| 620 | |
| 621 movf divemins+0,W | |
| 622 addlw 0x07 | |
| 623 movwf EEADR | |
| 624 call read_eeprom ; read He value | |
| 625 | |
| 626 movlw d'100' | |
| 627 movwf lo | |
| 628 movf EEDATA,W ; He value | |
| 629 subwf lo,F ; lo=100% - He% | |
| 630 | |
| 631 adjust_o2_2: ; test if O2+He>100... | |
| 632 movf divemins+0,W | |
| 633 addlw 0x07 | |
| 634 movwf EEADR | |
| 635 call read_eeprom ; read He value | |
| 636 movf EEDATA,W ; He value | |
| 637 addwf lo,W ; add O2 value | |
| 638 movwf hi ; store in temp | |
| 639 movlw d'101' | |
| 640 cpfseq hi ; O2 and He > 100? | |
| 641 bra adjust_o2_3 ; No! | |
| 642 | |
| 643 movlw d'4' ; LOWER O2 Limit | |
| 644 movwf lo | |
| 645 | |
| 646 adjust_o2_3: | |
| 647 movf divemins+0,W ; save current value | |
| 648 addlw 0x06 | |
| 649 movwf EEADR | |
| 650 movff lo,EEDATA | |
| 651 call write_eeprom ; Low-value | |
| 652 | |
| 653 movlw d'2' | |
| 654 movwf menupos | |
| 655 bra menu_gassetup1 | |
| 656 | |
| 657 adjust_he: | |
| 658 movf divemins+0,W ; read current value | |
| 659 addlw 0x07 | |
| 660 movwf EEADR | |
| 661 call read_eeprom ; Low-value | |
| 662 movff EEDATA,lo | |
| 663 | |
| 664 btfsc first_FA ; Minus? | |
| 665 bra adjust_he_1 ; yes, minus! | |
| 666 | |
| 667 incf lo,F | |
| 668 movlw d'92' ; He limited to (useless) 90% | |
| 669 cpfseq lo | |
| 670 bra adjust_he_2 | |
| 671 clrf lo | |
| 672 bra adjust_he_2 | |
| 673 | |
| 674 adjust_he_1: | |
| 675 decf lo,F ; decrease He | |
| 676 movlw d'255' | |
| 677 cpfseq lo | |
| 678 bra adjust_he_2 | |
| 679 clrf lo | |
| 680 | |
| 681 adjust_he_2: ; test if O2+He>100... | |
| 682 movf divemins+0,W | |
| 683 addlw 0x06 | |
| 684 movwf EEADR | |
| 685 call read_eeprom ; read He value | |
| 686 movf EEDATA,W ; He value | |
| 687 addwf lo,W ; add O2 value | |
| 688 movwf hi ; store in temp | |
| 689 movlw d'101' | |
| 690 cpfseq hi ; O2 and He > 100? | |
| 691 bra adjust_he_3 ; No! | |
| 692 ; clrf lo ; Yes, clear He to zero | |
| 693 decf lo,F ; reduce He again = unchanged after operation | |
| 694 | |
| 695 adjust_he_3: | |
| 696 movf divemins+0,W ; save current value | |
| 697 addlw 0x07 | |
| 698 movwf EEADR | |
| 699 movff lo,EEDATA | |
| 700 call write_eeprom ; Low-value | |
| 701 | |
| 702 movlw d'3' | |
| 703 movwf menupos | |
| 704 bra menu_gassetup1 ; | |
| 705 | |
| 706 restore_gas: | |
| 707 movf divemins+0,W ; read Default value | |
| 708 addlw 0x04 | |
| 709 movwf EEADR | |
| 710 call read_eeprom ; Low-value | |
| 711 movff EEDATA,lo | |
| 712 movf divemins+0,W | |
| 713 addlw 0x05 | |
| 714 movwf EEADR | |
| 715 call read_eeprom ; High-value | |
| 716 movff EEDATA,hi | |
| 717 | |
| 718 movf divemins+0,W ; save Default value | |
| 719 addlw 0x06 | |
| 720 movwf EEADR | |
| 721 movff lo,EEDATA | |
| 722 call write_eeprom ; Low-value | |
| 723 movf divemins+0,W | |
| 724 addlw 0x07 | |
| 725 movwf EEADR | |
| 726 movff hi,EEDATA | |
| 727 call write_eeprom ; High-value | |
| 728 | |
| 729 movlw d'5' | |
| 730 movwf menupos | |
| 731 bra menu_gassetup1 ; | |
| 732 | |
| 733 | |
| 734 next_gas_page: | |
| 735 call PLED_ClearScreen | |
| 736 movlw d'1' | |
| 737 movwf menupos | |
| 738 DISPLAYTEXT .109 ; Back | |
| 739 | |
| 740 DISPLAYTEXT .11 ; Exit | |
| 741 | |
| 742 next_gas_page1: | |
| 743 clrf timeout_counter2 | |
| 744 bcf menubit2 | |
| 745 bcf menubit3 | |
| 746 | |
| 747 rcall gassetup_title_bar2 ; Displays the title bar with the current Gas info | |
| 748 rcall gassetup_show_ppO2 ; Display the ppO2 of the change depth with the current gas | |
| 749 | |
| 750 WIN_TOP .65 | |
| 751 WIN_LEFT .20 | |
| 752 lfsr FSR2,letter | |
| 753 OUTPUTTEXT .105 ; "Active Gas? " | |
| 754 read_int_eeprom d'27' ; read flag register | |
| 755 | |
| 756 ; hi contains active gas flags in BIT0:4 .... | |
| 757 | |
| 758 movff decodata+0,lo ; Gas 0-4 | |
| 759 incf lo,F ; Gas 1-5 | |
| 760 | |
| 761 active_gas_display: | |
| 762 rrcf EEDATA ; roll flags into carry | |
| 763 decfsz lo,F ; max. 5 times... | |
| 764 bra active_gas_display | |
| 765 | |
| 766 btfss STATUS,C ; test carry | |
| 767 bra active_gas_display_no | |
| 768 | |
| 769 OUTPUTTEXT .96 ; Yes | |
| 770 bra active_gas_display_end | |
| 771 | |
| 772 active_gas_display_no: | |
| 773 movlw ' ' ; three spaces instead of "Yes" | |
| 774 movwf POSTINC2 | |
| 775 movlw ' ' | |
| 776 movwf POSTINC2 | |
| 777 movlw ' ' | |
| 778 movwf POSTINC2 | |
| 779 | |
| 780 active_gas_display_end: | |
| 781 call word_processor | |
| 782 | |
| 783 WIN_TOP .95 | |
| 784 WIN_LEFT .20 | |
| 785 lfsr FSR2,letter | |
| 786 OUTPUTTEXT .88 ; First Gas? | |
| 787 movlw ' ' | |
| 788 movwf POSTINC2 | |
| 789 | |
| 790 movlw d'33' | |
| 791 movwf EEADR | |
| 792 call read_eeprom ; Get current startgas 1-5 # into EEDATA | |
| 793 decf EEDATA,W ; 0-4 | |
| 794 cpfseq decodata+0 ; =current displayed gas #? | |
| 795 bra menu_firstgas0 ; no, display three spaces | |
| 796 | |
| 797 OUTPUTTEXT .96 ; Yes | |
| 798 bra menu_firstgas1 | |
| 799 | |
| 800 menu_firstgas0: | |
| 801 movlw ' ' | |
| 802 movwf POSTINC2 | |
| 803 movlw ' ' | |
| 804 movwf POSTINC2 | |
| 805 movlw ' ' | |
| 806 movwf POSTINC2 | |
| 807 | |
| 808 menu_firstgas1: | |
| 809 call word_processor | |
| 810 | |
| 811 WIN_TOP .125 | |
| 812 WIN_LEFT .20 | |
| 813 lfsr FSR2,letter | |
| 814 OUTPUTTEXT .107 ; Change+ | |
| 815 call word_processor | |
| 816 | |
| 817 WIN_TOP .155 | |
| 818 WIN_LEFT .20 | |
| 819 lfsr FSR2,letter | |
| 820 OUTPUTTEXT .108 ; Change- | |
| 821 call word_processor | |
| 822 | |
| 823 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
| 824 call PLED_menu_cursor | |
| 825 | |
| 826 next_gas_page_loop: | |
| 827 call check_switches_logbook | |
| 828 | |
| 829 btfsc menubit3 | |
| 830 bra next_gas_page2 ; move cursor | |
| 831 | |
| 832 btfsc menubit2 | |
| 833 bra do_next_gas_page ; call submenu | |
| 834 | |
| 835 btfsc divemode | |
| 836 goto restart ; dive started! | |
| 837 | |
| 838 btfsc onesecupdate | |
| 839 call timeout_surfmode | |
| 840 | |
| 841 btfsc onesecupdate | |
| 842 call set_dive_modes | |
| 843 | |
| 844 bcf onesecupdate ; 1 sec. functions done | |
| 845 | |
| 846 btfsc sleepmode | |
| 847 bra exit_gassetup | |
| 848 | |
| 849 bra next_gas_page_loop | |
| 850 | |
| 851 next_gas_page2: | |
| 852 incf menupos,F | |
| 853 | |
| 854 movlw d'7' | |
| 855 cpfseq menupos ; =7? | |
| 856 bra next_gas_page3 ; No | |
| 857 movlw d'1' | |
| 858 movwf menupos | |
| 859 | |
| 860 next_gas_page3: | |
| 861 clrf timeout_counter2 | |
| 862 call PLED_menu_cursor | |
| 863 | |
| 864 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! | |
| 865 | |
| 866 bcf menubit3 ; clear flag | |
| 867 bra next_gas_page_loop | |
| 868 | |
| 869 do_next_gas_page: | |
| 870 dcfsnz menupos,F | |
| 871 bra next_gas | |
| 872 dcfsnz menupos,F | |
| 873 bra toggle_active_gas | |
| 874 dcfsnz menupos,F | |
| 875 bra make_first_gas | |
| 876 dcfsnz menupos,F | |
| 877 bra change_gas_depth_plus | |
| 878 dcfsnz menupos,F | |
| 879 bra change_gas_depth_minus | |
| 880 bra exit_gassetup ; Exit menu | |
| 881 | |
| 882 make_first_gas: | |
| 883 movff decodata+0,EEDATA ; current gas (0-4) into EEDATA | |
| 884 incf EEDATA,F ; current gas (1-5) into EEDATA | |
| 885 movlw d'33' | |
| 886 movwf EEADR | |
| 887 call write_eeprom ; store in internal EEPROM | |
| 115 | 888 |
| 889 ; Set First gas to "Active" | |
| 890 read_int_eeprom d'27' ; read flag register | |
| 891 movff decodata+0,lo ; selected gas 0-4 | |
| 892 incf lo,F | |
| 893 dcfsnz lo,F | |
| 894 bsf EEDATA,0 | |
| 895 dcfsnz lo,F | |
| 896 bsf EEDATA,1 | |
| 897 dcfsnz lo,F | |
| 898 bsf EEDATA,2 | |
| 899 dcfsnz lo,F | |
| 900 bsf EEDATA,3 | |
| 901 dcfsnz lo,F | |
| 902 bsf EEDATA,4 | |
| 903 write_int_eeprom d'27' ; write flag register | |
| 904 | |
| 0 | 905 movlw d'3' |
| 906 movwf menupos | |
| 907 bra next_gas_page1 | |
| 908 | |
| 909 toggle_active_gas: | |
| 910 read_int_eeprom d'27' ; read flag register | |
| 911 movff decodata+0,lo ; selected gas 0-4 | |
| 912 incf lo,F | |
| 913 dcfsnz lo,F | |
| 914 btg EEDATA,0 | |
| 915 dcfsnz lo,F | |
| 916 btg EEDATA,1 | |
| 917 dcfsnz lo,F | |
| 918 btg EEDATA,2 | |
| 919 dcfsnz lo,F | |
| 920 btg EEDATA,3 | |
| 921 dcfsnz lo,F | |
| 922 btg EEDATA,4 | |
| 923 write_int_eeprom d'27' ; write flag register | |
| 924 movlw d'2' | |
| 925 movwf menupos | |
| 926 bra next_gas_page1 | |
| 927 | |
| 928 change_gas_depth_plus: | |
| 929 movf decodata+0,W ; read current value | |
| 930 addlw d'28' ; offset in memory | |
| 931 movwf EEADR | |
| 932 call read_eeprom ; Low-value | |
| 933 movff EEDATA,lo | |
| 934 | |
| 935 incf lo,F ; increase depth | |
| 936 movlw d'100' ; Change depth limit + 1 | |
| 937 cpfseq lo | |
| 938 bra change_gas_depth_plus2 | |
| 939 movlw d'99' ; Change depth limit | |
| 940 movwf lo | |
| 941 change_gas_depth_plus2: | |
| 942 movff lo,EEDATA ; write result | |
| 943 call write_eeprom ; save result in EEPROM | |
| 944 | |
| 945 movlw d'4' | |
| 946 movwf menupos | |
| 947 bra next_gas_page1 | |
| 948 | |
| 949 | |
| 950 change_gas_depth_minus: | |
| 951 movf decodata+0,W ; read current value | |
| 952 addlw d'28' ; offset in memory | |
| 953 movwf EEADR | |
| 954 call read_eeprom ; Low-value | |
| 955 movff EEDATA,lo | |
| 956 | |
| 957 decf lo,F ; decrease depth | |
| 958 movlw d'255' | |
| 959 cpfseq lo | |
| 960 bra change_gas_depth_minus2 | |
| 961 movlw d'0' | |
| 962 movwf lo | |
| 963 | |
| 964 change_gas_depth_minus2: | |
| 965 movff lo,EEDATA ; write result | |
| 966 call write_eeprom ; save result in EEPROM | |
| 967 | |
| 968 movlw d'5' | |
| 969 movwf menupos | |
| 970 bra next_gas_page1 | |
| 971 | |
| 972 ; Changed v1.44se | |
| 973 gassetup_title_bar2: | |
| 974 call PLED_topline_box | |
| 975 WIN_INVERT .1 ; Init new Wordprocessor | |
| 976 WIN_TOP .2 | |
| 977 WIN_LEFT .0 | |
| 978 lfsr FSR2,letter | |
| 979 OUTPUTTEXT .95 ; Gas# | |
| 980 movff decodata+0,lo | |
| 981 incf lo,F | |
| 982 bsf leftbind | |
| 983 output_99 | |
| 984 movlw ':' | |
| 985 movwf POSTINC2 | |
| 986 movlw ' ' | |
| 987 movwf POSTINC2 | |
| 988 call word_processor | |
| 989 | |
| 990 WIN_TOP .2 | |
| 991 WIN_LEFT .50 | |
| 992 lfsr FSR2,letter | |
| 993 | |
| 994 ;He check | |
| 995 movf divemins+0,W | |
| 996 addlw 0x07 | |
| 997 movwf EEADR | |
| 998 call read_eeprom ; He value | |
| 999 movff EEDATA,lo ; Move EEData -> lo | |
| 1000 movf lo,f ; Move lo -> f | |
| 1001 movlw d'0' ; Move 0 -> WREG | |
| 1002 cpfsgt lo ; He > 0? | |
| 1003 bra gassetup_title_bar3 ; NO check o2 | |
| 1004 | |
| 1005 ; YES Write TX 15/55 | |
| 1006 call gassetup_write_Tx ; Write TX | |
| 1007 movf divemins+0,W | |
| 1008 addlw 0x06 | |
| 1009 movwf EEADR | |
| 1010 call read_eeprom ; O2 value | |
| 1011 movff EEDATA,lo | |
| 1012 output_8 ; Write O2 | |
| 1013 movlw '/' | |
| 1014 movwf POSTINC2 | |
| 1015 movf divemins+0,W | |
| 1016 addlw 0x07 | |
| 1017 movwf EEADR | |
| 1018 call read_eeprom ; He value | |
| 1019 movff EEDATA,lo | |
| 1020 output_8 ; Write He | |
| 1021 bra gassetup_title_bar7 | |
| 1022 | |
| 1023 ; New v1.44se | |
| 1024 gassetup_title_bar3: ; O2 Check | |
| 1025 movf divemins+0,W | |
| 1026 addlw 0x06 | |
| 1027 movwf EEADR | |
| 1028 call read_eeprom ; O2 value | |
| 1029 movff EEDATA,lo | |
| 1030 movf lo,f ; Move lo -> f | |
| 1031 movlw d'21' ; Move 21 -> WREG | |
| 1032 cpfseq lo ; o2 = 21 | |
| 1033 cpfsgt lo ; o2 > 21% | |
| 1034 bra gassetup_title_bar5 ; NO AIR | |
| 1035 movlw d'100' ; Move 100 -> WREG | |
| 1036 cpfslt lo ; o2 < 100% | |
| 1037 bra gassetup_title_bar4 ; NO write O2 | |
| 1038 | |
| 1039 ; YES Write NX 32 | |
| 1040 call gassetup_write_Nx | |
| 1041 output_8 | |
| 1042 bra gassetup_title_bar7 | |
| 1043 | |
| 1044 ; New v1.44se | |
| 1045 gassetup_title_bar4: | |
| 1046 movlw 'O' | |
| 1047 movwf POSTINC2 | |
| 1048 movlw '2' | |
| 1049 movwf POSTINC2 | |
| 1050 movlw ' ' | |
| 1051 movwf POSTINC2 | |
| 1052 output_8 | |
| 1053 bra gassetup_title_bar7 | |
| 1054 | |
| 1055 ; New v1.44se | |
| 1056 gassetup_title_bar5: | |
| 1057 cpfseq lo ; o2 = 21% | |
| 1058 bra gassetup_title_bar6 | |
| 1059 | |
| 1060 movlw 'A' | |
| 1061 movwf POSTINC2 | |
| 1062 movlw 'I' | |
| 1063 movwf POSTINC2 | |
| 1064 movlw 'R' | |
| 1065 movwf POSTINC2 | |
| 1066 movlw ' ' | |
| 1067 movwf POSTINC2 | |
| 1068 output_8 | |
| 1069 bra gassetup_title_bar7 | |
| 1070 | |
| 1071 ; New v1.44se | |
| 1072 gassetup_title_bar6: ; ERROR | |
| 1073 movlw 'E' | |
| 1074 movwf POSTINC2 | |
| 1075 movlw 'R' | |
| 1076 movwf POSTINC2 | |
| 1077 movlw 'R' | |
| 1078 movwf POSTINC2 | |
| 1079 movlw ' ' | |
| 1080 movwf POSTINC2 | |
| 1081 output_8 | |
| 1082 bra gassetup_title_bar7 | |
| 1083 | |
| 1084 gassetup_title_bar7: | |
| 1085 movlw ' ' | |
| 1086 movwf POSTINC2 | |
| 1087 movlw 'i' | |
| 1088 movwf POSTINC2 | |
| 1089 movlw 'n' | |
| 1090 movwf POSTINC2 | |
| 1091 movlw ' ' | |
| 1092 movwf POSTINC2 | |
| 1093 movf decodata+0,W ; read current value | |
| 1094 addlw d'28' ; offset in memory | |
| 1095 movwf EEADR | |
| 1096 call read_eeprom ; Low-value | |
| 1097 movff EEDATA,lo | |
| 1098 output_8 | |
| 1099 movlw 'm' | |
| 1100 movwf POSTINC2 | |
| 1101 movlw ' ' | |
| 1102 movwf POSTINC2 | |
| 1103 | |
| 1104 call word_processor | |
| 1105 WIN_INVERT .0 ; Init new Wordprocessor | |
| 1106 return | |
| 1107 | |
| 1108 ; New v1.44se | |
| 1109 gassetup_write_Nx: | |
| 1110 movlw 'N' | |
| 1111 movwf POSTINC2 | |
| 1112 movlw 'X' | |
| 1113 movwf POSTINC2 | |
| 1114 movlw ' ' | |
| 1115 movwf POSTINC2 | |
| 1116 return | |
| 1117 | |
| 1118 ; New v1.44se | |
| 1119 gassetup_write_Tx: | |
| 1120 movlw 'T' | |
| 1121 movwf POSTINC2 | |
| 1122 movlw 'X' | |
| 1123 movwf POSTINC2 | |
| 1124 movlw ' ' | |
| 1125 movwf POSTINC2 | |
| 1126 return | |
| 1127 | |
| 1128 ; New v1.44se | |
| 1129 menu_gassetup_grey_inactive: | |
| 1130 ; Set Greyvalue to lower value when gas is inactive | |
| 1131 read_int_eeprom d'27' ; read flag register | |
| 1132 movff decodata+0,lo ; copy gas number 0-4 | |
| 1133 incf lo,F ; 1-5 | |
| 1134 menu_gassetup_list1: | |
| 1135 rrcf EEDATA ; roll flags into carry | |
| 1136 decfsz lo,F ; max. 5 times... | |
| 1137 bra menu_gassetup_list1 | |
| 3 | 1138 |
| 0 | 1139 btfss STATUS,C ; test carry |
| 3 | 1140 bra menu_gassetup_list1_grey |
| 1141 | |
| 1142 GETCUSTOM8 d'35' ;movlw color_white | |
| 1143 call PLED_set_color ; grey out inactive gases! | |
| 1144 return | |
| 1145 | |
| 1146 menu_gassetup_list1_grey: | |
| 0 | 1147 movlw color_grey |
| 1148 call PLED_set_color ; grey out inactive gases! | |
| 1149 return | |
| 1150 | |
| 1151 gassetup_show_ppO2: | |
| 1152 movf divemins+0,W | |
| 1153 addlw 0x06 | |
| 1154 movwf EEADR | |
| 1155 call read_eeprom ; O2 value | |
| 1156 movff EEDATA,hi | |
| 1157 | |
| 1158 movf decodata+0,W ; read current value | |
| 1159 addlw d'28' ; offset in memory | |
| 1160 movwf EEADR | |
| 1161 call read_eeprom ; Change depth in m | |
| 1162 movff EEDATA,lo | |
| 1163 movlw d'10' | |
| 1164 addwf lo,F ; Depth+10m=lo | |
| 1165 movf hi,W | |
| 1166 mulwf lo ; (Depth+10m)*O2 | |
| 1167 movff PRODL,xA+0 | |
| 1168 movff PRODH,xA+1 | |
| 1169 movlw d'10' | |
| 1170 movwf xB+0 | |
| 1171 clrf xB+1 | |
| 1172 call div16x16 ;xA/xB=xC with xA as remainder | |
| 1173 movff xC+0,lo ; ((Depth+10m)*O2)/10 = [0.01Bar] ppO2 | |
| 1174 movff xC+1,hi | |
| 1175 | |
| 1176 WIN_LEFT .55 | |
| 1177 WIN_TOP .35 | |
| 1178 lfsr FSR2,letter | |
| 50 | 1179 OUTPUTTEXT d'149' ; (ppO2: |
| 0 | 1180 output_16dp d'3' |
| 50 | 1181 OUTPUTTEXT d'150' ; Bar: |
| 0 | 1182 call word_processor |
| 35 | 1183 return |
| 1184 | |
| 1185 | |
| 1186 gassetup_sort_gaslist: ; Sorts Gaslist according to change depth | |
| 1187 ; EEPROM Locations of Gaslist | |
| 1188 ; Gas1: | |
| 1189 ; O2 Default:4 | |
| 1190 ; He Default:5 | |
| 1191 ; O2 Current:6 | |
| 1192 ; He Current:7 | |
| 1193 ; Change: 28 | |
| 1194 ; Active: 27,0 | |
| 1195 | |
| 1196 ; Gas2: | |
| 1197 ; O2 Default:8 | |
| 1198 ; He Default:9 | |
| 1199 ; O2 Current:10 | |
| 1200 ; He Current:11 | |
| 1201 ; Change: 29 | |
| 1202 ; Active: 27,1 | |
| 1203 | |
| 1204 ; Gas3: | |
| 1205 ; O2 Default:12 | |
| 1206 ; He Default:13 | |
| 1207 ; O2 Current:14 | |
| 1208 ; He Current:15 | |
| 1209 ; Change: 30 | |
| 1210 ; Active: 27,2 | |
| 1211 | |
| 1212 ; Gas4: | |
| 1213 ; O2 Default:16 | |
| 1214 ; He Default:17 | |
| 1215 ; O2 Current:18 | |
| 1216 ; He Current:19 | |
| 1217 ; Change: 31 | |
| 1218 ; Active: 27,3 | |
| 1219 | |
| 1220 ; Gas5: | |
| 1221 ; O2 Default:20 | |
| 1222 ; He Default:21 | |
| 1223 ; O2 Current:22 | |
| 1224 ; He Current:23 | |
| 1225 ; Change: 32 | |
| 1226 ; Active: 27,4 | |
| 1227 | |
| 47 | 1228 ; reset Change depths (Important for all users who upgrade from <1.60!) |
| 1229 clrf EEADRH | |
| 1230 clrf EEDATA | |
| 1231 write_int_eeprom d'118' ; | |
| 1232 write_int_eeprom d'119' ; | |
| 1233 write_int_eeprom d'120' ; | |
| 1234 write_int_eeprom d'121' ; | |
| 1235 write_int_eeprom d'122' ; | |
| 1236 movlw d'21' ; O2 Current | |
| 1237 movwf EEDATA | |
| 1238 write_int_eeprom d'96' ; | |
| 1239 write_int_eeprom d'100' ; | |
| 1240 write_int_eeprom d'104' ; | |
| 1241 write_int_eeprom d'108' ; | |
| 1242 write_int_eeprom d'112' ; | |
| 1243 | |
| 1244 clrf EEDATA ; He Current | |
| 1245 write_int_eeprom d'97' ; | |
| 1246 write_int_eeprom d'101' ; | |
| 1247 write_int_eeprom d'105' ; | |
| 1248 write_int_eeprom d'109' ; | |
| 1249 write_int_eeprom d'113' ; | |
| 1250 | |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1251 ; Find deepest Gas |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1252 ; Copy all to RAM |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1253 movlw d'3' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1254 movwf EEADR |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1255 clrf EEADRH |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1256 lfsr FSR2,letter ; Store gases in Letter buffer (max. 26Byte!) |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1257 gassetup_sort_gaslist1: |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1258 incf EEADR,F ; Next Adress |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1259 call read_eeprom ; Read byte |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1260 movff EEDATA,POSTINC2 ; Copy into RAM |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1261 movlw d'23' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1262 cpfseq EEADR ; All done? |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1263 bra gassetup_sort_gaslist1 ; No, not yet |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1264 ; Letter+0 = EEPROM 4 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1265 ; ... |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1266 ; Letter+20 = EEPROM 23 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1267 read_int_eeprom d'28' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1268 movff EEDATA,POSTINC2 ; Change Depth Gas1 -> Letter+21 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1269 read_int_eeprom d'29' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1270 movff EEDATA,POSTINC2 ; Change Depth Gas2 -> Letter+22 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1271 read_int_eeprom d'30' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1272 movff EEDATA,POSTINC2 ; Change Depth Gas3 -> Letter+23 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1273 read_int_eeprom d'31' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1274 movff EEDATA,POSTINC2 ; Change Depth Gas4 -> Letter+24 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1275 read_int_eeprom d'32' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1276 movff EEDATA,POSTINC2 ; Change Depth Gas5 -> Letter+25 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1277 read_int_eeprom d'27' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1278 movff EEDATA,POSTINC2 ; Active Byte -> Letter+26 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1279 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1280 ; All change depths = 0? -> Skip sort! |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1281 lfsr FSR2,letter+.20 ; Change depths... |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1282 movlw d'5' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1283 movwf logbook_temp3 ; Gas (0-4) |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1284 clrf logbook_temp1 ; counter |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1285 gassetup_sort_gaslist1a: |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1286 movf POSTINC2,W |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1287 addwf logbook_temp1,F ; sum |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1288 decfsz logbook_temp3,F ; Loop |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1289 bra gassetup_sort_gaslist1a |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1290 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1291 tstfsz logbook_temp1 ; All depths = 0? |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1292 bra gassetup_sort_gaslist1b ; No |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1293 return ; Yes, skip all! |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1294 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1295 gassetup_sort_gaslist1b: |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1296 ; Initialize sorting... |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1297 bcf menubit2 ; Change Start gas only 1x |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1298 movlw d'99' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1299 movwf logbook_temp4 ; Last Gas change depth |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1300 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1301 rcall gassetup_sort_sort ; Sort! |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1302 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 5 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1303 movlw d'5' ; Gas 5 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1304 movwf logbook_temp5 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1305 rcall gassetup_sort_store |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1306 movff logbook_temp1,EEDATA ; Change depth -> EEDATA |
| 45 | 1307 write_int_eeprom d'122' ; Write Change Depth Gas 5 |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1308 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1309 rcall gassetup_sort_sort ; Sort! |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1310 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 4 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1311 movlw d'4' ; Gas 4 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1312 movwf logbook_temp5 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1313 rcall gassetup_sort_store |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1314 movff logbook_temp1,EEDATA ; Change depth -> EEDATA |
| 45 | 1315 write_int_eeprom d'121' ; Write Change Depth Gas 4 |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1316 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1317 rcall gassetup_sort_sort ; Sort! |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1318 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 3 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1319 movlw d'3' ; Gas 3 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1320 movwf logbook_temp5 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1321 rcall gassetup_sort_store |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1322 movff logbook_temp1,EEDATA ; Change depth -> EEDATA |
| 45 | 1323 write_int_eeprom d'120' ; Write Change Depth Gas 3 |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1324 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1325 rcall gassetup_sort_sort ; Sort! |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1326 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 2 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1327 movlw d'2' ; Gas 2 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1328 movwf logbook_temp5 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1329 rcall gassetup_sort_store |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1330 movff logbook_temp1,EEDATA ; Change depth -> EEDATA |
| 45 | 1331 write_int_eeprom d'119' ; Write Change Depth Gas 2 |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1332 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1333 rcall gassetup_sort_sort ; Sort! |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1334 ; Done. Copy Gas #logbook_temp3 into EEPROM Place Gas 1 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1335 movlw d'1' ; Gas 1 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1336 movwf logbook_temp5 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1337 rcall gassetup_sort_store |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1338 movff logbook_temp1,EEDATA ; Change depth -> EEDATA |
| 45 | 1339 write_int_eeprom d'118' ; Write Change Depth Gas 1 |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1340 return |
| 35 | 1341 |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1342 gassetup_sort_sort: |
| 41 | 1343 clrf logbook_temp2 ; Gas (0-4) |
| 1344 clrf logbook_temp1 ; Here: Change depth in m | |
| 1345 clrf logbook_temp3 ; Gas (0-4) | |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1346 |
| 41 | 1347 lfsr FSR2,letter+.20 ; Change depths... |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1348 gassetup_sort_gaslist2: |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1349 movf POSTINC2,W ; Get Change depth into WREG |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1350 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1351 cpfsgt logbook_temp4 ; logbook_temp4 < W? Here: Change depth of last sort run |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1352 bra gassetup_sort_gaslist3 ; Skip, tested depth > max. Depth from last run |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1353 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1354 cpfslt logbook_temp1 ; logbook_temp1 < W? |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1355 bra gassetup_sort_gaslist3 ; Skip, tested depth < max. Depth from this run |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1356 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1357 movwf logbook_temp1 ; copy new depth (current run) |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1358 movff logbook_temp2,logbook_temp3 ; Holds deepest Gas 0-4 of this run |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1359 gassetup_sort_gaslist3: |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1360 incf logbook_temp2,F ; Check next Gas |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1361 movlw d'5' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1362 cpfseq logbook_temp2 ; All done? |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1363 bra gassetup_sort_gaslist2 ; No |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1364 gassetup_sort_gaslist4: |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1365 movff logbook_temp1,logbook_temp4 ; copy new depth (Store for next run) |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1366 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1367 ; Debugger |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1368 ;call enable_rs232 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1369 ; movff logbook_temp1,TXREG |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1370 ; call rs232_wait_tx ; wait for UART |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1371 ; movff logbook_temp2,TXREG |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1372 ; call rs232_wait_tx ; wait for UART |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1373 ; movff logbook_temp3,TXREG |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1374 ; call rs232_wait_tx ; wait for UART |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1375 ; movff logbook_temp4,TXREG |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1376 ; call rs232_wait_tx ; wait for UART |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1377 ; movff logbook_temp5,TXREG |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1378 ; call rs232_wait_tx ; wait for UART |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1379 ; WAITMS d'255' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1380 return |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1381 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1382 gassetup_sort_store: |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1383 lfsr FSR2,letter ; Point to Gas0 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1384 movf logbook_temp3,W |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1385 mullw d'4' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1386 movf PRODL,W ; x4 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1387 addwf FSR2L,F |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1388 movlw d'0' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1389 addwfc FSR2H,F ; Point to Gas #logbook_temp3 (0-4) |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1390 |
| 50 | 1391 ; btfsc menubit2 ; Change Start gas only 1x |
| 1392 ; bra gassetup_sort_store2 ; Skip | |
| 1393 ;; First Gas: 33 (1-5) | |
| 1394 ;; Was gas #logbook_temp3 first gas? | |
| 1395 ; read_int_eeprom d'33' ; Get old first gas (1-5) | |
| 1396 ; incf logbook_temp3,W ; Gas 1-5 -> WREG | |
| 1397 ; cpfseq EEDATA ; Compare with EEDATA d'33' | |
| 1398 ; bra gassetup_sort_store2 ; Was not first gas! | |
| 1399 ; movff logbook_temp5,EEDATA ; Copy new first gas | |
| 1400 ; write_int_eeprom d'123' ; Store | |
| 1401 ; bsf menubit2 ; Done. Do not change again. | |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1402 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1403 gassetup_sort_store2: |
| 45 | 1404 ; Was Gas #logbook_temp3 active? |
| 1405 ; Letter+26 holds active bits 25? | |
| 1406 movff logbook_temp3,logbook_temp6 ; Counter 0-4 | |
| 1407 incf logbook_temp6,F ; Counter 1-5 | |
| 1408 movff letter+.25, logbook_temp2 ; No longer used | |
| 1409 read_int_eeprom d'27' ; Active flag register | |
| 1410 gassetup_sort_store3: | |
| 1411 rrcf logbook_temp2,F ; Shift into Carry | |
| 1412 decfsz logbook_temp6,F ; 1-5 x | |
| 1413 bra gassetup_sort_store3 ; Loop | |
| 1414 ; Carry now holds active bit of gas #logbook_temp3 (0-4) | |
| 1415 | |
| 1416 btfss STATUS,C ; Was Gas active? | |
| 1417 clrf logbook_temp1 ; No!, Clear change Depth to make it inactive for sorted list! | |
| 1418 | |
| 49 | 1419 ;call enable_rs232 |
| 1420 ;movff logbook_temp1,TXREG | |
| 1421 ;call rs232_wait_tx ; wait for UART | |
| 1422 | |
| 1423 movf logbook_temp5,W ; 1-5 | |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1424 mullw d'4' |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1425 movff PRODL,EEADR ; Point to EEPROM of Gas #logbook_temp5 |
| 45 | 1426 movlw d'90' ; +90 Offset to new... |
| 1427 addwf EEADR,F ; ..sorted list! | |
| 1428 | |
|
36
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1429 movff POSTINC2,EEDATA ; O2 Default |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1430 call write_eeprom ; store in internal EEPROM |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1431 incf EEADR,F ; +1 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1432 movff POSTINC2,EEDATA ; He Default |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1433 call write_eeprom ; store in internal EEPROM |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1434 incf EEADR,F ; +1 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1435 movff POSTINC2,EEDATA ; O2 Current |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1436 call write_eeprom ; store in internal EEPROM |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1437 incf EEADR,F ; +1 |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1438 movff POSTINC2,EEDATA ; He Current |
|
3c38ba950dfb
Gas Setup now sorts Gases for new Deco code
heinrichsweikamp
parents:
35
diff
changeset
|
1439 call write_eeprom ; store in internal EEPROM |
| 0 | 1440 return |
