Routines |
Prev: B5DC | Up: Map | Next: B6AE |
Used by the routines at B52E and Calculate_ActivePlayer_Level.
|
||||||||||||
For an example, given A=16 - the output is 00100010.
First count the number of "10's" in A.
|
||||||||||||
Convert_Base10 | B699 | LD BC,$000A | BC=000A. | |||||||||
Convert_Base10_Loop | B69C | INC B | Increment B counter. | |||||||||
B69D | SUB C | A-=0A. | ||||||||||
B69E | JR NC,Convert_Base10_Loop | Jump back to Convert_Base10_Loop until there's a carry amount. | ||||||||||
B6A0 | ADD A,C | A+=C. | ||||||||||
B6A1 | DEC B | Decrease the counter in B by one to account for the carry. | ||||||||||
B6A2 | SLA B | Shift and rotate B four times. | ||||||||||
B6A4 | SLA B | |||||||||||
B6A6 | SLA B | |||||||||||
B6A8 | SLA B | |||||||||||
B6AA | AND %00001111 | Keep only bits 0-3. | ||||||||||
B6AC | OR B | Set the bits from B. | ||||||||||
B6AD | RET | Return. |
Prev: B5DC | Up: Map | Next: B6AE |