|  | Routines | 
| Prev: 45963 | Up: Map | Next: 46183 | 
| 
 | ||||||||
| 46106 | LD (46138),HL | Load list start address into operand of instruction at 46137 | ||||||
| 46109 | PUSH HL | Store HL (start address of list of characters) | ||||||
| 46110 | CALL 47938 | Play short downward scale sound | ||||||
| 46113 | POP HL | Restore HL (start address of list of characters) | ||||||
| 46114 | LD DE,49060 | Point DE at y-coordinate of top edge of window 3 in window data table at 49034... | ||||||
| 46117 | LD A,(HL) | Load required window height from start of list of characters... | ||||||
| 46118 | CALL 45625 | ...and set window's height to this value | ||||||
| 46121 | LD A,3 | Display character selection menu... | ||||||
| 46123 | CALL 47185 | ... | ||||||
| 46126 | LD HL,51367 | Print "WHO DO YOU WANT TO " text... | ||||||
| 46129 | CALL 46902 | ... | ||||||
| 46132 | POP HL | Restore HL (address to return to upon RET instruction)... | ||||||
| 46133 | EX (SP),HL | ...and swap with next value on stack (pointer to text that was PUSHed before this routine was called) | ||||||
| 46134 | CALL 46902 | Print the text ("TRAVEL TO" or "SUMMON") | ||||||
| 
The operand of the instruction at 46137 represents the start address of the list of characters. This is modified by the instruction at 46106.
 | ||||||||
| 46137 | LD HL,0 | Load HL with start address of list of characters | ||||||
| 46140 | INC HL | Advance HL by one byte | ||||||
| 46141 | LD A,(HL) | If value at HL is 255 (end marker)... | ||||||
| 46142 | CP 255 | ... | ||||||
| 46144 | JR Z,46165 | ...then skip ahead to 46165 | ||||||
| 46146 | PUSH HL | Store HL (current position in list of characters) | ||||||
| 46147 | LD (41937),A | Set character at current position in list to be Current Character | ||||||
| 46150 | LD HL,50753 | Point HL to text printing instruction to move cursor to start of next character row within window, then right by two characters and print | ||||||
| 46153 | CALL 46902 | |||||||
| 46156 | LD HL,45800 | Point HL at instruction to print full name of Current Character... | ||||||
| 46159 | CALL 46902 | ...and print | ||||||
| 46162 | POP HL | Restore HL (current position in list of characters) | ||||||
| 46163 | JR 46140 | Loop back to 46140 for next entry in list | ||||||
| 46165 | CALL 47502 | Process keyboard / joystick input on a menu and load A with selected item index | ||||||
| 46168 | INC A | Add one to selected item index (as first entry in list is window height)... | ||||||
| 46169 | LD C,A | ...and load into BC... | ||||||
| 46170 | LD B,0 | ... | ||||||
| 46172 | LD HL,(46138) | Load HL with list start address... | ||||||
| 46175 | ADD HL,BC | ...and add BC as offset | ||||||
| 46176 | LD A,(HL) | Load A with entry at position HL in list (i.e. index of selected character)... | ||||||
| 46177 | LD (41937),A | ...and set as Current Character | ||||||
| 46180 | JP 45792 | Print character's name and return | ||||||
| Prev: 45963 | Up: Map | Next: 46183 |