comparison src/start.asm @ 410:d3087a8ed7e1

BUGFIX: Fix rare issue after battery change (OSTC3 did not start properly)
author heinrichsweikamp
date Tue, 08 Mar 2016 11:42:58 +0100
parents a9e35c1327aa
children 4389fe9673b2
comparison
equal deleted inserted replaced
409:f141018d66b0 410:d3087a8ed7e1
211 lfsr FSR0,oPressureAdjust 211 lfsr FSR0,oPressureAdjust
212 call option_save ; Save in EEPROM 212 call option_save ; Save in EEPROM
213 213
214 call fix_180_dives ; fix dives made with the 1.80 214 call fix_180_dives ; fix dives made with the 1.80
215 215
216 rcall backup_flash_page ; backup the first 128bytes from flash to EEPROM
217
216 movlw d'1' ; store current version in EEPROM 218 movlw d'1' ; store current version in EEPROM
217 movwf EEADR ; =1 219 movwf EEADR ; =1
218 movwf EEADRH ; =1 220 movwf EEADRH ; =1
219 movlw softwareversion_x 221 movlw softwareversion_x
220 movwf EEDATA 222 movwf EEDATA
382 restart_set_modes_and_flags4: 384 restart_set_modes_and_flags4:
383 ; Apnea Mode 385 ; Apnea Mode
384 bsf FLAG_apnoe_mode 386 bsf FLAG_apnoe_mode
385 return ; start in Surfacemode 387 return ; start in Surfacemode
386 388
389 backup_flash_page: ; backup the first 128bytes from flash to EEPROM
390 ; Start address in internal flash
391 movlw 0x00
392 movwf TBLPTRL
393 movwf TBLPTRH
394 movwf TBLPTRU
395
396 movlw .128
397 movwf lo ; Byte counter
398 clrf EEADR
399 movlw .3
400 movwf EEADRH ; Setup backup address
401
402 TBLRD*- ; Dummy read to be in 128 byte block
403 backup_flash_loop:
404 tblrd+* ; Table Read with Pre-Increment
405 movff TABLAT,EEDATA ; put 1 byte
406 call write_eeprom ; save it in EEPROM
407 incf EEADR,F
408 decfsz lo,F ; 128byte done?
409 bra backup_flash_loop ; No
410 clrf EEADRH ; Reset EEADRH
411 return ; Done.
412
387 END 413 END