Prev: 47802 Up: Map Next: 47841
47811: Print Character
Input
A The character to print
PrintCharacter 47811 PUSH AF Stash the character to print on the stack.
47812 LD A,(23689) Jump to PrintCharacterDirect if *S_POSN is not equal to 3.
47815 CP 3
47817 JR NZ,PrintCharacterDirect
47819 POP AF Load the character to print into A but keep a copy on the stack.
47820 PUSH AF
47821 CP 13 Jump to CheckColumnPosition if this isn't a newline character (13).
47823 JR NZ,CheckColumnPosition
This is a newline, so scroll the screen up to action it.
47825 CALL ScrollScreen Call ScrollScreen.
47828 POP AF Clear the character off the stack (as there's nothing to print for a newline, just the screen scroll).
47829 RET Return.
Check the column position.
CheckColumnPosition 47830 LD A,(23688) Call ScrollScreen if *S_POSN is equal to 1.
47833 CP 1
47835 CALL Z,ScrollScreen
Actions printing A to the screen.
PrintCharacterDirect 47838 POP AF Restore the character to print from the stack.
47839 RST 16 Print to the screen using PRINT_A_1.
47840 RET Return.
View the equivalent code in Warlord.
Prev: 47802 Up: Map Next: 47841