Prev: 42395 Up: Map Next: 42434
42404: Print Character
Input
A The character to print
PrintCharacter 42404 PUSH AF Stash the character to print on the stack.
42405 LD A,(23689) Jump to PrintCharacterDirect if *S_POSN is not equal to 3.
42408 CP 3
42410 JR NZ,PrintCharacterDirect
42412 POP AF Load the character to print into A but keep a copy on the stack.
42413 PUSH AF
42414 CP 13 Jump to CheckColumnPosition if this isn't a newline character (13).
42416 JR NZ,CheckColumnPosition
This is a newline, so scroll the screen up to action it.
42418 CALL ScrollScreen Call ScrollScreen.
42421 POP AF Clear the character off the stack (as there's nothing to print for a newline, just the screen scroll).
42422 RET Return.
Check the column position.
CheckColumnPosition 42423 LD A,(23688) Call ScrollScreen if *S_POSN is equal to 1.
42426 CP 1
42428 CALL Z,ScrollScreen
Actions printing A to the screen.
PrintCharacterDirect 42431 POP AF Restore the character to print from the stack.
42432 RST 16 Print to the screen using PRINT_A_1.
42433 RET Return.
View the equivalent code in The Jewels Of Babylon.
Prev: 42395 Up: Map Next: 42434