Prev: 40153 Up: Map Next: 40190
40177: Decrease Magic Knight's current strength by one every fourth call
Used by the routine at 40190.
The operand of the instruction at 40177 represents the number of calls since the last time Magic Knight's strength was decreased, which happens once every four calls. This is modified by the instruction at 40182.
40177 LD A,0 Load A with number of cycles since last call...
40179 INC A ...and increase by one
40180 AND 3 Clear all but bits 0 and 1...
40182 LD (40178),A ...and store at 40178
40185 RET NZ If value is not zero (i.e. four cycles have not elapsed since last decrease) then return
40186 LD B,1 Decrease Magic Knight's strength by one and return...
40188 JR 40155 ...
Prev: 40153 Up: Map Next: 40190