Prev: 64627 Up: Map Next: 64687
64637: If do-not-draw-storm-cloud flag is set then prepare to draw storm cloud
This routine is only called when the Storm Cloud and Magic Knight are both in the same room.
If the do-not-draw-storm-cloud flag is set, then the display file address at which to draw the Storm Cloud is calculated, and the correct frame in the Storm Cloud graphic data at 25176 is determined. After this, the flag is reset, ensuring that the Storm Cloud can redrawn at its new position by the routine at 64687.
Used by the routine at 40008.
64637 LD A,(64688) If do-not-draw-storm-cloud flag is reset...
64640 OR A ...
64641 RET Z ...then return
64642 LD A,(23701) Load BC with Storm Cloud's apparent x-coordinate (characters)...
64645 RRCA ...
64646 RRCA ...
64647 RRCA ...
64648 AND 31 ...
64650 LD C,A ...
64651 LD B,0 ...
64653 LD HL,16544 Load HL with display file address for top pixel row of cell at character coordinates (0, 5)
64656 ADD HL,BC Add BC to HL as offset...
64657 LD (64704),HL ...and store at 64704
64660 LD A,(23701) Load HL with Storm Cloud's apparent x-coordinate (pixel-within-character)...
64663 AND 7 ...
64665 ADD A,A ...multiplied by 128...
64666 ADD A,A ...as each Storm Cloud frame graphic is 128 bytes long...
64667 ADD A,A ...
64668 ADD A,A ...
64669 LD L,A ...
64670 LD H,0 ...
64672 ADD HL,HL ...
64673 ADD HL,HL ...
64674 ADD HL,HL ...
64675 LD BC,25176 Load BC with start address of Storm Cloud graphic data...
64678 ADD HL,BC ...and add HL as offset in HL to give address of required frame's graphic data
64679 LD (64708),HL Store graphic's start address at 64708
64682 XOR A Reset do-not-draw-storm-cloud flag...
64683 LD (64688),A ...
64686 RET Return
Prev: 64627 Up: Map Next: 64687