[font="Courier New, Courier, mono"]; long jump score calculating routine [/font]
[font="Courier New, Courier, mono"]; score is calculated as follows :-[/font]
[font="Courier New, Courier, mono"]; for distances of 3.00m or above : ((whole metres jumped - 3) * 2000) + (centimetres * 20)[/font]
[font="Courier New, Courier, mono"]; no score for distances < 3.00m[/font]
[font="Courier New, Courier, mono"]; ENTRY: Y is pointing to the longest distance jumped (out of three) by the currently active player (4 bytes from $2b61)[/font]
[font="Courier New, Courier, mono"]; EXIT: the calculated score is stored from $2b74 (3 bytes)[/font]
[font="Courier New, Courier, mono"]
[/font]
[font="Courier New, Courier, mono"]D32E: A6 2C LDA,Y ; get tens of metres[/font]
[font="Courier New, Courier, mono"]D330: C6 28 LDB #$0A ; B = 10[/font]
[font="Courier New, Courier, mono"]D332: 3D MUL ; multiply tens of metres by 10, store result in B[/font]
[font="Courier New, Courier, mono"]D333: EB 03 ADDB $1,Y ; add metres to B[/font]
[font="Courier New, Courier, mono"]D335: C0 81 SUBB #$03 ; subtract 3 from B[/font]
[font="Courier New, Courier, mono"]D337: 25 33 BCS $D354 ; branch if less than 3 metres (no score for a jump of less than 3 metres)[/font]
[font="Courier New, Courier, mono"]D339: D7 DA STB $52 ; store result at $2852 (used as loop counter for routine @ $d514)[/font]
[font="Courier New, Courier, mono"]D33B: 27 2E BEQ $D343 ; branch if jump is > 3.00m and < 4.00m (no multiplier for the metres in this case)[/font]
[font="Courier New, Courier, mono"]D33D: CE 54 F6 LDU #$DC7E ; point U at the score lookup table (2000 points)[/font]
[font="Courier New, Courier, mono"]D340: BD F7 96 JSR $D514 ; calculate score for whole metres over 3, store at $2b74[/font]
[font="Courier New, Courier, mono"]D343: A6 00 LDA $2,Y ; get tens of centimetres[/font]
[font="Courier New, Courier, mono"]D345: C6 88 LDB #$0A ; B = 10[/font]
[font="Courier New, Courier, mono"]D347: 3D MUL ; multiply tens of centimetres by 10, store result in B[/font]
[font="Courier New, Courier, mono"]D348: EB 0B ADDB $3,Y ; add centimetres to B[/font]
[font="Courier New, Courier, mono"]D34A: D7 DA STB $52 ; store result at $2852 (loop counter for $d514)[/font]
[font="Courier New, Courier, mono"]D34C: 27 2E BEQ $D354 ; branch if centimetres are zero[/font]
[font="Courier New, Courier, mono"]D34E: CE 54 50 LDU #$DC72 ; point U at the score lookup table (20 points)[/font]
[font="Courier New, Courier, mono"]D351: BD 57 96 JSR $D514 ; calculate score for centimetres (as long as they are over zero), store at $2b76[/font]
[font="Courier New, Courier, mono"]D354: 39 RTS[/font]
[font="Courier New, Courier, mono"]
[/font]
[font="Courier New, Courier, mono"]; routine at $d514 calls a further routine at $d56f which does all the multiplying and decimally adjusts the result[/font]