Prev: 58896 Up: Map Next: 59033
58945: Main loop - handle spell menu and keyboard/joystick inputs
Used by the routine at 51152.
58945 LD A,1
58947 LD (60240),A Set graphic frame number/address pointer offset (no offset)
58950 LD A,0
Deal with spell menu routines, depending on spells activated:
58952 LD (60343),A General purpose byte used for a few different things - reset here
58955 LD A,(60129) Check what's been already drawn
58958 CP 8
58960 JP Z,58999 If the spell list has already been printed, can skip the next few routines as they've been done
58963 CP 24 Energy bar printed
58965 JP Z,59262
58968 CP 32 MOVE spell selected
58970 JP Z,59474
58973 CP 48 Spell cast requiring a controllable cursor icon, e.g. SERVANT, MISSILE
58975 JP Z,59689
58978 CP 56 Spell selected that is the same as the currently active effect spell
58980 JP Z,59933
58983 CALL 57081 Clear the Scroll status panel at the bottom of the screen
58986 CALL 57139 Print spell names on the scroll
58989 LD A,0
58991 LD (60140),A Reset spell number/pointer (60134)
58994 LD A,8
58996 LD (60129),A Indicate that spell list has now been printed
Draw the pointer/selector arrow on the scroll:
58999 LD A,133 Graphics address pointer offset for the scroll pointer arrow graphics at 44966.
59001 CALL 57538 Set up the arrow graphic ready to draw
59004 LD DE,20626 Screen address display position for the middle of the scroll, to draw the arrow pointer
59007 CALL 56612 Draw the scroll arrow pointer
Next, check for key/control presses in the spell menu.
Check if the fire button is being pressed:
59010 LD A,(60210) Check FIRE control flag (0 = not pressed, 1 = pressed)
59013 CP 0
59015 JR Z,59020
59017 JP 59130 Launch spell selection routine if fire is pressed
Fire button not pressed - check for UP/DOWN:
59020 LD A,(60158) Get up/down flag: 1 = up, -1 (255) = down, 0 = not pressed
59023 CP 0 Check if it's pressed
59025 JR NZ,59033
59027 LD A,5 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
59029 LD (60070),A
59032 RET
Prev: 58896 Up: Map Next: 59033