Prev: E610 Up: Map Next: E699
E641: Main loop - handle spell menu and keyboard/joystick inputs
Used by the routine at C7D0.
E641 LD A,$01
E643 LD ($EB50),A Set graphic frame number/address pointer offset (no offset)
E646 LD A,$00
Deal with spell menu routines, depending on spells activated:
E648 LD ($EBB7),A General purpose byte used for a few different things - reset here
E64B LD A,($EAE1) Check what's been already drawn
E64E CP $08
E650 JP Z,$E677 If the spell list has already been printed, can skip the next few routines as they've been done
E653 CP $18 Energy bar printed
E655 JP Z,$E77E
E658 CP $20 MOVE spell selected
E65A JP Z,$E852
E65D CP $30 Spell cast requiring a controllable cursor icon, e.g. SERVANT, MISSILE
E65F JP Z,$E929
E662 CP $38 Spell selected that is the same as the currently active effect spell
E664 JP Z,$EA1D
E667 CALL $DEF9 Clear the Scroll status panel at the bottom of the screen
E66A CALL $DF33 Print spell names on the scroll
E66D LD A,$00
E66F LD ($EAEC),A Reset spell number/pointer (EAE6)
E672 LD A,$08
E674 LD ($EAE1),A Indicate that spell list has now been printed
Draw the pointer/selector arrow on the scroll:
E677 LD A,$85 Graphics address pointer offset for the scroll pointer arrow graphics at AFA6.
E679 CALL $E0C2 Set up the arrow graphic ready to draw
E67C LD DE,$5092 Screen address display position for the middle of the scroll, to draw the arrow pointer
E67F CALL $DD24 Draw the scroll arrow pointer
Next, check for key/control presses in the spell menu.
Check if the fire button is being pressed:
E682 LD A,($EB32) Check FIRE control flag (0 = not pressed, 1 = pressed)
E685 CP $00
E687 JR Z,$E68C
E689 JP $E6FA Launch spell selection routine if fire is pressed
Fire button not pressed - check for UP/DOWN:
E68C LD A,($EAFE) Get up/down flag: 1 = up, -1 (255) = down, 0 = not pressed
E68F CP $00 Check if it's pressed
E691 JR NZ,$E699
E693 LD A,$05 If it's not pressed, set this counter byte to 5 - it's used to determine an incremental series of 5 tones, while the player holds up/down to scroll through the spell list
E695 LD ($EAA6),A
E698 RET
Prev: E610 Up: Map Next: E699