comparison src/ghostwriter.asm @ 634:4050675965ea

3.10 stable release
author heinrichsweikamp
date Tue, 28 Apr 2020 17:34:31 +0200
parents 185ba2f91f59
children 75e90cd0c2c3
comparison
equal deleted inserted replaced
633:690c48db7b5b 634:4050675965ea
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File ghostwriter.asm combined next generation V3.08.8 3 ; File ghostwriter.asm * combined next generation V3.09.4k
4 ; 4 ;
5 ; Ghostwriter (Log profile recorder) 5 ; Ghostwriter (Log profile recorder)
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
17 #include "strings.inc" 17 #include "strings.inc"
18 #include "tft_outputs.inc" 18 #include "tft_outputs.inc"
19 #include "divemode.inc" 19 #include "divemode.inc"
20 #include "rtc.inc" 20 #include "rtc.inc"
21 #include "logbook.inc" 21 #include "logbook.inc"
22 #include "convert.inc"
22 23
23 24
24 extern deco_pull_tissues_from_vault 25 extern deco_pull_tissues_from_vault
25 26
26 27
27 ; ---------------------------------------------------------------------------- 28 ;-----------------------------------------------------------------------------
28 ; Macros - write PROFILE data to FLASH (all macros are bank-safe) 29 ; Macros - write PROFILE Data to FLASH (all macros are bank-safe)
29 30
30 FLASH_LIT_PROFILE macro literal ; write 1 byte LITERAL to FLASH profile data 31 FLASH_LIT_PROFILE macro literal ; write 1 byte LITERAL to FLASH profile data
31 movlw literal 32 movlw literal
32 rcall ghostwrite_WREG_profile_exec 33 rcall ghostwrite_WREG_profile_exec
33 endm 34 endm
45 lfsr FSR0,memory_address 46 lfsr FSR0,memory_address
46 rcall ghostwrite_II_profile_exec 47 rcall ghostwrite_II_profile_exec
47 endm 48 endm
48 49
49 50
50 ; ---------------------------------------------------------------------------- 51 ;-----------------------------------------------------------------------------
51 ; private local Variables 52 ; private local Variables
52 53
53 CBLOCK local3 ; max size is 16 Byte !!! 54 CBLOCK local3 ; max size is 16 Byte !!!
54 divisor_temperature ; divisor used to time the sampling of dive data 55 divisor_temperature ; divisor used to time the sampling of dive data
55 divisor_deco ; divisor used to time the sampling of dive data 56 divisor_deco ; divisor used to time the sampling of dive data
60 divisor_tank ; divisor used to time the sampling of dive data 61 divisor_tank ; divisor used to time the sampling of dive data
61 ProfileFlagByte ; used to store events 62 ProfileFlagByte ; used to store events
62 ENDC ; used: 8 byte, remaining: 8 byte 63 ENDC ; used: 8 byte, remaining: 8 byte
63 64
64 65
65 ghostwriter CODE
66
67 ;============================================================================= 66 ;=============================================================================
68 67 ghostwrite1 CODE
69 68 ;=============================================================================
69
70 ;-----------------------------------------------------------------------------
71 ; prepare Data Recording
72 ;
70 global init_recording_params ; initialize profile recording parameters 73 global init_recording_params ; initialize profile recording parameters
71 init_recording_params: 74 init_recording_params:
72 movlw div_temperature ; get divisor for temperature storage 75 movlw div_temperature ; get divisor for temperature storage
73 movwf divisor_temperature ; initialize divisor 76 movwf divisor_temperature ; initialize divisor
74 77
103 106
104 init_recording_params_2: 107 init_recording_params_2:
105 return 108 return
106 109
107 110
111 ;=============================================================================
112 ghostwrite2 CODE
113 ;=============================================================================
114
115 ;-----------------------------------------------------------------------------
116 ; sample and store a Set of Dive Data
117 ;
108 global store_dive_data 118 global store_dive_data
109 store_dive_data: 119 store_dive_data:
110 bcf trigger_sample_divedata ; clear flag 120 bcf trigger_sample_divedata ; clear flag
111 121
112 ifndef _DEBUG 122 ifndef _DEBUG
141 addwf ProfileFlagByte,F ; - add to ProfileFlagByte 151 addwf ProfileFlagByte,F ; - add to ProfileFlagByte
142 check_extended2: 152 check_extended2:
143 decfsz divisor_supersat,W ; check divisor if it will become 0, dump decremented value to WREG 153 decfsz divisor_supersat,W ; check divisor if it will become 0, dump decremented value to WREG
144 bra check_extended3 ; NO - skip 154 bra check_extended3 ; NO - skip
145 movlw infolength_gf ; YES - get length of extra data 155 movlw infolength_gf ; YES - get length of extra data
146 addwf ProfileFlagByte,F ; add to ProfileFlagByte 156 addwf ProfileFlagByte,F ; - add to ProfileFlagByte
147 check_extended3: 157 check_extended3:
148 IFDEF _external_sensor 158 IFDEF _external_sensor
149 decfsz divisor_ppo2_sensors,W ; check divisor if it will become 0, dump decremented value to WREG 159 decfsz divisor_ppo2_sensors,W ; check divisor if it will become 0, dump decremented value to WREG
150 bra check_extended4 ; NO - skip 160 bra check_extended4 ; NO - skip
151 movlw infolength_ppo2_sensors ; YES - get length of extra data 161 movlw infolength_ppo2_sensors ; YES - get length of extra data
224 bsf ProfileFlagByte,7 ; YES - set event byte 1 flag in ProfileFlagByte 234 bsf ProfileFlagByte,7 ; YES - set event byte 1 flag in ProfileFlagByte
225 235
226 FLASH_CC_PROFILE ProfileFlagByte ; store ProfileFlagByte 236 FLASH_CC_PROFILE ProfileFlagByte ; store ProfileFlagByte
227 237
228 btfss event_occured ; global event flag set? 238 btfss event_occured ; global event flag set?
229 bra store_dive_data4 ; NO - no events to store 239 bra store_dive_data4 ; NO - no events to store
230 240
231 ; store the EventByte(s) + additional bytes now 241 ; store the EventByte(s) + additional bytes now
232 FLASH_CC_PROFILE event_byte1 ; store 1st event byte 242 FLASH_CC_PROFILE event_byte1 ; store 1st event byte
233 243
234 btfss event_byte1,7 ; another event byte available? 244 btfss event_byte1,7 ; another event byte available?
431 441
432 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 442 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
433 ; flash writing through the macros 443 ; flash writing through the macros
434 ; 444 ;
435 ghostwrite_II_profile_exec: 445 ghostwrite_II_profile_exec:
436 movf POSTINC0,W ; get byte into WREG 446 movf POSTINC0,W ; get byte into WREG
437 call write_byte_ext_flash_plus_prof ; write to external flash -> profile data 447 call ext_flash_write_byte_0x20_incdc ; write to external flash and increment ext_flash_dive_counter
438 movf POSTINC0,W ; get next byte into WREG 448 movf POSTINC0,W ; get next byte into WREG
439 ghostwrite_WREG_profile_exec: 449 ghostwrite_WREG_profile_exec:
440 goto write_byte_ext_flash_plus_prof ; write to external flash -> profile data (and return) 450 goto ext_flash_write_byte_0x20_incdc ; write to external flash and increment ext_flash_dive_counter (and return)
441 ; 451 ;
442 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
443 453
444 454
455 ;-----------------------------------------------------------------------------
456 ; finish Dive Data Recording and write Header
457 ;
445 global ghostwriter_end_dive 458 global ghostwriter_end_dive
446 ghostwriter_end_dive: 459 ghostwriter_end_dive:
447 ; save end-of-profile pointer for later storage in EEPROM 460 ; save end-of-profile pointer for later storage in EEPROM
448 MOVTT ext_flash_address,ext_flash_log_pointer 461 MOVTT ext_flash_address,ext_flash_log_pointer
449 462
466 ; clear bailout state (if applicable) 479 ; clear bailout state (if applicable)
467 bcf bailout_mode 480 bcf bailout_mode
468 481
469 ; check if dive is worth storage at all 482 ; check if dive is worth storage at all
470 btfss divetime_longer_1min ; dive longer than one minute? 483 btfss divetime_longer_1min ; dive longer than one minute?
471 goto ghostwriter_end_dive_common ; NO - discard everything 484 goto ghostwriter_end_dive_common ; NO - discard everything
472 485
473 ifndef _DEBUG 486 ifndef _DEBUG
474 ; in DEBUG compile, write simulated dives to logbook 487 ; in DEBUG compile, write simulated dives to logbook
475 btfsc sensor_override_active ; in simulator mode? 488 btfsc sensor_override_active ; in simulator mode?
476 goto ghostwriter_end_dive_common ; YES - discard everything 489 goto ghostwriter_end_dive_common ; YES - discard everything
504 bra ghostwriter_end_dive_1 ; NO - proceed 517 bra ghostwriter_end_dive_1 ; NO - proceed
505 TSTOSS opt_store_apnoe ; YES - logging in apnoe mode enabled? 518 TSTOSS opt_store_apnoe ; YES - logging in apnoe mode enabled?
506 goto ghostwriter_end_dive_cleanup ; NO - skip logging but do the after-dive cleanup 519 goto ghostwriter_end_dive_cleanup ; NO - skip logging but do the after-dive cleanup
507 520
508 ghostwriter_end_dive_1: 521 ghostwriter_end_dive_1:
509 ; dive finished (and longer than one minute) 522
523 ;---- dive finished (and longer than one minute) -------------------------
510 524
511 ; close profile recording 525 ; close profile recording
512 FLASH_LIT_PROFILE 0xFD ; write end-of-profile code, byte 1 526 FLASH_LIT_PROFILE 0xFD ; write end-of-profile code, byte 1
513 FLASH_LIT_PROFILE 0xFD ; write end-of-profile code, byte 2 527 FLASH_LIT_PROFILE 0xFD ; write end-of-profile code, byte 2
514 528
515 ; save end-of-profile pointer for later storage in header and EEPROM 529 ; save end-of-profile pointer for later storage in header and EEPROM
516 MOVTT ext_flash_address,ext_flash_log_pointer 530 MOVTT ext_flash_address,ext_flash_log_pointer
517 531
518 ; set to first address of profile data again to store dive length (number of recorded bytes) 532 ; go back again to start of profile data to store the profile length (number of recorded bytes)
519 rcall ghostwriter_load_pointer 533 call ghostwriter_load_pointer
520 534
521 ; skip internal "0xFA 0xFA #Divenumber:2 0xFA 0xFA" header, i.e. the first 6 bytes 535 ; skip internal "0xFA 0xFA #Divenumber:2 0xFA 0xFA" header, i.e. the first 6 bytes
522 ext_flash_inc_address_0x20 d'6' 536 EXT_FLASH_INC_ADDRESS_0x20 d'6'
523 537
524 ; store dive length (-> profile, NO ext_flash_length_counter increase, NO page delete) 538 ; store dive length (NO ext_flash_length_counter increase, NO page delete)
525 movf ext_flash_length_counter+0,W 539 movf ext_flash_length_counter+0,W ; get length of profile data, low byte
526 call write_byte_ext_flash_plus_nodel 540 call ext_flash_write_byte_0x20_nodel ; write to flash
527 movf ext_flash_length_counter+1,W 541 movf ext_flash_length_counter+1,W ; get length of profile data, high byte
528 call write_byte_ext_flash_plus_nodel 542 call ext_flash_write_byte_0x20_nodel ; write to flash
529 movf ext_flash_length_counter+2,W 543 movf ext_flash_length_counter+2,W ; get length of profile data, upper byte
530 call write_byte_ext_flash_plus_nodel 544 call ext_flash_write_byte_0x20_nodel ; write to flash
531 545
532 ; ... profile recording done 546 ; ... profile recording done
533 547
534 ; read, increment, and store again total number of dives 548 ; read, increment, and store updated total number of dives
535 call eeprom_total_dives_read ; read total number of dives 549 call eeprom_total_dives_read ; read total number of dives
536 INCI mpr ; increment by one 550 INCI mpr ; increment by one
537 call eeprom_total_dives_write ; store updated number of total dives 551 call eeprom_total_dives_write ; store updated number of total dives
538 552
539 ; prepare header 553 ; prepare header
596 lfsr FSR0,opt_dil_O2_ratio-.1 ; set base address to (opt_dil_O2_ratio - 1) because of pre-increment statement 610 lfsr FSR0,opt_dil_O2_ratio-.1 ; set base address to (opt_dil_O2_ratio - 1) because of pre-increment statement
597 ;bra end_dive_gaslist_common ; write all 5 diluents 611 ;bra end_dive_gaslist_common ; write all 5 diluents
598 ENDIF 612 ENDIF
599 613
600 end_dive_gaslist_common: ; helper function for writing gas list entries 614 end_dive_gaslist_common: ; helper function for writing gas list entries
601 ; 615
602 ; Memory Map: 616 ; Memory Map:
603 ; ------------------------- 617 ; -------------------------
604 ; opt_gas_O2_ratio res 5 618 ; opt_gas_O2_ratio res 5
605 ; opt_dil_O2_ratio res 5 619 ; opt_dil_O2_ratio res 5
606 ; opt_gas_He_ratio res 5 620 ; opt_gas_He_ratio res 5
607 ; opt_dil_He_ratio res 5 621 ; opt_dil_He_ratio res 5
608 ; opt_gas_type res 5 622 ; opt_gas_type res 5
609 ; opt_dil_type res 5 623 ; opt_dil_type res 5
610 ; opt_gas_change res 5 624 ; opt_gas_change res 5
611 ; opt_dil_change res 5 625 ; opt_dil_change res 5
612 ; 626
613 movlw .5 ; 5 gases to store 627 movlw .5 ; 5 gases to store
614 movwf lo ; use lo as counter 628 movwf lo ; use lo as counter
615 end_dive_gaslist_loop: 629 end_dive_gaslist_loop:
616 movff PREINC0,POSTINC1 ; increment FSR0 address and copy O2 ratio to buffer 630 movff PREINC0,POSTINC1 ; increment FSR0 address and copy O2 ratio to buffer
617 movlw .10 ; offset for H2 ratios 631 movlw .10 ; offset for H2 ratios
657 IFDEF _ccr_pscr 671 IFDEF _ccr_pscr
658 ; store setpoints 672 ; store setpoints
659 lfsr FSR0,opt_setpoint_cbar ; base address of ppO2 values 673 lfsr FSR0,opt_setpoint_cbar ; base address of ppO2 values
660 lfsr FSR1,opt_setpoint_change ; base address of change depths 674 lfsr FSR1,opt_setpoint_change ; base address of change depths
661 lfsr FSR2,header_buffer+index_sp1 ; base address of setpoint data in header buffer 675 lfsr FSR2,header_buffer+index_sp1 ; base address of setpoint data in header buffer
662 movlw .5 ; 5 setpoints (ppo2, depth) to be stored 676 movlw .5 ; 5 setpoints (ppO2, depth) to be stored
663 movwf lo ; use lo as counter 677 movwf lo ; use lo as counter
664 end_dive_sp_loop: 678 end_dive_sp_loop:
665 movff POSTINC0,POSTINC2 ; copy ppO2 value 679 movff POSTINC0,POSTINC2 ; copy ppO2 value
666 movff POSTINC1,POSTINC2 ; copy change depth 680 movff POSTINC1,POSTINC2 ; copy change depth
667 decfsz lo ; decrement counter, did it became 0 ? 681 decfsz lo ; decrement counter, did it became 0 ?
761 775
762 ; write header stop code 776 ; write header stop code
763 MOVLI 0xFBFB,mpr 777 MOVLI 0xFBFB,mpr
764 MOVII mpr,header_buffer+index_header_stop 778 MOVII mpr,header_buffer+index_header_stop
765 779
766 ; compute start address of header data 780 ; store header in the FLASH
767 call eeprom_total_dives_read ; read total number of dives 781 call eeprom_total_dives_read ; read total number of dives
768 decf mpr+0,W ; compute index from low(total number of dives) 782 decf mpr+0,W ; compute index from low(total number of dives)
769 call log_header_addr_by_index ; compute start address (returned in mpr:3) 783 call log_header_addr_by_index ; compute header start address
770 784 call ext_flash_erase_4kB ; erase the FLASH 4 kB block where the header will be stored
771 ; erase the FLASH 4 kB block where the header will be stored 785 FLASH_RR_WRITE header_buffer,.256 ; write the header to the FLASH
772 MOVTT mpr,ext_flash_address
773 call ext_flash_erase_4kB
774
775 ; write the header to the FLASH
776 FLASH_RR_WRITE header_buffer,mpr,.256
777 786
778 ghostwriter_end_dive_cleanup: 787 ghostwriter_end_dive_cleanup:
779 call eeprom_deco_data_write ; update deco data in EEPROM 788 call eeprom_deco_data_write ; update deco data in EEPROM
780 bsf reset_surface_interval ; request ISR to reset the surface interval timer 789 bsf reset_surface_interval ; request ISR to reset the surface interval timer
781 790
822 ; done with post-dive operations, return to surface loop 831 ; done with post-dive operations, return to surface loop
823 goto surfloop 832 goto surfloop
824 833
825 834
826 ;----------------------------------------------------------------------------- 835 ;-----------------------------------------------------------------------------
827 ; helper function for copying tissue pressures 836 ; Helper Function - copy Tissue Pressures
828 ; 837 ;
829 copy_tissuepres_to_header: 838 copy_tissuepres_to_header:
830 movwf eeprom_loop ; initialize loop counter (EEPROM var used here) 839 movwf eeprom_loop ; initialize loop counter (EEPROM var used here)
831 copy_tissuepres_to_header_loop: 840 copy_tissuepres_to_header_loop:
832 movf POSTINC1,W ; copy tissue pressure to WREG 841 movf POSTINC1,W ; copy tissue pressure to WREG
835 movwf POSTINC2 ; copy WREG to header buffer 844 movwf POSTINC2 ; copy WREG to header buffer
836 decfsz eeprom_loop,F ; decrement loop counter, all done? 845 decfsz eeprom_loop,F ; decrement loop counter, all done?
837 bra copy_tissuepres_to_header_loop ; NO - loop 846 bra copy_tissuepres_to_header_loop ; NO - loop
838 return ; YES - done 847 return ; YES - done
839 848
849
840 ;----------------------------------------------------------------------------- 850 ;-----------------------------------------------------------------------------
841 ; load ext_flash_address from EEPROM 851 ; Helper Function - increment Log Offset
842 ; 852 ;
843 ghostwriter_load_pointer: 853 increment_log_offset:
844 EEPROM_TT_READ eeprom_log_pointer,ext_flash_address 854 call eeprom_log_offset_read ; read current logbook offset into mpr
845 return 855 movf mpr+0,W ; get low byte
856 iorwf mpr+1,W ; inclusive-or with high byte, result zero?
857 bz increment_log_offset_1 ; YES - skip offset correction
858 INCI mpr ; NO - increment offset
859 call eeprom_log_offset_write ; - store incremented offset as new offset
860 increment_log_offset_1:
861 return ; done
862
846 863
847 ;----------------------------------------------------------------------------- 864 ;-----------------------------------------------------------------------------
848 ; write short header with dive number into profile memory 865 ; start Dive Data Recording (write short Header with Dive Number)
849 ; 866 ;
850 global ghostwriter_short_header 867 global ghostwriter_short_header
851 ghostwriter_short_header: 868 ghostwriter_short_header:
852 ; get pointer for profile storing 869 ; get pointer for profile storing
853 rcall ghostwriter_load_pointer 870 rcall ghostwriter_load_pointer
861 bra ghostwriter_short_header_init ; NO - initialize page 878 bra ghostwriter_short_header_init ; NO - initialize page
862 bra ghostwriter_short_header_2 ; YES - page is clean, can continue 879 bra ghostwriter_short_header_2 ; YES - page is clean, can continue
863 880
864 ghostwriter_short_header_init: 881 ghostwriter_short_header_init:
865 clrf ext_flash_address+0 ; low byte: set to zero 882 clrf ext_flash_address+0 ; low byte: set to zero
866 movlw 0xF0 ; high byte: keep higher nibble, set lower nibble to zero 883 movlw 0xF0 ; high byte: keep upper nibble, set lower nibble to zero
867 andwf ext_flash_address+1,F ; ... 884 andwf ext_flash_address+1,F ; ...
868 movlw .16 ; increment ext_flash_address to next multiple of 16*256 885 movlw .16 ; increment ext_flash_address to next multiple of 16*256
869 addwf ext_flash_address+1,F ; ... 886 addwf ext_flash_address+1,F ; ...
870 movlw .0 ; ... 887 movlw .0 ; ...
871 addwfc ext_flash_address+2,F ; ... 888 addwfc ext_flash_address+2,F ; ...
888 ; write short start header with dive number into profile memory 905 ; write short start header with dive number into profile memory
889 FLASH_LIT_PROFILE 0xFA ; 1st byte 906 FLASH_LIT_PROFILE 0xFA ; 1st byte
890 FLASH_LIT_PROFILE 0xFA ; 2nd byte 907 FLASH_LIT_PROFILE 0xFA ; 2nd byte
891 908
892 ; load total number of dives 909 ; load total number of dives
893 call eeprom_total_dives_read ; read total number of dives 910 call eeprom_total_dives_read ; read total number of dives into mpr:2
894 incf mpr+0,F ; increment low byte + 1 911 incf mpr+0,F ; increment low byte + 1
895 FLASH_II_PROFILE mpr 912 FLASH_II_PROFILE mpr ; write mpr:2 to FLASH
896 913
897 ; close short header 914 ; close short header
898 FLASH_LIT_PROFILE 0xFA ; 1st byte 915 FLASH_LIT_PROFILE 0xFA ; 1st byte
899 FLASH_LIT_PROFILE 0xFA ; 2nd byte 916 FLASH_LIT_PROFILE 0xFA ; 2nd byte
900 917
901 ; Keep room for dive length ext_flash_length_counter:3 (stored at the end of the dive) 918 ; Keep room for dive length ext_flash_length_counter:3 (stored at the end of the dive),
902 ; Writing 0xFF three times here is mandatory 919 ; writing 0xFF here is mandatory because 0xFF can be overwritten when closing the dive.
903 ; - 0xFF can be overwritten after the dive 920 ; The stored dive length counter itself is not part of the counted dive length.
904 ; - write_byte_ext_flash_plus_prof takes care of 4kB page switching 921
905 ; - fixes an issue when we are at exactly 0xXXX000 here... 922 setf WREG ; write 0xFF
906 923 call ext_flash_write_byte_0x20 ; write to profile (no dive length increment)
907 setf WREG ; write 0xFF 924 setf WREG ; write 0xFF
908 call write_byte_ext_flash_plus_nocnt ; write to profile without ext_flash_length_counter increase 925 call ext_flash_write_byte_0x20 ; write to profile (no dive length increment)
909 setf WREG ; write 0xFF 926 setf WREG ; write 0xFF
910 call write_byte_ext_flash_plus_nocnt ; write to profile without ext_flash_length_counter increase 927 call ext_flash_write_byte_0x20 ; write to profile (no dive length increment)
911 setf WREG ; write 0xFF
912 call write_byte_ext_flash_plus_nocnt ; write to profile without ext_flash_length_counter increase
913 928
914 ; store sizes and sampling rates of recording datasets 929 ; store sizes and sampling rates of recording datasets
915 930
916 FLASH_CC_PROFILE sampling_rate ; get general sampling rate 931 FLASH_CC_PROFILE sampling_rate ; get general sampling rate
917 932
956 btfsc tr_functions_activated ; TR functions activated? 971 btfsc tr_functions_activated ; TR functions activated?
957 movlw div_tank ; YES - get sampling rate 972 movlw div_tank ; YES - get sampling rate
958 ENDIF 973 ENDIF
959 FLASH_WREG_PROFILE ; WREG -> profile in ext. flash 974 FLASH_WREG_PROFILE ; WREG -> profile in ext. flash
960 975
976 return ; done
977
978
979 ;-----------------------------------------------------------------------------
980 ; Helper Function - load ext_flash_address from EEPROM
981 ;
982 ghostwriter_load_pointer:
983 EEPROM_TT_READ eeprom_log_pointer,ext_flash_address
961 return 984 return
962 985
963 ;----------------------------------------------------------------------------- 986 ;-----------------------------------------------------------------------------
964 ; increment log offset
965 ;
966 increment_log_offset:
967 call eeprom_log_offset_read ; read current logbook offset into mpr
968 movf mpr+0,W ; get low byte
969 iorwf mpr+1,W ; inclusive-or with high byte, result zero?
970 bz increment_log_offset_1 ; YES - skip offset correction
971 INCI mpr ; NO - increment offset
972 call eeprom_log_offset_write ; - store incremented offset as new offset
973 increment_log_offset_1:
974 return ; done
975 987
976 END 988 END