Prev: A082 Up: Map Next: A0C9
A091: Recharge Battery
Used by the routines at StartRobot and LoseLife.
Recharges the battery fully and shows the number of lives that are left, using a small picture of the robot followed by the number.
Before After
recharge-battery-before recharge-battery-after
RechargeBattery A091 LD A,$74 Set the level of the battery to the maximum of 74...
A093 LD ($963B),A ...as the target level.
A096 LD C,$46 Use bright yellow as the attribute...
A098 CALL SetBatteryAttributes ...and set the attributes of the battery bar using SetBatteryAttributes.
A09B LD A,($968C) This fetch has no effect, as A is replaced immediately.
A09E LD HL,$60E7 Point HL at the address of the sprite that is the picture of the robot...
A0A1 LD E,(HL) ...and fetch it into DE.
A0A2 INC HL
A0A3 LD D,(HL)
A0A4 LD HL,$57E0 Point HL at the position in the display file where the picture of the robot is drawn.
A0A7 LD A,($968B) Fetch the number of lives.
A0AA AND A Skip the picture if there are none left.
A0AB JR Z,RechargeBattery_ShowLives
A0AD LD C,A Keep the number.
A0AE INC DE Move on to the height byte of the sprite.
A0AF CALL DrawIcon Draw the picture using DrawIcon.
RechargeBattery_ShowLives A0B2 LD A,($968B) Fetch the number of lives.
A0B5 ADD A,$B0 Convert it into a digit with bit 7 set...
A0B7 LD ($A0CA),A ...and write it into the text.
A0BA LD HL,($5C36) Fetch the character set that the game uses...
A0BD LD ($9618),HL ...and use it to print text.
A0C0 LD HL,$A818 Point HL at the position of the number of lives.
A0C3 LD DE,$A0C9 Point DE at Text_Lives.
A0C6 JP PrintDoubleHeightText Print the number in double height characters using PrintDoubleHeightText.
Prev: A082 Up: Map Next: A0C9