Routines |
Prev: 50F4 | Up: Map | Next: 51DC |
Used by the routine at 52A0. Waits for keypresses while a character's name is being changed, and prints them as they are typed. Returns when ENTER is pressed.
|
||||||||
51A0 | LD L,A | Collect the start address of the message (the character's name) into HL | ||||||
51A1 | LD H,$FE | |||||||
51A3 | LD E,(HL) | |||||||
51A4 | INC H | |||||||
51A5 | LD D,(HL) | |||||||
51A6 | EX DE,HL | |||||||
51A7 | LD BC,$0C00 | B=0x0C, C=0x00 | ||||||
51AA | LD (HL),C | Blank out the current name (12 bytes) | ||||||
51AB | INC HL | |||||||
51AC | DJNZ $51AA | |||||||
51AE | PUSH AF | Save the message number | ||||||
51AF | LD HL,$5040 | 5040=display file address at which to print the name | ||||||
51B2 | CALL $50BC | Print the name built up so far | ||||||
51B5 | CALL $71E2 | Wait for a keypress | ||||||
51B8 | JR Z,$51B5 | |||||||
51BA | CP $0D | Set the zero flag if ENTER was pressed | ||||||
51BC | LD B,A | B=keypress code | ||||||
51BD | JR NZ,$51C1 | Jump unless ENTER was pressed | ||||||
51BF | POP AF | Restore the message number to A | ||||||
51C0 | RET | Return with the new name entered | ||||||
A key was pressed, and it wasn't ENTER. Place the ASCII code in the right slot of the message area corresponding to the character's name.
|
||||||||
51C1 | POP AF | Restore the message number to A | ||||||
51C2 | LD L,A | Collect the start address of the message (the character's name) into DE | ||||||
51C3 | LD H,$FE | |||||||
51C5 | LD E,(HL) | |||||||
51C6 | INC H | |||||||
51C7 | LD D,(HL) | |||||||
51C8 | LD HL,$000B | |||||||
51CB | LD C,A | Store the message number in C briefly | ||||||
51CC | ADD HL,DE | Point HL at the last byte in the message area for the character's name | ||||||
51CD | LD A,(HL) | Pick up this last byte in A | ||||||
51CE | AND A | Is the message area already full? | ||||||
51CF | JR NZ,$51D9 | Jump if so | ||||||
51D1 | EX DE,HL | HL=start address of the message area | ||||||
51D2 | DEC HL | |||||||
51D3 | INC HL | Point HL at the first unused slot in the message area | ||||||
51D4 | LD A,(HL) | |||||||
51D5 | AND A | |||||||
51D6 | JR NZ,$51D3 | |||||||
51D8 | LD (HL),B | Place the letter just entered into this slot | ||||||
51D9 | LD A,C | Restore the message number to A | ||||||
51DA | JR $51AE | Print the letter and collect another |
Prev: 50F4 | Up: Map | Next: 51DC |