Prev: $2AA9 Up: Map Next: $2AF9
$2AAA: Set MR CREAK's birth year
Used by the routines at $2BB0 and $2E13.
$2AAA LDA $D41B Generate a random value between $00 and $14.
$2AAD CMP #$15
$2AAF BCS $2AAA
$2AB1 ASL A Double it and add $D5. Now $D5<=A<=$FD and A is odd.
$2AB2 CLC
$2AB3 ADC #$D5
$2AB5 STA $A5 Store this value at $A5.
$2AB7 SEC Subtract 1. Now $D4<=A<=$FC and A is even.
$2AB8 SBC #$01
$2ABA PHA Save this value temporarily.
$2ABB LDA #$4D Initialise the battle year message address MSB at $1E to $4D.
$2ABD STA $1E
$2ABF PLA
$2AC0 AND #$7F Now $54<=A<=$7C and A is even.
$2AC2 CMP #$16 Is A less than $16?
$2AC4 BCC $2AE0 Branch if so (this never happens).
$2AC6 INC $1E Increment the message address MSB at $1E to $4E.
$2AC8 CMP #$2B Is A less than $2B?
$2ACA BCC $2AE0 Branch if so (this never happens).
$2ACC INC $1E Increment the message address MSB at $1E to $4F.
$2ACE CMP #$40 Is A less than $40?
$2AD0 BCC $2AE0 Branch if so (this never happens).
$2AD2 INC $1E Increment the message address MSB at $1E to $50.
$2AD4 CMP #$56 Is the random value less than $56?
$2AD6 BCC $2AE0 Branch if so.
$2AD8 INC $1E Increment the message address MSB at $1E to $51.
$2ADA CMP #$6B Is the random value less than $6B?
$2ADC BCC $2AE0 Branch if so.
$2ADE INC $1E Increment the message address MSB at $1E to $52.
$2AE0 ASL A Multiply A by 12.
$2AE1 ASL A
$2AE2 STA $57
$2AE4 ASL A
$2AE5 CLC
$2AE6 ADC $57
$2AE8 STA $1D Store this battle year message address LSB at $1D.
$2AEA LDY #$00 Copy the battle year to $94-$97.
$2AEC LDX #$00
$2AEE LDA ($1D),Y
$2AF0 STA $94,X
$2AF2 INX
$2AF3 INY
$2AF4 CPY #$04
$2AF6 BNE $2AEE
$2AF8 RTS
Prev: $2AA9 Up: Map Next: $2AF9