```
dust cloud item number decision
dust cloud item number decision
021AA9F6 2019 mov r0, #0x19 //getting ready to check item/encounter
021AA9F8 0100 lsl r0, r0, #0x4 //set r0 to 0x190 for the comparison
021AA9FA 4281 cmp r1, r0 //compare our number based on the rng with the set value to determine the final outcome of the dustcloud
021AA9FC D200 bcs #0x21AAA00 //r1 > r0, true, move on down
rng advances here, another x1000 calc
021AB044 0400 lsl r0,r0,#0x10 //"cleaning up" x1000 calc, i guess
021AB046 0C00 lsr r0,r0,#0x10
021AB048 2864 cmp r0,#0x64 //compar the x1000 calc with 0x64,
021AB04A D20A bcs #0x21AB062 //branch if >= 0x64
021AB04C 1C20 mov r0,r4 //if it's less than 0x64, this is what happens- it keeps 3E8(1000)
021AB04E F65AFB6B bl #0x2005728 //straight back for the next item calc if less than 0x64
021AB062 3C32 sub r4,#0x32 //set r4 = 950
021AB064 42A0 cmp r0,r4 // compare 950 and 1000(always)
021AB066 D20D bcs #0x21AB084 //always false, keep going
021AB068 4808 ldr r0,=#0x6A4 // this will be used for the calc instead of 3E8
021AB06A F65AFB5D bl #0x2005728 //back for the next rng advance and calc
02005728 -- setting up to advance rng again, advance
0200574E -- heading to 64-bit mult again,(#0209C06C) but with 6A4 to multiply OR 3E8(1700 or 1000) depending on whether r0 was greater or less than 0x64
209C06C - mult out with 1000 or 1700, same setup as before, jump to r15 again - ok, starting here. the game multiplies out u32 *1700(or u32 *1000), the lower 32 bits are written to one register and thrown away, the rest is written to another register(what we would call >>32 is this, basically)
021AB06E 2164 mov r1, r0 - the game takes that 3-digit result and moves it to r0 to use for later
021AB070 F6F1E92A blx #0x209C2C8
0209C2C8 E3510000 cmp r1,#0x0 -- this is where the bullshit begins----------------useless starting here
0209C2CC 012FFF1E bxeq r14
0209C2D0 E1500001 cmp r0,r1
0209C2D4 31A01000 movcc r1,r0
0209C2D8 33A00000 movcc r0,#0x0
0209C2DC 312FFF1E bxcc r14
0209C2E0 E3A0201C mov r2,#0x1C
0209C2E4 E1A03220 mov r3,r0,lsr #0x4
0209C2E8 E1510623 cmp r1,r3,lsr #0xC
0209C2EC D2422010 suble r2,r2,#0x10
0209C2F0 D1A03823 movle r3,r3,lsr #0x10
0209C2F4 E1510223 cmp r1,r3,lsr #0x4
0209C2F8 D2422008 suble r2,r2,#0x8
0209C2FC D1A03423 movle r3,r3,lsr #0x8
0209C300 E1510003 cmp r1,r3
0209C304 D2422004 suble r2,r2,#0x4
0209C308 D1A03223 movle r3,r3,lsr #0x4-------------------------------------useless part ends here
0209c30c e1a00210 mov r0,r0,lsl r2 -- left-shift r0 by 28 - take the 3-digit value and left-shift by 28 bits, removing the upper 2 values and leaving a single digit as "X0000000"
0209C310 E2611000 rsb r1,r1,#0x0-ignore
0209C314 E0900000 adds r0,r0,r0 -- add r0 to itself(double r0) -- r0 * 2, basically- "(2X)0000000"
0209C318 E0822082 add r2,r2,r2,lsl #0x1-ignore
0209C31C E08FF102 add r15,r15,r2,lsl #0x2-ignore
0209C320 E1A00000 nopskips a huge part of the math
---big skipped area
0209C474 E0B13083 adcs r3,r1,r3,lsl #0x1
0209C478 30433001 subcc r3,r3,r1
0209C47C E0B00000 adcs r0,r0,r0 - add with carry (2X)0000000
0209C480 E0B13083 adcs r3,r1,r3,lsl #0x1
0209C484 30433001 subcc r3,r3,r1
0209C488 E0B00000 adcs r0,r0,r0 - (2X)0000000
0209C48C E0B13083 adcs r3,r1,r3,lsl #0x1
0209C490 30433001 subcc r3,r3,r1
0209C494 E0B00000 adcs r0,r0,r0 - (2X)0000000
0209C498 E0B13083 adcs r3,r1,r3,lsl #0x1
0209C49C 30433001 subcc r3,r3,r1
0209C4A0 E0B00000 adcs r0,r0,r0 - (2X)0000000 -- these later add with carrys start to move the value back to the right. by the last one, the value is on the right again, single digit"0000000X"
0209C4A4 E1A01003 mov r1,r3
0209C4A8 E12FFF1E bx r14
021AB074 0400 lsl r0,r0,#0x10 - left-shift that value by 16
021AB076 0C01 lsr r1,r0,#0x10 - right shift by 16 to clear out u16
021AB078 2089 mov r0,#0x89- 137 in dec(no idea?)
021AB07A 0080 lsl r0,r0,#0x2 - this makes 0x89 into 0x224
021AB07C 1808 add r0,r1,r0 - add 224 + X from before to give us a gem item value
021AB07E 0400 lsl r0,r0,#0x10 - clear off same as before via left-right shifts
021AB080 0C00 lsr r0,r0,#0x10
021AB082 BD10 pop {r4,r15} - function is done, go back!
```