Prev: 75AC Up: Map Next: 7600
75AD: Print a character in the lower (input) window
Prints a character in the four-line window at the bottom of the screen, where the player's typing and the game's immediate replies appear. Unlike the story window, this one uses the Spectrum ROM's 8x8 font (766D) at 32 characters per line, and letters are always shown in upper case.
The print position is kept at $75A9 and the number of columns left at 75A8. After each character, the cursor character (from $75AB, a '+') is drawn in the next position, so the player can see where the next key will appear.
ENTER blanks the cursor and scrolls the window up a line (7600). A backspace ($08) rubs out the cursor, moves back one column and draws the cursor there; backspacing past the start of a line scrolls the window down again (763D). Reaching the end of a line also scrolls the window.
75AD PUSH HL Save HL and AF
75AE PUSH AF
75AF LD HL,($75A9) HL = where the next character goes
75B2 CP $0D Is it ENTER?
75B4 JR NZ,$75BD
75B6 LD A,$20 Yes: rub out the cursor with a space...
75B8 CALL $766D
75BB JR $75D4 ...then go straight to starting a new line
75BD CP $08 Is it a backspace?
75BF JR Z,$75EA
75C1 CP $61 Otherwise, is it a lower-case letter?
75C3 JR C,$75CB
75C5 CP $7B
75C7 JR NC,$75CB
75C9 AND $5F If so, make it upper case: this window always shows capitals
75CB CALL $766D Draw the character
75CE LD A,($75A8) One less column of room on this line
75D1 DEC A
75D2 JR NZ,$75DB Room left: just update the cursor position below
75D4 LD L,$E0 Line full: move to the start of the next one...
75D6 CALL $7600 ...scrolling the window up
75D9 LD A,$20 Full width of room again, on the fresh line
75DB LD ($75A8),A Save the columns left
75DE LD A,($75AB) A = the cursor character ('+')
75E1 LD ($75A9),HL Remember where it goes
75E4 CALL $766D Draw it, so the player can see where the next key will land
75E7 POP AF Restore AF
75E8 POP HL Restore HL
75E9 RET
75EA LD A,$20 BACKSPACE: rub out the cursor with a space
75EC CALL $766D
75EF DEC L Step back one character position
75F0 DEC L
75F1 LD A,($75A8) Was there anything on this line left to delete?
75F4 INC A
75F5 CP $21
75F7 JR NZ,$75DB Something there: just move the cursor back
75F9 LD L,$FF Nothing left on this line: move up to the end of the previous one...
75FB CALL $763D ...scrolling the window back down
75FE JR $75D9
Prev: 75AC Up: Map Next: 7600