![]() |
Routines |
| Prev: A9B5 | Up: Map | Next: AA14 |
|
Used by the routines at PrintNewline, PrintFullStop, ShiftTextPointer, PrintHyphen, PrintLetterD, PrintOneDecimalDigit, PrintHundredsTensAndUnits, TestSpace, PrintThisCharacter, LeaveFullStop, PrintTheControlCharacter, PrintTextToken, PrintTextBasedOnFlag, PrintLocationText, PrintFormattedObjectList, ParseInput, ReadCommandLine_CommandLinePrints, LeaveQuoteResult, TestFullStop, MapCursorKeys, IgnoreInputUntilGameHasStarted, DeleteInputCharacter, PrintObjectDescriptionText and ProcessCharacterAttribute.
In word-wrap mode, stores each letter at *BufferPointer in the word buffer at WordBuffer until a space, newline or quote, then prints the buffered word. When the print mode flag at PrintModeFlag is set, uses the alternate printer instead.
|
||||||||
| Print_Character | A9B7 | PUSH AF | Jump ahead to Print_Character_AlternateMode if the print mode flag at PrintModeFlag is not zero. | |||||
| A9B8 | LD A,($A027) | |||||||
| A9BB | AND A | |||||||
| A9BC | JR NZ,Print_Character_AlternateMode | |||||||
|
Handle word-wrap mode - write the character into the word buffer.
|
||||||||
| A9BE | POP AF | Read the word buffer pointer from *BufferPointer. | ||||||
| A9BF | PUSH AF | |||||||
| A9C0 | PUSH HL | |||||||
| A9C1 | LD HL,($A9B5) | |||||||
| A9C4 | CP $20 | Jump ahead to Print_Character_ScreenPrintMode if the character is a space. | ||||||
| A9C6 | JR Z,Print_Character_ScreenPrintMode | |||||||
| A9C8 | CP $0D | Jump ahead to Print_Character_ScreenPrintMode if the character is a new line. | ||||||
| A9CA | JR Z,Print_Character_ScreenPrintMode | |||||||
| A9CC | CP $22 | Jump ahead to Print_Character_ScreenPrintMode if the character is a quotation mark. | ||||||
| A9CE | JR Z,Print_Character_ScreenPrintMode | |||||||
| A9D0 | CP $08 | Jump ahead to Print_Character_WriteToBuffer if the character is not a backspace. | ||||||
| A9D2 | JR NZ,Print_Character_WriteToBuffer | |||||||
|
The character IS a backspace, so handle this.
|
||||||||
| A9D4 | DEC HL | Step the word buffer pointer back and join Print_Character_UpdateBufferPointer to store it. | ||||||
| A9D5 | JR Print_Character_UpdateBufferPointer | |||||||
|
Write the character into the word buffer and move the pointer on.
Write the character to the word buffer.
|
||||||||
| Print_Character_WriteToBuffer | A9D7 | LD (HL),A | Write the character to the word buffer. | |||||
| A9D8 | INC HL | Increment the word buffer pointer by one. | ||||||
| Print_Character_UpdateBufferPointer | A9D9 | LD ($A9B5),HL | Write the word buffer pointer back to *BufferPointer. | |||||
| A9DC | POP HL | Restore the saved pointer and the saved result from the stack. | ||||||
| A9DD | POP AF | |||||||
| A9DE | RET | Return. | ||||||
|
The character ends a word. If the word buffer holds letters, print them.
Flush the word buffer when it is not empty.
|
||||||||
| Print_Character_ScreenPrintMode | A9DF | PUSH DE | Jump to Print_Character_RestoreCharacter if the word buffer is empty. | |||||
| A9E0 | LD DE,$5C0B | |||||||
| A9E3 | AND A | |||||||
| A9E4 | SBC HL,DE | |||||||
| A9E6 | JR Z,Print_Character_RestoreCharacter | |||||||
| A9E8 | LD A,($C1F5) | Read the screen width. | ||||||
| A9EB | CP L | Compare *ScreenWidth with L (the buffered word length). | ||||||
| A9EC | PUSH AF | Go to Print_Character_ScrollScreen if the word fits on the line. | ||||||
| A9ED | JR NC,Print_Character_ScrollScreen | |||||||
| A9EF | LD A,$0D | Take a new line. | ||||||
| A9F1 | CALL Print_Character_ProcessCharacter | Call Print_Character_ProcessCharacter to print one character and remember the line. | ||||||
|
Print the buffered letters from WordBuffer and reset the word buffer pointer.
|
||||||||
| Print_Character_ScrollScreen | A9F4 | PUSH BC | Keep the print column and use the buffered length as the glyph counter. | |||||
| A9F5 | LD B,L | |||||||
| A9F6 | LD HL,$5C0B | HL=5C0B (the start of the word buffer, which overwrites DEFADD onwards). | ||||||
| A9F9 | LD ($A9B5),HL | Write HL (the start of the word buffer) to *BufferPointer. | ||||||
| Print_Character_ScrollLoop | A9FC | LD A,(HL) | Read the next character of the buffered word. | |||||
| A9FD | CALL Print_Character_ProcessCharacter | Call Print_Character_ProcessCharacter to print one character and remember the line. | ||||||
| AA00 | INC HL | Move to the next character. | ||||||
| AA01 | DJNZ Print_Character_ScrollLoop | Count the next character and repeat from Print_Character_ScrollLoop. | ||||||
| AA03 | POP BC | Restore BC from the stack. | ||||||
| AA04 | POP AF | |||||||
| AA05 | JR NZ,Print_Character_RestoreCharacter | And the saved flags, and go to Print_Character_RestoreCharacter when the zero flag is clear. | ||||||
|
Clear the print position flag after the buffered word is printed.
|
||||||||
| AA07 | XOR A | Reset *PrintPositionFlag. | ||||||
| AA08 | LD ($A025),A | |||||||
| Print_Character_RestoreCharacter | AA0B | POP DE | Restore the character from the stack. | |||||
| AA0C | POP HL | |||||||
| AA0D | POP AF | |||||||
| AA0E | JR Print_Character_ProcessCharacter | And jump to Print_Character_ProcessCharacter to print it. | ||||||
|
Print the character on the screen.
Use alternate print method (direct screen printing).
|
||||||||
| Print_Character_AlternateMode | AA10 | POP AF | Jump to CheckTVFlagAndProcess to check the television flag. | |||||
| AA11 | JP CheckTVFlagAndProcess | |||||||
| Prev: A9B5 | Up: Map | Next: AA14 |