Prev: A59B Up: Map Next: A5C2
A5A4: Print Character
Input
A The character to print
PrintCharacter A5A4 PUSH AF Stash the character to print on the stack.
A5A5 LD A,($5C89) Jump to PrintCharacterDirect if *S_POSN is not equal to 03.
A5A8 CP $03
A5AA JR NZ,PrintCharacterDirect
A5AC POP AF Load the character to print into A but keep a copy on the stack.
A5AD PUSH AF
A5AE CP $0D Jump to CheckColumnPosition if this isn't a newline character (0D).
A5B0 JR NZ,CheckColumnPosition
This is a newline, so scroll the screen up to action it.
A5B2 CALL ScrollScreen Call ScrollScreen.
A5B5 POP AF Clear the character off the stack (as there's nothing to print for a newline, just the screen scroll).
A5B6 RET Return.
Check the column position.
CheckColumnPosition A5B7 LD A,($5C88) Call ScrollScreen if *S_POSN is equal to 01.
A5BA CP $01
A5BC CALL Z,ScrollScreen
Actions printing A to the screen.
PrintCharacterDirect A5BF POP AF Restore the character to print from the stack.
A5C0 RST $10 Print to the screen using PRINT_A_1.
A5C1 RET Return.
View the equivalent code in The Jewels Of Babylon.
Prev: A59B Up: Map Next: A5C2