Prev: 51DC Up: Map Next: 52F5
52A0: Display the cast of characters and change their names
Used by the routine at 54A0. For each member of the cast: displays his name and title, walks him onto the screen, allows the user to change the name, and then walks him off the screen.
52A0 LD A,$15 Message 0x15: 'MR WACKER'
52A2 PUSH AF Save the message number
52A3 ADD A,$50 A=0x65-0x6F (message number for the character's title)
52A5 LD HL,$4080 4080=display file address
52A8 CALL $50BC Print the appropriate title (e.g. 'THE HEADMASTER')
52AB LD A,$F4 Message 0xF4: '' (empty string)
52AD CALL $50B9 Print this (thus removing 'Press 'C' to change name' from the screen)
52B0 POP AF Restore the message number for the character's name to A
52B1 PUSH AF Save it again
52B2 LD HL,$5040 5040=display file address
52B5 CALL $50BC Print the character's name there
52B8 POP AF Restore the message number for the character's name to A
52B9 PUSH AF Save it again
52BA ADD A,$E0 Point HL at an entry in the table of animatory states at 52F5
52BC LD L,A
52BD LD H,$52
52BF LD A,(HL) A=animatory state of the character standing, facing right
52C0 LD HL,$D200 Point HL at byte 0x00 of ERIC's buffer
52C3 LD (HL),A Fill in the animatory state
52C4 INC L L=0x01
52C5 LD (HL),$7C Fill in the character's x-coordinate
52C7 CALL $51DC Walk the character to the middle of the screen
52CA LD HL,$5C3B Reset bit 5 at 5C3B, ready for future keypresses
52CD RES 5,(HL)
52CF LD A,$FA Message 0xFA: 'Press 'C' to change name'
52D1 CALL $50B9 Print this message
52D4 CALL $71E2 Wait for a keypress
52D7 JR Z,$52D4
52D9 OR $20 Convert the keypress to lower case
52DB CP $63 Was 'c' pressed?
52DD JR NZ,$52EB Jump if not
The user pressed 'c' to change the character's name.
52DF LD A,$FC Message 0xFC: 'Enter new name'
52E1 CALL $50B9 Print this message
52E4 POP AF Restore the message number for the character's name to A
52E5 PUSH AF Save it again
52E6 CALL $51A0 Change the character's name
52E9 JR $52CA
The user pressed some key other than 'c'.
52EB CALL $51DC Walk the character off screen
52EE POP AF Restore the message number for the character's name to A
52EF INC A Next character
52F0 CP $20 Have we done all the main game characters yet?
52F2 JR NZ,$52A2 Jump back if not
52F4 RET
Prev: 51DC Up: Map Next: 52F5