comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 151:c3ac603ba248

Fix logbook display when there odd-size dives.
author JeanDo
date Mon, 10 Jan 2011 20:03:30 +0100
parents 055977afc2f9
children f5e9db793dd3
comparison
equal deleted inserted replaced
150:fc699a7460e6 151:c3ac603ba248
87 87
88 incf_eeprom_address d'1' ; Been one step too far ? 88 incf_eeprom_address d'1' ; Been one step too far ?
89 call I2CREAD ; reads one byte (Slow! Better use Blockread!) 89 call I2CREAD ; reads one byte (Slow! Better use Blockread!)
90 movlw 0xFA ; That was a FA ? 90 movlw 0xFA ; That was a FA ?
91 xorwf SSPBUF,W 91 xorwf SSPBUF,W
92 bz menu_loop_tooFar ; Got it ! 92 bz menu_loop_tooFar ; Got both of them...
93 93
94 decf_eeprom_address d'2' ; Instead, not far enough ? 94 infsnz divemins+0,F ; Advance to the next byte.
95 incf divemins+1,F
96 decf_eeprom_address d'2' ; One step back, two steps forward.
95 call I2CREAD ; reads one byte (Slow! Better use Blockread!) 97 call I2CREAD ; reads one byte (Slow! Better use Blockread!)
96 infsnz divemins+0,F ; Keep in sync (-1+2 == +1)
97 incf divemins+1,F
98 movlw 0xFA ; It was the second FA ? 98 movlw 0xFA ; It was the second FA ?
99 xorwf SSPBUF,W 99 xorwf SSPBUF,W
100 bz test_FA_DONE 100 bz test_FA_DONE
101 bra menu_logbook2 ; No: continue the fast loop... 101 bra menu_logbook2 ; No: continue the fast loop...
102 102
103 menu_loop_tooFar; 103 menu_loop_tooFar;
104 movlw -.1 ; Correct counter too, 104 decf_eeprom_address d'1' ; So stays pointing at the second one.
105 addwf divemins+0 ; by doing a 16bit decrement.
106 movlw 0
107 addwfc divemins+1
108 105
109 test_FA_DONE: ; Found 0xFA 0xFA! 106 test_FA_DONE: ; Found 0xFA 0xFA!
110 movff eeprom_address+0,eeprom_header_address+0 ; store current address into temp register 107 movff eeprom_address+0,eeprom_header_address+0 ; store current address into temp register
111 movff eeprom_address+1,eeprom_header_address+1 ; we must continue search here later 108 movff eeprom_address+1,eeprom_header_address+1 ; we must continue search here later
112 incf divenumber,F ; new header found, increase divenumber 109 incf divenumber,F ; new header found, increase divenumber