Prev: A9B7 Up: Map Next: AA71
AA14: Print One Character And Remember The Line
Used by the routine at Print_Character.
Turns an upper-case letter into lower case, remembers that a character has been printed on this line, and starts a new line when the character is a carriage return.
Convert uppercase letters to lowercase if needed.
Print_Character_ProcessCharacter AA14 CP $41 Jump ahead to Print_Character_CheckSpace if the character is below A.
AA16 JR C,Print_Character_CheckSpace
AA18 CP $5B Jump ahead to Print_Character_CheckSpace if the character is past Z.
AA1A JR NC,Print_Character_CheckSpace
AA1C OR $20 Set bit 5 to make the letter lower case.
Print_Character_CheckSpace AA1E PUSH AF Keep the character and jump to Print_Character_MarkPrintStarted when this line has already started.
AA1F LD A,($A025)
AA22 AND A
AA23 JR NZ,Print_Character_MarkPrintStarted
AA25 POP AF
AA26 CP $20 Return if the character is a space.
AA28 RET Z
AA29 PUSH AF Keep the character and set the print position flag at PrintPositionFlag.
Mark that we've started printing on this line.
Print_Character_MarkPrintStarted AA2A LD A,$01
AA2C LD ($A025),A
AA2F POP AF Jump ahead to Print_Character_CheckQuote if the character is not a new line.
AA30 PUSH AF
AA31 CP $0D
AA33 JR NZ,Print_Character_CheckQuote
Reset the print position flag for a carriage return.
AA35 XOR A Clear *PrintPositionFlag.
AA36 LD ($A025),A
AA39 JR Print_Character_Print Jump ahead to Print_Character_Print to print the character.
A quotation mark is printed as a blank, and the picture flag is consulted.
Print_Character_CheckQuote AA3B CP $22 Jump ahead to Print_Character_CheckPeriod if the character is not a quotation mark.
AA3D JR NZ,Print_Character_CheckPeriod
AA3F LD A,$20 Take a space.
AA41 CALL CheckTVFlagAndProcess Call CheckTVFlagAndProcess to honour the television flag.
AA44 JR Print_Character_SetTokenFormatFlag As after a full stop, go to Print_Character_SetTokenFormatFlag to set the flag at TokenFormatFlag so the next letter is a capital.
A sentence stop marks the token so the next letter can be printed in capitals.
Print_Character_CheckPeriod AA46 CP $2E Jump ahead to Print_Character_CheckLowercase if the character is not a full stop.
AA48 JR NZ,Print_Character_CheckLowercase
Print_Character_SetTokenFormatFlag AA4A LD A,$01 Set *TokenFormatFlag.
AA4C LD ($A026),A
AA4F JR Print_Character_Print Jump ahead to Print_Character_Print to print the character.
See whether the character byte is a lower-case letter, then see whether the character byte is past the lower-case letters, then read the lowercase Handling Flag.
Handle lowercase letters (dictionary word characters).
Print_Character_CheckLowercase AA51 CP $61 Jump ahead to Print_Character_Print if the character is below the letter a.
AA53 JR C,Print_Character_Print
AA55 CP $7B Jump ahead to Print_Character_Print if the character is at least 7B.
AA57 JR NC,Print_Character_Print
AA59 LD A,($A851) Jump to Print_Character_ResetTokenFormatFlag if the lowercase handling flag is set.
AA5C AND A
AA5D JR NZ,Print_Character_ResetTokenFormatFlag
AA5F LD A,($A026) Jump to Print_Character_Print if the token format flag is zero.
AA62 AND A
AA63 JR Z,Print_Character_Print
Reset the token format flag before converting to uppercase.
Print_Character_ResetTokenFormatFlag AA65 XOR A Reset *TokenFormatFlag.
AA66 LD ($A026),A
AA69 POP AF Restore the character from the stack.
Clear bit 5 from the character code (convert to uppercase).
AA6A AND %01011111 Clear bit 5 so a lowercase letter becomes uppercase.
AA6C PUSH AF Keep the character while it is printed.
Print_Character_Print AA6D POP AF Jump to CheckTVFlagAndProcess to check the television flag.
AA6E JP CheckTVFlagAndProcess
Prev: A9B7 Up: Map Next: AA71