Prev: F5D3 Up: Map Next: F64B
F5F1: Room logic : School Lane
First, draw the electricity wire.
F5F1 LD HL,$5DE7 Point HL to the screen buffer. (5B00)
F5F4 LD DE,$0020 Set DE to the amount to move forward by for each row.
F5F7 LD BC,$F5D3 Set BC to the data table. (F5D3)
F5FA LD (HL),$00 Reset all pixels on the first row.
F5FC ADD HL,DE Move to the next row.
F5FD LD (HL),$FF Set all pixels.
F5FF ADD HL,DE Move to the next row.
F600 LD (HL),$00 Reset all pixels.
F602 AND A Move back up to the initial row.
F603 SBC HL,DE
F605 SBC HL,DE
F607 LD A,(BC) Get the next byte.
F608 INC BC Move to the next place in the buffer.
F609 CP $FF Is it an end marker?
F60B JR Z,$F61D Jump foward if it is.
F60D OR A Is the data 0?
F60E JR Z,$F61A Jump forward if it isn't.
F610 CP $01 Is the data 1?
F612 JR NZ,$F617 Jump forward if it is.
F614 ADD HL,DE Otherwise move to the next row.
F615 JR $F61A
F617 AND A Move up a row.
F618 SBC HL,DE
F61A INC HL Move to the next column and repeat.
F61B JR $F5FA
Now set the main data for the room.
F61D LD A,$06 Moving objects decrease endurance by 6.
F61F LD ($F26E),A
F622 LD IX,$F5BE Point IX at the movement table.
F626 LD B,$03 3 lightning bolts to draw.
F628 PUSH BC Store BC.
F629 LD A,$0D Is flag 0D (Asteroids game won) set?
F62B CALL $EC1D
F62E LD BC,$F5CA Point BC at the first bounds table. (F5CA)
F631 JR NZ,$F636 If the flag is set, skip the next bit.
F633 LD BC,$F5CE Otherwise point BC at the second bounds table. (F5CE)
F636 CALL $EF35 Update moving objects.
F639 LD A,($F5D2) Get the next object ID to print.
F63C XOR $02 Invert bit 2, so the ID alternates between 38 and 3A.
F63E LD ($F5D2),A Set this for the next object ID.
F641 CALL $A8A0 Draw moving objects.
F644 CALL $E329 Check for collision detection.
F647 POP BC Restore BC.
F648 DJNZ $F628 Loop while there are more lighting bolts to draw.
F64A RET Return.
Prev: F5D3 Up: Map Next: F64B