Skip to navigation


Drawing lines: DrawIndicatorHand

Name: DrawIndicatorHand [Show more] Type: Subroutine Category: Drawing lines Summary: Apply min and max limits to an indicator value and draw a hand on the indicator
Arguments: A The value to show on the indicator X The indicator number (0-6)
.DrawIndicatorHand \ When we get here, the values of A are set as follows: \ \ * X = 0: Compass A = 0 to 73 \ * X = 1: Airspeed A = 9 to 74 \ * X = 2: Altimeter small hand A = 0 to 254 \ * X = 3: Altimeter large hand A = 0 to 104 \ * X = 4: Vertical speed A = -40 to 40 \ * X = 5: Turn A = -19 to 19 \ * X = 6: Slip A = ??? to ??? CLC \ Set A = A + the X-th byte of indicatorBase ADC indicatorBase,X \ \ This adds the relevant indicator's base value from the \ indicatorBase table to give the following: \ \ * Compass +0 A = 0 to 73 \ * Airspeed +48 A = 57 to 122 \ * Altimeter small hand +0 A = 0 to 254 \ * Altimeter large hand +0 A = 0 to 104 \ * Vertical speed +67 A = 27 to 107 \ * Turn +53 A = 34 to 72 \ * Slip +106 A = ??? to ??? CMP indicatorMin,X \ If A >= the X-th byte of indicatorMin, jump to dinh1 BCS dinh1 \ to skip the following LDA indicatorMin,X \ Set A to the X-th byte of indicatorMin, so A is at \ least the relevant value in indicatorMin BCC dinh2 \ Jump to dinh2 to skip the following, as we don't need \ to check the maximum limit (this BCC is effectively a \ JMP as we passed through the BCS above) .dinh1 \ If we get here then A >= the X-th byte of indicatorMin CMP indicatorMax,X \ If A >= the X-th byte of indicatorMax, jump to dinh2 BCC dinh2 \ to skip the following LDA indicatorMax,X \ Set A to the X-th byte of indicatorMax, so A is no \ more than the relevant value in indicatorMax .dinh2 \ A is now clipped to this indicator's range as given in \ the indicatorMin and indicatorMax tables, so the final \ ranges are: \ \ * Compass A = 0 to 73 \ * Airspeed A = 57 to 122 \ * Altimeter small hand A = 0 to 254 \ * Altimeter large hand A = 0 to 104 \ * Vertical speed A = 30 to 104 \ * Turn A = 33 to 72 \ * Slip A = 91 to 120 STA H \ Store the clipped indicator value in H JSR GetHandVector \ Calculate the vector for drawing the new dial hand \ with value A, returning the result in W, G and R \ Fall through into DrawIndicatorLine to draw the new \ hand on the indicator