Skip to navigation

Revs on the BBC Micro

Dashboard: AnimateTyres

Name: AnimateTyres [Show more] Type: Subroutine Category: Dashboard Summary: Update screen memory to animate the tyres
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ScreenHandler calls AnimateTyres
.AnimateTyres INC irqCounter \ Increment irqCounter, so it gets incremented every \ time the IRQ routine reaches section 4 of the custom \ screen LDA playerSpeedHi \ Set tyreTravel = tyreTravel + playerSpeedHi + 48 CLC ADC #48 ADC tyreTravel STA tyreTravel BCC tyre4 \ If the addition didn't overflow, jump to tyre4 to \ return from the subroutine LDA playerMoving \ If playerMoving = 0 then the player's car is not BEQ tyre4 \ moving so we don't need to animate the tyres, so jump \ to tyre4 to return from the subroutine LDX #4 \ Set a loop counter to go from 4 to 0 .tyre1 LDA tyreLeft3,X \ Set tyreLeft3 = tyreLeft3 EOR tyreTreadLeft EOR tyreTreadLeft,X STA tyreLeft3,X LDA tyreRight3,X \ Set tyreRight3 = tyreRight3 EOR tyreTreadRight EOR tyreTreadRight,X STA tyreRight3,X CPX #3 \ If X >= 3, jump to tyre2 to skip the following BCS tyre2 LDA tyreLeft1,X \ Flip the top four bits of tyreLeft1 EOR #%11110000 STA tyreLeft1,X LDA tyreRight2,X \ Flip the top four bits of tyreRight2 EOR #%11110000 STA tyreRight2,X BNE tyre3 \ If A is non-zero, jump to tyre3 to continue the loop .tyre2 LDA tyreLeft2,X \ Flip bits 6 and 7 of tyreLeft2 EOR #%11000000 STA tyreLeft2,X LDA tyreRight1,X \ Flip bits 4 and 5 of tyreRight1 EOR #%00110000 STA tyreRight1,X .tyre3 DEX \ Decrement the loop counter BPL tyre1 \ Loop back to animate the next tyre part .tyre4 RTS \ Return from the subroutine