Prev: 41090 Up: Map Next: 41161
41105: 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 41105 LD A,116 Set the level of the battery to the maximum of 116...
41107 LD (38459),A ...as the target level.
41110 LD C,70 Use bright yellow as the attribute...
41112 CALL SetBatteryAttributes ...and set the attributes of the battery bar using SetBatteryAttributes.
41115 LD A,(38540) This fetch has no effect, as A is replaced immediately.
41118 LD HL,24807 Point HL at the address of the sprite that is the picture of the robot...
41121 LD E,(HL) ...and fetch it into DE.
41122 INC HL
41123 LD D,(HL)
41124 LD HL,22496 Point HL at the position in the display file where the picture of the robot is drawn.
41127 LD A,(38539) Fetch the number of lives.
41130 AND A Skip the picture if there are none left.
41131 JR Z,RechargeBattery_ShowLives
41133 LD C,A Keep the number.
41134 INC DE Move on to the height byte of the sprite.
41135 CALL DrawIcon Draw the picture using DrawIcon.
RechargeBattery_ShowLives 41138 LD A,(38539) Fetch the number of lives.
41141 ADD A,176 Convert it into a digit with bit 7 set...
41143 LD (41162),A ...and write it into the text.
41146 LD HL,(23606) Fetch the character set that the game uses...
41149 LD (38424),HL ...and use it to print text.
41152 LD HL,43032 Point HL at the position of the number of lives.
41155 LD DE,41161 Point DE at Text_Lives.
41158 JP PrintDoubleHeightText Print the number in double height characters using PrintDoubleHeightText.
Prev: 41090 Up: Map Next: 41161