Prev: F5EC Up: Map Next: F658
F641: Get Level Digits
Converts the level of the active player into two digits using Convert_Base10, with a level of FF treated as 00. The units digit is returned in C and the tens digit in A.
Output
A Tens digit of the level
C Units digit of the level
Convert the active player's level into two digits.
Calculate_ActivePlayer_Level F641 LD A,($5EA0) If ActivePlayer_Level is not FF, jump to Calculate_Player_Level.
F644 CP $FF
F646 JR NZ,Calculate_Player_Level
F648 XOR A A=00.
This reads A into BC as two nibbles, e.g. level 21 would be 00010101 which returns 2101.
Calculate_Player_Level F649 CALL Convert_Base10 Call Convert_Base10.
F64C LD B,A B=A.
F64D AND %00001111 Keep only bits 0-3.
F64F LD C,A C=A.
Shift the tens digit down into A.
F650 LD A,B A=B.
F651 RRA Rotate the bits of A right four times.
F652 RRA
F653 RRA
F654 RRA
F655 AND %00001111 Keep only bits 0-3.
F657 RET Return.
Prev: F5EC Up: Map Next: F658