| Routines

36469: Move and draw the Skylabs in Skylab Landing Bay

Used by the routine at 34574.
36469 | LD IY,32989 | Point IY at the first byte of the first vertical guardian definition at 32989
The Skylab-moving loop begins here.
36473 | LD A,(IY+0) | Pick up the first byte of the guardian definition
36476 | CP 255 | Have we dealt with all the Skylabs yet?
36478 | JP Z,34719 | If so, re-enter the main loop
36481 | LD A,(IY+2) | Pick up the Skylab's pixel y-coordinate
36484 | CP (IY+6) | Has it reached its crash site yet?
36487 | JR NC,36497 | Jump if so
36489 | ADD A,(IY+4) | Increment the Skylab's y-coordinate (moving it downwards)
36492 | LD (IY+2),A
36495 | JR 36527 |
The Skylab has reached its crash site. Start or continue its disintegration.
36497 | INC (IY+1) | Increment the animation frame
36500 | LD A,(IY+1) | Pick up the animation frame
36503 | CP 8 | Has the Skylab completely disintegrated yet?
36505 | JR NZ,36527 | Jump if not
36507 | LD A,(IY+5) | Reset the Skylab's pixel y-coordinate
36510 | LD (IY+2),A
36513 | LD A,(IY+3) | Add 8 to the Skylab's x-coordinate (wrapping around at the right side of the screen)
36516 | ADD A,8
36518 | AND 31
36520 | LD (IY+3),A
36523 | LD (IY+1),0 | Reset the animation frame to 0
Now that the Skylab's movement has been dealt with, time to draw it.
36527 | LD E,(IY+2) | Pick up the Skylab's pixel y-coordinate in E
36530 | RLC E | Point DE at the entry in the screen buffer address lookup table at 33536 that corresponds to the Skylab's pixel y-coordinate
36532 | LD D,131
36534 | LD A,(DE) | Point HL at the address of the Skylab's location in the screen buffer at 24576
36535 | ADD A,(IY+3)
36538 | LD L,A
36539 | INC DE
36540 | LD A,(DE)
36541 | LD H,A
36542 | LD A,(IY+1) | Pick up the animation frame (0-7)
36545 | RRCA | Multiply it by 32
36546 | RRCA
36547 | RRCA
36548 | LD E,A | Point DE at the graphic data for the corresponding Skylab sprite (at 33024+A)
36549 | LD D,129
36551 | LD C,1 | Draw the Skylab to the screen buffer at 24576
36553 | CALL 36852
36556 | JP NZ,36103 | Kill Willy if the Skylab collided with him
36559 | LD A,(IY+2) | Point HL at the address of the Skylab's location in the attribute buffer at 23552
36562 | AND 64
36564 | RLCA
36565 | RLCA
36566 | ADD A,92
36568 | LD H,A
36569 | LD A,(IY+2)
36572 | RLCA
36573 | RLCA
36574 | AND 224
36576 | OR (IY+3)
36579 | LD L,A
36580 | LD A,(IY+0) | Pick up the Skylab's attribute byte
36583 | CALL 36447 | Set the attribute bytes for the Skylab
The current guardian definition has been dealt with. Time for the next one.
36586 | LD DE,7 | Point IY at the first byte of the next vertical guardian definition
36589 | ADD IY,DE
36591 | JR 36473 | Jump back to deal with the next Skylab