comparison code_part1/OSTC_code_asm_part1/start.asm @ 681:6e456a6398e0

Hardware4 support
author heinrichsweikamp
date Fri, 25 Jan 2013 18:00:49 +0100
parents 683e7d821678
children aebb6d039249
comparison
equal deleted inserted replaced
680:c6220d340684 681:6e456a6398e0
26 movlb b'00000001' ; ram bank 1 selected 26 movlb b'00000001' ; ram bank 1 selected
27 movff STKPTR,temp10 ; Save stack pointer, for crash reports. 27 movff STKPTR,temp10 ; Save stack pointer, for crash reports.
28 clrf temp10+1 28 clrf temp10+1
29 call init 29 call init
30 btfsc divemode ; Reset from Divemode? 30 btfsc divemode ; Reset from Divemode?
31 call PLED_resetdebugger ; Yes! Something went wrong, show reset informations 31 call DISP_resetdebugger ; Yes! Something went wrong, show reset informations
32 start3: 32 start3:
33 clrf STKPTR ; Clear Stackpointer 33 clrf STKPTR ; Clear Stackpointer
34 lfsr FSR0,year+1 ; Clear rambank 1-9, do not delete RTC registers 34 lfsr FSR0,year+1 ; Clear rambank 1-9, do not delete RTC registers
35 clear_rambank: 35 clear_rambank:
36 clrf POSTINC0 36 clrf POSTINC0
153 ; After update resets 153 ; After update resets
154 ; Reset brightness to ECO 154 ; Reset brightness to ECO
155 movlw LOW 0x103 155 movlw LOW 0x103
156 movwf EEADR 156 movwf EEADR
157 movlw HIGH 0x103 157 movlw HIGH 0x103
158 movwf EEADRH ; OLED brightness (=0: Eco, =1: High) 158 movwf EEADRH ; DISPLAY brightness (=0: Eco, =1: High)
159 movlw .0 159 movlw .0
160 movwf EEDATA 160 movwf EEDATA
161 call write_eeprom ; write byte 161 call write_eeprom ; write byte
162 clrf EEADRH ; Reset EEADRH 162 clrf EEADRH ; Reset EEADRH
163 163
261 restart1: 261 restart1:
262 ; Reset all CF and Gases 262 ; Reset all CF and Gases
263 call reset_gases 263 call reset_gases
264 ; call reset_all_cf 264 ; call reset_all_cf
265 ; Show info screen 265 ; Show info screen
266 call PLED_boot ; PLED boot (Incl. Clear Screen!) 266 call DISPLAY_boot ; DISP boot (Incl. Clear Screen!)
267 rcall display_new_cf_installed; Show info screen 267 rcall display_new_cf_installed; Show info screen
268 ; Save new number of current CF count 268 ; Save new number of current CF count
269 movlw max_custom_number ; Defined in definitions.asm 269 movlw max_custom_number ; Defined in definitions.asm
270 movwf EEDATA 270 movwf EEDATA
271 write_int_eeprom d'92' ; Store number of CF used in this firmware 271 write_int_eeprom d'92' ; Store number of CF used in this firmware
286 call read_eeprom ; read byte 286 call read_eeprom ; read byte
287 movlw 0xAA 287 movlw 0xAA
288 cpfseq EEDATA ; is 0xAA already? 288 cpfseq EEDATA ; is 0xAA already?
289 call logbook_convert_64k ; No, convert now (And write 0xAA to internal EEPROM 0x100) 289 call logbook_convert_64k ; No, convert now (And write 0xAA to internal EEPROM 0x100)
290 290
291 ; Set OLED brightness flag 291 ; Set DISPLAY brightness flag
292 movlw LOW 0x103 292 movlw LOW 0x103
293 movwf EEADR 293 movwf EEADR
294 movlw HIGH 0x103 294 movlw HIGH 0x103
295 movwf EEADRH ; OLED brightness (=0: Eco, =1: High) 295 movwf EEADRH ; DISPLAY brightness (=0: Eco, =1: High)
296 call read_eeprom ; read byte 296 call read_eeprom ; read byte
297 bcf oled_brightness_high ; Eco mode 297 bcf DISPLAY_brightness_high ; Eco mode
298 movlw .0 298 movlw .0
299 cpfseq EEDATA ; High? 299 cpfseq EEDATA ; High?
300 bsf oled_brightness_high ; Yes! 300 bsf DISPLAY_brightness_high ; Yes!
301 301
302 clrf EEADRH ; Reset EEADRH 302 clrf EEADRH ; Reset EEADRH
303 goto surfloop ; Jump to Surfaceloop! 303 goto surfloop ; Jump to Surfaceloop!
304 304
305 305
306 display_new_cf_installed: 306 display_new_cf_installed:
307 call PLED_new_cf_warning ; Display new CF warning screen 307 call DISP_new_cf_warning ; Display new CF warning screen
308 movlw d'20' ; timeout for warning screen 308 movlw d'20' ; timeout for warning screen
309 bra startup_screen3a ; Will RETURN after timeout or button press 309 bra startup_screen3a ; Will RETURN after timeout or button press
310 310
311 ;============================================================================= 311 ;=============================================================================
312 ; Setup all flags and parameters for divemode and simulator computations. 312 ; Setup all flags and parameters for divemode and simulator computations.
395 395
396 396
397 ;============================================================================= 397 ;=============================================================================
398 398
399 startup_screen1: 399 startup_screen1:
400 call PLED_ClearScreen 400 call DISP_ClearScreen
401 call PLED_startupscreen1 ; show startup sreen 401 call DISP_startupscreen1 ; show startup sreen
402 startup_screen1_2: 402 startup_screen1_2:
403 movlw d'10' ; timeout for startup screen 403 movlw d'10' ; timeout for startup screen
404 movwf temp1 404 movwf temp1
405 WAITMS d'200' 405 WAITMS d'200'
406 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! 406 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
426 btfsc switch_right ; Ack? 426 btfsc switch_right ; Ack?
427 return 427 return
428 bra screen1_loop ; loop screen 428 bra screen1_loop ; loop screen
429 429
430 startup_screen2: 430 startup_screen2:
431 call PLED_ClearScreen ; Page 1 431 call DISP_ClearScreen ; Page 1
432 call PLED_startupscreen2 ; show startup sreen 432 call DISP_startupscreen2 ; show startup sreen
433 bra startup_screen1_2 433 bra startup_screen1_2
434 434
435 startup_screen3a:; WARNING: Also used for decodescriptions and CF Warning screen! 435 startup_screen3a:; WARNING: Also used for decodescriptions and CF Warning screen!
436 movwf temp1 436 movwf temp1
437 WAITMS d'200' 437 WAITMS d'200'