# HG changeset patch # User JeanDo # Date 1294686210 -3600 # Node ID c3ac603ba248af47cba4347bdab3d8e850f546f0 # Parent fc699a7460e6ee2377f559856d9282b18313a724 Fix logbook display when there odd-size dives. diff -r fc699a7460e6 -r c3ac603ba248 code_part1/OSTC_code_asm_part1/menu_logbook.asm --- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm Mon Jan 10 02:57:59 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm Mon Jan 10 20:03:30 2011 +0100 @@ -89,22 +89,19 @@ call I2CREAD ; reads one byte (Slow! Better use Blockread!) movlw 0xFA ; That was a FA ? xorwf SSPBUF,W - bz menu_loop_tooFar ; Got it ! + bz menu_loop_tooFar ; Got both of them... - decf_eeprom_address d'2' ; Instead, not far enough ? + infsnz divemins+0,F ; Advance to the next byte. + incf divemins+1,F + decf_eeprom_address d'2' ; One step back, two steps forward. call I2CREAD ; reads one byte (Slow! Better use Blockread!) - infsnz divemins+0,F ; Keep in sync (-1+2 == +1) - incf divemins+1,F movlw 0xFA ; It was the second FA ? xorwf SSPBUF,W bz test_FA_DONE bra menu_logbook2 ; No: continue the fast loop... menu_loop_tooFar; - movlw -.1 ; Correct counter too, - addwf divemins+0 ; by doing a 16bit decrement. - movlw 0 - addwfc divemins+1 + decf_eeprom_address d'1' ; So stays pointing at the second one. test_FA_DONE: ; Found 0xFA 0xFA! movff eeprom_address+0,eeprom_header_address+0 ; store current address into temp register