| Routines

B7E8: Collect a keypress while a character's name is being entered

Used by the routine at B8E8. Waits for a keypress and returns with the zero flag set if it was ENTER; otherwise inserts the ASCII code of the keypress into the next slot in the character's name message, and returns with A holding the number of characters typed so far.
Input
DE | Address of the next slot in the character's name message
HL | Base address of the character's name message
B7E8 | PUSH HL | Save the message address for the character's name
B7E9 | PUSH DE |
B7EA | LD DE,$5020 | Set DE to the display file address at which to print the character's name
B7ED | CALL $AFE8 | Print the character's name (which is being edited)
B7F0 | CALL $673A | Wait for a keypress and collect its ASCII code in A
B7F3 | JR Z,$B7F0
B7F5 | POP DE |
B7F6 | POP HL | Restore the character name message address to HL
B7F7 | CP $0D | Was ENTER pressed?
B7F9 | RET Z | Return if so
B7FA | LD (DE),A | Store the ASCII code of the key just pressed
B7FB | INC E | Move DE along to the next slot in the name message
B7FC | LD A,E | Set A equal to the number of characters typed so far
B7FD | SUB L
B7FE | RET |