Routines |
Prev: E641 | Up: Map | Next: E6FA |
Used by the routine at E641.
|
||||
This routine cycles through the spell list at 6DFC, printing any spells that have been collected.
If the first byte of a spell's data set is 16, it means the spell has been collected and is available for display/selection.
Check whether it's up or down that's been pressed:
|
||||
E699 | LD C,A | Temp store for up/down flag: 1 = up, -1 (255) = down | ||
E69A | LD A,($EAA6) | Retrieve the counter flag set in the previous routine, used to create the incremental pitch sound effects as the player scrolls through the spells | ||
E69D | CP $00 | Skip next two instructions if zero (reached max pitch) | ||
E69F | JR Z,$E6A5 | |||
E6A1 | DEC A | Otherwise decrement... | ||
E6A2 | LD ($EAA6),A | ...and re-store. | ||
E6A5 | LD A,C | Retrieve the up/down flag value from C register | ||
E6A6 | CP $01 | Check if UP pressed. If not, run the following routine for DOWN. | ||
E6A8 | JR Z,$E6D1 | |||
DOWN pressed while in spell menu:
|
||||
E6AA | LD A,($EAE2) | Spell counter (up to 27 spells) for current spell | ||
E6AD | LD HL,($EAE3) | Address pointer for the current position in the spell list (spells at 6DFC) | ||
E6B0 | LD DE,$FFF0 | |||
E6B3 | CP $00 | If we don't currently have a counter position (byte at EAE2 is zero), then start at the end of the spell list ready to move up it | ||
E6B5 | JR NZ,$E6BE | |||
E6B7 | LD HL,($EB67) | Address pointer for the end of the spell list texts at 6FBC | ||
E6BA | LD A,($EB69) | Total number of spells (27) | ||
E6BD | INC A | Incremented ready for decrement at the start of the following loop | ||
E6BE | ADD HL,DE | Subtracts 16 from HL - first check is the data set for the last spell (MESSAGE) at 6FAC | ||
E6BF | DEC A | Decrement spell number counter (starts at 27) | ||
E6C0 | LD C,A | Store temporarily | ||
E6C1 | LD A,(HL) | Get 'spell collected' data byte | ||
E6C2 | CP $10 | Has the spell been collected (byte value = 16)? | ||
E6C4 | LD A,C | (Retrieve spell number counter) | ||
E6C5 | JR NZ,$E6B3 | If it hasn't been collected, keep checking the rest of the spells | ||
E6C7 | LD ($EAE2),A | Spell is available, so store the spell counter... | ||
E6CA | LD ($EAE3),HL | ...and the spell list address pointer | ||
E6CD | CALL $DF33 | Print the spell names on the scroll | ||
E6D0 | RET | |||
UP pressed while in spell menu:
|
||||
E6D1 | LD A,($EAE2) | Spell counter (up to 27 spells) for current spell | ||
E6D4 | LD C,A | |||
E6D5 | LD HL,($EAE3) | Address pointer for the current position in the spell list (spells at 6DFC) | ||
E6D8 | LD DE,$0010 | Offset for the spell address pointer to move down to the next spell | ||
E6DB | LD A,($EB69) | Total number of spells | ||
E6DE | CP C | Check if we've reached the end of the list... | ||
E6DF | JR NZ,$E6E8 | |||
E6E1 | LD HL,($EB65) | ...If so, switch to the start of the spell list | ||
E6E4 | LD C,$00 | ...and set the spell counter to zero | ||
E6E6 | JR $E6EA | |||
E6E8 | ADD HL,DE | Move down to next spell | ||
E6E9 | INC C | Increment the spell counter | ||
E6EA | LD A,(HL) | Get 'spell collected' data byte | ||
E6EB | CP $10 | Has the spell been collected (byte value = 16)? | ||
E6ED | JR NZ,$E6DB | If it hasn't been collected, keep checking the rest of the spells | ||
E6EF | LD A,C | Spell is available, so store the spell counter... | ||
E6F0 | LD ($EAE2),A | |||
E6F3 | LD ($EAE3),HL | ...and the spell list address pointer | ||
E6F6 | CALL $DF33 | Print the spell names on the scroll | ||
E6F9 | RET |
Prev: E641 | Up: Map | Next: E6FA |