Mercurial > public > hwos_code
comparison src/simulator.asm @ 81:8e13866b5496
add some extra safety checks when settings were altered from the PC software
author | mh@mh-THINK.localdomain |
---|---|
date | Fri, 28 Feb 2014 11:03:18 +0100 |
parents | ec4d8503ec45 |
children | f2201aa374db |
comparison
equal
deleted
inserted
replaced
80:db920ca01491 | 81:8e13866b5496 |
---|---|
65 | 65 |
66 global get_first_dil_to_WREG | 66 global get_first_dil_to_WREG |
67 get_first_dil_to_WREG: ; Gets first dil (0-4) into WREG | 67 get_first_dil_to_WREG: ; Gets first dil (0-4) into WREG |
68 lfsr FSR1,opt_dil_type ; Point to dil types | 68 lfsr FSR1,opt_dil_type ; Point to dil types |
69 clrf lo ; start with Gas0 | 69 clrf lo ; start with Gas0 |
70 bra get_first_gas_to_WREG2 ; Start | 70 get_first_dil_to_WREG2: |
71 movf lo,W ; | |
72 movf PLUSW1,W ; Get Type of Dil #lo | |
73 sublw .1 ; it is = 1 (First Dil) | |
74 bz get_first_dil_to_WREG3 ; Found the first dil! | |
75 incf lo,F ; ++ | |
76 movlw NUM_GAS+1 | |
77 cpfseq lo ; All done? | |
78 bra get_first_dil_to_WREG2 ; Not yet | |
79 ; No first dil found, use #1 | |
80 movlw .1 | |
81 movff WREG,opt_dil_type+0 ; Set Dil1 to First | |
82 return | |
83 get_first_dil_to_WREG3: | |
84 movf lo,W ; Put into Wreg | |
85 return ; Done | |
71 | 86 |
72 global get_first_gas_to_WREG | 87 global get_first_gas_to_WREG |
73 get_first_gas_to_WREG: ; Gets first gas (0-4) into WREG | 88 get_first_gas_to_WREG: ; Gets first gas (0-4) into WREG |
74 lfsr FSR1,opt_gas_type ; Point to gas types | 89 lfsr FSR1,opt_gas_type ; Point to gas types |
75 clrf lo ; start with Gas0 | 90 clrf lo ; start with Gas0 |
80 bz get_first_gas_to_WREG3 ; Found the first gas! | 95 bz get_first_gas_to_WREG3 ; Found the first gas! |
81 incf lo,F ; ++ | 96 incf lo,F ; ++ |
82 movlw NUM_GAS+1 | 97 movlw NUM_GAS+1 |
83 cpfseq lo ; All done? | 98 cpfseq lo ; All done? |
84 bra get_first_gas_to_WREG2 ; Not yet | 99 bra get_first_gas_to_WREG2 ; Not yet |
85 retlw .1 ; No first gas found, use #1 | 100 ; No first gas found, use #1 |
101 movlw .1 | |
102 movff WREG,opt_gas_type+0 ; Set Gas1 to First | |
103 return | |
86 get_first_gas_to_WREG3: | 104 get_first_gas_to_WREG3: |
87 movf lo,W ; Put into Wreg | 105 movf lo,W ; Put into Wreg |
88 return ; Done | 106 return ; Done |
89 | 107 |
90 deco_setup: | 108 deco_setup: |