Prev: BABA Up: Map Next: BAE1
BAC3: Print Character
Input
A The character to print
PrintCharacter BAC3 PUSH AF Stash the character to print on the stack.
BAC4 LD A,($5C89) Jump to PrintCharacterDirect if *S_POSN is not equal to 03.
BAC7 CP $03
BAC9 JR NZ,PrintCharacterDirect
BACB POP AF Load the character to print into A but keep a copy on the stack.
BACC PUSH AF
BACD CP $0D Jump to CheckColumnPosition if this isn't a newline character (0D).
BACF JR NZ,CheckColumnPosition
This is a newline, so scroll the screen up to action it.
BAD1 CALL ScrollScreen Call ScrollScreen.
BAD4 POP AF Clear the character off the stack (as there's nothing to print for a newline, just the screen scroll).
BAD5 RET Return.
Check the column position.
CheckColumnPosition BAD6 LD A,($5C88) Call ScrollScreen if *S_POSN is equal to 01.
BAD9 CP $01
BADB CALL Z,ScrollScreen
Actions printing A to the screen.
PrintCharacterDirect BADE POP AF Restore the character to print from the stack.
BADF RST $10 Print to the screen using PRINT_A_1.
BAE0 RET Return.
View the equivalent code in Warlord.
Prev: BABA Up: Map Next: BAE1