Prev: 9F5B Up: Map Next: A082
A04B: Start Robot Life
The handler for entity type 58, 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 40).
Input
IX Entity
StartRobotLife A04B DEC (IX+$06) Count down the timer of the entity, and jump to start the robot materialising when it reaches zero.
A04E JR Z,StartRobotLife_Materialise
A050 LD A,(IX+$06) Fetch the timer.
A053 AND $03 Use the low two bits...
A055 PUSH AF ...to make a beep using MakeBeep on every fourth frame...
A056 CALL Z,MakeBeep ...by saving them...
A059 POP AF ...and restoring them.
A05A AND $02 Use bright black as the attribute, unless bit 1 of the timer is set...
A05C LD A,$40
A05E JR Z,StartRobotLife_KeepAttribute
A060 OR $10 ...in which case add red paper.
StartRobotLife_KeepAttribute A062 LD E,A Keep the attribute.
A063 LD HL,$5859 Point HL at the attributes of a block of the panel...
A066 LD BC,$0602 ...which is six characters wide (B) and two characters tall (C).
StartRobotLife_Row A069 PUSH BC Save the dimensions...
A06A PUSH HL ...and the address of the start of the row.
StartRobotLife_Column A06B LD A,(HL) Fetch an attribute...
A06C AND $07 ...keep the ink and combine it with the new attribute...
A06E OR E
A06F LD (HL),A ...and store it.
A070 INC L Move on to the next attribute.
A071 DJNZ StartRobotLife_Column Loop back until the row is done.
A073 POP HL Restore the address of the start of the row...
A074 LD BC,$0020 ...and move down to the next row.
A077 ADD HL,BC
A078 POP BC Restore the dimensions.
A079 DEC C Count down the rows.
A07A JR NZ,StartRobotLife_Row Loop back until both rows have been done.
A07C RET Return.
StartRobotLife_Materialise A07D LD (IX+$00),$40 Start the robot materialising by setting its type to 40.
A081 RET Return.
Prev: 9F5B Up: Map Next: A082