Mercurial > public > mk2
diff code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 33:6e5db85382a2
Speedy simulator! New Deco code test 1
author | heinrichsweikamp |
---|---|
date | Tue, 25 May 2010 17:37:26 +0200 |
parents | 68825abc35f7 |
children | 3ab1188651af |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm Mon May 24 17:48:21 2010 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm Tue May 25 17:37:26 2010 +0200 @@ -600,7 +600,8 @@ bra exit_profileview ; back to list btfsc menubit3 ; ENTER? - bra profileview_menu ; Switch to the Profileview menu + bra exit_profileview ; back to list +; bra profileview_menu ; Switch to the Profileview menu btfsc onesecupdate call timeout_surfmode ; timeout @@ -882,216 +883,216 @@ return -profileview_menu: - movlw d'1' - movwf menupos -profileview_menu1: - call PLED_clear_divemode_menu - call PLED_profileview_menu ; Displays Menu -profileview_menu2: - call PLED_divemenu_cursor - bcf sleepmode ; clear some flags - bcf menubit2 - bcf menubit3 - bcf switch_right - bcf switch_left - clrf timeout_counter2 - -profileview_menu_loop: - call check_switches_logbook - - btfsc menubit3 ; SET/MENU? - bra profileview_menu_move_cursor; Move Cursor - btfsc menubit2 ; ENTER? - bra profileview_menu_do ; Do task - - btfsc onesecupdate - call timeout_surfmode ; timeout - btfsc onesecupdate - call set_dive_modes ; check, if divemode must be entered - bcf onesecupdate ; one second update - btfsc sleepmode ; Timeout? - bra exit_profileview ; back to list - btfsc divemode - goto restart ; Enter Divemode if required - - bra profileview_menu_loop ; wait for something to do - -profileview_menu_do: - dcfsnz menupos,F - bra exit_profileview ; back to list, quit profileview menu - dcfsnz menupos,F - bra profileview_menu_delete ; Delete Dive from external EEPROM +;profileview_menu: +; movlw d'1' +; movwf menupos +;profileview_menu1: +; call PLED_clear_divemode_menu +; call PLED_profileview_menu ; Displays Menu +;profileview_menu2: +; call PLED_divemenu_cursor +; bcf sleepmode ; clear some flags +; bcf menubit2 +; bcf menubit3 +; bcf switch_right +; bcf switch_left +; clrf timeout_counter2 +; +;profileview_menu_loop: +; call check_switches_logbook +; +; btfsc menubit3 ; SET/MENU? +; bra profileview_menu_move_cursor; Move Cursor +; btfsc menubit2 ; ENTER? +; bra profileview_menu_do ; Do task +; +; btfsc onesecupdate +; call timeout_surfmode ; timeout +; btfsc onesecupdate +; call set_dive_modes ; check, if divemode must be entered +; bcf onesecupdate ; one second update +; btfsc sleepmode ; Timeout? +; bra exit_profileview ; back to list +; btfsc divemode +; goto restart ; Enter Divemode if required +; +; bra profileview_menu_loop ; wait for something to do +; +;profileview_menu_do: ; dcfsnz menupos,F -; bra profileview_menu_format ; Delete all Dives from external EEPROM -; -profileview_menu_move_cursor: - incf menupos,F - movlw d'3' ; number of menu options+1 - cpfseq menupos ; =limit? - bra profileview_menu_move_cursor2 ; No! - movlw d'1' ; Yes, reset to position 1! - movwf menupos -profileview_menu_move_cursor2: - bra profileview_menu2 ; Return to Profile Menu, also updates cursor - -profileview_menu_format: - call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! - - movwf menupos ; Used as temp - tstfsz menupos - bra profileview_menu_format_loop2 ; Format now! - - bra exit_profileview ; back to list, quit profileview menu +; bra exit_profileview ; back to list, quit profileview menu +; dcfsnz menupos,F +; bra profileview_menu_delete ; Delete Dive from external EEPROM +;; dcfsnz menupos,F +;; bra profileview_menu_format ; Delete all Dives from external EEPROM +;; +;profileview_menu_move_cursor: +; incf menupos,F +; movlw d'3' ; number of menu options+1 +; cpfseq menupos ; =limit? +; bra profileview_menu_move_cursor2 ; No! +; movlw d'1' ; Yes, reset to position 1! +; movwf menupos +;profileview_menu_move_cursor2: +; bra profileview_menu2 ; Return to Profile Menu, also updates cursor -profileview_menu_format_loop2: ; Do now format! - call PLED_ClearScreen - DISPLAYTEXT .12 ; "Wait.." - call reset_external_eeprom ; delete profile memory - goto menu ; Return to Menu - -profileview_menu_delete: - call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! - movwf menupos ; Used as temp - tstfsz menupos - bra profileview_menu_delete_loop2 ; Delete now! - - bra exit_profileview ; back to list, quit profileview menu - -profileview_menu_delete_loop2: ; Do now delete - call PLED_ClearScreen - DISPLAYTEXT .12 ; "Wait.." - -; eeprom_address:2 is set to the second byte after the ending 0xFD 0xFD -; eeprom_address:2 - 1 -> set to the last byte after the 0xFD 0xFD of the current dive - -; Set pointer to Byte after the final "0xFD 0xFD" - decf_eeprom_address d'1' ; Macro, that subtracts 8Bit from eeprom_address:2 with banking at 0x8000 - movff eeprom_address+0,divemins+0 - movff eeprom_address+1,divemins+1 - -; eeprom_header_address:2 + 1 -> set to the first 0xFA of the 0xFA 0xFA start bytes of the header - movlw d'1' ; - addwf eeprom_header_address+0,F - movlw d'0' - addwfc eeprom_header_address+1,F ; eeprom_header_address:2 + 1 - btfsc eeprom_header_address+1,7 ; at 7FFF? - clrf eeprom_header_address+0 ; Yes, clear address (+0 first!) - btfsc eeprom_header_address+1,7 ; at 7FFF? - clrf eeprom_header_address+1 ; Yes, clear address +;profileview_menu_format: +; call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! +; +; movwf menupos ; Used as temp +; tstfsz menupos +; bra profileview_menu_format_loop2 ; Format now! +; +; bra exit_profileview ; back to list, quit profileview menu +; +;profileview_menu_format_loop2: ; Do now format! +; call PLED_ClearScreen +; DISPLAYTEXT .12 ; "Wait.." +; call reset_external_eeprom ; delete profile memory +; goto menu ; Return to Menu - movff divemins+0,eeprom_address+0 - movff divemins+1,eeprom_address+1 ; Read source - call I2CREAD ; reads one byte (Slow! Better use Blockread!) - movwf profile_temp+0 - movlw 0xFE - cpfseq profile_temp+0 - bra profileview_menu_delete_notlast ; we're not deleting the last dive.... - -; Just move the 0xFE after the dive and delete the rest with 0xFF - movff eeprom_header_address+0, eeprom_address+0 - movff eeprom_header_address+1, eeprom_address+1 ; Write target - movlw 0xFE - call I2CWRITE ; Write the byte - -; Now, delete everything _between_ eeprom_header_address and divemins:2+2 with 0xFF - movlw d'1' ; - addwf eeprom_header_address+0,F - movlw d'0' - addwfc eeprom_header_address+1,F ; eeprom_header_address:2 + 1 - btfsc eeprom_header_address+1,7 ; at 7FFF? - clrf eeprom_header_address+0 ; Yes, clear address (+0 first!) - btfsc eeprom_header_address+1,7 ; at 7FFF? - clrf eeprom_header_address+1 ; Yes, clear address - - movff eeprom_header_address+0,eeprom_address+0 - movff eeprom_header_address+1,eeprom_address+1 - - movlw d'1' ; - addwf divemins+0,F - movlw d'0' - addwfc divemins+1,F ; divemins:2 + 1 - btfss divemins+1,7 ; at 7FFF? - bra profileview_menu_delete_loop2a ; Skip - clrf divemins+0 ; Yes, clear address - clrf divemins+1 - +;profileview_menu_delete: +; call PLED_confirmbox ; Returns WREG=0 for Cancel (Or Timeout) and WREG=1 for OK! +; movwf menupos ; Used as temp +; tstfsz menupos +; bra profileview_menu_delete_loop2 ; Delete now! +; +; bra exit_profileview ; back to list, quit profileview menu +; +;profileview_menu_delete_loop2: ; Do now delete +; call PLED_ClearScreen +; DISPLAYTEXT .12 ; "Wait.." +; +;; eeprom_address:2 is set to the second byte after the ending 0xFD 0xFD +;; eeprom_address:2 - 1 -> set to the last byte after the 0xFD 0xFD of the current dive +; +;; Set pointer to Byte after the final "0xFD 0xFD" +; decf_eeprom_address d'1' ; Macro, that subtracts 8Bit from eeprom_address:2 with banking at 0x8000 +; movff eeprom_address+0,divemins+0 +; movff eeprom_address+1,divemins+1 +; +;; eeprom_header_address:2 + 1 -> set to the first 0xFA of the 0xFA 0xFA start bytes of the header +; movlw d'1' ; +; addwf eeprom_header_address+0,F +; movlw d'0' +; addwfc eeprom_header_address+1,F ; eeprom_header_address:2 + 1 +; btfsc eeprom_header_address+1,7 ; at 7FFF? +; clrf eeprom_header_address+0 ; Yes, clear address (+0 first!) +; btfsc eeprom_header_address+1,7 ; at 7FFF? +; clrf eeprom_header_address+1 ; Yes, clear address +; +; movff divemins+0,eeprom_address+0 +; movff divemins+1,eeprom_address+1 ; Read source +; call I2CREAD ; reads one byte (Slow! Better use Blockread!) +; movwf profile_temp+0 +; movlw 0xFE +; cpfseq profile_temp+0 +; bra profileview_menu_delete_notlast ; we're not deleting the last dive.... +; +;; Just move the 0xFE after the dive and delete the rest with 0xFF +; movff eeprom_header_address+0, eeprom_address+0 +; movff eeprom_header_address+1, eeprom_address+1 ; Write target +; movlw 0xFE +; call I2CWRITE ; Write the byte +; +;; Now, delete everything _between_ eeprom_header_address and divemins:2+2 with 0xFF +; movlw d'1' ; +; addwf eeprom_header_address+0,F +; movlw d'0' +; addwfc eeprom_header_address+1,F ; eeprom_header_address:2 + 1 +; btfsc eeprom_header_address+1,7 ; at 7FFF? +; clrf eeprom_header_address+0 ; Yes, clear address (+0 first!) +; btfsc eeprom_header_address+1,7 ; at 7FFF? +; clrf eeprom_header_address+1 ; Yes, clear address +; ; movff eeprom_header_address+0,eeprom_address+0 ; movff eeprom_header_address+1,eeprom_address+1 - - -profileview_menu_delete_loop2a: - movlw 0xFF - call I2CWRITE ; Write the byte - - incf_eeprom_address d'1' ; Macro, that adds 8Bit to eeprom_address:2 with banking at 0x8000 - - movff divemins+0,sub_a+0 - movff divemins+1,sub_a+1 - movff eeprom_address+0,sub_b+0 - movff eeprom_address+1,sub_b+1 - call sub16 ; sub_c = sub_a - sub_b - tstfsz sub_c+0 ; Done (Result=Zero?) ? - bra profileview_menu_delete_loop2a ; No, continue - tstfsz sub_c+1 ; Done (Result=Zero?) ? - bra profileview_menu_delete_loop2a ; No, continue - goto menu_logbook ; Return to list when done deleting - -profileview_menu_delete_notlast: -; Move everything byte-wise from divemins:2 to eeprom_header_address:2 until 0xFD 0xFD 0xFE is found and were moved - call get_free_EEPROM_location ; Searches 0xFD, 0xFD, 0xFE and sets Pointer to 0xFE - - incf_eeprom_address d'2' ; Macro, that adds 8Bit to eeprom_address:2 with banking at 0x8000 - movff eeprom_address+0,profile_temp+0 - movff eeprom_address+1,profile_temp+1 -; holds now address of 0xFE + 2 (Abort condition....) - decf_eeprom_address d'2' ; Macro, that subtracts 8Bit from eeprom_address:2 with banking at 0x8000 -; holds now address of 0xFE again - movff eeprom_address+0,divemins+0 - movff eeprom_address+1,divemins+1 ; Copy to working read registers - -profileview_menu_delete_loop3: - movff divemins+0,eeprom_address+0 - movff divemins+1,eeprom_address+1 ; Read source - call I2CREAD ; reads one byte (Slow! Better use Blockread!) - movff eeprom_header_address+0, eeprom_address+0 - movff eeprom_header_address+1, eeprom_address+1 ; Write target - call I2CWRITE ; Write the byte - - movff divemins+0,eeprom_address+0 - movff divemins+1,eeprom_address+1 ; Set to source again - movlw 0xFF - call I2CWRITE ; Delete the source.... - - movlw d'1' - addwf divemins+0,F ; Increase source (Divemins:2) - movlw d'0' - addwfc divemins+1,F - btfsc divemins+1,7 ; at 0x8000? - clrf divemins+0 ; Yes, clear address (+0 first!) - btfsc divemins+1,7 ; at 0x8000? - clrf divemins+1 ; Yes, clear address - - movlw d'1' ; Increase target (eeprom_header_address:2) - addwf eeprom_header_address+0,F - movlw d'0' - addwfc eeprom_header_address+1,F ; eeprom_header_address:2 + 1 - btfsc eeprom_header_address+1,7 ; at 7FFF? - clrf eeprom_header_address+0 ; Yes, clear address (+0 first!) - btfsc eeprom_header_address+1,7 ; at 7FFF? - clrf eeprom_header_address+1 ; Yes, clear address - - movff divemins+0,sub_a+0 - movff divemins+1,sub_a+1 - movff profile_temp+0,sub_b+0 - movff profile_temp+1,sub_b+1 - call sub16 ; sub_c = sub_a - sub_b - tstfsz sub_c+0 ; Done (Result=Zero?) ? - bra profileview_menu_delete_loop3 ; No, continue - tstfsz sub_c+1 ; Done (Result=Zero?) ? - bra profileview_menu_delete_loop3 ; No, continue - - goto menu_logbook ; Return to list when done deleting +; +; movlw d'1' ; +; addwf divemins+0,F +; movlw d'0' +; addwfc divemins+1,F ; divemins:2 + 1 +; btfss divemins+1,7 ; at 7FFF? +; bra profileview_menu_delete_loop2a ; Skip +; clrf divemins+0 ; Yes, clear address +; clrf divemins+1 +; +;; movff eeprom_header_address+0,eeprom_address+0 +;; movff eeprom_header_address+1,eeprom_address+1 +; +; +;profileview_menu_delete_loop2a: +; movlw 0xFF +; call I2CWRITE ; Write the byte +; +; incf_eeprom_address d'1' ; Macro, that adds 8Bit to eeprom_address:2 with banking at 0x8000 +; +; movff divemins+0,sub_a+0 +; movff divemins+1,sub_a+1 +; movff eeprom_address+0,sub_b+0 +; movff eeprom_address+1,sub_b+1 +; call sub16 ; sub_c = sub_a - sub_b +; tstfsz sub_c+0 ; Done (Result=Zero?) ? +; bra profileview_menu_delete_loop2a ; No, continue +; tstfsz sub_c+1 ; Done (Result=Zero?) ? +; bra profileview_menu_delete_loop2a ; No, continue +; goto menu_logbook ; Return to list when done deleting +; +;profileview_menu_delete_notlast: +;; Move everything byte-wise from divemins:2 to eeprom_header_address:2 until 0xFD 0xFD 0xFE is found and were moved +; call get_free_EEPROM_location ; Searches 0xFD, 0xFD, 0xFE and sets Pointer to 0xFE +; +; incf_eeprom_address d'2' ; Macro, that adds 8Bit to eeprom_address:2 with banking at 0x8000 +; movff eeprom_address+0,profile_temp+0 +; movff eeprom_address+1,profile_temp+1 +;; holds now address of 0xFE + 2 (Abort condition....) +; decf_eeprom_address d'2' ; Macro, that subtracts 8Bit from eeprom_address:2 with banking at 0x8000 +;; holds now address of 0xFE again +; movff eeprom_address+0,divemins+0 +; movff eeprom_address+1,divemins+1 ; Copy to working read registers +; +;profileview_menu_delete_loop3: +; movff divemins+0,eeprom_address+0 +; movff divemins+1,eeprom_address+1 ; Read source +; call I2CREAD ; reads one byte (Slow! Better use Blockread!) +; movff eeprom_header_address+0, eeprom_address+0 +; movff eeprom_header_address+1, eeprom_address+1 ; Write target +; call I2CWRITE ; Write the byte +; +; movff divemins+0,eeprom_address+0 +; movff divemins+1,eeprom_address+1 ; Set to source again +; movlw 0xFF +; call I2CWRITE ; Delete the source.... +; +; movlw d'1' +; addwf divemins+0,F ; Increase source (Divemins:2) +; movlw d'0' +; addwfc divemins+1,F +; btfsc divemins+1,7 ; at 0x8000? +; clrf divemins+0 ; Yes, clear address (+0 first!) +; btfsc divemins+1,7 ; at 0x8000? +; clrf divemins+1 ; Yes, clear address +; +; movlw d'1' ; Increase target (eeprom_header_address:2) +; addwf eeprom_header_address+0,F +; movlw d'0' +; addwfc eeprom_header_address+1,F ; eeprom_header_address:2 + 1 +; btfsc eeprom_header_address+1,7 ; at 7FFF? +; clrf eeprom_header_address+0 ; Yes, clear address (+0 first!) +; btfsc eeprom_header_address+1,7 ; at 7FFF? +; clrf eeprom_header_address+1 ; Yes, clear address +; +; movff divemins+0,sub_a+0 +; movff divemins+1,sub_a+1 +; movff profile_temp+0,sub_b+0 +; movff profile_temp+1,sub_b+1 +; call sub16 ; sub_c = sub_a - sub_b +; tstfsz sub_c+0 ; Done (Result=Zero?) ? +; bra profileview_menu_delete_loop3 ; No, continue +; tstfsz sub_c+1 ; Done (Result=Zero?) ? +; bra profileview_menu_delete_loop3 ; No, continue +; +; goto menu_logbook ; Return to list when done deleting \ No newline at end of file