Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 38:8ece4837a642
test & debugging new deco code...
author | heinrichsweikamp |
---|---|
date | Mon, 31 May 2010 19:14:09 +0200 |
parents | d4f0c097a7fa |
children | 1705b3f7e5b3 |
comparison
equal
deleted
inserted
replaced
37:016a2412d164 | 38:8ece4837a642 |
---|---|
314 call PLED_display_cns ; Show CNS | 314 call PLED_display_cns ; Show CNS |
315 | 315 |
316 call check_gas_change ; Checks if a better gas should be selected (by user) | 316 call check_gas_change ; Checks if a better gas should be selected (by user) |
317 | 317 |
318 ; Check for decompression gases if in decomode | 318 ; Check for decompression gases if in decomode |
319 divemode_check_decogases: ; CALLed from Simulator | |
320 btfss dekostop_active | 319 btfss dekostop_active |
321 bra reset_decompression_gases ; While in NDL, do not set deompression gas | 320 bra reset_decompression_gases ; While in NDL, do not set deompression gas |
322 | 321 |
322 divemode_check_decogases: ; CALLed from Simulator | |
323 ; Copy active gases to char_I_deco_N2_ratio and char_I_deco_He_ratio | 323 ; Copy active gases to char_I_deco_N2_ratio and char_I_deco_He_ratio |
324 | 324 |
325 clrf hi ; # of gas (0-4) | 325 clrf hi ; # of gas (0-4) |
326 ; Gas0 is Start gas, do not copy | 326 ; Gas0 is Start gas, do not copy |
327 | 327 |
328 lfsr FSR1, char_I_deco_He_ratio5 ; most shallow decogas | 328 lfsr FSR1, char_I_deco_He_ratio5 ; most shallow decogas |
329 | |
330 divemode_check_decogases2: | 329 divemode_check_decogases2: |
331 incf hi,F ; increase | 330 incf hi,F ; increase |
332 rcall copy_decogas_info | 331 rcall copy_decogas_info |
333 movlw d'4' | 332 movlw d'4' |
334 cpfseq hi ; 4 Gases copied? | 333 cpfseq hi ; 4 Gases copied? |
337 ; Now, set change depth. Inactive gases get depth=0! | 336 ; Now, set change depth. Inactive gases get depth=0! |
338 | 337 |
339 read_int_eeprom d'27' ; read flag register | 338 read_int_eeprom d'27' ; read flag register |
340 movff EEDATA,hi ; temp | 339 movff EEDATA,hi ; temp |
341 | 340 |
342 read_int_eeprom d'28' ; read gas_change_depth Gas1 | 341 read_int_eeprom d'29' ; read gas_change_depth Gas2 |
343 movlw d'0' | 342 movlw d'0' |
344 btfsc hi,1 ; Skip if clear -> Skip if inactive | 343 btfsc hi,1 ; Skip if clear -> Skip if inactive |
345 movf EEDATA,W | 344 movf EEDATA,W |
346 movff WREG,char_I_deco_gas_change5 | 345 movff WREG,char_I_deco_gas_change5 |
347 | 346 |
348 read_int_eeprom d'29' ; read gas_change_depth Gas2 | 347 read_int_eeprom d'30' ; read gas_change_depth Gas3 |
349 movlw d'0' | 348 movlw d'0' |
350 btfsc hi,2 ; Skip if clear -> Skip if inactive | 349 btfsc hi,2 ; Skip if clear -> Skip if inactive |
351 movf EEDATA,W | 350 movf EEDATA,W |
352 movff WREG,char_I_deco_gas_change4 | 351 movff WREG,char_I_deco_gas_change4 |
353 | 352 |
354 read_int_eeprom d'30' ; read gas_change_depth Gas3 | 353 read_int_eeprom d'31' ; read gas_change_depth Gas4 |
355 movlw d'0' | 354 movlw d'0' |
356 btfsc hi,3 ; Skip if clear -> Skip if inactive | 355 btfsc hi,3 ; Skip if clear -> Skip if inactive |
357 movf EEDATA,W | 356 movf EEDATA,W |
358 movff WREG,char_I_deco_gas_change3 | 357 movff WREG,char_I_deco_gas_change3 |
359 | 358 |
360 read_int_eeprom d'31' ; read gas_change_depth Gas1 | 359 read_int_eeprom d'32' ; read gas_change_depth Gas5 |
361 movlw d'0' | 360 movlw d'0' |
362 btfsc hi,4 ; Skip if clear -> Skip if inactive | 361 btfsc hi,4 ; Skip if clear -> Skip if inactive |
363 movf EEDATA,W | 362 movf EEDATA,W |
364 movff WREG,char_I_deco_gas_change2 | 363 movff WREG,char_I_deco_gas_change2 |
364 | |
365 ; Debugger | |
366 call enable_rs232 | |
367 movff char_I_deco_He_ratio5,TXREG | |
368 call rs232_wait_tx ; wait for UART | |
369 movff char_I_deco_N2_ratio5,TXREG | |
370 call rs232_wait_tx ; wait for UART | |
371 movff char_I_deco_He_ratio4,TXREG | |
372 call rs232_wait_tx ; wait for UART | |
373 movff char_I_deco_N2_ratio4,TXREG | |
374 call rs232_wait_tx ; wait for UART | |
375 movff char_I_deco_He_ratio3,TXREG | |
376 call rs232_wait_tx ; wait for UART | |
377 movff char_I_deco_N2_ratio3,TXREG | |
378 call rs232_wait_tx ; wait for UART | |
379 movff char_I_deco_He_ratio2,TXREG | |
380 call rs232_wait_tx ; wait for UART | |
381 movff char_I_deco_N2_ratio2,TXREG | |
382 call rs232_wait_tx ; wait for UART | |
383 movff char_I_deco_gas_change5,TXREG | |
384 call rs232_wait_tx ; wait for UART | |
385 movff char_I_deco_gas_change4,TXREG | |
386 call rs232_wait_tx ; wait for UART | |
387 movff char_I_deco_gas_change3,TXREG | |
388 call rs232_wait_tx ; wait for UART | |
389 movff char_I_deco_gas_change2,TXREG | |
390 call rs232_wait_tx ; wait for UART | |
391 | |
365 return | 392 return |
366 | 393 |
367 copy_decogas_info: | 394 copy_decogas_info: |
368 movf hi,W ; Gas 1-4 | 395 movf hi,W ; Gas 1-4 |
369 mullw d'4' ; times 4... | 396 mullw d'4' ; times 4... |
389 return | 416 return |
390 | 417 |
391 reset_decompression_gases: ; reset the deco gas while in NDL | 418 reset_decompression_gases: ; reset the deco gas while in NDL |
392 ostc_debug 'F' ; Sends debug-information to screen if debugmode active | 419 ostc_debug 'F' ; Sends debug-information to screen if debugmode active |
393 clrf lo | 420 clrf lo |
394 movff lo, char_I_deco_gas_change ; clear | 421 movff lo,char_I_deco_gas_change5 |
395 movff lo, char_I_deco_N2_ratio ; clear | 422 movff lo,char_I_deco_gas_change4 |
396 movff lo, char_I_deco_He_ratio ; clear | 423 movff lo,char_I_deco_gas_change3 |
424 movff lo,char_I_deco_gas_change2 | |
425 ; movff lo, char_I_deco_gas_change ; clear | |
426 ; movff lo, char_I_deco_N2_ratio ; clear | |
427 ; movff lo, char_I_deco_He_ratio ; clear | |
397 ;call PLED_gaschange_DEBUG | 428 ;call PLED_gaschange_DEBUG |
398 return | 429 return |
399 | 430 |
400 calc_deko_divemode2: | 431 calc_deko_divemode2: |
401 bcf twosecupdate | 432 bcf twosecupdate |