Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 803:fec91971e4b9
BUGFIX: Entry time in logbook when dive was around midnight
author | heinrichsweikamp |
---|---|
date | Fri, 30 Jan 2015 13:39:05 +0100 |
parents | e8af55eb83cb |
children | c50296c3059e |
comparison
equal
deleted
inserted
replaced
802:798c1acb750a | 803:fec91971e4b9 |
---|---|
355 clrf sub_b+1 | 355 clrf sub_b+1 |
356 movff hi,sub_b+0 | 356 movff hi,sub_b+0 |
357 movff PRODL,sub_a+0 | 357 movff PRODL,sub_a+0 |
358 movff PRODH,sub_a+1 | 358 movff PRODH,sub_a+1 |
359 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values) | 359 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values) |
360 | |
361 btfss neg_flag | |
362 bra display_start_dive_normal ; Not during midnight... | |
363 | |
364 ; subtract result from 1440 (amount minutes/day) | |
365 bsf premenu ; Set temporary flag | |
366 movlw LOW .1440 | |
367 movwf sub_a+0 | |
368 movlw HIGH .1440 | |
369 movwf sub_a+1 | |
370 movff sub_c+0,sub_b+0 | |
371 movff sub_c+1,sub_b+1 | |
372 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values) | |
373 | |
374 display_start_dive_normal: | |
360 ; sub_c:2 holds entry time in minutes | 375 ; sub_c:2 holds entry time in minutes |
361 movff sub_c+0,lo | 376 movff sub_c+0,lo |
362 movff sub_c+1,hi | 377 movff sub_c+1,hi |
363 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | 378 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) |
364 movff lo,PRODL ; temp | 379 movff lo,PRODL ; temp |
365 movff hi,lo | 380 movff hi,lo |
366 output_99x ; hour | 381 output_99x ; hour |
367 PUTC ':' | 382 PUTC ':' |
368 movff PRODL,lo | 383 movff PRODL,lo |
369 output_99x ; minute | 384 output_99x ; minute |
385 | |
386 btfss premenu ; premenu is still 1 if dive was during midnight... | |
387 bra logbook_divetime_common | |
388 | |
389 ; ...show a ",-1" behind the entry time to indicate that... | |
390 PUTC "," | |
391 PUTC "-" | |
392 PUTC "1" | |
393 bcf premenu | |
370 bra logbook_divetime_common ; Skip end-of-divetime | 394 bra logbook_divetime_common ; Skip end-of-divetime |
371 | 395 |
372 display_end_of_divetime: | 396 display_end_of_divetime: |
373 PUTC 0x94 ; "End of dive" icon | 397 PUTC 0x94 ; "End of dive" icon |
374 call I2CREAD2 ; hour | 398 call I2CREAD2 ; hour |