Prev: 55359 Up: Map Next: 55401
55364: Display an information window with text at HL and return to game
This routine is called by the instructions at 31025, 55173, 55287, 55294, 55308 and 55335. Immediately after each of these calls is a byte of data representing the index of the window to draw. This data is read in this routine by loading the return address (where the data is held) into DE and then performing a LD A,(DE).
There is also a JP to this routine by the instruction at 34093, however this jump lies within a block of code that is never called - see trivia.
Used by the routines at 30968, 33952, 55170, 55287, 55291, 55308 and 55332.
Input
HL Points to text to print in the window
55364 POP DE Remove value on top of stack, as we are not returning to this address, but reading data from it
55365 LD A,(DE) Load A with window index data...
55366 LD (55387),A ...and modify instruction at 55386 with this index
55369 PUSH HL Store HL (pointer to text to print)
55370 LD L,A Load eight times window index into HL...
55371 LD H,0 ...
55373 ADD HL,HL ...
55374 ADD HL,HL ...
55375 ADD HL,HL ...
55376 LD DE,37091 Point DE at y-coordinate of top of window in first entry of window data table at 37089...
55379 ADD HL,DE ...and add HL as offset in HL
55380 EX DE,HL Swap DE (now points to y-coordinate of top of required window) and HL (now points to first entry in window data table)
55381 POP HL Restore HL (pointer to text to print)
55382 CALL 33774 Adjust height of window to accommodate text
55385 PUSH HL Store HL (pointer to start of text data)
The operand of the instruction at 55386 represents a window index. This is modified by the instruction at 55366.
55386 LD A,0 Draw window with index specified in data previously...
55388 CALL 34990 ...
55391 POP HL Restore HL (pointer to start of text data)
55392 CALL 34762 Print text to screen
55395 CALL 55138 Display "PRESS FIRE TO CONTINUE" window and wait for fire to be pressed
55398 JP 29482 Set Magic Knight's available action flags, validate I.D. Card if appropriate and jump to start of main game loop
Prev: 55359 Up: Map Next: 55401