![]() |
Routines |
Prev: 36469 | Up: Map |
Used by the routine at 34574.
|
|||||||
36593 | LD IY,32989 | Point IY at the first byte of the first vertical guardian definition at 32989 | |||||
The guardian-moving loop begins here.
|
|||||||
36597 | LD A,(IY+0) | Pick up the first byte of the guardian definition | |||||
36600 | CP 255 | Have we dealt with all the guardians yet? | |||||
36602 | RET Z | Return if so | |||||
36603 | INC (IY+1) | Increment the guardian's animation frame | |||||
36606 | RES 2,(IY+1) | Reset the animation frame to 0 if it overflowed to 4 | |||||
36610 | LD A,(IY+2) | Pick up the guardian's pixel y-coordinate | |||||
36613 | ADD A,(IY+4) | Add the current y-coordinate increment | |||||
36616 | CP (IY+5) | Has the guardian reached the highest point of its path (minimum y-coordinate)? | |||||
36619 | JR C,36631 | If so, jump to change its direction of movement | |||||
36621 | CP (IY+6) | Has the guardian reached the lowest point of its path (maximum y-coordinate)? | |||||
36624 | JR NC,36631 | If so, jump to change its direction of movement | |||||
36626 | LD (IY+2),A | Update the guardian's pixel y-coordinate | |||||
36629 | JR 36639 | ||||||
36631 | LD A,(IY+4) | Negate the y-coordinate increment; this changes the guardian's direction of movement | |||||
36634 | NEG | ||||||
36636 | LD (IY+4),A | ||||||
Now that the guardian's movement has been dealt with, time to draw it.
|
|||||||
36639 | LD A,(IY+2) | Pick up the guardian's pixel y-coordinate | |||||
36642 | AND 127 | Point DE at the entry in the screen buffer address lookup table at 33536 that corresponds to the guardian's pixel y-coordinate | |||||
36644 | RLCA | ||||||
36645 | LD E,A | ||||||
36646 | LD D,131 | ||||||
36648 | LD A,(DE) | Point HL at the address of the guardian's location in the screen buffer at 24576 | |||||
36649 | OR (IY+3) | ||||||
36652 | LD L,A | ||||||
36653 | INC DE | ||||||
36654 | LD A,(DE) | ||||||
36655 | LD H,A | ||||||
36656 | LD A,(IY+1) | Pick up the guardian's animation frame (0-3) | |||||
36659 | RRCA | Multiply it by 32 | |||||
36660 | RRCA | ||||||
36661 | RRCA | ||||||
36662 | LD E,A | Point DE at the graphic data for the appropriate guardian sprite (at 33024+A) | |||||
36663 | LD D,129 | ||||||
36665 | LD C,1 | Draw the guardian to the screen buffer at 24576 | |||||
36667 | CALL 36852 | ||||||
36670 | JP NZ,36102 | Kill Willy if the guardian collided with him | |||||
36673 | LD A,(IY+2) | Pick up the guardian's pixel y-coordinate | |||||
36676 | AND 64 | Point HL at the address of the guardian's location in the attribute buffer at 23552 | |||||
36678 | RLCA | ||||||
36679 | RLCA | ||||||
36680 | ADD A,92 | ||||||
36682 | LD H,A | ||||||
36683 | LD A,(IY+2) | ||||||
36686 | RLCA | ||||||
36687 | RLCA | ||||||
36688 | AND 224 | ||||||
36690 | OR (IY+3) | ||||||
36693 | LD L,A | ||||||
36694 | LD A,(IY+0) | Pick up the guardian's attribute byte | |||||
36697 | CALL 36447 | Set the attribute bytes for the guardian | |||||
The current guardian definition has been dealt with. Time for the next one.
|
|||||||
36700 | LD DE,7 | Point IY at the first byte of the next vertical guardian definition | |||||
36703 | ADD IY,DE | ||||||
36705 | JR 36597 | Jump back to deal with the next vertical guardian |
Prev: 36469 | Up: Map |