comparison src/tft_outputs.asm @ 317:7b64c0ba6a7e new_screen_layout

VSIbar #3c: extra steps to keep calculation clear
author janos_kovacs <kovjanos@gmail.com>
date Thu, 11 Jun 2015 13:40:14 +0100
parents c6c934f05b42
children 6d8c82fe5a01
comparison
equal deleted inserted replaced
316:c6c934f05b42 317:7b64c0ba6a7e
1003 movff xC+0,sub_b+0 ; multiplier 1003 movff xC+0,sub_b+0 ; multiplier
1004 movff xC+2,sub_b+1 ; offset 1004 movff xC+2,sub_b+1 ; offset
1005 ;bra TFT_velocity_VSIbar_com 1005 ;bra TFT_velocity_VSIbar_com
1006 1006
1007 TFT_velocity_VSIbar_com: 1007 TFT_velocity_VSIbar_com:
1008 clrf divB
1008 ; multiply 1009 ; multiply
1009 movff divA+0,xA+0 1010 movff divA+0,xA+0
1010 clrf xA+1 1011 clrf xA+1
1011 movff sub_b+0,xB+0 1012 movff sub_b+0,xB+0
1012 clrf xB+1 1013 clrf xB+1
1013 call mult16x16 ; xA*xB=xC 1014 call mult16x16 ; xA*xB=xC
1014 movlw .1 1015 movlw .1
1015 cpfslt xC+3 1016 cpfslt xC+3
1016 bra TFT_velocity_VSIbar_max 1017 bra TFT_velocity_VSIbar_max
1018 movlw .1
1017 cpfslt xC+2 1019 cpfslt xC+2
1018 bra TFT_velocity_VSIbar_max 1020 bra TFT_velocity_VSIbar_max
1021 movlw .1
1019 cpfslt xC+1 1022 cpfslt xC+1
1020 bra TFT_velocity_VSIbar_max 1023 bra TFT_velocity_VSIbar_max
1021 ; add offset 1024 ; add offset
1022 movff sub_b+1,WREG 1025 movff sub_b+1,WREG
1023 addwf xC+0,1 1026 addwf xC+0,1
1095 ; divA+0=0 is descend, clear everything if it's actually zero 1098 ; divA+0=0 is descend, clear everything if it's actually zero
1096 movlw .0 1099 movlw .0
1097 cpfsgt divA+0 1100 cpfsgt divA+0
1098 bra TFT_velocity_VSIbar_desc_clr 1101 bra TFT_velocity_VSIbar_desc_clr
1099 1102
1103 clrf divB
1100 ; Desc uses a single multiplier/offset value: *1 / +3 1104 ; Desc uses a single multiplier/offset value: *1 / +3
1101 movlw .1 1105 movlw .1
1102 movff WREG,sub_b+0 ; multiplier 1106 movff WREG,sub_b+0 ; multiplier
1103 movlw .3 1107 movlw .3
1104 movff WREG,sub_b+1 ; offset 1108 movff WREG,sub_b+1 ; offset
1109 clrf xB+1 1113 clrf xB+1
1110 call mult16x16 ; xA*xB=xC 1114 call mult16x16 ; xA*xB=xC
1111 movlw .1 1115 movlw .1
1112 cpfslt xC+3 1116 cpfslt xC+3
1113 bra TFT_velocity_VSIbar_desc_max 1117 bra TFT_velocity_VSIbar_desc_max
1118 movlw .1
1114 cpfslt xC+2 1119 cpfslt xC+2
1115 bra TFT_velocity_VSIbar_desc_max 1120 bra TFT_velocity_VSIbar_desc_max
1121 movlw .1
1116 cpfslt xC+1 1122 cpfslt xC+1
1117 bra TFT_velocity_VSIbar_desc_max 1123 bra TFT_velocity_VSIbar_desc_max
1118 ; add offset 1124 ; add offset
1119 movff sub_b+1,WREG 1125 movff sub_b+1,WREG
1120 addwf xC+0,1 1126 addwf xC+0,1