![]() |
Routines |
| Prev: 43445 | Up: Map | Next: 43540 |
|
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 | 43447 | PUSH AF | Jump ahead to Print_Character_AlternateMode if the print mode flag at PrintModeFlag is not zero. | |||||
| 43448 | LD A,(40999) | |||||||
| 43451 | AND A | |||||||
| 43452 | JR NZ,Print_Character_AlternateMode | |||||||
|
Handle word-wrap mode - write the character into the word buffer.
|
||||||||
| 43454 | POP AF | Read the word buffer pointer from *BufferPointer. | ||||||
| 43455 | PUSH AF | |||||||
| 43456 | PUSH HL | |||||||
| 43457 | LD HL,(43445) | |||||||
| 43460 | CP 32 | Jump ahead to Print_Character_ScreenPrintMode if the character is a space. | ||||||
| 43462 | JR Z,Print_Character_ScreenPrintMode | |||||||
| 43464 | CP 13 | Jump ahead to Print_Character_ScreenPrintMode if the character is a new line. | ||||||
| 43466 | JR Z,Print_Character_ScreenPrintMode | |||||||
| 43468 | CP 34 | Jump ahead to Print_Character_ScreenPrintMode if the character is a quotation mark. | ||||||
| 43470 | JR Z,Print_Character_ScreenPrintMode | |||||||
| 43472 | CP 8 | Jump ahead to Print_Character_WriteToBuffer if the character is not a backspace. | ||||||
| 43474 | JR NZ,Print_Character_WriteToBuffer | |||||||
|
The character IS a backspace, so handle this.
|
||||||||
| 43476 | DEC HL | Step the word buffer pointer back and join Print_Character_UpdateBufferPointer to store it. | ||||||
| 43477 | 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 | 43479 | LD (HL),A | Write the character to the word buffer. | |||||
| 43480 | INC HL | Increment the word buffer pointer by one. | ||||||
| Print_Character_UpdateBufferPointer | 43481 | LD (43445),HL | Write the word buffer pointer back to *BufferPointer. | |||||
| 43484 | POP HL | Restore the saved pointer and the saved result from the stack. | ||||||
| 43485 | POP AF | |||||||
| 43486 | 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 | 43487 | PUSH DE | Jump to Print_Character_RestoreCharacter if the word buffer is empty. | |||||
| 43488 | LD DE,23563 | |||||||
| 43491 | AND A | |||||||
| 43492 | SBC HL,DE | |||||||
| 43494 | JR Z,Print_Character_RestoreCharacter | |||||||
| 43496 | LD A,(49653) | Read the screen width. | ||||||
| 43499 | CP L | Compare *ScreenWidth with L (the buffered word length). | ||||||
| 43500 | PUSH AF | Go to Print_Character_ScrollScreen if the word fits on the line. | ||||||
| 43501 | JR NC,Print_Character_ScrollScreen | |||||||
| 43503 | LD A,13 | Take a new line. | ||||||
| 43505 | 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 | 43508 | PUSH BC | Keep the print column and use the buffered length as the glyph counter. | |||||
| 43509 | LD B,L | |||||||
| 43510 | LD HL,23563 | HL=23563 (the start of the word buffer, which overwrites DEFADD onwards). | ||||||
| 43513 | LD (43445),HL | Write HL (the start of the word buffer) to *BufferPointer. | ||||||
| Print_Character_ScrollLoop | 43516 | LD A,(HL) | Read the next character of the buffered word. | |||||
| 43517 | CALL Print_Character_ProcessCharacter | Call Print_Character_ProcessCharacter to print one character and remember the line. | ||||||
| 43520 | INC HL | Move to the next character. | ||||||
| 43521 | DJNZ Print_Character_ScrollLoop | Count the next character and repeat from Print_Character_ScrollLoop. | ||||||
| 43523 | POP BC | Restore BC from the stack. | ||||||
| 43524 | POP AF | |||||||
| 43525 | 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.
|
||||||||
| 43527 | XOR A | Reset *PrintPositionFlag. | ||||||
| 43528 | LD (40997),A | |||||||
| Print_Character_RestoreCharacter | 43531 | POP DE | Restore the character from the stack. | |||||
| 43532 | POP HL | |||||||
| 43533 | POP AF | |||||||
| 43534 | 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 | 43536 | POP AF | Jump to CheckTVFlagAndProcess to check the television flag. | |||||
| 43537 | JP CheckTVFlagAndProcess | |||||||
| Prev: 43445 | Up: Map | Next: 43540 |