Prev: 40795 Up: Map Next: 41090
41035: Start Robot Life
The handler for entity type 88, which is the robot at the start of a life. A block of the panel flashes while a counter counts down, and then the robot starts to materialise (type 64).
Input
IX Entity
StartRobotLife 41035 DEC (IX+6) Count down the timer of the entity, and jump to start the robot materialising when it reaches zero.
41038 JR Z,StartRobotLife_Materialise
41040 LD A,(IX+6) Fetch the timer.
41043 AND 3 Use the low two bits...
41045 PUSH AF ...to make a beep using MakeBeep on every fourth frame...
41046 CALL Z,MakeBeep ...by saving them...
41049 POP AF ...and restoring them.
41050 AND 2 Use bright black as the attribute, unless bit 1 of the timer is set...
41052 LD A,64
41054 JR Z,StartRobotLife_KeepAttribute
41056 OR 16 ...in which case add red paper.
StartRobotLife_KeepAttribute 41058 LD E,A Keep the attribute.
41059 LD HL,22617 Point HL at the attributes of a block of the panel...
41062 LD BC,1538 ...which is six characters wide (B) and two characters tall (C).
StartRobotLife_Row 41065 PUSH BC Save the dimensions...
41066 PUSH HL ...and the address of the start of the row.
StartRobotLife_Column 41067 LD A,(HL) Fetch an attribute...
41068 AND 7 ...keep the ink and combine it with the new attribute...
41070 OR E
41071 LD (HL),A ...and store it.
41072 INC L Move on to the next attribute.
41073 DJNZ StartRobotLife_Column Loop back until the row is done.
41075 POP HL Restore the address of the start of the row...
41076 LD BC,32 ...and move down to the next row.
41079 ADD HL,BC
41080 POP BC Restore the dimensions.
41081 DEC C Count down the rows.
41082 JR NZ,StartRobotLife_Row Loop back until both rows have been done.
41084 RET Return.
StartRobotLife_Materialise 41085 LD (IX+0),64 Start the robot materialising by setting its type to 64.
41089 RET Return.
Prev: 40795 Up: Map Next: 41090