|  | Routines | 
| Prev: 46490 | Up: Map | Next: 46742 | 
| 
 | ||||||||
| 46560 | ADD A,A | Multiply value of A by eight... | ||||||
| 46561 | ADD A,A | ... | ||||||
| 46562 | ADD A,A | ... | ||||||
| 46563 | LD C,A | Store in C | ||||||
| 46564 | LD B,0 | Set B to zero | ||||||
| 46566 | LD IX,46752 | Set IX to point to data for axes | ||||||
| 46570 | ADD IX,BC | Add eight times axe number as offset to IX pointer | ||||||
| 46572 | LD C,(IX+0) | Load axe's x-coordinate into C | ||||||
| 46575 | LD B,(IX+1) | Load axe's y-coordinate into B | ||||||
| 46578 | PUSH BC | Store BC | ||||||
| 46579 | LD (23677),BC | Load BC into coordinate storage | ||||||
| 46583 | LD A,(IX+4) | Load A with axe's current frame number | ||||||
| 46586 | PUSH IX | Store IX | ||||||
| 46588 | CALL 63040 | Draw axe to screen | ||||||
| 46591 | POP IX | Restore IX | ||||||
| 46593 | POP BC | Restore BC | ||||||
| 46594 | LD A,(IX+2) | Load x-velocity into A | ||||||
| 46597 | ADD A,C | Add x-coordinate to A | ||||||
| 46598 | LD C,A | Load new x-coordinate back into C | ||||||
| 46599 | LD A,(IX+3) | Load y-velocity into A | ||||||
| 46602 | ADD A,B | Add y-coordinate to A | ||||||
| 46603 | LD B,A | Load new y-coordinate back into B | ||||||
| 46604 | LD (IX+0),C | Update data with new x-... | ||||||
| 46607 | LD (IX+1),B | ...and y-coordinates | ||||||
| 46610 | LD (23677),BC | Update coordinate storage | ||||||
| 46614 | LD A,(IX+4) | Load A with axe frame data | ||||||
| 46617 | SUB 116 | Subtract 116 (frame number of first axe frame) to get "absolute frame number" (see trivia) | ||||||
| 46619 | INC A | Advance absolute frame number by one | ||||||
| 46620 | AND 3 | Cap absolute frame number to 3, and wrap round from 3 to 0 as there are only four frames | ||||||
| 46622 | ADD A,116 | Add 116 to absolute frame number to give relative frame number again | ||||||
| 46624 | LD (IX+4),A | Store new frame number | ||||||
| 46627 | PUSH IX | Store IX | ||||||
| 46629 | CALL 63040 | Draw axe to screen | ||||||
| 46632 | POP IX | Restore IX | ||||||
| 46634 | LD A,(IX+0) | Load x-coordinate of axe | ||||||
| 46637 | OR A | If x-coordinate is zero... | ||||||
| 46638 | CALL Z,46742 | ...multiply x "velocity" by minus one | ||||||
| 46641 | CP 244 | If x-coordinate is 244... | ||||||
| 46643 | CALL Z,46742 | ...multiply x "velocity" by minus one | ||||||
| 46646 | INC IX | Temporarily advance IX pointer to work with y "velocities" | ||||||
| 46648 | LD A,(IX+0) | Load y-coordinate of axe | ||||||
| 46651 | CP 172 | If y-coordinate is 172... | ||||||
| 46653 | CALL Z,46742 | ...multiply y "velocity" by minus one | ||||||
| 46656 | CP 100 | If y-coordinate is 100... | ||||||
| 46658 | CALL Z,46742 | ...multiply y "velocity" by minus one | ||||||
| 46661 | DEC IX | Move IX back one again (reversing instruction at 46646) | ||||||
| 46663 | LD A,(24840) | Load A with Magic Knight's current x-coordinate | ||||||
| 46666 | LD B,A | Copy into B | ||||||
| 46667 | LD A,(IX+0) | Load A with x-coordinate of axe | ||||||
| 46670 | ADD A,6 | Add 6 to x-coordinate of axe | ||||||
| 46672 | SUB B | Subtract B to get x-distance between Magic Knight and the axe, plus 6 | ||||||
| 46673 | CP 21 | If this value is not less than 21 then... | ||||||
| 46675 | JP NC,46741 | ...return | ||||||
| 46678 | LD A,(24841) | Else, load B with Magic Knight's y-coordinate... | ||||||
| 46681 | LD B,A | ... | ||||||
| 46682 | LD A,(IX+1) | Load A with y-coordinate of axe (uses same coordinate system as PLOT command, i.e. y=0 is at bottom of screen) | ||||||
| 46685 | SUB B | Subtract B to get y-distance between Magic Knight and the axe | ||||||
| 46686 | CP 39 | If this value is not less than 39 then... | ||||||
| 46688 | JP NC,46741 | ...return | ||||||
| 46691 | LD A,30 | If Magic Knight is wearing the Shield... | ||||||
| 46693 | CALL 45505 | ... | ||||||
| 46696 | JP Z,46719 | ...then skip ahead to 46719 | ||||||
| 46699 | LD A,(24768) | Else, decrease Magic Knight's current strength by one... | ||||||
| 46702 | DEC A | ... | ||||||
| 46703 | LD (24768),A | ... | ||||||
| 46706 | CALL 46463 | Print Magic Knight's current strength at (6, 2) as text if he is carrying the Mirror | ||||||
| 46709 | LD A,(24768) | Load Magic Knight's current strength into A... | ||||||
| 46712 | OR A | If Magic Knight's strength is zero... | ||||||
| 46713 | LD HL,51071 | ...point HL to "YOU DIED OF EXHAUSTION" text... | ||||||
| 46716 | JP Z,64582 | ...and jump to "game over" window routine and exit | ||||||
| 46719 | LD C,32 | Set C to 32 (number of times to repeat loop below) | ||||||
| 46721 | LD A,16 | Set speaker bit... | ||||||
| 46723 | OUT (254),A | ... | ||||||
| 46725 | LD A,R | Load A with random number between 0 - 15 (as R register increases with each instruction executed)... | ||||||
| 46727 | AND 15 | ... | ||||||
| 46729 | LD B,A | Load value into B | ||||||
| 46730 | DJNZ 46730 | Pause by repeating this line B times | ||||||
| 46732 | XOR A | Set A to zero | ||||||
| 46733 | OUT (254),A | Reset speaker bit | ||||||
| 46735 | DEC C | Decrease C... | ||||||
| 46736 | JR NZ,46721 | ...and repeat loop if C is not zero | ||||||
| 46738 | XOR A | Reset speaker bit... | ||||||
| 46739 | OUT (254),A | ... | ||||||
| 46741 | RET | Return | ||||||
| Prev: 46490 | Up: Map | Next: 46742 |