Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 281:f8f865c70a0d
no more sorted gaslist...
author | heinrichsweikamp |
---|---|
date | Tue, 19 Apr 2011 09:54:33 +0200 |
parents | a728b4a1b660 |
children | 5351d47ee28a |
comparison
equal
deleted
inserted
replaced
280:ce6f861d4e3e | 281:f8f865c70a0d |
---|---|
333 btfss dekostop_active | 333 btfss dekostop_active |
334 bra reset_decompression_gases ; While in NDL, do not set deompression gas | 334 bra reset_decompression_gases ; While in NDL, do not set deompression gas |
335 | 335 |
336 divemode_check_decogases: ; CALLed from Simulator | 336 divemode_check_decogases: ; CALLed from Simulator |
337 ; Copy active gases to char_I_deco_N2_ratio and char_I_deco_He_ratio | 337 ; Copy active gases to char_I_deco_N2_ratio and char_I_deco_He_ratio |
338 read_int_eeprom d'97' ; Read He ratio | 338 read_int_eeprom d'5' ; Read He ratio |
339 movff EEDATA,char_I_deco_He_ratio+4 ; And copy into hold register | 339 movff EEDATA,char_I_deco_He_ratio+4 ; And copy into hold register |
340 read_int_eeprom d'96' ; Read O2 ratio | 340 read_int_eeprom d'4' ; Read O2 ratio |
341 movff char_I_deco_He_ratio+4, wait_temp ; copy into bank1 register | 341 movff char_I_deco_He_ratio+4, wait_temp ; copy into bank1 register |
342 bsf STATUS,C ; | 342 bsf STATUS,C ; |
343 movlw d'100' ; 100% | 343 movlw d'100' ; 100% |
344 subfwb wait_temp,W ; minus He | 344 subfwb wait_temp,W ; minus He |
345 subfwb EEDATA,F ; minus O2 | 345 subfwb EEDATA,F ; minus O2 |
346 movff EEDATA, char_I_deco_N2_ratio+4; = N2! | 346 movff EEDATA, char_I_deco_N2_ratio+4; = N2! |
347 | 347 |
348 read_int_eeprom d'101' ; Read He ratio | 348 read_int_eeprom d'9' ; Read He ratio |
349 movff EEDATA,char_I_deco_He_ratio+3 ; And copy into hold register | 349 movff EEDATA,char_I_deco_He_ratio+3 ; And copy into hold register |
350 read_int_eeprom d'100' ; Read O2 ratio | 350 read_int_eeprom d'8' ; Read O2 ratio |
351 movff char_I_deco_He_ratio+3, wait_temp ; copy into bank1 register | 351 movff char_I_deco_He_ratio+3, wait_temp ; copy into bank1 register |
352 bsf STATUS,C ; | 352 bsf STATUS,C ; |
353 movlw d'100' ; 100% | 353 movlw d'100' ; 100% |
354 subfwb wait_temp,W ; minus He | 354 subfwb wait_temp,W ; minus He |
355 subfwb EEDATA,F ; minus O2 | 355 subfwb EEDATA,F ; minus O2 |
356 movff EEDATA, char_I_deco_N2_ratio+3; = N2! | 356 movff EEDATA, char_I_deco_N2_ratio+3; = N2! |
357 | 357 |
358 read_int_eeprom d'105' ; Read He ratio | 358 read_int_eeprom d'13' ; Read He ratio |
359 movff EEDATA,char_I_deco_He_ratio+2 ; And copy into hold register | 359 movff EEDATA,char_I_deco_He_ratio+2 ; And copy into hold register |
360 read_int_eeprom d'104' ; Read O2 ratio | 360 read_int_eeprom d'12' ; Read O2 ratio |
361 movff char_I_deco_He_ratio+2, wait_temp ; copy into bank1 register | 361 movff char_I_deco_He_ratio+2, wait_temp ; copy into bank1 register |
362 bsf STATUS,C ; | 362 bsf STATUS,C ; |
363 movlw d'100' ; 100% | 363 movlw d'100' ; 100% |
364 subfwb wait_temp,W ; minus He | 364 subfwb wait_temp,W ; minus He |
365 subfwb EEDATA,F ; minus O2 | 365 subfwb EEDATA,F ; minus O2 |
366 movff EEDATA, char_I_deco_N2_ratio+2; = N2! | 366 movff EEDATA, char_I_deco_N2_ratio+2; = N2! |
367 | 367 |
368 read_int_eeprom d'109' ; Read He ratio | 368 read_int_eeprom d'17' ; Read He ratio |
369 movff EEDATA,char_I_deco_He_ratio+1 ; And copy into hold register | 369 movff EEDATA,char_I_deco_He_ratio+1 ; And copy into hold register |
370 read_int_eeprom d'108' ; Read O2 ratio | 370 read_int_eeprom d'16' ; Read O2 ratio |
371 movff char_I_deco_He_ratio+1, wait_temp ; copy into bank1 register | 371 movff char_I_deco_He_ratio+1, wait_temp ; copy into bank1 register |
372 bsf STATUS,C ; | 372 bsf STATUS,C ; |
373 movlw d'100' ; 100% | 373 movlw d'100' ; 100% |
374 subfwb wait_temp,W ; minus He | 374 subfwb wait_temp,W ; minus He |
375 subfwb EEDATA,F ; minus O2 | 375 subfwb EEDATA,F ; minus O2 |
376 movff EEDATA, char_I_deco_N2_ratio+1; = N2! | 376 movff EEDATA, char_I_deco_N2_ratio+1; = N2! |
377 | 377 |
378 read_int_eeprom d'113' ; Read He ratio | 378 read_int_eeprom d'21' ; Read He ratio |
379 movff EEDATA,char_I_deco_He_ratio+0; And copy into hold register | 379 movff EEDATA,char_I_deco_He_ratio+0; And copy into hold register |
380 read_int_eeprom d'112' ; Read O2 ratio | 380 read_int_eeprom d'20' ; Read O2 ratio |
381 movff char_I_deco_He_ratio+0, wait_temp ; copy into bank1 register | 381 movff char_I_deco_He_ratio+0, wait_temp ; copy into bank1 register |
382 bsf STATUS,C ; | 382 bsf STATUS,C ; |
383 movlw d'100' ; 100% | 383 movlw d'100' ; 100% |
384 subfwb wait_temp,W ; minus He | 384 subfwb wait_temp,W ; minus He |
385 subfwb EEDATA,F ; minus O2 | 385 subfwb EEDATA,F ; minus O2 |
386 movff EEDATA, char_I_deco_N2_ratio+0; = N2! | 386 movff EEDATA, char_I_deco_N2_ratio+0; = N2! |
387 | 387 |
388 ; Now, set change depth. Inactive gases have depth=0! | 388 read_int_eeprom d'28' ; read gas_change_depth Gas1 |
389 read_int_eeprom d'118' ; read gas_change_depth Gas1 | |
390 btfss sorted_gaslist_active,0 ; Apply depth? | 389 btfss sorted_gaslist_active,0 ; Apply depth? |
391 clrf EEDATA ; No, clear! | 390 clrf EEDATA ; No, clear! |
392 movff EEDATA,char_I_deco_gas_change+4 ; Yes! | 391 movff EEDATA,char_I_deco_gas_change+4 ; Yes! |
393 | 392 |
394 read_int_eeprom d'119' ; read gas_change_depth Gas2 | 393 read_int_eeprom d'29' ; read gas_change_depth Gas2 |
395 btfss sorted_gaslist_active,1 ; Apply depth? | 394 btfss sorted_gaslist_active,1 ; Apply depth? |
396 clrf EEDATA ; No, clear! | 395 clrf EEDATA ; No, clear! |
397 movff EEDATA,char_I_deco_gas_change+3 ; Yes! | 396 movff EEDATA,char_I_deco_gas_change+3 ; Yes! |
398 | 397 |
399 read_int_eeprom d'120' ; read gas_change_depth Gas3 | 398 read_int_eeprom d'30' ; read gas_change_depth Gas3 |
400 btfss sorted_gaslist_active,2 ; Apply depth? | 399 btfss sorted_gaslist_active,2 ; Apply depth? |
401 clrf EEDATA ; No, clear! | 400 clrf EEDATA ; No, clear! |
402 movff EEDATA,char_I_deco_gas_change+2 ; Yes! | 401 movff EEDATA,char_I_deco_gas_change+2 ; Yes! |
403 | 402 |
404 read_int_eeprom d'121' ; read gas_change_depth Gas4 | 403 read_int_eeprom d'31' ; read gas_change_depth Gas4 |
405 btfss sorted_gaslist_active,3 ; Apply depth? | 404 btfss sorted_gaslist_active,3 ; Apply depth? |
406 clrf EEDATA ; No, clear! | 405 clrf EEDATA ; No, clear! |
407 movff EEDATA,char_I_deco_gas_change+1 ; Yes! | 406 movff EEDATA,char_I_deco_gas_change+1 ; Yes! |
408 | 407 |
409 read_int_eeprom d'122' ; read gas_change_depth Gas5 | 408 read_int_eeprom d'32' ; read gas_change_depth Gas5 |
410 btfss sorted_gaslist_active,4 ; Apply depth? | 409 btfss sorted_gaslist_active,4 ; Apply depth? |
411 clrf EEDATA ; No, clear! | 410 clrf EEDATA ; No, clear! |
412 movff EEDATA,char_I_deco_gas_change+0 ; Yes! | 411 movff EEDATA,char_I_deco_gas_change+0 ; Yes! |
412 | |
413 | |
414 ; read_int_eeprom d'97' ; Read He ratio | |
415 ; movff EEDATA,char_I_deco_He_ratio+4 ; And copy into hold register | |
416 ; read_int_eeprom d'96' ; Read O2 ratio | |
417 ; movff char_I_deco_He_ratio+4, wait_temp ; copy into bank1 register | |
418 ; bsf STATUS,C ; | |
419 ; movlw d'100' ; 100% | |
420 ; subfwb wait_temp,W ; minus He | |
421 ; subfwb EEDATA,F ; minus O2 | |
422 ; movff EEDATA, char_I_deco_N2_ratio+4; = N2! | |
423 ; | |
424 ; read_int_eeprom d'101' ; Read He ratio | |
425 ; movff EEDATA,char_I_deco_He_ratio+3 ; And copy into hold register | |
426 ; read_int_eeprom d'100' ; Read O2 ratio | |
427 ; movff char_I_deco_He_ratio+3, wait_temp ; copy into bank1 register | |
428 ; bsf STATUS,C ; | |
429 ; movlw d'100' ; 100% | |
430 ; subfwb wait_temp,W ; minus He | |
431 ; subfwb EEDATA,F ; minus O2 | |
432 ; movff EEDATA, char_I_deco_N2_ratio+3; = N2! | |
433 ; | |
434 ; read_int_eeprom d'105' ; Read He ratio | |
435 ; movff EEDATA,char_I_deco_He_ratio+2 ; And copy into hold register | |
436 ; read_int_eeprom d'104' ; Read O2 ratio | |
437 ; movff char_I_deco_He_ratio+2, wait_temp ; copy into bank1 register | |
438 ; bsf STATUS,C ; | |
439 ; movlw d'100' ; 100% | |
440 ; subfwb wait_temp,W ; minus He | |
441 ; subfwb EEDATA,F ; minus O2 | |
442 ; movff EEDATA, char_I_deco_N2_ratio+2; = N2! | |
443 ; | |
444 ; read_int_eeprom d'109' ; Read He ratio | |
445 ; movff EEDATA,char_I_deco_He_ratio+1 ; And copy into hold register | |
446 ; read_int_eeprom d'108' ; Read O2 ratio | |
447 ; movff char_I_deco_He_ratio+1, wait_temp ; copy into bank1 register | |
448 ; bsf STATUS,C ; | |
449 ; movlw d'100' ; 100% | |
450 ; subfwb wait_temp,W ; minus He | |
451 ; subfwb EEDATA,F ; minus O2 | |
452 ; movff EEDATA, char_I_deco_N2_ratio+1; = N2! | |
453 ; | |
454 ; read_int_eeprom d'113' ; Read He ratio | |
455 ; movff EEDATA,char_I_deco_He_ratio+0; And copy into hold register | |
456 ; read_int_eeprom d'112' ; Read O2 ratio | |
457 ; movff char_I_deco_He_ratio+0, wait_temp ; copy into bank1 register | |
458 ; bsf STATUS,C ; | |
459 ; movlw d'100' ; 100% | |
460 ; subfwb wait_temp,W ; minus He | |
461 ; subfwb EEDATA,F ; minus O2 | |
462 ; movff EEDATA, char_I_deco_N2_ratio+0; = N2! | |
463 ; | |
464 ; Now, set change depth. Inactive gases have depth=0! | |
465 ; read_int_eeprom d'118' ; read gas_change_depth Gas1 | |
466 ; btfss sorted_gaslist_active,0 ; Apply depth? | |
467 ; clrf EEDATA ; No, clear! | |
468 ; movff EEDATA,char_I_deco_gas_change+4 ; Yes! | |
469 ; | |
470 ; read_int_eeprom d'119' ; read gas_change_depth Gas2 | |
471 ; btfss sorted_gaslist_active,1 ; Apply depth? | |
472 ; clrf EEDATA ; No, clear! | |
473 ; movff EEDATA,char_I_deco_gas_change+3 ; Yes! | |
474 ; | |
475 ; read_int_eeprom d'120' ; read gas_change_depth Gas3 | |
476 ; btfss sorted_gaslist_active,2 ; Apply depth? | |
477 ; clrf EEDATA ; No, clear! | |
478 ; movff EEDATA,char_I_deco_gas_change+2 ; Yes! | |
479 ; | |
480 ; read_int_eeprom d'121' ; read gas_change_depth Gas4 | |
481 ; btfss sorted_gaslist_active,3 ; Apply depth? | |
482 ; clrf EEDATA ; No, clear! | |
483 ; movff EEDATA,char_I_deco_gas_change+1 ; Yes! | |
484 ; | |
485 ; read_int_eeprom d'122' ; read gas_change_depth Gas5 | |
486 ; btfss sorted_gaslist_active,4 ; Apply depth? | |
487 ; clrf EEDATA ; No, clear! | |
488 ; movff EEDATA,char_I_deco_gas_change+0 ; Yes! | |
413 | 489 |
414 ; Debugger | 490 ; Debugger |
415 ; call enable_rs232 | 491 ; call enable_rs232 |
416 ; movff char_I_deco_He_ratio+4,TXREG | 492 ; movff char_I_deco_He_ratio+4,TXREG |
417 ; call rs232_wait_tx ; wait for UART | 493 ; call rs232_wait_tx ; wait for UART |
944 movwf xB+0 | 1020 movwf xB+0 |
945 clrf xB+1 | 1021 clrf xB+1 |
946 call div16x16 ; compute depth in full m -> result in xC+0 | 1022 call div16x16 ; compute depth in full m -> result in xC+0 |
947 | 1023 |
948 check_gas_change1: ; check gas1 | 1024 check_gas_change1: ; check gas1 |
949 read_int_eeprom d'27' ; read flag register | 1025 ; read_int_eeprom d'27' ; read flag register |
1026 movff sorted_gaslist_active,EEDATA ; Get flag register | |
950 btfss EEDATA,0 ; check active flag | 1027 btfss EEDATA,0 ; check active flag |
951 bra check_gas_change2 ; skip inactive gases! | 1028 bra check_gas_change2 ; skip inactive gases! |
952 movlw d'1' | 1029 movlw d'1' |
953 cpfseq active_gas ; is this gas currently selected? | 1030 cpfseq active_gas ; is this gas currently selected? |
954 bra check_gas_change1x ; No... | 1031 bra check_gas_change1x ; No... |
965 subwf EEDATA,W ; Change depth-3m | 1042 subwf EEDATA,W ; Change depth-3m |
966 cpfslt xC+0 ; current depth<Change depth-3m? | 1043 cpfslt xC+0 ; current depth<Change depth-3m? |
967 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1044 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
968 | 1045 |
969 check_gas_change2: ; check gas2 | 1046 check_gas_change2: ; check gas2 |
970 read_int_eeprom d'27' ; read flag register | 1047 ; read_int_eeprom d'27' ; read flag register |
1048 movff sorted_gaslist_active,EEDATA ; Get flag register | |
971 btfss EEDATA,1 ; check active flag | 1049 btfss EEDATA,1 ; check active flag |
972 bra check_gas_change3 ; skip inactive gases! | 1050 bra check_gas_change3 ; skip inactive gases! |
973 movlw d'2' | 1051 movlw d'2' |
974 cpfseq active_gas ; is this gas currently selected? | 1052 cpfseq active_gas ; is this gas currently selected? |
975 bra check_gas_change2x ; No... | 1053 bra check_gas_change2x ; No... |
986 subwf EEDATA,W ; Change depth-3m | 1064 subwf EEDATA,W ; Change depth-3m |
987 cpfslt xC+0 ; current depth<Change depth-3m? | 1065 cpfslt xC+0 ; current depth<Change depth-3m? |
988 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1066 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
989 | 1067 |
990 check_gas_change3: ; check gas3 | 1068 check_gas_change3: ; check gas3 |
991 read_int_eeprom d'27' ; read flag register | 1069 ; read_int_eeprom d'27' ; read flag register |
1070 movff sorted_gaslist_active,EEDATA ; Get flag register | |
992 btfss EEDATA,2 ; check active flag | 1071 btfss EEDATA,2 ; check active flag |
993 bra check_gas_change4 ; skip inactive gases! | 1072 bra check_gas_change4 ; skip inactive gases! |
994 movlw d'3' | 1073 movlw d'3' |
995 cpfseq active_gas ; is this gas currently selected? | 1074 cpfseq active_gas ; is this gas currently selected? |
996 bra check_gas_change3x ; No... | 1075 bra check_gas_change3x ; No... |
1007 subwf EEDATA,W ; Change depth-3m | 1086 subwf EEDATA,W ; Change depth-3m |
1008 cpfslt xC+0 ; current depth<Change depth-3m? | 1087 cpfslt xC+0 ; current depth<Change depth-3m? |
1009 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1088 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1010 | 1089 |
1011 check_gas_change4: ; check gas4 | 1090 check_gas_change4: ; check gas4 |
1012 read_int_eeprom d'27' ; read flag register | 1091 ; read_int_eeprom d'27' ; read flag register |
1092 movff sorted_gaslist_active,EEDATA ; Get flag register | |
1013 btfss EEDATA,3 ; check active flag | 1093 btfss EEDATA,3 ; check active flag |
1014 bra check_gas_change5 ; skip inactive gases! | 1094 bra check_gas_change5 ; skip inactive gases! |
1015 movlw d'4' | 1095 movlw d'4' |
1016 cpfseq active_gas ; is this gas currently selected? | 1096 cpfseq active_gas ; is this gas currently selected? |
1017 bra check_gas_change4x ; No... | 1097 bra check_gas_change4x ; No... |
1028 subwf EEDATA,W ; Change depth-3m | 1108 subwf EEDATA,W ; Change depth-3m |
1029 cpfslt xC+0 ; current depth<Change depth-3m? | 1109 cpfslt xC+0 ; current depth<Change depth-3m? |
1030 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1110 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1031 | 1111 |
1032 check_gas_change5: ; check gas5 | 1112 check_gas_change5: ; check gas5 |
1033 read_int_eeprom d'27' ; read flag register | 1113 ; read_int_eeprom d'27' ; read flag register |
1114 movff sorted_gaslist_active,EEDATA ; Get flag register | |
1034 btfss EEDATA,4 ; check active flag | 1115 btfss EEDATA,4 ; check active flag |
1035 bra check_gas_change6 ; skip inactive gases! | 1116 bra check_gas_change6 ; skip inactive gases! |
1036 movlw d'5' | 1117 movlw d'5' |
1037 cpfseq active_gas ; is this gas currently selected? | 1118 cpfseq active_gas ; is this gas currently selected? |
1038 bra check_gas_change5x ; No... | 1119 bra check_gas_change5x ; No... |
1773 bsf STATUS,C ; Borrow bit | 1854 bsf STATUS,C ; Borrow bit |
1774 subfwb EEDATA,F ; minus O2 | 1855 subfwb EEDATA,F ; minus O2 |
1775 movff EEDATA, char_I_N2_ratio ; = N2! | 1856 movff EEDATA, char_I_N2_ratio ; = N2! |
1776 | 1857 |
1777 ; Configure sorted_gaslist_active flag register | 1858 ; Configure sorted_gaslist_active flag register |
1778 clrf sorted_gaslist_active ; Clear all flags | 1859 read_int_eeprom d'27' |
1779 read_int_eeprom d'118' ; read gas_change_depth Gas1 | 1860 movff EEDATA, sorted_gaslist_active |
1780 tstfsz EEDATA ; =0m? | 1861 return |
1781 bsf sorted_gaslist_active,0 ; No, Set Flag for Gas1 | 1862 |
1782 | 1863 |
1783 read_int_eeprom d'119' ; read gas_change_depth Gas2 | 1864 ; |
1784 tstfsz EEDATA ; =0m? | 1865 ; clrf sorted_gaslist_active ; Clear all flags |
1785 bsf sorted_gaslist_active,1 ; No, Set Flag for Gas2 | 1866 ; read_int_eeprom d'118' ; read gas_change_depth Gas1 |
1786 | 1867 ; tstfsz EEDATA ; =0m? |
1787 read_int_eeprom d'120' ; read gas_change_depth Gas3 | 1868 ; bsf sorted_gaslist_active,0 ; No, Set Flag for Gas1 |
1788 tstfsz EEDATA ; =0m? | 1869 ; |
1789 bsf sorted_gaslist_active,2 ; No, Set Flag for Gas3 | 1870 ; read_int_eeprom d'119' ; read gas_change_depth Gas2 |
1790 | 1871 ; tstfsz EEDATA ; =0m? |
1791 read_int_eeprom d'121' ; read gas_change_depth Gas4 | 1872 ; bsf sorted_gaslist_active,1 ; No, Set Flag for Gas2 |
1792 tstfsz EEDATA ; =0m? | 1873 ; |
1793 bsf sorted_gaslist_active,3 ; No, Set Flag for Gas4 | 1874 ; read_int_eeprom d'120' ; read gas_change_depth Gas3 |
1794 | 1875 ; tstfsz EEDATA ; =0m? |
1795 read_int_eeprom d'122' ; read gas_change_depth Gas5 | 1876 ; bsf sorted_gaslist_active,2 ; No, Set Flag for Gas3 |
1796 tstfsz EEDATA ; =0m? | 1877 ; |
1797 bsf sorted_gaslist_active,4 ; No, Set Flag for Gas5 | 1878 ; read_int_eeprom d'121' ; read gas_change_depth Gas4 |
1798 return | 1879 ; tstfsz EEDATA ; =0m? |
1880 ; bsf sorted_gaslist_active,3 ; No, Set Flag for Gas4 | |
1881 ; | |
1882 ; read_int_eeprom d'122' ; read gas_change_depth Gas5 | |
1883 ; tstfsz EEDATA ; =0m? | |
1884 ; bsf sorted_gaslist_active,4 ; No, Set Flag for Gas5 | |
1885 ; return | |
1886 ; |