Skip to navigation


Drivers: AddRacePoints

Name: AddRacePoints [Show more] Type: Subroutine Category: Drivers Summary: Add the race points to the driver's total points
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * AwardRacePoints calls AddRacePoints

Arguments: X The race position whose points should be added Y The driver who receives those points, i.e. who has then added to their total accumulated points
.AddRacePoints SED \ Set the D flag to switch arithmetic to Binary Coded \ Decimal (BCD) LDA totalPointsLo,Y \ Add (0 racePointsHi racePointsLo) for position X to CLC \ (totalPointsTop totalPointsHi totalPointsLo) for ADC racePointsLo,X \ driver Y, starting with the low bytes STA totalPointsLo,Y LDA totalPointsHi,Y \ And then the high bytes ADC racePointsHi,X STA totalPointsHi,Y LDA totalPointsTop,Y \ And then the top bytes ADC #0 STA totalPointsTop,Y CLD \ Clear the D flag to switch arithmetic to normal RTS \ Return from the subroutine