Prev: 55218 Up: Map Next: 55233
55219: Update characters' stats as they tire or regenerate
Used by the routine at 55077.
Input
A A character's stat (strength, stamina, happiness or spell power)
C An increment (while asleep) or decrement (while awake) for that stat
Output
A New value of stat
55219 ADD A,C Add stat and data together
55220 OR A Check sign flag
55221 JP P,55226 If sign flag reset (i.e. MSB is reset and result is positive) then jump ahead to 55226
55224 XOR A else stat must have dropped below zero, so set stat to zero (as it can't be less than 0)
55225 RET Return
55226 CP 100 If new value of stat is less than or equal to 100...
55228 RET Z ...then return...
55229 RET C ...
55230 LD A,100 ...else set stat to 100 (as it can't be greater than 100)
55232 RET Return
Prev: 55218 Up: Map Next: 55233