Prev: BE2E Up: Map Next: BE55
BE37: Print Character
Print one character, scrolling the text window when the cursor reaches its edge.
Input
A Character to print
PrintCharacter BE37 PUSH AF Keep the character safe on the stack.
BE38 LD A,($5C89) Jump to PrintCharacter_Direct if the line byte of S_POSN (5C89) is not row 03.
BE3B CP $03
BE3D JR NZ,PrintCharacter_Direct
BE3F POP AF Restore the character from the stack, leaving a copy.
BE40 PUSH AF
BE41 CP $0D Jump to PrintCharacter_CheckColumn if this is not a newline (0D).
BE43 JR NZ,PrintCharacter_CheckColumn
A newline scrolls the text window and prints nothing.
BE45 CALL ScrollScreen Call ScrollScreen.
BE48 POP AF Discard the character from the stack.
BE49 RET Return.
Check the column.
PrintCharacter_CheckColumn BE4A LD A,($5C88) Call ScrollScreen if *S_POSN is column 01.
BE4D CP $01
BE4F CALL Z,ScrollScreen
Print the character.
PrintCharacter_Direct BE52 POP AF Restore the character from the stack.
BE53 RST $10 Print it with PRINT_A_1.
BE54 RET Return.
Prev: BE2E Up: Map Next: BE55